@mixd-id/web-scaffold 0.1.230406287 → 0.1.230406289
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 +1 -1
- package/src/components/List.vue +7 -6
- package/src/utils/preset-selector.js +44 -10
package/package.json
CHANGED
package/src/components/List.vue
CHANGED
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
</div>
|
|
121
121
|
</slot>
|
|
122
122
|
|
|
123
|
-
<VirtualTable v-if="presetView === 'table'"
|
|
123
|
+
<VirtualTable v-if="presetView === 'table' || pivotEnabled"
|
|
124
124
|
ref="table"
|
|
125
125
|
:columns="columns"
|
|
126
126
|
class="flex-1 rounded-lg panel-400"
|
|
@@ -170,13 +170,13 @@
|
|
|
170
170
|
<div v-if="extBar.open && pivotEnabled"
|
|
171
171
|
:style="extStyle" class="border-t-[1px] border-text-50 flex flex-col relative md:p-5">
|
|
172
172
|
|
|
173
|
-
<div :class="$style.resize2"
|
|
173
|
+
<div :class="$style.resize2" class="group"
|
|
174
174
|
@mousedown="(e) => $util.dragResize(e, resize2)">
|
|
175
175
|
<button type="button" @click.prevent="extBar.open = false"
|
|
176
|
-
:class="$style.extClose">
|
|
176
|
+
:class="$style.extClose" class="group-hover:bg-primary">
|
|
177
177
|
<svg width="14"
|
|
178
178
|
height="14"
|
|
179
|
-
class="fill-text-300 cursor-pointer"
|
|
179
|
+
class="fill-text-300 group-hover:fill-white cursor-pointer"
|
|
180
180
|
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M432.6 209.3l-191.1 183.1C235.1 397.8 229.1 400 224 400s-11.97-2.219-16.59-6.688L15.41 209.3C5.814 200.2 5.502 184.1 14.69 175.4c9.125-9.625 24.38-9.938 33.91-.7187L224 342.8l175.4-168c9.5-9.219 24.78-8.906 33.91 .7187C442.5 184.1 442.2 200.2 432.6 209.3z"/></svg>
|
|
181
181
|
</button>
|
|
182
182
|
</div>
|
|
@@ -922,11 +922,12 @@ export default{
|
|
|
922
922
|
}
|
|
923
923
|
|
|
924
924
|
.resize2{
|
|
925
|
-
@apply h-[
|
|
925
|
+
@apply h-[5px] hover:bg-primary bg-text-50 cursor-n-resize absolute top-0 left-0 right-0 flex items-center justify-center;
|
|
926
|
+
@apply z-20;
|
|
926
927
|
}
|
|
927
928
|
|
|
928
929
|
.extClose{
|
|
929
|
-
@apply w-[21px] h-[21px] rounded-full bg-
|
|
930
|
+
@apply w-[21px] h-[21px] rounded-full bg-text-50 flex items-center justify-center hover:bg-red-600;
|
|
930
931
|
}
|
|
931
932
|
|
|
932
933
|
</style>
|
|
@@ -22,17 +22,39 @@ const getValue = (filter, opt) => {
|
|
|
22
22
|
break
|
|
23
23
|
|
|
24
24
|
case 'number':
|
|
25
|
+
case 'currency':
|
|
25
26
|
switch(operator) {
|
|
26
27
|
case '=':
|
|
27
28
|
withoutKey ? whereObj = { [Op.eq]:filter.value } : whereObj[key] = filter.value
|
|
28
29
|
break
|
|
29
30
|
|
|
30
31
|
case '>':
|
|
32
|
+
withoutKey ?
|
|
33
|
+
whereObj = { [Op.gt]:filter.value } :
|
|
34
|
+
whereObj[key] = {
|
|
35
|
+
[Op[operator]]: filter.value
|
|
36
|
+
}
|
|
37
|
+
break
|
|
38
|
+
|
|
31
39
|
case '>=':
|
|
40
|
+
withoutKey ?
|
|
41
|
+
whereObj = { [Op.gte]:filter.value } :
|
|
42
|
+
whereObj[key] = {
|
|
43
|
+
[Op[operator]]: filter.value
|
|
44
|
+
}
|
|
45
|
+
break
|
|
46
|
+
|
|
32
47
|
case '<':
|
|
48
|
+
withoutKey ?
|
|
49
|
+
whereObj = { [Op.lt]:filter.value } :
|
|
50
|
+
whereObj[key] = {
|
|
51
|
+
[Op[operator]]: filter.value
|
|
52
|
+
}
|
|
53
|
+
break
|
|
54
|
+
|
|
33
55
|
case '<=':
|
|
34
56
|
withoutKey ?
|
|
35
|
-
whereObj = { [Op
|
|
57
|
+
whereObj = { [Op.lte]:filter.value } :
|
|
36
58
|
whereObj[key] = {
|
|
37
59
|
[Op[operator]]: filter.value
|
|
38
60
|
}
|
|
@@ -40,11 +62,11 @@ const getValue = (filter, opt) => {
|
|
|
40
62
|
|
|
41
63
|
case 'in':
|
|
42
64
|
withoutKey ?
|
|
43
|
-
whereObj = { [Op.in]: filter.value.split(',')
|
|
65
|
+
whereObj = { [Op.in]: (!Array.isArray(filter.value) ? filter.value.split(',') : filter.value)
|
|
44
66
|
.map(_ => parseInt(_))
|
|
45
67
|
.filter(_ => !isNaN(_)) } :
|
|
46
68
|
whereObj[key] = {
|
|
47
|
-
[Op.in]: filter.value.split(',')
|
|
69
|
+
[Op.in]: (!Array.isArray(filter.value) ? filter.value.split(',') : filter.value)
|
|
48
70
|
.map(_ => parseInt(_))
|
|
49
71
|
.filter(_ => !isNaN(_))
|
|
50
72
|
}
|
|
@@ -321,13 +343,11 @@ const getValue = (filter, opt) => {
|
|
|
321
343
|
withoutKey ?
|
|
322
344
|
whereObj = {
|
|
323
345
|
[Op.in]: (!Array.isArray(filter.value) ? filter.value.split(',') : filter.value)
|
|
324
|
-
.
|
|
325
|
-
.filter(_ => !isNaN(_))
|
|
346
|
+
.filter(_ => _)
|
|
326
347
|
} :
|
|
327
348
|
whereObj[key] = {
|
|
328
349
|
[Op.in]: (!Array.isArray(filter.value) ? filter.value.split(',') : filter.value)
|
|
329
|
-
.
|
|
330
|
-
.filter(_ => !isNaN(_))
|
|
350
|
+
.filter(_ => _)
|
|
331
351
|
}
|
|
332
352
|
break
|
|
333
353
|
|
|
@@ -358,6 +378,8 @@ const getValue = (filter, opt) => {
|
|
|
358
378
|
break
|
|
359
379
|
}
|
|
360
380
|
|
|
381
|
+
//console.log('getValue', type, util.inspect({ filter, whereObj }, false, null, true /* enable colors */))
|
|
382
|
+
|
|
361
383
|
return whereObj
|
|
362
384
|
}
|
|
363
385
|
|
|
@@ -867,7 +889,7 @@ const filtersToSequelizeInclude = async(filters, opt, includes) => {
|
|
|
867
889
|
}
|
|
868
890
|
}
|
|
869
891
|
}
|
|
870
|
-
//console.log('whereObj', whereObj)
|
|
892
|
+
//console.log('whereObj', util.inspect(whereObj, false, null, true /* enable colors */))
|
|
871
893
|
|
|
872
894
|
// Apply where to includes
|
|
873
895
|
for(let key in whereObj){
|
|
@@ -895,7 +917,8 @@ const filtersToSequelizeInclude = async(filters, opt, includes) => {
|
|
|
895
917
|
include.where[Op.and].push({ [currentKey]: whereObj[key] })
|
|
896
918
|
}
|
|
897
919
|
|
|
898
|
-
//console.log('includes', includes)
|
|
920
|
+
//console.log('includes', util.inspect(includes, false, null, true /* enable colors */))
|
|
921
|
+
|
|
899
922
|
return includes
|
|
900
923
|
}
|
|
901
924
|
|
|
@@ -916,7 +939,13 @@ const syntaxSearchToSequelizeOpt = async(search, opt) => {
|
|
|
916
939
|
}
|
|
917
940
|
|
|
918
941
|
const presetToSequelizeList = async(preset, {
|
|
919
|
-
conn,
|
|
942
|
+
conn,
|
|
943
|
+
model,
|
|
944
|
+
config,
|
|
945
|
+
where:initialWhere,
|
|
946
|
+
replacements: initialReplacements,
|
|
947
|
+
include,
|
|
948
|
+
order:initialOrder
|
|
920
949
|
}) => {
|
|
921
950
|
|
|
922
951
|
if(!initialOrder){
|
|
@@ -965,6 +994,10 @@ const presetToSequelizeList = async(preset, {
|
|
|
965
994
|
}
|
|
966
995
|
}
|
|
967
996
|
|
|
997
|
+
if(include){
|
|
998
|
+
include = await filtersToSequelizeInclude(filters, config, include)
|
|
999
|
+
}
|
|
1000
|
+
|
|
968
1001
|
if(pivot && pivot.enabled){
|
|
969
1002
|
const { attributes, group, order } = await pivotToSequelizeWhere(pivot, {
|
|
970
1003
|
model,
|
|
@@ -1005,6 +1038,7 @@ const presetToSequelizeList = async(preset, {
|
|
|
1005
1038
|
},
|
|
1006
1039
|
limit: itemsPerPage,
|
|
1007
1040
|
order,
|
|
1041
|
+
include,
|
|
1008
1042
|
replacements: [
|
|
1009
1043
|
...(initialReplacements ?? []),
|
|
1010
1044
|
...replacements,
|