@opengis/cms 0.0.57 → 0.0.58

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 (149) hide show
  1. package/README.md +131 -131
  2. package/dist/AddNewItemInTree-05PSSEFi.js +76 -0
  3. package/dist/ArticlesPage-CFjE_cw_.js +298 -0
  4. package/dist/CollectionsBreadcrumb-BCxeRikP.js +4 -0
  5. package/dist/CollectionsBreadcrumb.vue_vue_type_script_setup_true_lang-umRzB5mY.js +53 -0
  6. package/dist/CollectionsPage-DHfPNql6.js +124 -0
  7. package/dist/{CreateForm-BMOBeP4G.js → CreateForm-5FvT45vH.js} +1 -1
  8. package/dist/Dashboard-C1eGscNd.js +358 -0
  9. package/dist/EditCollectionPage-DIr1tdtn.js +187 -0
  10. package/dist/{EmptyData-DaZt_nAm.js → EmptyData-DxPrSXhV.js} +1 -1
  11. package/dist/{MenuAddPage-Bf48Z-ah.js → MenuAddPage-D-p3gFgm.js} +40 -35
  12. package/dist/MenuBody-rN5j4YBu.js +125 -0
  13. package/dist/MenuItemPage-BoJw885D.js +1027 -0
  14. package/dist/MenuList-DFEBS0NB.js +172 -0
  15. package/dist/MenuPage-BCZB_S8j.js +107 -0
  16. package/dist/MenuWrapper-AZ_8s-zd.js +12 -0
  17. package/dist/MonacoEditor-Db-3Jc3E.js +4 -0
  18. package/dist/{UniversalTable.vue_vue_type_script_setup_true_lang-CJGTsd1V.js → UniversalTable-CzqPG-tY.js} +12 -12
  19. package/dist/{UniversalTablePagination.vue_vue_type_script_setup_true_lang-GYZd_gkA.js → UniversalTablePagination-4gL47A7I.js} +1 -1
  20. package/dist/VsFormTags-CMjiu9sY.js +114 -0
  21. package/dist/VsPreview-DwETkOpb.js +63 -0
  22. package/dist/contentForm-CtMhQTG0.js +489 -0
  23. package/dist/getField-CpwVE28P.js +179 -0
  24. package/dist/index.d.ts +8 -0
  25. package/dist/index.html +29 -29
  26. package/dist/index.js +72 -71
  27. package/dist/style.css +1 -1
  28. package/dist/vs-builder-edit-D-q1o8tF.js +604 -0
  29. package/dist/vs-builder-monaco-B3Jj0V31.js +33 -0
  30. package/dist/vs-builder-preview-BH4VAM3a.js +44 -0
  31. package/dist/vs-form-custom-datatable-BDZo48w3.js +317 -0
  32. package/dist/vs-form-integer-BZ855R3g.js +61 -0
  33. package/dist/vs-form-media-select-NY27EaG1.js +837 -0
  34. package/dist/vs-form-reference-list-Dtv8fJJU.js +1536 -0
  35. package/dist/vs-form-reletion-link-BhzNQszm.js +34 -0
  36. package/dist/vs-form-tiptap-DDFQjRjY.js +4 -0
  37. package/dist/vs-form-tiptap.vue_vue_type_script_setup_true_lang-DGgsqXwg.js +11 -0
  38. package/dist/vs-richtext-md-C098v_6Q.js +4 -0
  39. package/dist/vs-richtext-md.vue_vue_type_script_setup_true_lang-Ct8uTV-J.js +14 -0
  40. package/input-types.json +9 -9
  41. package/locales/en.json +815 -814
  42. package/locales/uk.json +813 -812
  43. package/module/cms/cls/content.status.json +17 -17
  44. package/module/cms/cls/user_type.json +9 -9
  45. package/module/cms/form/admin.users.form.json +77 -77
  46. package/module/cms/select/cms.page_type.sql +1 -1
  47. package/module/cms/select/news_tag_id.sql +11 -11
  48. package/module/cms/table/admin.users.table.json +53 -53
  49. package/module/cms/table/collection.default.table.json +96 -96
  50. package/module/cms/table/single.default.table.json +116 -116
  51. package/package.json +68 -68
  52. package/plugin.js +43 -43
  53. package/server/app.js +35 -35
  54. package/server/config.js +4 -4
  55. package/server/functions/getContent.js +45 -45
  56. package/server/functions/getDraftKey.js +22 -22
  57. package/server/functions/getSearchData.js +31 -31
  58. package/server/functions/getTags.js +30 -30
  59. package/server/functions/getUser.js +27 -27
  60. package/server/functions/utils/mock.reply.js +55 -55
  61. package/server/index.js +22 -22
  62. package/server/migrations/fixes.sql +129 -129
  63. package/server/migrations/site.sql +595 -595
  64. package/server/plugins/adminHook.js +78 -78
  65. package/server/plugins/hook.js +59 -59
  66. package/server/plugins/vite.js +75 -75
  67. package/server/routes/category/controllers/cms.category.delete.js +21 -21
  68. package/server/routes/category/controllers/cms.category.get.js +17 -17
  69. package/server/routes/category/controllers/cms.category.list.js +16 -16
  70. package/server/routes/category/controllers/cms.category.post.js +21 -21
  71. package/server/routes/category/controllers/cms.category.put.js +23 -23
  72. package/server/routes/category/index.mjs +22 -22
  73. package/server/routes/cms/controllers/cmsStat.js +55 -55
  74. package/server/routes/cms/controllers/cmsSuggest.js +57 -57
  75. package/server/routes/cms/controllers/deleteContent.js +113 -113
  76. package/server/routes/cms/controllers/deleteMedia.js +76 -76
  77. package/server/routes/cms/controllers/downloadMedia.js +84 -84
  78. package/server/routes/cms/controllers/getContent.js +113 -113
  79. package/server/routes/cms/controllers/getContentBySlug.js +93 -93
  80. package/server/routes/cms/controllers/insertContent.js +217 -217
  81. package/server/routes/cms/controllers/listMedia.js +155 -155
  82. package/server/routes/cms/controllers/metadataMedia.js +39 -39
  83. package/server/routes/cms/controllers/properties.get.js +18 -18
  84. package/server/routes/cms/controllers/properties.post.js +99 -99
  85. package/server/routes/cms/controllers/searchContent.js +214 -214
  86. package/server/routes/cms/controllers/translate.js +89 -89
  87. package/server/routes/cms/controllers/updateContent.js +266 -266
  88. package/server/routes/cms/controllers/uploadMedia.js +79 -79
  89. package/server/routes/cms/functions/getSettings.js +48 -48
  90. package/server/routes/cms/index.mjs +112 -112
  91. package/server/routes/cms/utils/additionalData.js +35 -35
  92. package/server/routes/cms/utils/getCollection.js +89 -89
  93. package/server/routes/cms/utils/getSingle.js +188 -188
  94. package/server/routes/cms/utils/inputTypes.js +5 -5
  95. package/server/routes/cms/utils/insertContentLocalization.js +104 -104
  96. package/server/routes/cms/utils/requestTranslation.js +85 -85
  97. package/server/routes/cms/utils/updateLocalization.js +47 -47
  98. package/server/routes/cmsSpace/controllers/deleteSpace.js +25 -25
  99. package/server/routes/cmsSpace/controllers/getSpaces.js +27 -27
  100. package/server/routes/cmsSpace/controllers/insertSpace.js +21 -21
  101. package/server/routes/cmsSpace/controllers/updateSpace.js +23 -23
  102. package/server/routes/cmsSpace/index.mjs +20 -20
  103. package/server/routes/contentType/controllers/addContentType.js +160 -160
  104. package/server/routes/contentType/controllers/contentTypeList.js +54 -54
  105. package/server/routes/contentType/controllers/delContentType.js +75 -75
  106. package/server/routes/contentType/controllers/editContentType.js +88 -88
  107. package/server/routes/contentType/controllers/getContentType.js +65 -65
  108. package/server/routes/contentType/index.mjs +35 -35
  109. package/server/routes/contentType/utils/updateContents.js +44 -44
  110. package/server/routes/contentType/utils/updateCustomContentTable.js +53 -53
  111. package/server/routes/feedback/controllers/email.list.js +24 -24
  112. package/server/routes/feedback/controllers/feedback.js +48 -48
  113. package/server/routes/feedback/controllers/feedback.list.js +37 -37
  114. package/server/routes/feedback/controllers/news.subscriptions.js +44 -44
  115. package/server/routes/feedback/index.mjs +71 -71
  116. package/server/routes/logs/controllers/export.user.logs.js +77 -77
  117. package/server/routes/logs/controllers/user.logs.js +44 -44
  118. package/server/routes/logs/index.mjs +9 -9
  119. package/server/routes/menu/controllers/addMenu.js +37 -37
  120. package/server/routes/menu/controllers/delMenu.js +31 -31
  121. package/server/routes/menu/controllers/editMenu.js +41 -41
  122. package/server/routes/menu/controllers/getMenu.js +24 -24
  123. package/server/routes/menu/functions/getMenu.js +50 -50
  124. package/server/routes/menu/index.mjs +13 -13
  125. package/server/routes/migration/controllers/collectionToCustom.js +137 -137
  126. package/server/routes/migration/index.mjs +8 -8
  127. package/server/routes/root.mjs +8 -8
  128. package/server/routes/tags/controllers/add.tags.js +24 -24
  129. package/server/routes/tags/controllers/del.tags.js +19 -19
  130. package/server/routes/tags/controllers/edit.tags.js +25 -25
  131. package/server/routes/tags/controllers/get.tags.js +15 -15
  132. package/server/routes/tags/index.mjs +14 -14
  133. package/server/templates/cls/cms.category_type.json +9 -9
  134. package/server/templates/cls/cms.content_review_status.json +9 -9
  135. package/server/templates/cls/cms.content_status.json +9 -9
  136. package/server/templates/cls/cms.content_type.json +9 -9
  137. package/server/templates/cls/cms.lang.json +9 -9
  138. package/server/templates/page/login.html +126 -126
  139. package/utils.d.ts +52 -52
  140. package/utils.js +8 -8
  141. package/dist/ArticlesPage-BcR1hbds.js +0 -286
  142. package/dist/BuilderPage-CK_osM89.js +0 -386
  143. package/dist/CollectionsBreadcrumb.vue_vue_type_script_setup_true_lang-CnOe9ORD.js +0 -45
  144. package/dist/CollectionsPage-JfmrHNR_.js +0 -110
  145. package/dist/EditCollectionPage-Cw3GQYRe.js +0 -809
  146. package/dist/MenuItemPage-CXn5HC8j.js +0 -1366
  147. package/dist/MenuPage-tJZtK46W.js +0 -106
  148. package/dist/contentForm-B6gHgGkz.js +0 -586
  149. package/dist/getField-Y5WXnRR0.js +0 -2948
