@opengis/cms 0.0.1 → 0.0.3

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 (52) hide show
  1. package/package.json +2 -2
  2. package/server/plugins/vite.js +3 -3
  3. package/{editor/src → src}/components/manager/children/vs-manager-collection-item-content.vue +116 -116
  4. package/{editor/src → src}/components/manager/manager-table/vs-manager-colection-table-add.vue +84 -84
  5. /package/{editor/index.html → index.html} +0 -0
  6. /package/{editor/public → public}/vite.svg +0 -0
  7. /package/{editor/src → src}/App.vue +0 -0
  8. /package/{editor/src → src}/assets/tailwind/tailwind.js +0 -0
  9. /package/{editor/src → src}/assets/vue.svg +0 -0
  10. /package/{editor/src → src}/components/builder/vs-builder-content.vue +0 -0
  11. /package/{editor/src → src}/components/builder/vs-builder-menu.vue +0 -0
  12. /package/{editor/src → src}/components/formats/index.js +0 -0
  13. /package/{editor/src → src}/components/formats/vs-manager-table-date.vue +0 -0
  14. /package/{editor/src → src}/components/formats/vs-manager-table-switch.vue +0 -0
  15. /package/{editor/src → src}/components/icons/icon-actions.vue +0 -0
  16. /package/{editor/src → src}/components/icons/icon-arrow-left.vue +0 -0
  17. /package/{editor/src → src}/components/icons/icon-check.vue +0 -0
  18. /package/{editor/src → src}/components/icons/icon-chewron-right.vue +0 -0
  19. /package/{editor/src → src}/components/icons/icon-close.vue +0 -0
  20. /package/{editor/src → src}/components/icons/icon-edit.vue +0 -0
  21. /package/{editor/src → src}/components/icons/icon-folder.vue +0 -0
  22. /package/{editor/src → src}/components/icons/icon-folder2.vue +0 -0
  23. /package/{editor/src → src}/components/icons/icon-home.vue +0 -0
  24. /package/{editor/src → src}/components/icons/icon-image.vue +0 -0
  25. /package/{editor/src → src}/components/icons/icon-logo.vue +0 -0
  26. /package/{editor/src → src}/components/icons/icon-media.vue +0 -0
  27. /package/{editor/src → src}/components/icons/icon-point.vue +0 -0
  28. /package/{editor/src → src}/components/icons/icon-search.vue +0 -0
  29. /package/{editor/src → src}/components/icons/icon-table.vue +0 -0
  30. /package/{editor/src → src}/components/icons/icon-users.vue +0 -0
  31. /package/{editor/src → src}/components/icons/icon.plus.vue +0 -0
  32. /package/{editor/src → src}/components/manager/children/vs-manager-collection-content.vue +0 -0
  33. /package/{editor/src → src}/components/manager/children/vs-manager-single-content.vue +0 -0
  34. /package/{editor/src → src}/components/manager/manager-table/vs-manager-collection-table.vue +0 -0
  35. /package/{editor/src → src}/components/manager/vs-manager-menu.vue +0 -0
  36. /package/{editor/src → src}/components/media/Breadcrumb.vue +0 -0
  37. /package/{editor/src → src}/components/shared-components/vs-not-data.vue +0 -0
  38. /package/{editor/src → src}/components/vs-main-menu.vue +0 -0
  39. /package/{editor/src → src}/helpers/debounce.js +0 -0
  40. /package/{editor/src → src}/helpers/translite.js +0 -0
  41. /package/{editor/src → src}/main.js +0 -0
  42. /package/{editor/src → src}/misc/import-file.js +0 -0
  43. /package/{editor/src → src}/pages/vs-builder.vue +0 -0
  44. /package/{editor/src → src}/pages/vs-layout.vue +0 -0
  45. /package/{editor/src → src}/pages/vs-manager.vue +0 -0
  46. /package/{editor/src → src}/pages/vs-media.vue +0 -0
  47. /package/{editor/src → src}/router/router.js +0 -0
  48. /package/{editor/src → src}/router/routes.config.js +0 -0
  49. /package/{editor/src → src}/style.css +0 -0
  50. /package/{editor/src → src}/templates/form-columns.js +0 -0
  51. /package/{editor/src → src}/templates/form-template.js +0 -0
  52. /package/{editor/vite.config.js → vite.config.js} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/cms",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "cms",
5
5
  "type": "module",
6
6
  "author": "Softpro",
