@live-change/frontend-auto-form 0.9.85 → 0.9.87

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,76 @@
1
+ <template>
2
+ <div class="w-full lg:w-8/12 md:w-11/12">
3
+
4
+ <!-- <pre>{{ identifiers }}</pre>
5
+ <pre>{{ modelDefinition.identifiers }}</pre> -->
6
+ <!-- <pre>{{identifiersObject}}</pre> -->
7
+
8
+ <div class="bg-surface-0 dark:bg-surface-900 p-4 shadow-sm rounded-border">
9
+
10
+ <ModelEditor :service="serviceName" :model="modelName" :identifiers="identifiersObject" draft
11
+ @saved="handleSaved" />
12
+
13
+ </div>
14
+ </div>
15
+ </template>
16
+
17
+ <script setup>
18
+
19
+ import ModelEditor from "../components/crud/ModelEditor.vue"
20
+
21
+ import { ref, computed, onMounted, defineProps, toRefs } from 'vue'
22
+
23
+ const props = defineProps({
24
+ serviceName: {
25
+ type: String,
26
+ required: true,
27
+ },
28
+ modelName: {
29
+ type: String,
30
+ required: true,
31
+ },
32
+ id: {
33
+ type: String,
34
+ required: true,
35
+ }
36
+ })
37
+ const { serviceName, modelName, id } = toRefs(props)
38
+
39
+ import { useApi, usePath, live } from '@live-change/vue3-ssr'
40
+ const api = useApi()
41
+ const path = usePath()
42
+
43
+ const modelDefinition = computed(() => {
44
+ const service = api.services[serviceName.value]
45
+ if(!service) return null
46
+ const model = service.models[modelName.value]
47
+ if(!model) return null
48
+ return model
49
+ })
50
+
51
+ const identifiersObject = computed(() => {
52
+ return {
53
+ [modelName.value[0].toLowerCase() + modelName.value.slice(1)]: id.value
54
+ }
55
+ })
56
+
57
+ import { useRouter } from 'vue-router'
58
+ const router = useRouter()
59
+
60
+ function handleSaved(result) {
61
+ console.log("HANDLE SAVED", result)
62
+ router.push({
63
+ name: 'auto-form:view',
64
+ params: {
65
+ serviceName: serviceName.value,
66
+ modelName: modelName.value,
67
+ id: id.value
68
+ }
69
+ })
70
+ }
71
+
72
+ </script>
73
+
74
+ <style scoped>
75
+
76
+ </style>
@@ -73,7 +73,7 @@
73
73
 
74
74
  function createRoute(serviceName, model) {
75
75
  return {
76
- name: 'auto-form:editor',
76
+ name: 'auto-form:create',
77
77
  params: {
78
78
  serviceName,
79
79
  modelName: model.name
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="w-full lg:w-8/12 md:w-11/12">
3
3
 
4
- <ModelView :service="serviceName" :model="modelName" :identifiers="identifiersObject" />
4
+ <ModelView :service="serviceName" :model="modelName" :id="id" />
5
5
 
6
6
  </div>
7
7
  </template>
@@ -21,37 +21,12 @@
21
21
  type: String,
22
22
  required: true,
23
23
  },
24
- identifiers: {
25
- type: Array,
26
- default: []
27
- }
28
- })
29
- const { serviceName, modelName, identifiers } = toRefs(props)
30
-
31
- import { useApi, usePath, live } from '@live-change/vue3-ssr'
32
- const api = useApi()
33
- const path = usePath()
34
-
35
- const modelDefinition = computed(() => {
36
- const service = api.services[serviceName.value]
37
- if(!service) return null
38
- const model = service.models[modelName.value]
39
- if(!model) return null
40
- return model
41
- })
42
-
43
- const identifiersObject = computed(() => {
44
- const result = {}
45
- for(const [i, identifier] of Object.entries(identifiers.value)) {
46
- const identifierDefinition = modelDefinition.value.identifiers[i]
47
- if(typeof identifierDefinition === 'string') {
48
- result[identifierDefinition] = identifier
49
- } else {
50
- result[identifierDefinition.name] = identifier
51
- }
24
+ id: {
25
+ type: String,
26
+ required: true,
52
27
  }
53
- return result
54
28
  })
29
+ const { serviceName, modelName, id } = toRefs(props)
55
30
 
56
31
  </script>
57
32
 
@@ -15,13 +15,19 @@ export function autoFormRoutes(config = {}) {
15
15
  }),
16
16
 
17
17
  route({
18
- name: 'auto-form:editor', path: prefix + '/editor/:serviceName/:modelName/:identifiers*', meta: { },
19
- component: () => import("./pages/Editor.vue"),
18
+ name: 'auto-form:create', path: prefix + '/create/:serviceName/:modelName/:identifiersWithNames*', meta: { },
19
+ component: () => import("./pages/Create.vue"),
20
20
  props: true
21
21
  }),
