@dataloop-ai/components 0.18.67 → 0.18.68

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.18.67",
3
+ "version": "0.18.68",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -210,7 +210,13 @@
210
210
  </template>
211
211
 
212
212
  <script lang="ts">
213
- import { defineComponent, getCurrentInstance, PropType, ref } from 'vue-demi'
213
+ import {
214
+ computed,
215
+ defineComponent,
216
+ getCurrentInstance,
217
+ PropType,
218
+ ref
219
+ } from 'vue-demi'
214
220
  import DlBrush from '../../components/DlBrush.vue'
215
221
  import { DlTooltip } from '../../../../shared'
216
222
  import {
@@ -231,6 +237,7 @@ import {
231
237
  flattenConfusionMatrix
232
238
  } from './utils'
233
239
  import { debounce, isObject } from 'lodash'
240
+ import { stateManager } from '../../../../../StateManager'
234
241
  export default defineComponent({
235
242
  components: {
236
243
  DlBrush,
@@ -321,10 +328,12 @@ export default defineComponent({
321
328
  return [0, offsetHeight]
322
329
  }
323
330
 
324
- const debouncedCalculateXAxisElOffset = debounce(
325
- calculateXAxisElOffset,
326
- 100
327
- )
331
+ const debouncedCalculateXAxisElOffset = computed(() => {
332
+ if (stateManager.disableDebounce) {
333
+ return calculateXAxisElOffset
334
+ }
335
+ return debounce(calculateXAxisElOffset, 100)
336
+ })
328
337
 
329
338
  return {
330
339
  resizeObserver,
@@ -129,6 +129,7 @@ import { DlToast } from '../../DlToast'
129
129
  import '../styles/themes.css'
130
130
  import '../styles/themes-base16.css'
131
131
  import { debounce } from 'lodash'
132
+ import { stateManager } from '../../../../StateManager'
132
133
 
133
134
  export default defineComponent({
134
135
  name: 'CodeEditor',
@@ -389,7 +390,12 @@ export default defineComponent({
389
390
  lineNum.value = localLineNum
390
391
  }
391
392
 
392
- const debouncedGetLinesCount = debounce(getLinesCount, 100)
393
+ const debouncedGetLinesCount = computed(() => {
394
+ if (stateManager.disableDebounce) {
395
+ return getLinesCount
396
+ }
397
+ return debounce(getLinesCount, 100)
398
+ })
393
399
 
394
400
  onMounted(() => {
395
401
  emit('lang', props.languages[0][0])
@@ -128,7 +128,7 @@
128
128
  </div>
129
129
  </template>
130
130
  <script lang="ts">
131
- import { defineComponent, ref, PropType, nextTick } from 'vue-demi'
131
+ import { defineComponent, ref, PropType, nextTick, computed } from 'vue-demi'
132
132
  import { DlButton } from '../../../../basic'
133
133
  import { DlDatePicker } from '../../../DlDateTime'
134
134
  import { DlMenu, DlIcon } from '../../../../essential'
@@ -147,6 +147,7 @@ import {
147
147
  isEligibleToChange
148
148
  } from '../utils'
149
149
  import { v4 } from 'uuid'
150
+ import { stateManager } from '../../../../../StateManager'
150
151
 
151
152
  export default defineComponent({
152
153
  components: {
@@ -310,10 +311,12 @@ export default defineComponent({
310
311
  emit('update:model-value', stringValue)
311
312
  }
312
313
 
313
- const debouncedSetModal = debounce(
314
- () => (suggestionModal.value = true),
315
- 200
316
- )
314
+ const debouncedSetModal = computed(() => {
315
+ if (stateManager.disableDebounce) {
316
+ return () => (suggestionModal.value = true)
317
+ }
318
+ return debounce(() => (suggestionModal.value = true), 100)
319
+ })
317
320
 
318
321
  return {
319
322
  uuid: v4(),
@@ -104,6 +104,7 @@ import { DlIcon, DlCheckbox } from '../../../essential'
104
104
  import { DlItemSection } from '../../../shared'
105
105
  import { v4 } from 'uuid'
106
106
  import { debounce } from 'lodash'
107
+ import { stateManager } from '../../../../StateManager'
107
108
 
108
109
  const ValueTypes = [Array, Boolean, String, Number, Object, Function]
109
110
 
@@ -168,6 +169,9 @@ export default defineComponent({
168
169
  return this.totalItems ? 'indeterminate' : undefined
169
170
  },
170
171
  handleChildren(): any {
172
+ if (stateManager.disableDebounce) {
173
+ return this.toggleChildren.bind(this)
174
+ }
171
175
  return debounce(this.toggleChildren.bind(this), 50)
172
176
  },
173
177
  hasChildren(): boolean {
@@ -232,12 +232,12 @@ export default defineComponent({
232
232
  },
233
233
  methods: {
234
234
  handleChange(value: number) {
235
+ if (this.sliderValue === value) return
236
+
235
237
  this.$emit('change', value)
238
+ this.sliderValue = value
236
239
  },
237
240
  handleResetButtonClick() {
238
- if (this.value === this.initialValue) return
239
-
240
- this.sliderValue = this.initialValue
241
241
  this.handleChange(this.initialValue)
242
242
  }
243
243
  }
@@ -14,7 +14,8 @@
14
14
 
15
15
  <script lang="ts">
16
16
  import { debounce } from 'lodash'
17
- import { defineComponent, toRef } from 'vue-demi'
17
+ import { computed, defineComponent, ref, toRef } from 'vue-demi'
18
+ import { stateManager } from '../../../../StateManager'
18
19
  import { getInputValue } from '../utils'
19
20
 
20
21
  export default defineComponent({
@@ -48,6 +49,7 @@ export default defineComponent({
48
49
  emits: ['update:model-value', 'change'],
49
50
  setup(props, { emit }) {
50
51
  const modelRef = toRef(props, 'modelValue')
52
+ const sliderInput = ref<HTMLInputElement>(null)
51
53
 
52
54
  const handleChange = (evt: any) => {
53
55
  const val = evt.target.value
@@ -57,11 +59,18 @@ export default defineComponent({
57
59
 
58
60
  emit('change', Number(value))
59
61
  emit('update:model-value', Number(value))
62
+ if (sliderInput.value) sliderInput.value.value = value
60
63
  }
61
64
 
62
- const debouncedHandleChange = debounce(handleChange, 300)
65
+ const debouncedHandleChange = computed(() => {
66
+ if (stateManager.disableDebounce) {
67
+ return handleChange
68
+ }
69
+ return debounce(handleChange, 100)
70
+ })
63
71
 
64
72
  return {
73
+ sliderInput,
65
74
  modelRef,
66
75
  handleChange: debouncedHandleChange
67
76
  }
@@ -178,6 +178,7 @@ export default defineComponent({
178
178
  },
179
179
  watch: {
180
180
  isTrue() {
181
+ // todo: what the hell ?
181
182
  debounce(() => {
182
183
  nextTick(() => {
183
184
  (this.$refs.input as HTMLInputElement).checked =
@@ -45,12 +45,12 @@ export default defineComponent({
45
45
  },
46
46
  watch: {
47
47
  value(newValue, oldValue) {
48
- console.log(`@@@ value changed from ${oldValue} to ${newValue}`)
48
+ console.log(`@@@ model value update ${oldValue} to ${newValue}`)
49
49
  }
50
50
  },
51
51
  methods: {
52
52
  handleChange(value: number) {
53
- console.log(`@@@ value changed to ${value}`)
53
+ console.log(`@@@ handling change ${value}`)
54
54
  }
55
55
  },
56
56
  template: 'dl-slider-demo'