@dataloop-ai/components 0.17.127 → 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.127",
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
  })
@@ -2,7 +2,9 @@
2
2
  <div
3
3
  :id="uuid"
4
4
  class="dl-switch-wrapper"
5
- :style="`height: ${size}px; margin: ${margin}`"
5
+ :style="`height: ${size}px; margin: ${margin}; ${
6
+ fluid ? 'justify-content: space-between;' : ''
7
+ }`"
6
8
  >
7
9
  <label
8
10
  v-if="!!leftLabel"
@@ -102,7 +104,8 @@ export default defineComponent({
102
104
  value: { type: Any, default: null },
103
105
  falseValue: { type: Any, default: false },
104
106
  trueValue: { type: Any, default: true },
105
- tabindex: { type: String, default: '0' }
107
+ tabindex: { type: String, default: '0' },
108
+ fluid: { type: Boolean, default: false }
106
109
  },
107
110
  emits: ['update:model-value', 'toggle', 'click', 'change'],
108
111
  data() {
@@ -9,6 +9,18 @@
9
9
  />
10
10
  Switch with value not updating
11
11
  <dl-switch v-model="switchValue" />
12
+ Switch with left-label
13
+ <dl-switch
14
+ v-model="switchValue"
15
+ left-label="Left label"
16
+ />
17
+ <div style="width: 500px">
18
+ <dl-switch
19
+ v-model="switchValue"
20
+ left-label="Left label"
21
+ fluid
22
+ />
23
+ </div>
12
24
  </div>
13
25
  </template>
14
26