@dataloop-ai/components 0.20.48 → 0.20.50

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.20.48",
3
+ "version": "0.20.50",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -7,12 +7,18 @@
7
7
  :data-resizable="resizable"
8
8
  :data-collapsable="collapsable"
9
9
  :data-direction="direction"
10
+ @mouseenter="handleMouseEnter"
11
+ @mouseleave="handleMouseLeave"
10
12
  >
11
13
  <div ref="panel" class="inner-container" style="height: 100%">
12
14
  <div v-if="collapsed" class="inner-container-overlay" />
13
15
  <div v-if="collapsable === true">
14
16
  <div
15
- v-if="direction === 'right' && isFullWidth === true"
17
+ v-if="
18
+ direction === 'right' &&
19
+ isFullWidth === true &&
20
+ hideCollapseButton === false
21
+ "
16
22
  class="collapse-icon collapse-icon--right"
17
23
  @click="handleCollapseButtonClick"
18
24
  >
@@ -36,7 +42,11 @@
36
42
  />
37
43
  </div>
38
44
  <div
39
- v-else-if="direction === 'left' && isFullWidth === true"
45
+ v-else-if="
46
+ direction === 'left' &&
47
+ isFullWidth === true &&
48
+ hideCollapseButton === false
49
+ "
40
50
  class="collapse-icon collapse-icon--left"
41
51
  @click="handleCollapseButtonClick"
42
52
  >
@@ -140,6 +150,11 @@ export default defineComponent({
140
150
  default: 36,
141
151
  validator: (val: number) => val >= 0
142
152
  },
153
+ maxStretchableWidth: {
154
+ type: Number,
155
+ default: 360,
156
+ validator: (val: number) => val >= 0
157
+ },
143
158
  direction: {
144
159
  type: String,
145
160
  default: 'right',
@@ -168,7 +183,7 @@ export default defineComponent({
168
183
  default: null
169
184
  }
170
185
  },
171
- emits: ['update:model-value'],
186
+ emits: ['update:model-value', 'panel-width'],
172
187
  data() {
173
188
  return {
174
189
  uuid: `dl-panel-container-${v4()}`,
@@ -176,7 +191,8 @@ export default defineComponent({
176
191
  left: 0,
177
192
  isFullWidth: true,
178
193
  avoidUserSelect: false,
179
- collapsed: false
194
+ collapsed: false,
195
+ hideCollapseButton: false
180
196
  }
181
197
  },
182
198
  computed: {
@@ -283,6 +299,12 @@ export default defineComponent({
283
299
  }
284
300
  },
285
301
  methods: {
302
+ handleMouseEnter() {
303
+ this.hideCollapseButton = false
304
+ },
305
+ handleMouseLeave() {
306
+ this.hideCollapseButton = true
307
+ },
286
308
  reset() {
287
309
  const element = this.$refs['panel'] as HTMLDivElement
288
310
  element.style.width = this.w + 'px'
@@ -328,8 +350,8 @@ export default defineComponent({
328
350
  this.collapsed = false
329
351
  }
330
352
  } else {
331
- if (e.pageX > this.left + this.w) {
332
- element.style.width = this.w + 'px'
353
+ if (e.pageX > this.left + this.maxStretchableWidth) {
354
+ element.style.width = this.maxStretchableWidth + 'px'
333
355
 
334
356
  this.collapsed = false
335
357
  } else if (e.pageX < this.left + this.minW) {
@@ -342,6 +364,7 @@ export default defineComponent({
342
364
  this.collapsed = false
343
365
  }
344
366
  }
367
+ this.$emit('panel-width', parseInt(element.style.width))
345
368
  },
346
369
  mouseup(e: MouseEvent) {
347
370
  if (this.direction === 'right') {
@@ -387,7 +410,6 @@ export default defineComponent({
387
410
  if (this.isFullWidth === false) {
388
411
  element.style.width = this.w + 'px'
389
412
  element.style.right = this.w + 'px'
390
-
391
413
  this.isFullWidth = true
392
414
  this.collapsed = false
393
415
  } else {
@@ -397,6 +419,7 @@ export default defineComponent({
397
419
  this.isFullWidth = false
398
420
  this.collapsed = true
399
421
  }
422
+ this.$emit('panel-width', parseInt(element.style.width))
400
423
  }
401
424
  }
402
425
  },