@hostlink/nuxt-light 1.20.3 → 1.20.5
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 +2 -1
- package/dist/runtime/components/l-date-picker.vue +7 -1
- package/dist/runtime/components/l-table-old.vue +718 -0
- package/dist/runtime/components/l-table.vue +37 -57
- package/dist/runtime/components/l-table2.vue +733 -29
- package/dist/runtime/index.d.ts +2 -1
- package/dist/runtime/index.js +4 -1
- package/dist/runtime/lib/getID.js +1 -1
- package/dist/runtime/lib/index.d.ts +1 -0
- package/dist/runtime/lib/index.js +1 -0
- package/dist/runtime/light.d.ts +8 -8
- package/dist/runtime/pages/MailLog/index.vue +2 -4
- package/dist/runtime/plugin.js +4 -1
- package/package.json +2 -2
- package/dist/runtime/lib/collect.d.ts +0 -2
- package/dist/runtime/lib/collect.js +0 -2
|
@@ -4,6 +4,7 @@ import { useQuasar, QTable, type QTableColumn, type QTableProps, Dialog, QTab }
|
|
|
4
4
|
import { ref, computed, onMounted, useSlots, useAttrs, watch, defineComponent, h } from "vue";
|
|
5
5
|
import { t, q, useLight, GQLFieldBuilder, model } from '../';
|
|
6
6
|
import { toQuery } from '@hostlink/light';
|
|
7
|
+
import { collect } from "#imports"
|
|
7
8
|
|
|
8
9
|
const $q = useQuasar();
|
|
9
10
|
|
|
@@ -206,57 +207,6 @@ const validateData = () => {
|
|
|
206
207
|
|
|
207
208
|
}
|
|
208
209
|
|
|
209
|
-
const getData = async (
|
|
210
|
-
operation: string,
|
|
211
|
-
filters = {},
|
|
212
|
-
sort: String,
|
|
213
|
-
offset: number,
|
|
214
|
-
limit: number,
|
|
215
|
-
fields: Array<string> = []) => {
|
|
216
|
-
|
|
217
|
-
const query: any = {};
|
|
218
|
-
query[operation] = {
|
|
219
|
-
meta: {
|
|
220
|
-
total: true,
|
|
221
|
-
key: true,
|
|
222
|
-
name: true
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
let offset_limit: any = {}
|
|
227
|
-
if (offset) {
|
|
228
|
-
offset_limit.offset = offset;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
if (limit) {
|
|
232
|
-
offset_limit.limit = limit;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
if (offset_limit) {
|
|
236
|
-
query[operation].data = {
|
|
237
|
-
__args: offset_limit
|
|
238
|
-
};
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
let params: any = {}
|
|
242
|
-
if (sort) {
|
|
243
|
-
params.sort = sort;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
if (filters) {
|
|
247
|
-
params.filters = filters
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
query[operation].__args = params;
|
|
251
|
-
|
|
252
|
-
query[operation].data = query[operation].data || {};
|
|
253
|
-
Object.assign(query[operation].data, fields);
|
|
254
|
-
|
|
255
|
-
const resp = await q(query);
|
|
256
|
-
return resp[operation];
|
|
257
|
-
|
|
258
|
-
}
|
|
259
|
-
|
|
260
210
|
const onLocalRequest = async (p: any) => {
|
|
261
211
|
if (!isServerSide) return;
|
|
262
212
|
|
|
@@ -338,9 +288,9 @@ const onLocalRequest = async (p: any) => {
|
|
|
338
288
|
validateData();
|
|
339
289
|
},
|
|
340
290
|
loadObjects(model: string, filters: any = null, fields: Array<any> = []) {
|
|
341
|
-
return this.loadData(
|
|
291
|
+
return this.loadData(model, filters, fields);
|
|
342
292
|
},
|
|
343
|
-
async loadData(
|
|
293
|
+
async loadData(model: string, filters: any = null, fields: Array<any> = []) {
|
|
344
294
|
fields.forEach((f) => {
|
|
345
295
|
builder.add(f);
|
|
346
296
|
})
|
|
@@ -353,8 +303,41 @@ const onLocalRequest = async (p: any) => {
|
|
|
353
303
|
}
|
|
354
304
|
}
|
|
355
305
|
loading.value = true;
|
|
306
|
+
|
|
356
307
|
try {
|
|
357
|
-
|
|
308
|
+
let c = collect(model, builder.get())
|
|
309
|
+
|
|
310
|
+
if (localFilters) {
|
|
311
|
+
for (let [key, value] of Object.entries(localFilters)) {
|
|
312
|
+
if (typeof value == "object") {
|
|
313
|
+
if (value.contains) {
|
|
314
|
+
c = c.whereContains(key, value.contains);
|
|
315
|
+
}
|
|
316
|
+
if (value.between) {
|
|
317
|
+
c = c.whereBetween(key, value.between);
|
|
318
|
+
}
|
|
319
|
+
} else {
|
|
320
|
+
c = c.where(key, value);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
if (sort) {
|
|
326
|
+
if (sort.split(":")[1] == "asc") {
|
|
327
|
+
c = c.sortBy(sort.split(":")[0]);
|
|
328
|
+
} else {
|
|
329
|
+
c = c.sortByDesc(sort.split(":")[0]);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
c = c.forPage(p.pagination.page, p.pagination.rowsPerPage);
|
|
334
|
+
|
|
335
|
+
const data = await c.all();
|
|
336
|
+
const allData = {
|
|
337
|
+
data,
|
|
338
|
+
meta: c.meta
|
|
339
|
+
}
|
|
340
|
+
|
|
358
341
|
this.setData(allData);
|
|
359
342
|
} catch (e: any) {
|
|
360
343
|
quasar.dialog({
|
|
@@ -363,9 +346,6 @@ const onLocalRequest = async (p: any) => {
|
|
|
363
346
|
})
|
|
364
347
|
this.setData({ data: [], meta: { total: 0, key: "", name: "" } });
|
|
365
348
|
}
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
349
|
}
|
|
370
350
|
}
|
|
371
351
|
|