@@ -8,7 +8,7 @@
8
8
  "scripts": {
9
9
  "test": "node --test test/**/*.test.js",
10
10
  "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
11
- "build": "vite build editor",
11
+ "build": "vite build",
12
12
  "start": "node server",
13
13
  "prod": "cross-env NODE_ENV=production npm run start",
14
14
  "docs:dev": "vitepress dev docs",
@@ -14,7 +14,7 @@ async function plugin(fastify) {
14
14
  const vite = await import('vite');
15
15
 
16
16
  const viteServer = await vite.createServer({
17
- root: `${root}/editor`,
17
+ root: `${root}`,
18
18
  server: {
19
19
  middlewareMode: true,
20
20
  },
@@ -50,7 +50,7 @@ async function plugin(fastify) {
50
50
  // From Build
51
51
  fastify.get('*', async (req, reply) => {
52
52
  const { user } = req.session?.passport || {};
53
- const assetsDir = 'editor/dist';
53
+ const assetsDir = '/dist';
54
54
  if (!user) return reply.redirect('/login');
55
55
  const stream = fs.createReadStream(`${assetsDir}/index.html`);
56
56
  return reply.type('text/html').send(stream);
@@ -58,7 +58,7 @@ async function plugin(fastify) {
58
58
 
59
59
  const fileSize = {};
60
60
  async function staticFile(req, reply) {
61
- const assetsDir = 'editor/dist';
61
+ const assetsDir = '/dist';
62
62
  const filePath = path.join(root, assetsDir, req.url);
63
63
  const ext = path.extname(filePath);
64
64
 
@@ -1,116 +1,116 @@
1
- <template>
2
- <div class="flex items-center justify-between">
3
- <div class="mt-[10px]">
4
- <h2 class="font-medium text-2xl">{{ objectData?.title }}</h2>
5
- <p class="text-gray-600">{{ objectData?.description }}</p>
6
- </div>
7
- <div class="flex items-center gap-1">
8
- <button
9
- @click="deleteById"
10
- class="py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-white bg-red-500 rounded-lg !border-gray-200 hover:bg-red-700 duration-300"
11
- >
12
- Видалити
13
- </button>
14
- <button
15
- @click="updateDataById"
16
- 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"
17
- >
18
- Зберегти
19
- </button>
20
- </div>
21
- </div>
22
- <div>
23
- <div class="w-full mt-[20px] bg-white rounded-xl p-[20px] border">
24
- <VsForm
25
- :key="formUpdateCounter"
26
- class="w-full"
27
- :scheme
28
- v-model="formValues"
29
- />
30
- </div>
31
- </div>
32
- </template>
33
-
34
- <script setup>
35
- import axios from "axios";
36
- import { computed, getCurrentInstance, onMounted, ref, watch } from "vue";
37
- import { useRoute, useRouter } from "vue-router";
38
-
39
- const $notify = getCurrentInstance().proxy.$notify;
40
-
41
- const route = useRoute();
42
- const router = useRouter();
43
-
44
- const template = computed(() => route?.params?.template);
45
- const id = computed(() => route?.params?.id);
46
- const objectData = ref(null);
47
- const formValues = ref({});
48
- const formUpdateCounter = ref(1);
49
-
50
- const getDataById = async () => {
51
- try {
52
- const { data } = await axios.get(
53
- `/api/cms-manager/${template.value}/${id.value}`
54
- );
55
- objectData.value = data?.rows?.[0];
56
- formValues.value = data?.rows?.[0];
57
- formUpdateCounter.value = formUpdateCounter.value + 1;
58
- } catch (error) {}
59
- };
60
-
61
- const updateDataById = async () => {
62
- try {
63
- await axios.put(`/api/cms-manager/${id.value}`, formValues.value);
64
- await $notify({
65
- type: "success",
66
- title: "Успішно!",
67
- message: "Дані успішно оновлено",
68
- });
69
- getDataById();
70
- } catch (error) {
71
- await $notify({
72
- type: "error",
73
- title: "Помилка!",
74
- message: "При спробі оновити дані виникла помилка",
75
- });
76
- }
77
- };
78
-
79
- const deleteById = async () => {
80
- try {
81
- await axios.delete(`/api/cms-manager/${id.value}`);
82
- await $notify({
83
- type: "success",
84
- title: "Успішно!",
85
- message: "Об'єкт видалено успішно",
86
- });
87
- await router?.back();
88
- // getDataById();
89
- } catch (error) {
90
- await $notify({
91
- type: "error",
92
- title: "Помилка!",
93
- message: "При спробі видалити об'єкт виникла помилка",
94
- });
95
- }
96
- };
97
-
98
- watch(template, getDataById);
99
- onMounted(() => getDataById());
100
-
101
- const scheme = {
102
- title: {
103
- ua: "Назва",
104
- type: "Text",
105
- placeholder: "Назва",
106
- validators: ["required"],
107
- },
108
- body: { ua: "Контент", type: "TextEditor", validators: ["required"] },
109
- enabled: {
110
- ua: "Чи увімкнений",
111
- type: "Switcher",
112
- },
113
- };
114
- </script>
115
-
116
- <style lang="scss" scoped></style>
1
+ <template>
2
+ <div class="flex items-center justify-between">
3
+ <div class="mt-[10px]">
4
+ <h2 class="font-medium text-2xl">{{ objectData?.title }}</h2>
5
+ <p class="text-gray-600">{{ objectData?.description }}</p>
6
+ </div>
7
+ <div class="flex items-center gap-1">
8
+ <button
9
+ @click="deleteById"
10
+ class="py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-white bg-red-500 rounded-lg !border-gray-200 hover:bg-red-700 duration-300"
11
+ >
12
+ Видалити
13
+ </button>
14
+ <button
15
+ @click="updateDataById"
16
+ 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"
17
+ >
18
+ Зберегти
19
+ </button>
20
+ </div>
21
+ </div>
22
+ <div>
23
+ <div class="w-full mt-[20px] bg-white rounded-xl p-[20px] border">
24
+ <VsForm
25
+ :key="formUpdateCounter"
26
+ class="w-full"
27
+ :scheme
28
+ v-model="formValues"
29
+ />
30
+ </div>
31
+ </div>
32
+ </template>
33
+
34
+ <script setup>
35
+ import axios from "axios";
36
+ import { computed, getCurrentInstance, onMounted, ref, watch } from "vue";
37
+ import { useRoute, useRouter } from "vue-router";
38
+
39
+ const $notify = getCurrentInstance().proxy.$notify;
40
+
41
+ const route = useRoute();
42
+ const router = useRouter();
43
+
44
+ const template = computed(() => route?.params?.template);
45
+ const id = computed(() => route?.params?.id);
46
+ const objectData = ref(null);
47
+ const formValues = ref({});
48
+ const formUpdateCounter = ref(1);
49
+
50
+ const getDataById = async () => {
51
+ try {
52
+ const { data } = await axios.get(
53
+ `/api/cms-manager/${template.value}/${id.value}`
54
+ );
55
+ objectData.value = data?.rows?.[0];
56
+ formValues.value = data?.rows?.[0];
57
+ formUpdateCounter.value = formUpdateCounter.value + 1;
58
+ } catch (error) {}
59
+ };
60
+
61
+ const updateDataById = async () => {
62
+ try {
63
+ await axios.put(`/api/cms-manager/${id.value}`, formValues.value);
64
+ await $notify({
65
+ type: "success",
66
+ title: "Успішно!",
67
+ message: "Дані успішно оновлено",
68
+ });
69
+ getDataById();
70
+ } catch (error) {
71
+ await $notify({
72
+ type: "error",
73
+ title: "Помилка!",
74
+ message: "При спробі оновити дані виникла помилка",
75
+ });
76
+ }
77
+ };
78
+
79
+ const deleteById = async () => {
80
+ try {
81
+ await axios.delete(`/api/cms-manager/${id.value}`);
82
+ await $notify({
83
+ type: "success",
84
+ title: "Успішно!",
85
+ message: "Об'єкт видалено успішно",
86
+ });
87
+ await router?.back();
88
+ // getDataById();
89
+ } catch (error) {
90
+ await $notify({
91
+ type: "error",
92
+ title: "Помилка!",
93
+ message: "При спробі видалити об'єкт виникла помилка",
94
+ });
95
+ }
96
+ };
97
+
98
+ watch(template, getDataById);
99
+ onMounted(() => getDataById());
100
+
101
+ const scheme = {
102
+ title: {
103
+ ua: "Назва",
104
+ type: "Text",
105
+ placeholder: "Назва",
106
+ validators: ["required"],
107
+ },
108
+ body: { ua: "Контент", type: "TextEditor", validators: ["required"] },
109
+ enabled: {
110
+ ua: "Чи увімкнений",
111
+ type: "Switcher",
112
+ },
113
+ };
114
+ </script>
115
+
116
+ <style lang="scss" scoped></style>
@@ -1,84 +1,84 @@
1
- <template>
2
- <button
3
- @click="formVisible = true"
4
- 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"
5
- >
6
- Створити
7
- </button>
8
-
9
- <VsDialog title="Створити об'єкт" v-model:visible="formVisible">
10
- <div>
11
- <VsForm ref="form" :scheme v-model="formValue" />
12
- </div>
13
- <template #footer>
14
- <div class="flex justify-end p-[20px] gap-[10px] border-t w-full">
15
- <button
16
- @click="formVisible = false"
17
- class="py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border rounded-lg border-gray-200 hover:bg-gray-100 duration-300"
18
- >
19
- Скасувати</button
20
- ><button
21
- @click="createNewObject"
22
- 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"
23
- >
24
- Створити
25
- </button>
26
- </div>
27
- </template>
28
- </VsDialog>
29
- </template>
30
-
31
- <script setup>
32
- import axios from "axios";
33
- import { getCurrentInstance, ref } from "vue";
34
- import { translit } from "../../../helpers/translite";
35
-
36
- const $notify = getCurrentInstance().proxy.$notify;
37
- const emit = defineEmits(["update-list"]);
38
-
39
- const props = defineProps({ template: { type: String, default: () => "" } });
40
-
41
- const formVisible = ref(false);
42
- const formValue = ref({});
43
- const form = ref();
44
-
45
- const createNewObject = async () => {
46
- try {
47
- await form.value.doValidation();
48
- formValue.value.url = translit(formValue.value.title);
49
- await axios.post(`/api/cms-manager/${props.template}`, formValue.value);
50
- $notify({
51
- type: "success",
52
- title: "Успушно!",
53
- message: "Об'єкт створено успішно",
54
- });
55
- formValue.value = {};
56
- formVisible.value = false;
57
- emit("update-list");
58
- } catch (error) {
59
- $notify({
60
- type: "error",
61
- title: "Помилка!",
62
- message: "При спробі створити об'єкт сталася помилка",
63
- });
64
- }
65
- };
66
-
67
- const scheme = [
68
- {
69
- key: "title",
70
- ua: "Назва",
71
- type: "Text",
72
- placeholder: "Назва",
73
- validators: ["required"],
74
- },
75
- { key: "body", ua: "Контент", type: "TextEditor", validators: ["required"] },
76
- {
77
- ua: "Чи увімкнений",
78
- name: "enabled",
79
- type: "Switcher",
80
- },
81
- ];
82
- </script>
83
-
84
- <style lang="scss" scoped></style>
1
+ <template>
2
+ <button
3
+ @click="formVisible = true"
4
+ 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"
5
+ >
6
+ Створити
7
+ </button>
8
+
9
+ <VsDialog title="Створити об'єкт" v-model:visible="formVisible">
10
+ <div>
11
+ <VsForm ref="form" :scheme v-model="formValue" />
12
+ </div>
13
+ <template #footer>
14
+ <div class="flex justify-end p-[20px] gap-[10px] border-t w-full">
15
+ <button
16
+ @click="formVisible = false"
17
+ class="py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border rounded-lg border-gray-200 hover:bg-gray-100 duration-300"
18
+ >
19
+ Скасувати</button
20
+ ><button
21
+ @click="createNewObject"
22
+ 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"
23
+ >
24
+ Створити
25
+ </button>
26
+ </div>
27
+ </template>
28
+ </VsDialog>
29
+ </template>
30
+
31
+ <script setup>
32
+ import axios from "axios";
33
+ import { getCurrentInstance, ref } from "vue";
34
+ import { translit } from "../../../helpers/translite";
35
+
36
+ const $notify = getCurrentInstance().proxy.$notify;
37
+ const emit = defineEmits(["update-list"]);
38
+
39
+ const props = defineProps({ template: { type: String, default: () => "" } });
40
+
41
+ const formVisible = ref(false);
42
+ const formValue = ref({});
43
+ const form = ref();
44
+
45
+ const createNewObject = async () => {
46
+ try {
47
+ await form.value.doValidation();
48
+ formValue.value.url = translit(formValue.value.title);
49
+ await axios.post(`/api/cms-manager/${props.template}`, formValue.value);
50
+ $notify({
51
+ type: "success",
52
+ title: "Успушно!",
53
+ message: "Об'єкт створено успішно",
54
+ });
55
+ formValue.value = {};
56
+ formVisible.value = false;
57
+ emit("update-list");
58
+ } catch (error) {
59
+ $notify({
60
+ type: "error",
61
+ title: "Помилка!",
62
+ message: "При спробі створити об'єкт сталася помилка",
63
+ });
64
+ }
65
+ };
66
+
67
+ const scheme = [
68
+ {
69
+ key: "title",
70
+ ua: "Назва",
71
+ type: "Text",
72
+ placeholder: "Назва",
73
+ validators: ["required"],
74
+ },
75
+ { key: "body", ua: "Контент", type: "TextEditor", validators: ["required"] },
76
+ {
77
+ ua: "Чи увімкнений",
78
+ name: "enabled",
79
+ type: "Switcher",
80
+ },
81
+ ];
82
+ </script>
83
+
84
+ <style lang="scss" scoped></style>
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes