@live-change/frontend-auto-form 0.9.14 → 0.9.16

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.
@@ -21,8 +21,8 @@
21
21
  :canLoadTop="false" canDropBottom
22
22
  loadBottomSensorSize="4000px" dropBottomSensorSize="3000px">
23
23
  <template #empty>
24
- <div class="text-xl text-800 my-3 mx-3">
25
- No {{ pluralize(model) }} found
24
+ <div class="text-xl text-800 my-1 mx-3">
25
+ No <strong>{{ pluralize(model[0].toLowerCase() + model.slice(1)) }}</strong> found.
26
26
  </div>
27
27
  </template>
28
28
  <template #default="{ item: object }">
@@ -44,7 +44,8 @@
44
44
  <Button icon="pi pi-pencil" severity="primary" label="Edit" class="mr-2" />
45
45
  </router-link>
46
46
 
47
- <Button icon="pi pi-eraser" severity="primary" label="Delete" class="mr-2" />
47
+ <Button v-if="modelDefinition.crud?.delete" @click="ev => deleteObject(ev, object)"
48
+ icon="pi pi-eraser" severity="primary" label="Delete" class="mr-2" />
48
49
  </div>
49
50
  </div>
50
51
  </template>
@@ -60,19 +61,42 @@
60
61
  </div>
61
62
  </div>
62
63
 
63
- <div v-if="modelDefinition.value?.crud?.create" class="mt-3 flex flex-row justify-content-end mr-2">
64
+ <div v-if="modelDefinition.crud?.create" class="mt-2 flex flex-row justify-content-end mr-2">
64
65
  <router-link :to="createRoute" class="no-underline2">
65
66
  <Button icon="pi pi-plus" :label="'Create new '+model" />
66
67
  </router-link>
67
68
  </div>
68
69
 
70
+ <ConfirmPopup group="delete">
71
+ <template #message="slotProps">
72
+ <div class="flex flex-row align-items-center w-full gap-3 border-bottom-1 surface-border px-3 pt-1 pb-1">
73
+ <i class="pi pi-trash text-3xl text-primary-500"></i>
74
+ <p>
75
+ Do you want to delete {{ model[0].toLowerCase() + model.slice(1) }}
76
+ <ObjectIdentification
77
+ :objectType="service + '_' + model"
78
+ :object="slotProps.message.object.to ?? slotProps.message.object.id"
79
+ :data="slotProps.message.object"
80
+ />
81
+ ?
82
+ </p>
83
+ </div>
84
+ </template>
85
+ </ConfirmPopup>
86
+
69
87
  </div>
70
88
  </template>
71
89
 
72
90
  <script setup>
73
91
 
92
+ import ConfirmPopup from "primevue/confirmpopup"
74
93
  import Button from "primevue/button"
75
94
 
95
+ import { useToast } from 'primevue/usetoast'
96
+ const toast = useToast()
97
+ import { useConfirm } from 'primevue/useconfirm'
98
+ const confirm = useConfirm()
99
+
76
100
  import { ref, computed, onMounted, defineProps, toRefs } from 'vue'
77
101
  import { RangeViewer, injectComponent } from "@live-change/vue3-components"
78
102
  import pluralize from 'pluralize'
@@ -178,6 +202,24 @@
178
202
  }
179
203
  }))
180
204
 
205
+ function deleteObject(event, object) {
206
+ confirm.require({
207
+ group: 'delete',
208
+ target: event.currentTarget,
209
+ object,
210
+ acceptClass: "p-button-danger",
211
+ accept: async () => {
212
+ await api.actions[service.value][modelDefinition.value.crud.delete]({
213
+ ...objectIdentifiers(object)
214
+ });
215
+ toast.add({ severity: "info", summary: model.value + " deleted", life: 1500 });
216
+ },
217
+ reject: () => {
218
+ toast.add({ severity: "error", summary: "Rejected", detail: "You have rejected", life: 3e3 });
219
+ }
220
+ });
221
+ }
222
+
181
223
  </script>
182
224
 
183
225
  <style scoped>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/frontend-auto-form",
3
- "version": "0.9.14",
3
+ "version": "0.9.16",
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.9.14",
26
- "@live-change/dao": "^0.9.14",
27
- "@live-change/dao-vue3": "^0.9.14",
28
- "@live-change/dao-websocket": "^0.9.14",
29
- "@live-change/framework": "^0.9.14",
30
- "@live-change/image-frontend": "^0.9.14",
31
- "@live-change/image-service": "^0.9.14",
32
- "@live-change/session-service": "^0.9.14",
33
- "@live-change/vue3-components": "^0.9.14",
34
- "@live-change/vue3-ssr": "^0.9.14",
25
+ "@live-change/cli": "^0.9.16",
26
+ "@live-change/dao": "^0.9.16",
27
+ "@live-change/dao-vue3": "^0.9.16",
28
+ "@live-change/dao-websocket": "^0.9.16",
29
+ "@live-change/framework": "^0.9.16",
30
+ "@live-change/image-frontend": "^0.9.16",
31
+ "@live-change/image-service": "^0.9.16",
32
+ "@live-change/session-service": "^0.9.16",
33
+ "@live-change/vue3-components": "^0.9.16",
34
+ "@live-change/vue3-ssr": "^0.9.16",
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.9.14",
55
+ "@live-change/codeceptjs-helper": "^0.9.16",
56
56
  "codeceptjs": "^3.6.5",
57
57
  "generate-password": "1.7.1",
58
58
  "playwright": "1.48.1",
@@ -63,5 +63,5 @@
63
63
  "author": "Michał Łaszczewski <michal@laszczewski.pl>",
64
64
  "license": "ISC",
65
65
  "description": "",
66
- "gitHead": "5d0f137a1a16f892868719d919f4a76584fa879f"
66
+ "gitHead": "226df9fa7eb682f6d7da5e4541eb320e8309facf"
67
67
  }