@mixd-id/web-scaffold 0.1.230406282 → 0.1.230406283
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/package.json
CHANGED
package/src/components/List.vue
CHANGED
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
</div>
|
|
70
70
|
|
|
71
71
|
<div class="px-3">
|
|
72
|
-
<button type="button" class="text-primary p-
|
|
72
|
+
<button type="button" class="text-primary p-5 text-left w-full" @click="openPreset">Edit</button>
|
|
73
73
|
</div>
|
|
74
74
|
|
|
75
75
|
</div>
|
|
@@ -285,6 +285,8 @@ export default{
|
|
|
285
285
|
this.preset.columns.push(...columns)
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
+
this.loadEnums()
|
|
289
|
+
|
|
288
290
|
Object.assign(this.data, data ?? {})
|
|
289
291
|
|
|
290
292
|
this.$emit('after-load')
|
|
@@ -345,6 +347,37 @@ export default{
|
|
|
345
347
|
}
|
|
346
348
|
},
|
|
347
349
|
|
|
350
|
+
loadEnums(){
|
|
351
|
+
|
|
352
|
+
for(let i in this.preset.columns){
|
|
353
|
+
const column = this.preset.columns[i]
|
|
354
|
+
|
|
355
|
+
if(column.enumSrc) {
|
|
356
|
+
const [ src, key, attr ] = column.enumSrc.split(':')
|
|
357
|
+
this.socket.send(src, {
|
|
358
|
+
columns: [
|
|
359
|
+
{ key:attr, visible:true }
|
|
360
|
+
],
|
|
361
|
+
filters: [
|
|
362
|
+
{
|
|
363
|
+
key:key, value: [ { operator:'in', value:[ 1 ] } ]
|
|
364
|
+
}
|
|
365
|
+
]
|
|
366
|
+
})
|
|
367
|
+
.then(res => {
|
|
368
|
+
this.preset.columns[i].typeParams = (res.items ?? []).map(_ => {
|
|
369
|
+
return {
|
|
370
|
+
text: _[attr] ?? _[key],
|
|
371
|
+
value: _[key]
|
|
372
|
+
}
|
|
373
|
+
})
|
|
374
|
+
})
|
|
375
|
+
.catch(err => this.log('Load enums error', err))
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
},
|
|
380
|
+
|
|
348
381
|
resize1(w){
|
|
349
382
|
if(this.config.sidebar.width + w >= 270 && this.config.sidebar.width + w <= 600){
|
|
350
383
|
this.config.sidebar.width += w
|
|
@@ -397,7 +397,7 @@ export default{
|
|
|
397
397
|
break
|
|
398
398
|
|
|
399
399
|
case 'enum':
|
|
400
|
-
const enumObj = column.typeParams.filter((_) => _.value === value).pop()
|
|
400
|
+
const enumObj = (column.typeParams ?? []).filter((_) => _.value === value).pop()
|
|
401
401
|
text = enumObj ? enumObj.text : value
|
|
402
402
|
break
|
|
403
403
|
}
|
|
@@ -898,7 +898,7 @@ const syntaxSearchToSequelizeOpt = async(search, opt) => {
|
|
|
898
898
|
}
|
|
899
899
|
|
|
900
900
|
const presetToSequelizeList = async(preset, {
|
|
901
|
-
conn, model, order:initialOrder, config, where:initialWhere
|
|
901
|
+
conn, model, order:initialOrder, config, where:initialWhere, replacements: initialReplacements
|
|
902
902
|
}) => {
|
|
903
903
|
|
|
904
904
|
if(!initialOrder){
|
|
@@ -986,6 +986,7 @@ const presetToSequelizeList = async(preset, {
|
|
|
986
986
|
limit: itemsPerPage,
|
|
987
987
|
order,
|
|
988
988
|
replacements: [
|
|
989
|
+
...(initialReplacements ?? []),
|
|
989
990
|
...replacements,
|
|
990
991
|
...filterReplacements,
|
|
991
992
|
...searchReplacements
|
|
@@ -460,19 +460,20 @@
|
|
|
460
460
|
</div>
|
|
461
461
|
<ListItem :items="presetPivot.rows"
|
|
462
462
|
@reorder="(from, to) => { presetPivot.rows.splice(to, 0, presetPivot.rows.splice(from, 1)[0]); apply() }"
|
|
463
|
-
class="mt-2 h-[
|
|
463
|
+
class="mt-2 h-[25vh] overflow-y-auto border-[1px] border-text-200 bg-base-400 rounded-lg p-0.5"
|
|
464
|
+
container-class="divide-y divide-text-50">
|
|
464
465
|
<template v-slot="{ item, index }">
|
|
465
466
|
<div class="flex flex-row items-center gap-3 p-2 bg-base-500 hover:bg-primary-100 first:rounded-t-md last:rounded-b-md">
|
|
466
467
|
<div data-reorder v-if="(presetPivot.rows ?? []).length > 1">
|
|
467
468
|
<svg width="14" height="14" class="fill-text-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M496 288H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-128H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16z"/></svg>
|
|
468
469
|
</div>
|
|
469
470
|
<div class="flex-1 flex flex-row gap-3">
|
|
470
|
-
<strong class="flex-1">
|
|
471
|
+
<strong class="flex-1 cursor-pointer" @click="$refs.columnSelector.open(obj => Object.assign(item, obj))">
|
|
471
472
|
{{ item.label ? item.label : item.key }}
|
|
472
473
|
</strong>
|
|
473
474
|
<select v-if="item.type === 'date'"
|
|
474
475
|
v-model="item.aggregrate"
|
|
475
|
-
class="appearance-none bg-
|
|
476
|
+
class="px-1 appearance-none bg-base-300 rounded-md border-[1px] border-text-50 outline-none"
|
|
476
477
|
@change="apply()">
|
|
477
478
|
<option value="date">Date</option>
|
|
478
479
|
<option value="month">Month</option>
|
|
@@ -496,7 +497,7 @@
|
|
|
496
497
|
</div>
|
|
497
498
|
<ListItem :items="presetPivot.values"
|
|
498
499
|
@reorder="(from, to) => { presetPivot.values.splice(to, 0, presetPivot.values.splice(from, 1)[0]); }"
|
|
499
|
-
class="mt-2 h-[
|
|
500
|
+
class="mt-2 h-[25vh] overflow-y-auto border-[1px] border-text-200 bg-base-400 rounded-lg p-0.5">
|
|
500
501
|
<template v-slot="{ item, index }">
|
|
501
502
|
<div class="flex flex-row items-center gap-3 p-2 bg-base-500 hover:bg-primary-100 first:rounded-t-md last:rounded-b-md">
|
|
502
503
|
<div data-reorder v-if="(presetPivot.values ?? []).length > 1">
|
|
@@ -507,7 +508,8 @@
|
|
|
507
508
|
{{ item.label ? item.label : item.key }}
|
|
508
509
|
</strong>
|
|
509
510
|
<select v-model="item.aggregrate"
|
|
510
|
-
class="appearance-none bg-
|
|
511
|
+
class="px-1 appearance-none bg-base-300 rounded-md border-[1px] border-text-50 outline-none"
|
|
512
|
+
@change="apply()">
|
|
511
513
|
<option value="">Default</option>
|
|
512
514
|
<option value="count">Count</option>
|
|
513
515
|
<option v-if="[ 'number' ].includes(item.type)" value="sum">Sum</option>
|