@live-change/frontend-auto-form 0.8.125 → 0.8.127

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,85 @@
1
+ <template>
2
+ <div>
3
+ <div v-if="editor">
4
+ <auto-editor
5
+ :definition="modelDefinition"
6
+ v-model="editor.value.value"
7
+ :rootValue="editor.value.value"
8
+ :i18n="i18n" />
9
+ <div v-if="draft">
10
+ save buttons
11
+ </div>
12
+ </div>
13
+ </div>
14
+ </template>
15
+
16
+ <script setup>
17
+
18
+ import AutoEditor from '../form/AutoEditor.vue'
19
+
20
+ import { ref, computed, onMounted, defineProps, defineEmits, toRefs } from 'vue'
21
+
22
+ const props = defineProps({
23
+ service: {
24
+ type: String,
25
+ required: true,
26
+ },
27
+ model: {
28
+ type: String,
29
+ required: true,
30
+ },
31
+ identifiers: {
32
+ type: Object,
33
+ default: []
34
+ },
35
+ draft: {
36
+ type: Boolean,
37
+ default: false
38
+ },
39
+ options: {
40
+ type: Object,
41
+ default: () => ({})
42
+ },
43
+ i18n: {
44
+ type: String,
45
+ default: ''
46
+ }
47
+ })
48
+ const { service, model, identifiers, draft, options, i18n } = toRefs(props)
49
+
50
+ const emit = defineEmits(['saved', 'draftSaved', 'draftDiscarded', 'saveError', 'created' ])
51
+
52
+ import { useApi, usePath, live } from '@live-change/vue3-ssr'
53
+ const api = useApi()
54
+ const path = usePath()
55
+
56
+ const modelDefinition = computed(() => {
57
+ return api.services?.[service.value]?.models?.[model.value]
58
+ })
59
+
60
+ import { editorData } from "@live-change/frontend-auto-form"
61
+ import { computedAsync } from "@vueuse/core"
62
+
63
+ const editor = computedAsync(async () => {
64
+ const ed = await editorData({
65
+ service: service.value,
66
+ model: model.value,
67
+ identifiers: identifiers.value,
68
+ draft: draft.value,
69
+ autoSave: true,
70
+ ...options.value,
71
+ onSaved: (...args) => emit('saved', ...args),
72
+ onDraftSaved: (...args) => emit('draftSaved', ...args),
73
+ onDraftDiscarded: (...args) => emit('draftDiscarded', ...args),
74
+ onSaveError: (...args) => emit('saveError', ...args),
75
+ onCreated: (...args) => emit('created', ...args),
76
+ })
77
+ //console.log("ED", ed)
78
+ return ed
79
+ })
80
+
81
+ </script>
82
+
83
+ <style scoped>
84
+
85
+ </style>
@@ -11,12 +11,16 @@
11
11
  <h4>definition</h4>
12
12
  <pre>{{ modelDefinition }}</pre>
13
13
 
14
+ <ModelEditor :service="serviceName" :model="modelName" :identifiers="identifiersObject" draft />
15
+
14
16
  </div>
15
17
  </div>
16
18
  </template>
17
19
 
18
20
  <script setup>
19
21
 
22
+ import ModelEditor from "../components/crud/ModelEditor.vue"
23
+
20
24
  import { ref, computed, onMounted, defineProps, toRefs } from 'vue'
21
25
 
22
26
  const props = defineProps({
@@ -60,23 +64,10 @@
60
64
  return result
61
65
  })
62
66
 
63
-
64
- import { editorData } from "@live-change/frontend-auto-form"
65
-
66
- /*const treeSettings = computedAsync(async () => {
67
- const ed = await editorData({
68
- service: serviceName,
69
- model: modelName,
70
- identifiers: { file: tree.value },
71
- draft: true,
72
- onCreated() {
73
- console.log("CREATED")
74
- // TODO: change route - add identifiers
75
- },
76
- })
77
- console.log("ED", ed)
78
- return ed
79
- })*/
67
+ function handleCreated() {
68
+ console.log("CREATED")
69
+ // TODO: change route - add identifiers
70
+ }
80
71
 
81
72
  </script>
82
73
 
package/index.js CHANGED
@@ -12,6 +12,9 @@ export { editorData }
12
12
 
13
13
  export * from './front/src/logic/relations.js'
14
14
 
15
+ import ModelEditor from './front/src/components/crud/ModelEditor.vue'
16
+ export { ModelEditor }
17
+
15
18
  export * from './front/src/router.js'
16
19
 
17
20
  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.8.125",
3
+ "version": "0.8.127",
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.5.2",
25
- "@live-change/cli": "^0.8.125",
26
- "@live-change/dao": "^0.8.125",
27
- "@live-change/dao-vue3": "^0.8.125",
28
- "@live-change/dao-websocket": "^0.8.125",
29
- "@live-change/framework": "^0.8.125",
30
- "@live-change/image-frontend": "^0.8.125",
31
- "@live-change/image-service": "^0.8.125",
32
- "@live-change/session-service": "^0.8.125",
33
- "@live-change/vue3-components": "^0.8.125",
34
- "@live-change/vue3-ssr": "^0.8.125",
25
+ "@live-change/cli": "^0.8.127",
26
+ "@live-change/dao": "^0.8.127",
27
+ "@live-change/dao-vue3": "^0.8.127",
28
+ "@live-change/dao-websocket": "^0.8.127",
29
+ "@live-change/framework": "^0.8.127",
30
+ "@live-change/image-frontend": "^0.8.127",
31
+ "@live-change/image-service": "^0.8.127",
32
+ "@live-change/session-service": "^0.8.127",
33
+ "@live-change/vue3-components": "^0.8.127",
34
+ "@live-change/vue3-ssr": "^0.8.127",
35
35
  "@vueuse/core": "^10.11.0",
36
36
  "codeceptjs-assert": "^0.0.5",
37
37
  "compression": "^1.7.4",
@@ -52,7 +52,7 @@
52
52
  "vue3-scroll-border": "0.1.6"
53
53
  },
54
54
  "devDependencies": {
55
- "@live-change/codeceptjs-helper": "^0.8.125",
55
+ "@live-change/codeceptjs-helper": "^0.8.127",
56
56
  "codeceptjs": "^3.6.5",
57
57
  "generate-password": "1.7.1",
58
58
  "playwright": "^1.41.2",
@@ -63,5 +63,5 @@
63
63
  "author": "Michał Łaszczewski <michal@laszczewski.pl>",
64
64
  "license": "ISC",
65
65
  "description": "",
66
- "gitHead": "d7d1cdd1d9d670e3eb065bf56fcdbc67e4d97dea"
66
+ "gitHead": "4c2787b59fcfd2a62f3e9345f0a3a3e855584cb7"
67
67
  }