@mixd-id/web-scaffold 0.1.240411091 → 0.1.240411092

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mixd-id/web-scaffold",
3
3
  "private": false,
4
- "version": "0.1.240411091",
4
+ "version": "0.1.240411092",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -87,7 +87,7 @@
87
87
 
88
88
  <div v-else class="flex flex-row gap-2">
89
89
  <Dropdown v-model="value.operator"
90
- :class="![ 'notEmpty' ].includes(value.operator) ? 'w-[100px]' : 'w-full'"
90
+ :class="![ 'notEmpty', 'empty' ].includes(value.operator) ? 'w-[100px]' : 'w-full'"
91
91
  :readonly="readonly"
92
92
  @change="apply">
93
93
  <option value="eq">Equal</option>
@@ -100,8 +100,9 @@
100
100
  <option value="notIn">Except with comma</option>
101
101
  <option value="regex">Regex</option>
102
102
  <option value="notEmpty">Not Empty</option>
103
+ <option value="empty">Empty</option>
103
104
  </Dropdown>
104
- <Textbox v-if="![ 'notEmpty' ].includes(value.operator)"
105
+ <Textbox v-if="![ 'notEmpty', 'empty' ].includes(value.operator)"
105
106
  v-model="value.value"
106
107
  :readonly="readonly"
107
108
  class="flex-1"
@@ -88,7 +88,7 @@
88
88
  </thead>
89
89
  <tbody>
90
90
  <tr v-for="(item, index) in visibleItems"
91
- :key="item"
91
+ :key="item.id ?? (visibleStartIndex + index)"
92
92
  @dragover="(e) => $emit('dragover', e, item)"
93
93
  @mouseover="hover(item, index)" @mouseout="hoverIndex = -1"
94
94
  @click="select(item, index)"
@@ -131,7 +131,7 @@
131
131
  </thead>
132
132
  <tbody ref="tbody">
133
133
  <tr v-for="(item, index) in visibleItems"
134
- :key="item"
134
+ :key="item.id ?? (visibleStartIndex + index)"
135
135
  @dragover="(e) => $emit('dragover', e, item)"
136
136
  @mouseover="hover(item, index)" @mouseout="hoverIndex = -1"
137
137
  @click="select(item, index)"
@@ -511,6 +511,11 @@ export default{
511
511
  }
512
512
 
513
513
  this.scrolled = this.scrollTop > 0
514
+
515
+ this.scrollerCache = {
516
+ id: (this.cItems ?? [])[this.visibleStartIndex]?.id,
517
+ index: this.visibleStartIndex
518
+ }
514
519
  }, 16),
515
520
 
516
521
  passiveScrollSupported() {
@@ -817,15 +822,19 @@ export default{
817
822
  }
818
823
  },
819
824
 
820
- scrollerStyle(to){
821
- if(this.scrolled && this.scrollerCache?.id){
822
- const index = this.items.findIndex(_ => _.id === this.scrollerCache.id)
823
- const addToScroll = (index - this.scrollerCache.index) * this.itemHeight
824
- this.scrollTop = this.$refs.cont.scrollTop = this.scrollTop + addToScroll
825
+ scrollerStyle(){
826
+ if(this.scrollerCache?.id && this.itemHeight > 0 && this.$refs.cont){
827
+ const index = (this.cItems ?? []).findIndex(_ => _.id === this.scrollerCache.id)
828
+ if(index >= 0){
829
+ const addToScroll = (index - this.scrollerCache.index) * this.itemHeight
830
+ if(addToScroll !== 0){
831
+ this.scrollTop = this.$refs.cont.scrollTop = this.scrollTop + addToScroll
832
+ }
833
+ }
825
834
  }
826
835
 
827
836
  this.scrollerCache = {
828
- id: (this.items ?? [])[this.visibleStartIndex]?.id,
837
+ id: (this.cItems ?? [])[this.visibleStartIndex]?.id,
829
838
  index: this.visibleStartIndex
830
839
  }
831
840
  },
@@ -729,6 +729,17 @@ const filtersToSequelizeWhere = async(filters, opt) => {
729
729
  }
730
730
  }
731
731
  break
732
+
733
+ case 'empty':
734
+ whereObj = {
735
+ [key]:{
736
+ [Op.or]: [
737
+ { [Op.eq]: null },
738
+ { [Op.eq]: '' }
739
+ ]
740
+ }
741
+ }
742
+ break
732
743
  }
733
744
  break
734
745
  }
@@ -318,6 +318,17 @@ const getValue = (filter, opt) => {
318
318
  }
319
319
  break
320
320
 
321
+ case 'empty':
322
+ whereObj = {
323
+ [key]:{
324
+ [Op.or]: [
325
+ { [Op.eq]: null },
326
+ { [Op.eq]: '' }
327
+ ]
328
+ }
329
+ }
330
+ break
331
+
321
332
  case 'in':
322
333
  withoutKey ?
323
334
  whereObj = {
@@ -698,6 +709,17 @@ const filtersToSequelizeWhere = async(filters, opt) => {
698
709
  }
699
710
  break
700
711
 
712
+ case 'empty':
713
+ whereObj = {
714
+ [key]:{
715
+ [Op.or]: [
716
+ { [Op.eq]: null },
717
+ { [Op.eq]: '' }
718
+ ]
719
+ }
720
+ }
721
+ break
722
+
701
723
  case 'in':
702
724
  whereObj = {
703
725
  [key]:{
@@ -318,6 +318,17 @@ const getValue = (filter, opt) => {
318
318
  }
319
319
  break
320
320
 
321
+ case 'empty':
322
+ whereObj = {
323
+ [key]:{
324
+ [Op.or]: [
325
+ { [Op.eq]: null },
326
+ { [Op.eq]: '' }
327
+ ]
328
+ }
329
+ }
330
+ break
331
+
321
332
  case 'in':
322
333
  withoutKey ?
323
334
  whereObj = {
@@ -698,6 +709,17 @@ const filtersToSequelizeWhere = async(filters, opt) => {
698
709
  }
699
710
  break
700
711
 
712
+ case 'empty':
713
+ whereObj = {
714
+ [key]:{
715
+ [Op.or]: [
716
+ { [Op.eq]: null },
717
+ { [Op.eq]: '' }
718
+ ]
719
+ }
720
+ }
721
+ break
722
+
701
723
  case 'in':
702
724
  whereObj = {
703
725
  [key]:{