@hostlink/nuxt-light 0.0.18 → 0.0.21
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.
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/l-app-main.vue +27 -5
- package/dist/runtime/components/l-app.vue +9 -5
- package/dist/runtime/components/l-btn.vue +1 -1
- package/dist/runtime/components/l-date-picker.vue +12 -15
- package/dist/runtime/components/l-file-manager-move.vue +1 -1
- package/dist/runtime/components/l-file-manager-preview.vue +1 -1
- package/dist/runtime/components/l-file-manager.vue +1 -1
- package/dist/runtime/components/l-form.vue +1 -0
- package/dist/runtime/components/l-input.vue +17 -4
- package/dist/runtime/components/l-login.vue +9 -11
- package/dist/runtime/components/l-page.vue +3 -1
- package/dist/runtime/components/l-select.vue +2 -2
- package/dist/runtime/components/l-table.vue +129 -104
- package/dist/runtime/components/l-time-picker.vue +24 -5
- package/dist/runtime/{light.d.ts → index.d.ts} +1 -1
- package/dist/runtime/{light.mjs → index.mjs} +3 -1
- package/dist/runtime/lib/addObject.mjs +9 -4
- package/dist/runtime/lib/deleteObject.d.ts +1 -0
- package/dist/runtime/lib/deleteObject.mjs +12 -0
- package/dist/runtime/lib/getID.d.ts +2 -0
- package/dist/runtime/lib/getID.mjs +13 -0
- package/dist/runtime/lib/index.d.ts +4 -2
- package/dist/runtime/lib/index.mjs +4 -2
- package/dist/runtime/lib/listObject.d.ts +1 -0
- package/dist/runtime/lib/listObject.mjs +19 -0
- package/dist/runtime/lib/login.d.ts +1 -1
- package/dist/runtime/lib/login.mjs +3 -2
- package/dist/runtime/lib/m.d.ts +1 -1
- package/dist/runtime/lib/m.mjs +5 -1
- package/dist/runtime/lib/removeObject.mjs +6 -9
- package/dist/runtime/lib/updateObject.mjs +8 -7
- package/dist/runtime/pages/EventLog/_eventlog_id/view.vue +1 -1
- package/dist/runtime/pages/EventLog/index.vue +2 -10
- package/dist/runtime/pages/MailLog/index.vue +2 -8
- package/dist/runtime/pages/Permission/add.vue +1 -1
- package/dist/runtime/pages/Permission/all.vue +1 -1
- package/dist/runtime/pages/Permission/index.vue +1 -1
- package/dist/runtime/pages/Role/add.vue +1 -1
- package/dist/runtime/pages/Role/index.vue +2 -2
- package/dist/runtime/pages/System/database/table.vue +1 -1
- package/dist/runtime/pages/System/index.vue +1 -1
- package/dist/runtime/pages/System/mailtest.vue +1 -1
- package/dist/runtime/pages/System/menu/index.vue +2 -2
- package/dist/runtime/pages/System/package.vue +1 -1
- package/dist/runtime/pages/System/phpinfo.vue +1 -1
- package/dist/runtime/pages/System/setting.vue +12 -2
- package/dist/runtime/pages/System/view_as.vue +2 -2
- package/dist/runtime/pages/User/_user_id/change-password.vue +1 -7
- package/dist/runtime/pages/User/_user_id/edit.vue +4 -3
- package/dist/runtime/pages/User/_user_id/view.vue +3 -2
- package/dist/runtime/pages/User/add.vue +16 -6
- package/dist/runtime/pages/User/index.vue +3 -3
- package/dist/runtime/pages/User/profile.vue +1 -1
- package/dist/runtime/pages/User/setting/bio-auth.vue +1 -2
- package/dist/runtime/pages/User/setting/index.vue +1 -1
- package/dist/runtime/pages/User/setting/information.vue +1 -1
- package/dist/runtime/pages/User/setting/password.vue +1 -1
- package/dist/runtime/pages/User/setting/two-factor-auth.vue +1 -1
- package/dist/runtime/pages/UserLog/index.vue +1 -12
- package/dist/runtime/pages/index.vue +5 -11
- package/dist/runtime/pages/logout.vue +1 -1
- package/dist/runtime/plugin.mjs +1 -1
- package/dist/runtime/routes.mjs +0 -10
- package/package.json +1 -1
- package/dist/runtime/lib/viewAs.d.ts +0 -1
- package/dist/runtime/lib/viewAs.mjs +0 -15
- package/dist/runtime/pages/User/setting/2fa.vue +0 -60
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { useQuasar } from 'quasar';
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useQuasar, QTable } from 'quasar';
|
|
3
3
|
import { useRoute } from 'vue-router';
|
|
4
|
-
import { ref, computed, onMounted,useSlots } from "vue";
|
|
5
|
-
import { t } from '../
|
|
4
|
+
import { ref, computed, onMounted, useSlots, reactive } from "vue";
|
|
5
|
+
import { t, deleteObject, listObject } from '../';
|
|
6
6
|
|
|
7
7
|
const route = useRoute();
|
|
8
8
|
const module = route.path.split("/")[1];
|
|
9
|
-
const errors = ref([]);
|
|
9
|
+
const errors = ref<InstanceType<any>>([]);
|
|
10
10
|
|
|
11
11
|
const props = defineProps({
|
|
12
12
|
columns: {
|
|
13
|
-
type: Array
|
|
13
|
+
type: Array<{
|
|
14
|
+
label: string,
|
|
15
|
+
name: string,
|
|
16
|
+
align?: string,
|
|
17
|
+
sortable?: boolean,
|
|
18
|
+
searchable?: boolean,
|
|
19
|
+
searchType?: string,
|
|
20
|
+
field?: string | Object,
|
|
21
|
+
}>,
|
|
14
22
|
required: true
|
|
15
23
|
},
|
|
16
24
|
showActions: {
|
|
@@ -27,6 +35,7 @@ const props = defineProps({
|
|
|
27
35
|
},
|
|
28
36
|
})
|
|
29
37
|
|
|
38
|
+
|
|
30
39
|
//apply all aligns to the columns
|
|
31
40
|
props.columns.forEach((col) => {
|
|
32
41
|
if (!col.align) {
|
|
@@ -55,7 +64,14 @@ const renderColumns = computed(() => {
|
|
|
55
64
|
return cols;
|
|
56
65
|
})
|
|
57
66
|
|
|
58
|
-
|
|
67
|
+
interface LTableRequest {
|
|
68
|
+
loadData: (model: string, filters: any, fields: Array<any>) => void
|
|
69
|
+
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const emits = defineEmits<{
|
|
73
|
+
request: [p: LTableRequest]
|
|
74
|
+
}>()
|
|
59
75
|
|
|
60
76
|
const loading = ref(false);
|
|
61
77
|
|
|
@@ -70,7 +86,7 @@ if (props.showActions && props.showActions instanceof Array) {
|
|
|
70
86
|
|
|
71
87
|
|
|
72
88
|
const pagination = ref({
|
|
73
|
-
sortBy:
|
|
89
|
+
sortBy: "",
|
|
74
90
|
descending: true,
|
|
75
91
|
page: 1,
|
|
76
92
|
rowsPerPage: 10,
|
|
@@ -89,100 +105,136 @@ const hasSearch = computed(() => {
|
|
|
89
105
|
})
|
|
90
106
|
})
|
|
91
107
|
|
|
92
|
-
const table = ref(
|
|
108
|
+
const table = ref<InstanceType<typeof QTable>>();
|
|
93
109
|
|
|
94
|
-
const filters = ref({});
|
|
95
|
-
const rows = ref([]);
|
|
110
|
+
const filters = ref<InstanceType<any>>({});
|
|
111
|
+
const rows = ref<InstanceType<any>>([]);
|
|
96
112
|
|
|
97
113
|
onMounted(() => {
|
|
98
|
-
table.value
|
|
114
|
+
if (table.value) {
|
|
115
|
+
table.value.requestServerInteraction();
|
|
116
|
+
}
|
|
99
117
|
})
|
|
100
118
|
|
|
101
|
-
let primaryKey = ref(
|
|
102
|
-
const
|
|
103
|
-
const onRequest = async (p) => {
|
|
119
|
+
let primaryKey = ref(null);
|
|
120
|
+
const modelName = ref("");
|
|
104
121
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
122
|
+
|
|
123
|
+
const validateData = () => {
|
|
124
|
+
if (props.showActions) {
|
|
125
|
+
if (props.showActions.includes("edit")) {
|
|
126
|
+
if (rows.value.length > 0) {
|
|
127
|
+
//get first row
|
|
128
|
+
let row = rows.value[0];
|
|
129
|
+
//check has primary key
|
|
130
|
+
|
|
131
|
+
if (!primaryKey.value) {
|
|
132
|
+
errors.value.push("[edit] Primary key not found in the data");
|
|
133
|
+
}
|
|
134
|
+
}
|
|
112
135
|
}
|
|
113
|
-
p.fields.push(col.name);
|
|
114
|
-
});
|
|
115
136
|
|
|
137
|
+
if (props.showActions.includes("delete")) {
|
|
138
|
+
if (rows.value.length > 0) {
|
|
139
|
+
//get first row
|
|
140
|
+
let row = rows.value[0];
|
|
141
|
+
//check has primary key
|
|
142
|
+
|
|
143
|
+
if (!row[primaryKey.value]) {
|
|
144
|
+
errors.value.push("[delete] Primary key not found in the data");
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
116
148
|
|
|
117
|
-
if (actionDelete) {
|
|
118
|
-
p.fields.push("canDelete");
|
|
119
149
|
}
|
|
120
150
|
|
|
121
|
-
|
|
151
|
+
}
|
|
122
152
|
|
|
123
|
-
|
|
124
|
-
p.done = (data) => {
|
|
125
|
-
loading.value = false;
|
|
126
|
-
rows.value = data.rows;
|
|
127
|
-
pagination.value.rowsPerPage = p.pagination.rowsPerPage;
|
|
128
|
-
pagination.value.page = p.pagination.page;
|
|
129
|
-
pagination.value.sortBy = p.pagination.sortBy;
|
|
130
|
-
pagination.value.descending = p.pagination.descending;
|
|
153
|
+
const onRequest = async (p: any) => {
|
|
131
154
|
|
|
132
|
-
pagination.value = Object.assign(pagination.value, data.pagination);
|
|
133
155
|
|
|
134
|
-
|
|
156
|
+
const callback = {
|
|
157
|
+
async loadData(model: String, filters: null, fields: Array<any> = []) {
|
|
135
158
|
|
|
159
|
+
//
|
|
160
|
+
let localFields: Array<any> = [];
|
|
136
161
|
|
|
137
|
-
|
|
138
|
-
|
|
162
|
+
fields.forEach((f) => {
|
|
163
|
+
localFields.push(f);
|
|
164
|
+
});
|
|
139
165
|
|
|
166
|
+
props.columns.forEach((col) => {
|
|
167
|
+
if (col.name.startsWith("_")) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (localFields.includes(col.name)) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
localFields.push(col.name);
|
|
174
|
+
});
|
|
140
175
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
//get first row
|
|
145
|
-
let row = rows.value[0];
|
|
146
|
-
//check has primary key
|
|
176
|
+
if (actionView) {
|
|
177
|
+
localFields.push("canView");
|
|
178
|
+
}
|
|
147
179
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
}
|
|
180
|
+
if (actionDelete) {
|
|
181
|
+
localFields.push("canDelete");
|
|
152
182
|
}
|
|
153
183
|
|
|
154
|
-
if (
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
let row = rows.value[0];
|
|
158
|
-
//check has primary key
|
|
184
|
+
if (activeEdit) {
|
|
185
|
+
localFields.push("canUpdate");
|
|
186
|
+
}
|
|
159
187
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
let localFilters = getFilterValue();
|
|
191
|
+
//merge the filters
|
|
192
|
+
if (filters) {
|
|
193
|
+
localFilters = {
|
|
194
|
+
...localFilters,
|
|
195
|
+
...filters
|
|
163
196
|
}
|
|
164
197
|
}
|
|
165
198
|
|
|
166
|
-
}
|
|
167
199
|
|
|
168
200
|
|
|
169
|
-
|
|
201
|
+
let sort = "";
|
|
202
|
+
if (p.pagination.sortBy) {
|
|
203
|
+
sort = p.pagination.sortBy + ":" + (p.pagination.descending ? "desc" : "asc");
|
|
204
|
+
}
|
|
170
205
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
206
|
+
loading.value = true;
|
|
207
|
+
const offset = (p.pagination.page - 1) * p.pagination.rowsPerPage;
|
|
208
|
+
const limit = p.pagination.rowsPerPage;
|
|
209
|
+
const allData = await listObject(model, localFilters, sort, offset, limit, localFields);
|
|
210
|
+
|
|
211
|
+
rows.value = allData.data;
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
console.log(allData.meta)
|
|
215
|
+
//meta
|
|
216
|
+
primaryKey.value = allData.meta.key;
|
|
217
|
+
modelName.value = allData.meta.name;
|
|
174
218
|
|
|
175
|
-
p.limit = p.pagination.rowsPerPage;
|
|
176
|
-
p.offset = (p.pagination.page - 1) * p.pagination.rowsPerPage;
|
|
177
219
|
|
|
220
|
+
pagination.value.rowsPerPage = p.pagination.rowsPerPage;
|
|
221
|
+
pagination.value.page = p.pagination.page;
|
|
222
|
+
pagination.value.sortBy = p.pagination.sortBy;
|
|
223
|
+
pagination.value.descending = p.pagination.descending;
|
|
224
|
+
pagination.value.rowsNumber = allData.meta.total;
|
|
225
|
+
loading.value = false;
|
|
226
|
+
validateData()
|
|
178
227
|
|
|
228
|
+
}
|
|
229
|
+
}
|
|
179
230
|
|
|
180
|
-
emits("request", p);
|
|
231
|
+
//emits("request", p);
|
|
232
|
+
emits("request", callback);
|
|
181
233
|
|
|
182
234
|
}
|
|
183
235
|
|
|
184
236
|
const getFilterValue = () => {
|
|
185
|
-
let f = {};
|
|
237
|
+
let f: any = {};
|
|
186
238
|
|
|
187
239
|
props.columns.forEach((col) => {
|
|
188
240
|
if (col.searchable) {
|
|
@@ -202,24 +254,13 @@ const getFilterValue = () => {
|
|
|
202
254
|
|
|
203
255
|
}
|
|
204
256
|
}
|
|
205
|
-
})
|
|
206
|
-
Object.entries(filters.value).forEach(([key, value]) => {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
f[key] = {
|
|
210
|
-
contains: value
|
|
211
|
-
}
|
|
212
|
-
}) */
|
|
213
|
-
|
|
214
|
-
|
|
257
|
+
});
|
|
215
258
|
return f;
|
|
216
259
|
}
|
|
217
260
|
|
|
218
261
|
|
|
219
262
|
const onFilters = () => {
|
|
220
263
|
//clone the filters
|
|
221
|
-
|
|
222
|
-
|
|
223
264
|
onRequest({
|
|
224
265
|
pagination: {
|
|
225
266
|
page: 1,
|
|
@@ -236,39 +277,22 @@ const ss = Object.entries(slots).map(([key, value]) => {
|
|
|
236
277
|
return key;
|
|
237
278
|
});
|
|
238
279
|
|
|
239
|
-
|
|
240
|
-
/*
|
|
241
|
-
let MyComp = h("div", null, ["abc"])
|
|
242
|
-
|
|
243
|
-
console.log(MyComp)
|
|
244
|
-
*/
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
280
|
const qua = useQuasar();
|
|
251
|
-
const onDelete = async (id) => {
|
|
281
|
+
const onDelete = async (id: any) => {
|
|
252
282
|
|
|
253
283
|
try {
|
|
254
|
-
await
|
|
255
|
-
} catch (e) {
|
|
256
|
-
|
|
284
|
+
await deleteObject(modelName.value, id)
|
|
285
|
+
} catch (e: any) {
|
|
257
286
|
qua.notify({
|
|
258
287
|
message: e.message,
|
|
259
|
-
color: "negative"
|
|
260
|
-
icon: "report_problem"
|
|
288
|
+
color: "negative"
|
|
261
289
|
})
|
|
262
|
-
|
|
263
|
-
|
|
264
290
|
return;
|
|
265
|
-
|
|
266
291
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
292
|
// refresh the table
|
|
270
|
-
table.value
|
|
271
|
-
|
|
293
|
+
if (table.value) {
|
|
294
|
+
table.value.requestServerInteraction();
|
|
295
|
+
}
|
|
272
296
|
}
|
|
273
297
|
|
|
274
298
|
|
|
@@ -294,9 +318,10 @@ const onDelete = async (id) => {
|
|
|
294
318
|
<q-td :props="props" auto-width>
|
|
295
319
|
<div class="text-grey-8">
|
|
296
320
|
|
|
297
|
-
<l-view-btn
|
|
321
|
+
<l-view-btn v-if="actionView && props.row.canView"
|
|
322
|
+
:to="`/${modelName}/${props.row[primaryKey]}/view`"></l-view-btn>
|
|
298
323
|
|
|
299
|
-
<l-edit-btn :to="`/${
|
|
324
|
+
<l-edit-btn :to="`/${modelName}/${props.row[primaryKey]}/edit`" v-if="activeEdit"></l-edit-btn>
|
|
300
325
|
|
|
301
326
|
<l-delete-btn v-if="actionDelete && props.row.canDelete"
|
|
302
327
|
@submit="onDelete(props.row[primaryKey])"></l-delete-btn>
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed, ref } from "vue";
|
|
3
|
-
const props = defineProps(
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
modelValue: {
|
|
5
|
+
type: [String, Object],
|
|
6
|
+
required: false,
|
|
7
|
+
default: null
|
|
8
|
+
}, required: {
|
|
9
|
+
type: Boolean,
|
|
10
|
+
default: false
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
|
|
4
14
|
const emit = defineEmits(["update:modelValue"]);
|
|
5
15
|
const popup = ref(null);
|
|
6
16
|
const localValue = computed({
|
|
@@ -9,13 +19,22 @@ const localValue = computed({
|
|
|
9
19
|
// popup.value.hide();
|
|
10
20
|
emit('update:modelValue', value)
|
|
11
21
|
}
|
|
12
|
-
|
|
13
22
|
});
|
|
23
|
+
|
|
24
|
+
const rules = ["time"];
|
|
25
|
+
if (props.required) {
|
|
26
|
+
rules.push(val => !!val || 'Required.');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
14
33
|
</script>
|
|
15
34
|
<template>
|
|
16
|
-
<q-input v-model="localValue" mask="time" :rules="
|
|
35
|
+
<q-input v-model="localValue" mask="time" :rules="rules">
|
|
17
36
|
<template v-slot:prepend>
|
|
18
|
-
<q-icon
|
|
37
|
+
<q-btn icon="sym_o_access_time" round dense flat>
|
|
19
38
|
<q-popup-proxy cover transition-show="scale" transition-hide="scale" ref="popup">
|
|
20
39
|
<q-time v-model="localValue" format24h>
|
|
21
40
|
<div class="row items-center justify-end">
|
|
@@ -23,7 +42,7 @@ const localValue = computed({
|
|
|
23
42
|
</div>
|
|
24
43
|
</q-time>
|
|
25
44
|
</q-popup-proxy>
|
|
26
|
-
</q-
|
|
45
|
+
</q-btn>
|
|
27
46
|
</template>
|
|
28
47
|
</q-input>
|
|
29
48
|
</template>
|
|
@@ -4,4 +4,4 @@ interface Light {
|
|
|
4
4
|
removeError: (error: String) => void;
|
|
5
5
|
}
|
|
6
6
|
export declare function useLight(): Light;
|
|
7
|
-
export { notify, addObject, f, getApiUrl, getCurrentUser, getObject, id, list, listData, login, m, mutation, q, removeObject, t, updateObject,
|
|
7
|
+
export { notify, addObject, f, getApiUrl, getCurrentUser, getObject, id, list, listData, login, m, mutation, q, removeObject, t, updateObject, getID, deleteObject, listObject } from "./lib";
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import { Dialog } from "quasar";
|
|
1
2
|
import m from "./m.mjs";
|
|
2
3
|
export default async (name, data) => {
|
|
3
|
-
|
|
4
|
-
data
|
|
5
|
-
})
|
|
6
|
-
|
|
4
|
+
try {
|
|
5
|
+
return await m(`add${name}`, { data });
|
|
6
|
+
} catch (e) {
|
|
7
|
+
Dialog.create({
|
|
8
|
+
title: "Error",
|
|
9
|
+
message: e.message
|
|
10
|
+
});
|
|
11
|
+
}
|
|
7
12
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function deleteObject(name: string, id: number): Promise<any>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Dialog } from "quasar";
|
|
2
|
+
import m from "./m.mjs";
|
|
3
|
+
export default async function deleteObject(name, id) {
|
|
4
|
+
try {
|
|
5
|
+
return await m(`delete${name}`, { id });
|
|
6
|
+
} catch (e) {
|
|
7
|
+
Dialog.create({
|
|
8
|
+
title: "Error",
|
|
9
|
+
message: e.message
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useRoute } from "vue-router";
|
|
2
|
+
const route = useRoute();
|
|
3
|
+
export default () => {
|
|
4
|
+
let route2 = useRoute();
|
|
5
|
+
let name = route2.name?.toString();
|
|
6
|
+
if (name == void 0)
|
|
7
|
+
return 0;
|
|
8
|
+
let parts = name.split("-");
|
|
9
|
+
const module = parts[0];
|
|
10
|
+
const moduleLower = module.charAt(0).toLowerCase() + module.slice(1);
|
|
11
|
+
const keyname = parts[1];
|
|
12
|
+
return parseInt(route2.params[keyname]);
|
|
13
|
+
};
|
|
@@ -11,8 +11,10 @@ import m from "./m";
|
|
|
11
11
|
import mutation from "./mutation";
|
|
12
12
|
import q from "./q";
|
|
13
13
|
import removeObject from "./removeObject";
|
|
14
|
+
import deleteObject from "./deleteObject";
|
|
14
15
|
import t from "./t";
|
|
15
16
|
import updateObject from "./updateObject";
|
|
16
|
-
import
|
|
17
|
+
import listObject from "./listObject";
|
|
17
18
|
declare const notify: (message: string, color?: string) => void;
|
|
18
|
-
|
|
19
|
+
import getID from "./getID";
|
|
20
|
+
export { addObject, f, getApiUrl, getCurrentUser, getObject, id, list, listData, login, m, mutation, q, removeObject, t, updateObject, notify, getID, deleteObject, listObject };
|
|
@@ -12,9 +12,10 @@ import m from "./m.mjs";
|
|
|
12
12
|
import mutation from "./mutation.mjs";
|
|
13
13
|
import q from "./q.mjs";
|
|
14
14
|
import removeObject from "./removeObject.mjs";
|
|
15
|
+
import deleteObject from "./deleteObject.mjs";
|
|
15
16
|
import t from "./t.mjs";
|
|
16
17
|
import updateObject from "./updateObject.mjs";
|
|
17
|
-
import
|
|
18
|
+
import listObject from "./listObject.mjs";
|
|
18
19
|
const notify = function(message, color = "green") {
|
|
19
20
|
Notify.create({
|
|
20
21
|
message,
|
|
@@ -22,4 +23,5 @@ const notify = function(message, color = "green") {
|
|
|
22
23
|
position: "top"
|
|
23
24
|
});
|
|
24
25
|
};
|
|
25
|
-
|
|
26
|
+
import getID from "./getID.mjs";
|
|
27
|
+
export { addObject, f, getApiUrl, getCurrentUser, getObject, id, list, listData, login, m, mutation, q, removeObject, t, updateObject, notify, getID, deleteObject, listObject };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function listObject(name: string, filters: {} | undefined, sort: String, offset: number, limit: number, fields?: Array<string>): Promise<any>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import q from "./q.mjs";
|
|
2
|
+
import f from "./f.mjs";
|
|
3
|
+
export default async function listObject(name, filters = {}, sort, offset, limit, fields = []) {
|
|
4
|
+
let offset_limit = {};
|
|
5
|
+
if (offset) {
|
|
6
|
+
offset_limit.offset = offset;
|
|
7
|
+
}
|
|
8
|
+
if (limit) {
|
|
9
|
+
offset_limit.limit = limit;
|
|
10
|
+
}
|
|
11
|
+
let params = {};
|
|
12
|
+
if (sort) {
|
|
13
|
+
params.sort = sort;
|
|
14
|
+
}
|
|
15
|
+
if (filters) {
|
|
16
|
+
params.filters = filters;
|
|
17
|
+
}
|
|
18
|
+
return await q(`list${name}`, params, [f("data", offset_limit, fields), f("meta", ["total", "key", "name"])]);
|
|
19
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: (username: string, password: string) => Promise<boolean>;
|
|
1
|
+
declare const _default: (username: string, password: string, code?: string) => Promise<boolean>;
|
|
2
2
|
export default _default;
|
package/dist/runtime/lib/m.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function (operation:
|
|
1
|
+
export default function (operation: string, args: any, fields?: never[]): Promise<any>;
|
package/dist/runtime/lib/m.mjs
CHANGED
|
@@ -4,7 +4,11 @@ export default async function(operation, args, fields = []) {
|
|
|
4
4
|
const mutation = {
|
|
5
5
|
mutation: {}
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
if (arguments.length == 1) {
|
|
8
|
+
mutation.mutation[operation] = true;
|
|
9
|
+
} else {
|
|
10
|
+
mutation.mutation[operation] = {};
|
|
11
|
+
}
|
|
8
12
|
if (args) {
|
|
9
13
|
mutation.mutation[operation].__args = args;
|
|
10
14
|
}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Dialog } from "quasar";
|
|
2
2
|
import m from "./m.mjs";
|
|
3
|
-
const qua = useQuasar();
|
|
4
3
|
export default async function removeObject(name, id) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
try {
|
|
5
|
+
return await m(`remove${name}`, { id });
|
|
6
|
+
} catch (e) {
|
|
7
|
+
Dialog.create({
|
|
9
8
|
title: "Error",
|
|
10
|
-
message:
|
|
9
|
+
message: e.message
|
|
11
10
|
});
|
|
12
|
-
throw new Error(result.errors[0].message);
|
|
13
11
|
}
|
|
14
|
-
return result;
|
|
15
12
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import m from "./m.mjs";
|
|
2
|
+
import { Dialog } from "quasar";
|
|
2
3
|
export default async (name, id, data) => {
|
|
3
|
-
|
|
4
|
-
id,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
try {
|
|
5
|
+
return await m(`update${name}`, { id, data });
|
|
6
|
+
} catch (e) {
|
|
7
|
+
Dialog.create({
|
|
8
|
+
title: "Error",
|
|
9
|
+
message: e.message
|
|
10
|
+
});
|
|
9
11
|
}
|
|
10
|
-
return resp.data[`update${name}`];
|
|
11
12
|
};
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { listData } from "../../light"
|
|
3
|
-
|
|
4
|
-
const onRequest = async (params) => {
|
|
5
|
-
listData("EventLog", params, ["canRead"]);
|
|
6
|
-
};
|
|
7
|
-
|
|
8
2
|
const columns = [
|
|
9
3
|
{
|
|
10
4
|
label: "EventLog ID",
|
|
@@ -42,16 +36,14 @@ const columns = [
|
|
|
42
36
|
sortable: true,
|
|
43
37
|
searchable: true,
|
|
44
38
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
39
|
]
|
|
49
40
|
|
|
50
41
|
</script>
|
|
51
42
|
|
|
52
43
|
<template>
|
|
53
44
|
<l-page>
|
|
54
|
-
<l-table @request="
|
|
45
|
+
<l-table @request="$event.loadData('EventLog')" :columns="columns" sort-by="eventlog_id:desc"
|
|
46
|
+
:show-actions="['view']">
|
|
55
47
|
|
|
56
48
|
</l-table>
|
|
57
49
|
</l-page>
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { listData } from "../../light"
|
|
3
|
-
const onRequest = async (params) => {
|
|
4
|
-
listData("MailLog", params, ["body"]);
|
|
5
|
-
};
|
|
6
|
-
|
|
7
2
|
const columns = [
|
|
8
3
|
{
|
|
9
4
|
label: "ID",
|
|
@@ -33,7 +28,6 @@ const columns = [
|
|
|
33
28
|
sortable: true,
|
|
34
29
|
searchable: true,
|
|
35
30
|
searchType: "date",
|
|
36
|
-
|
|
37
31
|
}
|
|
38
32
|
]
|
|
39
33
|
|
|
@@ -41,8 +35,8 @@ const columns = [
|
|
|
41
35
|
|
|
42
36
|
<template>
|
|
43
37
|
<l-page>
|
|
44
|
-
<l-table @request="
|
|
45
|
-
|
|
38
|
+
<l-table @request="$event.loadData('MailLog', null, ['body'])" :columns="columns" sort-by="maillog_id:desc">
|
|
39
|
+
|
|
46
40
|
|
|
47
41
|
</l-table>
|
|
48
42
|
</l-page>
|