package/README.md CHANGED
@@ -1,131 +1,131 @@
1
- <!-- ![alt text](https://cdn.softpro.ua/data/npm/admin/opengis-admin.png) -->
2
- # @opengis/cms
3
-
4
- [![NPM version](https://img.shields.io/npm/v/@opengis/cms?style=plain)](https://www.npmjs.com/package/@opengis/cms)
5
- [![NPM last update](https://img.shields.io/npm/last-update/@opengis/cms?style=plain)]()
6
- [![NPM downloads](https://img.shields.io/npm/dw/@opengis/cms?style=plain)]()
7
- [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=plain)](http://standardjs.com/)
8
-
9
- This package standardizes static website content management process. Built using the **Fastify** and **Vite** frameworks for reactive, component-driven development.
10
-
11
- ## Features
12
-
13
- - **Real-time Editing** - Update content without stopping or reloading the website.
14
- - **Page Templates** - Use pre-created templates to quickly start your website.
15
- - **Dashboard** - Control panel for quick evaluation of key metrics.
16
- - **Multi-user mode** - Work together with a team on content in real time.
17
- - **User Settings** - Includes functionality for managing user settings, creating user groups, and defining roles with interface permissions.
18
-
19
- ## Install
20
-
21
- ```bash
22
- npm i @opengis/cms
23
- ```
24
-
25
- ## Usage Astro
26
-
27
- ```js
28
- ---
29
- import Layout from "@/layouts/Layout.astro";
30
-
31
- // get posts
32
- import { getContents } from "@/utils/cms";
33
- const postsData = await getContents({ collection: "posts"});
34
- const { lang } = Astro.params;
35
- ---
36
-
37
- <Layout
38
- title={lang === "uk" ? "Про нас" : "About us"}
39
- >
40
- { postsData }
41
- </Layout>
42
- ```
43
-
44
- ## Usage CMS
45
-
46
- ```js
47
- // main.ts
48
- app.config.globalProperties.$settings = {
49
- cms: {
50
- locale: 'uk', // мова сайту по замовчуванню
51
- locales: ['uk', 'en'], // доступні варіанти перекладу
52
- previewUrl: 'http://site.ua' // адреса перегляду контенту з редактора
53
- }
54
- };
55
- ```
56
-
57
- ```js
58
- // router.config
59
- export default [
60
- {
61
- path: '/cms.dashboard',
62
- component: () => import('@opengis/cms').then(el => el.Dashboard),
63
- },
64
- {
65
- path: '/cms.content/:type?/:id?',
66
- component: () => import('@opengis/cms').then(el => el.Contnet),
67
- },
68
- {
69
- path: '/cms.menu/:id?',
70
- component: () => import('@opengis/cms').then(el => el.Menu),
71
- },
72
- ]
73
- ```
74
- ## Start
75
-
76
- Configure **pg**, **redis** and **s3** connections in `.env` file
77
-
78
- ```bash
79
- node --env-file=.env.ip server
80
- bun --env-file=.env.ip server
81
- pm2 start server --name api -- --env-file=.env.ip
82
- ```
83
-
84
- ## Documentation
85
-
86
- For a detailed understanding of `cms`, its features, and how to use them, refer to our [Documentation](https://apidocs.softpro.ua/cms/).
87
-
88
- ## Technology stack
89
-
90
- <a href="https://fastify.dev/" target="_blank">
91
- <img src="https://img.shields.io/badge/Fastify-323330?style=for-the-badge&logo=fastify" /></a>
92
-
93
- <a href="https://vuejs.org/" target="_blank">
94
- <img src="https://img.shields.io/badge/Vue%20js-323330?style=for-the-badge&logo=vuedotjs&logoColor=4FC08D" /></a>
95
-
96
- <a href="https://vite.dev/" target="_blank">
97
- <img src="https://img.shields.io/badge/Vite-323330?style=for-the-badge&logo=vite" /></a>
98
-
99
- <a href="https://www.postgresql.org/" target="_blank">
100
- <img src="https://img.shields.io/badge/PostgreSQL-323330?style=for-the-badge&logo=postgresql&logoColor=white" /></a>
101
-
102
- <a href="https://redis.io/" target="_blank">
103
- <img src="https://img.shields.io/badge/redis-323330.svg?&style=for-the-badge&logo=redis&logoColor=%23DD0031" /></a>
104
-
105
- <a href="https://nodejs.org/" target="_blank">
106
- <img src="https://img.shields.io/badge/Node.js-323330?style=for-the-badge&logo=node.js&logoColor=white" /></a>
107
-
108
-
109
-
110
- ## Contribute
111
-
112
- Feel free to contact us through our website [SOFTPRO.UA](https://softpro.ua) or email <info@softpro.ua>
113
-
114
- - Report bugs
115
- - Share your ideas
116
- - Ask questions
117
-
118
- ## Follow Us
119
-
120
- [Official site](https://softpro.ua)
121
-
122
- <p>
123
- <a href="https://www.instagram.com/gissoftpro/" target="_blank"><img src="https://cdn.softpro.ua/data/npm/instagram.png" alt="Softpro Instagram" title="oftpro Instagram"></a>&nbsp;&nbsp;
124
- <a href="https://www.facebook.com/gissoftpro" target="_blank"><img src="https://cdn.softpro.ua/data/npm/facebook.png" alt="Softpro Facebook" title="Softpro Facebook"></a>&nbsp;&nbsp;
125
- <a href="https://t.me/softprogis" target="_blank"><img src="https://cdn.softpro.ua/data/npm/telegram.png" alt="Softpro Telegram" title="Softpro Telegram"></a>&nbsp;&nbsp;
126
- <a href="https://www.linkedin.com/in/softpro-ukraine-a8876b282/recent-activity/all/" target="_blank"><img src="https://cdn.softpro.ua/data/npm/social/linkedin.png" alt="Softpro Linkedin" title="Softpro LinkedIn"></a>&nbsp;&nbsp;
127
- </p>
128
-
129
- ## License
130
-
131
- Copyright © SOFTPRO. All rights reserved.
1
+ <!-- ![alt text](https://cdn.softpro.ua/data/npm/admin/opengis-admin.png) -->
2
+ # @opengis/cms
3
+
4
+ [![NPM version](https://img.shields.io/npm/v/@opengis/cms?style=plain)](https://www.npmjs.com/package/@opengis/cms)
5
+ [![NPM last update](https://img.shields.io/npm/last-update/@opengis/cms?style=plain)]()
6
+ [![NPM downloads](https://img.shields.io/npm/dw/@opengis/cms?style=plain)]()
7
+ [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=plain)](http://standardjs.com/)
8
+
9
+ This package standardizes static website content management process. Built using the **Fastify** and **Vite** frameworks for reactive, component-driven development.
10
+
11
+ ## Features
12
+
13
+ - **Real-time Editing** - Update content without stopping or reloading the website.
14
+ - **Page Templates** - Use pre-created templates to quickly start your website.
15
+ - **Dashboard** - Control panel for quick evaluation of key metrics.
16
+ - **Multi-user mode** - Work together with a team on content in real time.
17
+ - **User Settings** - Includes functionality for managing user settings, creating user groups, and defining roles with interface permissions.
18
+
19
+ ## Install
20
+
21
+ ```bash
22
+ npm i @opengis/cms
23
+ ```
24
+
25
+ ## Usage Astro
26
+
27
+ ```js
28
+ ---
29
+ import Layout from "@/layouts/Layout.astro";
30
+
31
+ // get posts
32
+ import { getContents } from "@/utils/cms";
33
+ const postsData = await getContents({ collection: "posts"});
34
+ const { lang } = Astro.params;
35
+ ---
36
+
37
+ <Layout
38
+ title={lang === "uk" ? "Про нас" : "About us"}
39
+ >
40
+ { postsData }
41
+ </Layout>
42
+ ```
43
+
44
+ ## Usage CMS
45
+
46
+ ```js
47
+ // main.ts
48
+ app.config.globalProperties.$settings = {
49
+ cms: {
50
+ locale: 'uk', // мова сайту по замовчуванню
51
+ locales: ['uk', 'en'], // доступні варіанти перекладу
52
+ previewUrl: 'http://site.ua' // адреса перегляду контенту з редактора
53
+ }
54
+ };
55
+ ```
56
+
57
+ ```js
58
+ // router.config
59
+ export default [
60
+ {
61
+ path: '/cms.dashboard',
62
+ component: () => import('@opengis/cms').then(el => el.Dashboard),
63
+ },
64
+ {
65
+ path: '/cms.content/:type?/:id?',
66
+ component: () => import('@opengis/cms').then(el => el.Content),
67
+ },
68
+ {
69
+ path: '/cms.menu/:id?',
70
+ component: () => import('@opengis/cms').then(el => el.Menu),
71
+ },
72
+ ]
73
+ ```
74
+ ## Start
75
+
76
+ Configure **pg**, **redis** and **s3** connections in `.env` file
77
+
78
+ ```bash
79
+ node --env-file=.env.ip server
80
+ bun --env-file=.env.ip server
81
+ pm2 start server --name api -- --env-file=.env.ip
82
+ ```
83
+
84
+ ## Documentation
85
+
86
+ For a detailed understanding of `cms`, its features, and how to use them, refer to our [Documentation](https://apidocs.softpro.ua/cms/).
87
+
88
+ ## Technology stack
89
+
90
+ <a href="https://fastify.dev/" target="_blank">
91
+ <img src="https://img.shields.io/badge/Fastify-323330?style=for-the-badge&logo=fastify" /></a>
92
+
93
+ <a href="https://vuejs.org/" target="_blank">
94
+ <img src="https://img.shields.io/badge/Vue%20js-323330?style=for-the-badge&logo=vuedotjs&logoColor=4FC08D" /></a>
95
+
96
+ <a href="https://vite.dev/" target="_blank">
97
+ <img src="https://img.shields.io/badge/Vite-323330?style=for-the-badge&logo=vite" /></a>
98
+
99
+ <a href="https://www.postgresql.org/" target="_blank">
100
+ <img src="https://img.shields.io/badge/PostgreSQL-323330?style=for-the-badge&logo=postgresql&logoColor=white" /></a>
101
+
102
+ <a href="https://redis.io/" target="_blank">
103
+ <img src="https://img.shields.io/badge/redis-323330.svg?&style=for-the-badge&logo=redis&logoColor=%23DD0031" /></a>
104
+
105
+ <a href="https://nodejs.org/" target="_blank">
106
+ <img src="https://img.shields.io/badge/Node.js-323330?style=for-the-badge&logo=node.js&logoColor=white" /></a>
107
+
108
+
109
+
110
+ ## Contribute
111
+
112
+ Feel free to contact us through our website [SOFTPRO.UA](https://softpro.ua) or email <info@softpro.ua>
113
+
114
+ - Report bugs
115
+ - Share your ideas
116
+ - Ask questions
117
+
118
+ ## Follow Us
119
+
120
+ [Official site](https://softpro.ua)
121
+
122
+ <p>
123
+ <a href="https://www.instagram.com/gissoftpro/" target="_blank"><img src="https://cdn.softpro.ua/data/npm/instagram.png" alt="Softpro Instagram" title="oftpro Instagram"></a>&nbsp;&nbsp;
124
+ <a href="https://www.facebook.com/gissoftpro" target="_blank"><img src="https://cdn.softpro.ua/data/npm/facebook.png" alt="Softpro Facebook" title="Softpro Facebook"></a>&nbsp;&nbsp;
125
+ <a href="https://t.me/softprogis" target="_blank"><img src="https://cdn.softpro.ua/data/npm/telegram.png" alt="Softpro Telegram" title="Softpro Telegram"></a>&nbsp;&nbsp;
126
+ <a href="https://www.linkedin.com/in/softpro-ukraine-a8876b282/recent-activity/all/" target="_blank"><img src="https://cdn.softpro.ua/data/npm/social/linkedin.png" alt="Softpro Linkedin" title="Softpro LinkedIn"></a>&nbsp;&nbsp;
127
+ </p>
128
+
129
+ ## License
130
+
131
+ Copyright © SOFTPRO. All rights reserved.
@@ -0,0 +1,76 @@
1
+ import { defineComponent as g, mergeModels as x, useModel as w, ref as m, openBlock as y, createBlock as C, unref as i, withCtx as u, createElementVNode as s, toDisplayString as d, createVNode as k } from "vue";
2
+ import { useI18n as V } from "vue-i18n";
3
+ import M from "@opengis/form";
4
+ import { VsModal as h, notify as q } from "@opengis/core";
5
+ const I = { class: "flex justify-end p-[20px] gap-[10px] border-t w-full" }, F = /* @__PURE__ */ g({
6
+ __name: "AddNewItemInTree",
7
+ props: {
8
+ isOpen: { type: Boolean, required: !0 },
9
+ isOpenModifiers: {}
10
+ },
11
+ emits: /* @__PURE__ */ x(["addNewItem"], ["update:isOpen"]),
12
+ setup(p, { emit: c }) {
13
+ const { t } = V(), a = w(p, "isOpen"), n = m({}), f = c, o = m({}), v = {
14
+ title: {
15
+ type: "text",
16
+ label: t("cms.menu.form.name"),
17
+ required: !0,
18
+ placeholder: t("cms.menu.form.name"),
19
+ validators: ["required"]
20
+ },
21
+ value: {
22
+ type: "text",
23
+ label: t("cms.menu.form.value"),
24
+ required: !0,
25
+ placeholder: t("cms.menu.form.value"),
26
+ validators: ["required"]
27
+ }
28
+ }, b = async () => {
29
+ if (await n.value.validate()) {
30
+ q({
31
+ type: "warning",
32
+ title: t("cms.common.actions.warning"),
33
+ message: t("cms.menu.createMenuFailed")
34
+ });
35
+ return;
36
+ }
37
+ f("addNewItem", o.value), o.value = {};
38
+ };
39
+ return (r, e) => (y(), C(i(h), {
40
+ teleport: "#modal",
41
+ visible: a.value,
42
+ title: r.$t("cms.menu.createMenu"),
43
+ template: "default",
44
+ closeClickBack: !1,
45
+ onClose: e[3] || (e[3] = (l) => a.value = !1)
46
+ }, {
47
+ footer: u(() => [
48
+ s("div", I, [
49
+ s("button", {
50
+ class: "inline-flex items-center px-3 py-2 text-sm text-black duration-300 border border-gray-200 rounded-lg gap-x-2 whitespace-nowrap hover:bg-gray-100",
51
+ onClick: e[2] || (e[2] = (l) => {
52
+ a.value = !1, o.value = {};
53
+ })
54
+ }, d(r.$t("cms.common.actions.cancel")), 1),
55
+ s("button", {
56
+ onClick: b,
57
+ class: "py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"
58
+ }, d(r.$t("cms.common.actions.save")), 1)
59
+ ])
60
+ ]),
61
+ default: u(() => [
62
+ k(i(M), {
63
+ form: n.value,
64
+ "onUpdate:form": e[0] || (e[0] = (l) => n.value = l),
65
+ modelValue: o.value,
66
+ "onUpdate:modelValue": e[1] || (e[1] = (l) => o.value = l),
67
+ schema: v
68
+ }, null, 8, ["form", "modelValue"])
69
+ ]),
70
+ _: 1
71
+ }, 8, ["visible", "title"]));
72
+ }
73
+ });
74
+ export {
75
+ F as default
76
+ };
@@ -0,0 +1,298 @@
1
+ import { defineComponent as ce, defineAsyncComponent as D, ref as o, inject as ue, computed as R, onMounted as de, watch as L, nextTick as z, openBlock as n, createElementBlock as d, createVNode as A, unref as u, createElementVNode as r, toDisplayString as b, createTextVNode as me, createCommentVNode as h, createStaticVNode as pe, createBlock as N } from "vue";
2
+ import { useRoute as ve, useRouter as fe } from "vue-router";
3
+ import { HelpCircle as he, Plus as ge, ChevronDown as be, Calendar as G, User as ye, Globe as we, FileText as xe } from "lucide-vue-next";
4
+ import { VsInputCheckbox as ke } from "@opengis/form";
5
+ import Ce from "@opengis/filter";
6
+ import { confirm as H } from "@opengis/core";
7
+ import { useI18n as _e } from "vue-i18n";
8
+ const $e = { class: "space-y-6 mx-auto max-w-[90%]" }, Ae = { class: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between" }, Ee = { class: "flex items-center gap-2" }, Te = { class: "text-3xl font-bold text-slate-800 dark:text-white mb-2" }, Ue = ["href", "title"], je = { class: "flex items-center gap-2" }, qe = {
9
+ key: 0,
10
+ class: "text-card-foreground shadow-lg border-0 bg-white/80 dark:bg-slate-800/80 backdrop-blur-sm"
11
+ }, Fe = {
12
+ key: 1,
13
+ class: "text-card-foreground shadow-lg border-0 bg-white/80 dark:bg-slate-800/80 backdrop-blur-sm"
14
+ }, Ve = {
15
+ key: 0,
16
+ class: "p-2 border-b border-gray-200 sm:px-4 sm:py-2 dark:border-gray-700"
17
+ }, De = { class: "flex flex-col gap-4 sm:flex-row" }, Ne = { class: "relative flex items-center gap-2 ml-auto" }, Be = {
18
+ key: 1,
19
+ class: "absolute top-full right-2/3 translate-x-1/2 min-w-[150%] p-4 z-10 bg-white border border-gray-300 rounded-md mt-2 dark:bg-slate-800 dark:border-slate-700 shadow-lg"
20
+ }, Oe = { class: "max-h-60 overflow-y-auto overflow-x-hidden" }, Le = { key: 2 }, Ke = /* @__PURE__ */ ce({
21
+ __name: "ArticlesPage",
22
+ setup(Se) {
23
+ const K = D(
24
+ () => import("./UniversalTable-CzqPG-tY.js")
25
+ ), Q = D(
26
+ () => import("./UniversalTablePagination-4gL47A7I.js")
27
+ ), J = D(
28
+ () => import("./EmptyData-DxPrSXhV.js")
29
+ ), W = D(
30
+ () => import("./CollectionsBreadcrumb-BCxeRikP.js")
31
+ ), s = ve(), m = fe(), c = o(null), X = o(""), { t: y, locale: Y } = _e(), E = o([]), Z = ue("cms.menu") || [], T = o(""), v = o(""), U = o(null), j = o(1), w = o(!1), p = o(["title", "slug", "author", "publish_at", "published_at", "status"]), q = o([]), x = o([]), F = o([]), k = o({}), V = o(0), C = o(!1), S = () => {
32
+ var l;
33
+ let t = (l = c.value) == null ? void 0 : l.columns.filter((e) => {
34
+ var a;
35
+ return (a = p == null ? void 0 : p.value) == null ? void 0 : a.includes(e.name);
36
+ });
37
+ q.value = t.map((e) => {
38
+ switch (e.name) {
39
+ case "title":
40
+ return {
41
+ ...e,
42
+ title: e.name ? e.name.charAt(0).toUpperCase() + e.name.slice(1) : "--",
43
+ icon: xe
44
+ };
45
+ case "slug":
46
+ return {
47
+ ...e,
48
+ title: e.name ? e.name.charAt(0).toUpperCase() + e.name.slice(1) : "-",
49
+ icon: we
50
+ };
51
+ case "author":
52
+ return {
53
+ ...e,
54
+ title: e.name ? e.name.charAt(0).toUpperCase() + e.name.slice(1) : "-",
55
+ icon: ye
56
+ };
57
+ case "publish_at":
58
+ return {
59
+ ...e,
60
+ title: e.name ? e.name.charAt(0).toUpperCase() + e.name.slice(1) : "-",
61
+ icon: G
62
+ };
63
+ case "published_at":
64
+ return {
65
+ ...e,
66
+ title: e.name ? e.name.charAt(0).toUpperCase() + e.name.slice(1) : "-",
67
+ icon: G
68
+ };
69
+ default:
70
+ return {
71
+ ...e,
72
+ title: e.name ? e.name.charAt(0).toUpperCase() + e.name.slice(1) : "-"
73
+ };
74
+ }
75
+ }), w.value = !1;
76
+ }, I = R(
77
+ () => {
78
+ var e, a, i, f;
79
+ const t = (s.params.id || "").toString(), l = t === "pages" ? y("cms.articles.title") : t;
80
+ return ((e = U.value) == null ? void 0 : e.title) || ((a = c.value) == null ? void 0 : a.title) || T.value || ((f = (i = Z.value) == null ? void 0 : i.find(($) => $.id === s.params.id)) == null ? void 0 : f.title) || l;
81
+ }
82
+ ), M = async () => {
83
+ try {
84
+ const t = await fetch("/api/cms-type?type=collection");
85
+ if (!t.ok)
86
+ return;
87
+ const e = ((await t.json()).rows || []).find((a) => a.id === s.params.id);
88
+ e && (U.value = e);
89
+ } catch (t) {
90
+ console.error("Error fetching collection meta:", t);
91
+ }
92
+ }, ee = R(() => [
93
+ {
94
+ label: I.value || s.params.id,
95
+ route: `collections/${s.params.id}`
96
+ }
97
+ ]), te = (t) => {
98
+ t === "collections" ? m.push("/collections") : m.push(`/${t}`);
99
+ }, P = () => {
100
+ m.push(`/collections/${s.params.id}/create`);
101
+ }, ae = () => {
102
+ m.push(`/collections/${s.params.id}/edit`);
103
+ }, le = async () => {
104
+ H({
105
+ title: y("cms.builder.deleteTitle"),
106
+ message: y("cms.builder.deleteObject"),
107
+ type: "error",
108
+ onConfirm: async () => {
109
+ try {
110
+ await fetch(`/api/cms-type/${s.params.id}`, { method: "DELETE" }), m.push("/collections");
111
+ } catch (t) {
112
+ console.error("Failed to delete collection:", t);
113
+ }
114
+ }
115
+ });
116
+ }, se = async (t) => {
117
+ H({
118
+ title: y("cms.builder.deleteTitle"),
119
+ message: y("cms.builder.deleteObject"),
120
+ type: "error",
121
+ onConfirm: async () => {
122
+ await fetch(`/api/cms/${s.params.id}/${t.id}`, { method: "DELETE" }), _();
123
+ }
124
+ });
125
+ }, ie = (t) => {
126
+ m.push(`/collections/${s.params.id}/${t.id}`);
127
+ }, _ = async () => {
128
+ var t, l;
129
+ if (!C.value) {
130
+ C.value = !0;
131
+ try {
132
+ const a = await (await fetch(
133
+ `/api/cms/${s.params.id}?page=${j.value}&filter=${v.value}&limit=12`
134
+ )).json();
135
+ if (E.value = a.rows || [], c.value = a, (a == null ? void 0 : a.type) === "single" && ((l = (t = a == null ? void 0 : a.rows) == null ? void 0 : t[0]) != null && l.title) && (T.value = a.rows[0].title), !F.value.length) {
136
+ const i = (a.filters || []).map((f) => {
137
+ const { extra: $, title: O, ...g } = f;
138
+ return g;
139
+ });
140
+ F.value = i;
141
+ }
142
+ s.params.id === "pages" && p.value.push("type"), oe(), S();
143
+ } finally {
144
+ C.value = !1;
145
+ }
146
+ }
147
+ }, oe = () => {
148
+ var l;
149
+ if (!((l = c.value) != null && l.columns))
150
+ return;
151
+ const t = c.value.columns.map((e, a) => ({
152
+ text: e.label,
153
+ id: e.name
154
+ }));
155
+ x.value = [
156
+ ...p.value.map((e) => t.find((a) => a.id === e)).filter(Boolean),
157
+ ...t.filter((e) => !p.value.includes(e.id))
158
+ ];
159
+ }, ne = (t, l) => {
160
+ if (!l)
161
+ return !0;
162
+ const e = l.toLowerCase();
163
+ return q.value.some((a) => {
164
+ const i = t[a.name];
165
+ return i && i.toString().toLowerCase().includes(e);
166
+ });
167
+ }, re = (t) => {
168
+ const l = Object.entries(t == null ? void 0 : t.data).filter(([, a]) => a != null).map(([a, i]) => `${a}=${i}`).join("|");
169
+ v.value = l;
170
+ const e = { ...s.query };
171
+ l ? e.filter = l : delete e.filter, m.replace({ query: e });
172
+ }, B = () => {
173
+ if (s.query.filter) {
174
+ v.value = s.query.filter;
175
+ const t = s.query.filter.split("|"), l = {};
176
+ t.forEach((e) => {
177
+ const [a, i] = e.split("=");
178
+ a && i && (l[a] = i);
179
+ }), k.value = l;
180
+ } else
181
+ v.value = "", k.value = {}, V.value++;
182
+ };
183
+ return de(() => {
184
+ B(), M(), _();
185
+ }), L(() => s.params.id, () => {
186
+ k.value = {}, v.value = "", F.value = [], U.value = null, T.value = "";
187
+ const t = { ...s.query };
188
+ delete t.filter, m.replace({ query: t }), V.value++, B(), M(), _();
189
+ }), L(() => s.query, async () => {
190
+ B(), await z(), _();
191
+ }, { deep: !0 }), L(j, async () => {
192
+ s.query.filter || (v.value = "", k.value = {}, V.value++), await z(), _();
193
+ }), (t, l) => {
194
+ var e, a, i, f, $, O;
195
+ return n(), d("div", $e, [
196
+ A(u(W), {
197
+ items: ee.value,
198
+ loading: C.value && !((e = U.value) != null && e.title) && !((a = c.value) != null && a.title) && !T.value,
199
+ onNavigate: te
200
+ }, null, 8, ["items", "loading"]),
201
+ r("div", Ae, [
202
+ r("div", Ee, [
203
+ r("h1", Te, b(I.value), 1),
204
+ r("a", {
205
+ href: `https://cms.opengis.info/${u(Y)}/guides/content/`,
206
+ target: "_blank",
207
+ title: t.$t("cms.guide.content")
208
+ }, [
209
+ A(u(he), { class: "w-5 h-5" })
210
+ ], 8, Ue)
211
+ ]),
212
+ r("div", je, [
213
+ E.value.length ? (n(), d("button", {
214
+ key: 0,
215
+ onClick: P,
216
+ 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"
217
+ }, [
218
+ A(u(ge), { class: "w-4 h-4 mr-2" }),
219
+ me(" " + b(t.$t("cms.articles.createArticle")), 1)
220
+ ])) : h("", !0),
221
+ ((i = c.value) == null ? void 0 : i.type) === "collection" ? (n(), d("button", {
222
+ key: 1,
223
+ onClick: ae,
224
+ class: "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium h-9 px-4 py-2 border border-slate-300 bg-white text-slate-700 shadow-sm transition-all duration-200 transform hover:bg-slate-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
225
+ }, b(t.$t("cms.common.actions.edit")), 1)) : h("", !0),
226
+ r("button", {
227
+ onClick: le,
228
+ class: "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium h-9 px-4 py-2 border border-red-300 bg-white text-red-600 shadow-sm transition-all duration-200 transform hover:bg-red-50 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
229
+ }, b(t.$t("cms.common.actions.delete")), 1)
230
+ ])
231
+ ]),
232
+ C.value ? (n(), d("div", qe, [...l[3] || (l[3] = [
233
+ pe('<div class="p-4 border-b border-gray-200 sm:px-4 sm:py-3 dark:border-gray-700"><div class="flex flex-col gap-4 sm:flex-row sm:items-center"><div class="h-10 w-full rounded-md bg-gray-100 animate-pulse sm:max-w-2xl"></div><div class="h-10 w-40 rounded-md bg-gray-100 animate-pulse sm:ml-auto"></div></div></div><div class="p-4 space-y-3"><div class="h-12 rounded-md bg-gray-100 animate-pulse"></div><div class="h-12 rounded-md bg-gray-100 animate-pulse"></div><div class="h-12 rounded-md bg-gray-100 animate-pulse"></div><div class="h-12 rounded-md bg-gray-100 animate-pulse"></div><div class="h-12 rounded-md bg-gray-100 animate-pulse"></div></div>', 2)
234
+ ])])) : E.value.length || v.value.length ? (n(), d("div", Fe, [
235
+ (n(), d("div", Ve, [
236
+ r("div", De, [
237
+ (n(), N(u(Ce), {
238
+ key: V.value,
239
+ schema: F.value,
240
+ history: !0,
241
+ value: k.value,
242
+ view: "inline",
243
+ onChange: re
244
+ }, null, 8, ["schema", "value"])),
245
+ r("div", Ne, [
246
+ x.value.length > 0 ? (n(), d("div", {
247
+ key: 0,
248
+ class: "flex items-center gap-2 cursor-pointer text-sm border border-gray-300 rounded-md p-2 dark:text-white",
249
+ onClick: l[0] || (l[0] = (g) => w.value = !w.value)
250
+ }, [
251
+ r("p", null, b(t.$t("cms.articles.showColumns")), 1),
252
+ A(u(be), { class: "w-4 h-4" })
253
+ ])) : h("", !0),
254
+ x.value.length > 0 && w.value ? (n(), d("div", Be, [
255
+ r("div", Oe, [
256
+ x.value.length > 0 && w.value ? (n(), N(u(ke), {
257
+ key: 0,
258
+ options: x.value,
259
+ modelValue: p.value,
260
+ "onUpdate:modelValue": l[1] || (l[1] = (g) => p.value = g)
261
+ }, null, 8, ["options", "modelValue"])) : h("", !0)
262
+ ]),
263
+ r("button", {
264
+ class: "text-sm bg-blue-600 text-white rounded-md p-2 mt-4 w-full",
265
+ onClick: S
266
+ }, b(t.$t("cms.articles.update")), 1)
267
+ ])) : h("", !0)
268
+ ])
269
+ ])
270
+ ])),
271
+ q.value.length > 0 ? (n(), N(u(K), {
272
+ key: 1,
273
+ class: "max-h-[calc(100vh-290px)] overflow-y-auto",
274
+ rows: E.value,
275
+ columns: q.value,
276
+ query: X.value,
277
+ filterFn: ne,
278
+ onDelete: se,
279
+ onEdit: ie
280
+ }, null, 8, ["rows", "columns", "query"])) : h("", !0),
281
+ ((f = c.value) == null ? void 0 : f.total) > 20 ? (n(), N(u(Q), {
282
+ key: 2,
283
+ total: ($ = c.value) == null ? void 0 : $.filtered,
284
+ count: (O = c.value) == null ? void 0 : O.count,
285
+ page: j.value,
286
+ "onUpdate:page": l[2] || (l[2] = (g) => j.value = g),
287
+ limit: 20
288
+ }, null, 8, ["total", "count", "page"])) : h("", !0)
289
+ ])) : (n(), d("div", Le, [
290
+ A(u(J), { onAction: P })
291
+ ]))
292
+ ]);
293
+ };
294
+ }
295
+ });
296
+ export {
297
+ Ke as default
298
+ };
@@ -0,0 +1,4 @@
1
+ import { _ as f } from "./CollectionsBreadcrumb.vue_vue_type_script_setup_true_lang-umRzB5mY.js";
2
+ export {
3
+ f as default
4
+ };