22
22
 
23
23
  route({
24
- name: 'auto-form:view', path: prefix + '/view/:serviceName/:modelName/:identifiers*', meta: { },
24
+ name: 'auto-form:edit', path: prefix + '/edit/:serviceName/:modelName/:id', meta: { },
25
+ component: () => import("./pages/Edit.vue"),
26
+ props: true
27
+ }),
28
+
29
+ route({
30
+ name: 'auto-form:view', path: prefix + '/view/:serviceName/:modelName/:id', meta: { },
25
31
  component: () => import("./pages/View.vue"),
26
32
  props: true
27
33
  }),
@@ -38,6 +44,12 @@ export function autoFormRoutes(config = {}) {
38
44
  props: true
39
45
  }),
40
46
 
47
+ route({
48
+ name: 'auto-form:actionParameters', path: prefix + '/action/:serviceName/:actionName/:parametersJson', meta: { },
49
+ component: () => import("./pages/Action.vue"),
50
+ props: true
51
+ }),
52
+
41
53
  ]
42
54
  }
43
55
 
package/index.js CHANGED
@@ -47,6 +47,8 @@ export * from './front/src/router.js'
47
47
 
48
48
  import DataWithSchema from './front/src/components/schema/DataWithSchema.vue'
49
49
  export { DataWithSchema }
50
+ import SchemaFromDefinition from './front/src/components/schema/SchemaFromDefinition.vue'
51
+ export { SchemaFromDefinition }
50
52
  export * from './front/src/logic/schema.js'
51
53
 
52
54
  import en from "./front/locales/en.json"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/frontend-auto-form",
3
- "version": "0.9.85",
3
+ "version": "0.9.87",
4
4
  "scripts": {
5
5
  "memDev": "node server/start.js memDev --enableSessions --initScript ./init.js --dbAccess",
6
6
  "localDevInit": "rm tmp.db; lcli localDev --enableSessions --initScript ./init.js",
@@ -22,16 +22,16 @@
22
22
  "type": "module",
23
23
  "dependencies": {
24
24
  "@fortawesome/fontawesome-free": "^6.7.2",
25
- "@live-change/cli": "^0.9.85",
26
- "@live-change/dao": "^0.9.85",
27
- "@live-change/dao-vue3": "^0.9.85",
28
- "@live-change/dao-websocket": "^0.9.85",
29
- "@live-change/framework": "^0.9.85",
30
- "@live-change/image-frontend": "^0.9.85",
31
- "@live-change/image-service": "^0.9.85",
32
- "@live-change/session-service": "^0.9.85",
33
- "@live-change/vue3-components": "^0.9.85",
34
- "@live-change/vue3-ssr": "^0.9.85",
25
+ "@live-change/cli": "^0.9.87",
26
+ "@live-change/dao": "^0.9.87",
27
+ "@live-change/dao-vue3": "^0.9.87",
28
+ "@live-change/dao-websocket": "^0.9.87",
29
+ "@live-change/framework": "^0.9.87",
30
+ "@live-change/image-frontend": "^0.9.87",
31
+ "@live-change/image-service": "^0.9.87",
32
+ "@live-change/session-service": "^0.9.87",
33
+ "@live-change/vue3-components": "^0.9.87",
34
+ "@live-change/vue3-ssr": "^0.9.87",
35
35
  "@vueuse/core": "^12.3.0",
36
36
  "codeceptjs-assert": "^0.0.5",
37
37
  "compression": "^1.7.5",
@@ -49,10 +49,10 @@
49
49
  "v-shared-element": "3.1.1",
50
50
  "vue-meta": "^3.0.0-alpha.9",
51
51
  "vue-router": "^4.5.0",
52
- "vue3-scroll-border": "0.1.6"
52
+ "vue3-scroll-border": "0.1.7"
53
53
  },
54
54
  "devDependencies": {
55
- "@live-change/codeceptjs-helper": "^0.9.85",
55
+ "@live-change/codeceptjs-helper": "^0.9.87",
56
56
  "codeceptjs": "^3.6.10",
57
57
  "generate-password": "1.7.1",
58
58
  "playwright": "1.49.1",
@@ -63,5 +63,5 @@
63
63
  "author": "Michał Łaszczewski <michal@laszczewski.pl>",
64
64
  "license": "ISC",
65
65
  "description": "",
66
- "gitHead": "126afb0aad3ab6e03aa5742726f429c95c46783a"
66
+ "gitHead": "7a7694ad2801b7ffa16f347aed441ca5f81ab5fd"
67
67
  }