@mixd-id/web-scaffold 0.1.240411027 → 0.1.240411028
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
|
@@ -88,7 +88,8 @@
|
|
|
88
88
|
</div>
|
|
89
89
|
|
|
90
90
|
<div v-else class="flex flex-row gap-2">
|
|
91
|
-
<Dropdown v-model="value.operator"
|
|
91
|
+
<Dropdown v-model="value.operator"
|
|
92
|
+
:class="![ 'notEmpty' ].includes(value.operator) ? 'w-[100px]' : 'w-full'"
|
|
92
93
|
:readonly="readonly"
|
|
93
94
|
@change="apply">
|
|
94
95
|
<option value="eq">Equal</option>
|
|
@@ -100,8 +101,10 @@
|
|
|
100
101
|
<option value="in">Multiple with comma</option>
|
|
101
102
|
<option value="notIn">Except with comma</option>
|
|
102
103
|
<option value="regex">Regex</option>
|
|
104
|
+
<option value="notEmpty">Not Empty</option>
|
|
103
105
|
</Dropdown>
|
|
104
|
-
<Textbox v-
|
|
106
|
+
<Textbox v-if="![ 'notEmpty' ].includes(value.operator)"
|
|
107
|
+
v-model="value.value"
|
|
105
108
|
:readonly="readonly"
|
|
106
109
|
class="flex-1"
|
|
107
110
|
@keyup.enter="apply"
|
package/src/utils/helpers.mjs
CHANGED
|
@@ -560,34 +560,37 @@ const arrayRemove = (arr, items, opt = {}) => {
|
|
|
560
560
|
}
|
|
561
561
|
}
|
|
562
562
|
|
|
563
|
-
const arrayUnshift = (arr,
|
|
563
|
+
const arrayUnshift = (arr, items, opt = { update:true }) => {
|
|
564
564
|
if(!Array.isArray(arr)) return
|
|
565
|
+
if(!Array.isArray(items)) items = [ items ]
|
|
565
566
|
if(!opt.key){
|
|
566
|
-
opt.key =
|
|
567
|
+
opt.key = items[0] && items[0].uid ? 'uid' : 'id'
|
|
567
568
|
}
|
|
568
569
|
|
|
569
|
-
opt
|
|
570
|
+
if(!Array.isArray(opt.key)){
|
|
571
|
+
opt.key = [ opt.key ]
|
|
572
|
+
}
|
|
570
573
|
|
|
571
|
-
|
|
572
|
-
|
|
574
|
+
for(let item of items){
|
|
575
|
+
if(!item) continue
|
|
573
576
|
|
|
574
|
-
const
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
577
|
+
const index = arr.findIndex((_) => {
|
|
578
|
+
for(let key of opt.key){
|
|
579
|
+
if(_[key] !== item[key]){
|
|
580
|
+
return false
|
|
581
|
+
}
|
|
578
582
|
}
|
|
579
|
-
|
|
583
|
+
return true
|
|
584
|
+
})
|
|
580
585
|
|
|
581
|
-
if(
|
|
582
|
-
|
|
586
|
+
if(index >= 0){
|
|
587
|
+
if(opt.update !== false){
|
|
588
|
+
Object.assign(arr[index], item)
|
|
589
|
+
}
|
|
583
590
|
}
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
else{
|
|
587
|
-
if(opt.highlight){
|
|
588
|
-
item._highlight = true
|
|
591
|
+
else{
|
|
592
|
+
arr.unshift(item)
|
|
589
593
|
}
|
|
590
|
-
arr.unshift(item)
|
|
591
594
|
}
|
|
592
595
|
}
|
|
593
596
|
|
|
@@ -307,6 +307,17 @@ const getValue = (filter, opt) => {
|
|
|
307
307
|
}
|
|
308
308
|
break
|
|
309
309
|
|
|
310
|
+
case 'notEmpty':
|
|
311
|
+
whereObj = {
|
|
312
|
+
[key]:{
|
|
313
|
+
[Op.or]: [
|
|
314
|
+
{ [Op.ne]: null },
|
|
315
|
+
{ [Op.ne]: '' }
|
|
316
|
+
]
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
break
|
|
320
|
+
|
|
310
321
|
case 'in':
|
|
311
322
|
withoutKey ?
|
|
312
323
|
whereObj = {
|
|
@@ -676,6 +687,17 @@ const filtersToSequelizeWhere = async(filters, opt) => {
|
|
|
676
687
|
}
|
|
677
688
|
break
|
|
678
689
|
|
|
690
|
+
case 'notEmpty':
|
|
691
|
+
whereObj = {
|
|
692
|
+
[key]:{
|
|
693
|
+
[Op.or]: [
|
|
694
|
+
{ [Op.ne]: null },
|
|
695
|
+
{ [Op.ne]: '' }
|
|
696
|
+
]
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
break
|
|
700
|
+
|
|
679
701
|
case 'in':
|
|
680
702
|
whereObj = {
|
|
681
703
|
[key]:{
|
|
@@ -307,6 +307,17 @@ const getValue = (filter, opt) => {
|
|
|
307
307
|
}
|
|
308
308
|
break
|
|
309
309
|
|
|
310
|
+
case 'notEmpty':
|
|
311
|
+
whereObj = {
|
|
312
|
+
[key]:{
|
|
313
|
+
[Op.or]: [
|
|
314
|
+
{ [Op.ne]: null },
|
|
315
|
+
{ [Op.ne]: '' }
|
|
316
|
+
]
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
break
|
|
320
|
+
|
|
310
321
|
case 'in':
|
|
311
322
|
withoutKey ?
|
|
312
323
|
whereObj = {
|
|
@@ -676,6 +687,17 @@ const filtersToSequelizeWhere = async(filters, opt) => {
|
|
|
676
687
|
}
|
|
677
688
|
break
|
|
678
689
|
|
|
690
|
+
case 'notEmpty':
|
|
691
|
+
whereObj = {
|
|
692
|
+
[key]:{
|
|
693
|
+
[Op.or]: [
|
|
694
|
+
{ [Op.ne]: null },
|
|
695
|
+
{ [Op.ne]: '' }
|
|
696
|
+
]
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
break
|
|
700
|
+
|
|
679
701
|
case 'in':
|
|
680
702
|
whereObj = {
|
|
681
703
|
[key]:{
|