@dataloop-ai/components 0.17.128 → 0.17.129

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataloop-ai/components",
3
- "version": "0.17.128",
3
+ "version": "0.17.129",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -57,20 +57,21 @@ export default defineComponent({
57
57
  },
58
58
  watch: {
59
59
  modelValue: {
60
- handler(val) {
60
+ handler(val, oldVal) {
61
61
  this.$nextTick(() => {
62
- if (val) this.applyGridElementStyles()
62
+ if (val) {
63
+ if (val.length !== oldVal?.length) {
64
+ this.applyIndexesForChildren()
65
+ }
66
+ this.applyGridElementStyles()
67
+ }
63
68
  })
64
69
  },
65
70
  immediate: true
66
71
  }
67
72
  },
68
73
  mounted() {
69
- Array.from((this.$refs.grid as HTMLElement).children).forEach(
70
- (element: Element, index: number) => {
71
- (element as HTMLElement).dataset.index = `${index}`
72
- }
73
- )
74
+ this.applyIndexesForChildren()
74
75
  },
75
76
  methods: {
76
77
  applyGridElementStyles() {
@@ -135,6 +136,13 @@ export default defineComponent({
135
136
  },
136
137
  layoutChanged() {
137
138
  this.$emit('layout-changed', this.modelValue)
139
+ },
140
+ applyIndexesForChildren() {
141
+ Array.from((this.$refs.grid as HTMLElement).children).forEach(
142
+ (element: Element, index: number) => {
143
+ (element as HTMLElement).dataset.index = `${index}`
144
+ }
145
+ )
138
146
  }
139
147
  }
140
148
  })