@dataloop-ai/components 0.20.180 → 0.20.181

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.180",
3
+ "version": "0.20.181",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -239,6 +239,7 @@
239
239
  :children="getOptionChildren(item)"
240
240
  :capitalized="capitalizedOptions"
241
241
  :readonly="isReadonlyOption(item)"
242
+ :disable-row="isDisableRowOption(item)"
242
243
  :indentation="indentation"
243
244
  :is-expanded="item.expanded"
244
245
  :tooltip="getOptionTooltip(item)"
@@ -291,6 +292,7 @@
291
292
  :children="getOptionChildren(option)"
292
293
  :capitalized="capitalizedOptions"
293
294
  :readonly="isReadonlyOption(option)"
295
+ :disable-row="isDisableRowOption(option)"
294
296
  :indentation="indentation"
295
297
  :is-expanded="isExpandedOption(option)"
296
298
  :tooltip="getOptionTooltip(option)"
@@ -1045,6 +1047,9 @@ export default defineComponent({
1045
1047
  isReadonlyOption(option: any) {
1046
1048
  return !!option?.readonly
1047
1049
  },
1050
+ isDisableRowOption(option: DlSelectOptionType) {
1051
+ return typeof option === 'object' && option !== null && !!option.disableRow
1052
+ },
1048
1053
  getOptionCount(option: any) {
1049
1054
  return option?.count ?? null
1050
1055
  },
@@ -17,9 +17,12 @@
17
17
  <dl-list-item
18
18
  v-else
19
19
  class="option"
20
- :class="{ highlighted: highlightSelected && isSelected }"
20
+ :class="{
21
+ highlighted: highlightSelected && isSelected,
22
+ 'disabled-row': disableRow
23
+ }"
21
24
  :with-wave="withWave"
22
- clickable
25
+ :clickable="!disableRow"
23
26
  :style="`width: ${computedWidth}`"
24
27
  @click="handleClick"
25
28
  >
@@ -44,6 +47,7 @@
44
47
  :model-value="modelValue"
45
48
  :value="value"
46
49
  :indeterminate-value="indeterminateValue"
50
+ :disabled="disableRow"
47
51
  @update:model-value="handleCheckboxUpdate"
48
52
  @checked="handleSingleSelect"
49
53
  @unchecked="handleSingleDeselect"
@@ -95,6 +99,7 @@
95
99
  :with-wave="withWave"
96
100
  :capitalized="capitalized"
97
101
  :readonly="isReadonlyOption(child)"
102
+ :disable-row="isDisableRowOption(child)"
98
103
  :indentation="indentation"
99
104
  :is-expanded="isExpanded"
100
105
  :filter-term="filterTerm"
@@ -138,7 +143,6 @@ import { debounce } from 'lodash'
138
143
  import { stateManager } from '../../../../StateManager'
139
144
  import { getCaseInsensitiveInput, getLabel } from '../utils'
140
145
  import {
141
- DlSelectedValueType,
142
146
  DlSelectOption,
143
147
  DlSelectOptionType
144
148
  } from '../../types'
@@ -166,7 +170,7 @@ export default defineComponent({
166
170
  multiselect: { type: Boolean, default: false },
167
171
  value: { type: ValueTypes, default: null },
168
172
  children: {
169
- type: Array as PropType<DlSelectedValueType[]>,
173
+ type: Array as PropType<DlSelectOptionType[]>,
170
174
  default: null
171
175
  },
172
176
  highlightSelected: { type: Boolean, default: false },
@@ -180,6 +184,7 @@ export default defineComponent({
180
184
  label: { type: String, default: null },
181
185
  capitalized: { type: Boolean, default: false },
182
186
  readonly: { type: Boolean, default: false },
187
+ disableRow: { type: Boolean, default: false },
183
188
  indentation: { type: Number, default: 30 },
184
189
  isExpanded: {
185
190
  type: Boolean,
@@ -351,6 +356,11 @@ export default defineComponent({
351
356
  }
352
357
  },
353
358
  handleClick(e: Event) {
359
+ if (this.disableRow) {
360
+ e.stopPropagation()
361
+ e.preventDefault()
362
+ return
363
+ }
354
364
  e.stopPropagation()
355
365
  e.preventDefault()
356
366
  if (this.multiselect) {
@@ -394,6 +404,9 @@ export default defineComponent({
394
404
  },
395
405
  isReadonlyOption(option: any) {
396
406
  return !!option?.readonly
407
+ },
408
+ isDisableRowOption(option: DlSelectOptionType) {
409
+ return typeof option === 'object' && option !== null && !!option.disableRow
397
410
  }
398
411
  }
399
412
  })
@@ -456,4 +469,10 @@ export default defineComponent({
456
469
  line-height: 16px;
457
470
  color: var(--dl-color-lighter);
458
471
  }
472
+
473
+ .disabled-row {
474
+ opacity: 0.6;
475
+ cursor: not-allowed;
476
+ pointer-events: none;
477
+ }
459
478
  </style>
@@ -5,6 +5,7 @@ export interface DlSelectOption {
5
5
  expanded?: boolean
6
6
  children?: DlSelectOption[]
7
7
  readonly?: boolean
8
+ disableRow?: boolean
8
9
  tooltip?: string
9
10
  }
10
11