@dataloop-ai/components 0.19.277 → 0.19.279

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.19.277",
3
+ "version": "0.19.279",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -34,6 +34,7 @@
34
34
  :empty-state-props="emptyStateProps"
35
35
  :hide-bottom="hideBottom"
36
36
  :hide-no-data="hideNoData"
37
+ identifier-as-tooltip
37
38
  @row-click="handleRowClick"
38
39
  >
39
40
  <template #body-cell-displayLabel="item">
@@ -41,6 +42,7 @@
41
42
  :text="item.row.displayLabel"
42
43
  :indicator-color="item.row.color"
43
44
  class="dl-label-picker-item"
45
+ :data-label-picker-identifier="item.row.identifier"
44
46
  />
45
47
  </template>
46
48
  </dl-tree-table>
@@ -48,7 +50,15 @@
48
50
  </template>
49
51
 
50
52
  <script lang="ts">
51
- import { ref, PropType, defineComponent, computed, toRefs } from 'vue-demi'
53
+ import {
54
+ ref,
55
+ PropType,
56
+ defineComponent,
57
+ computed,
58
+ toRefs,
59
+ onMounted,
60
+ nextTick
61
+ } from 'vue-demi'
52
62
  import { DlLabel, DlIcon } from '../../essential'
53
63
  import { DlInput, DlTreeTable } from '../../compound'
54
64
  import { DlEmptyStateProps, DlTableColumn, DlTableRow } from '../../types'
@@ -188,6 +198,18 @@ export default defineComponent({
188
198
  }
189
199
  return false
190
200
  }
201
+
202
+ onMounted(() => {
203
+ nextTick(() => {
204
+ if (items.value?.[0]?.identifier) {
205
+ const target = table.value.$el.querySelector(
206
+ `[data-label-picker-identifier="${items.value[0].identifier}"]`
207
+ )
208
+ target?.closest('tr')?.classList.add('selected')
209
+ }
210
+ })
211
+ })
212
+
191
213
  return {
192
214
  handleRowClick,
193
215
  inputValue,
@@ -1,6 +1,5 @@
1
1
  export * from './highlightSyntax'
2
2
 
3
- import { DateInterval } from '../../../DlDateTime/types'
4
3
  import { ColorSchema, SyntaxColorSchema, Filters } from '../types'
5
4
  import {
6
5
  operators,
@@ -155,17 +155,25 @@
155
155
  @highlighted-item="setHighlightedIndex"
156
156
  @selected-item="handleSelectedItem"
157
157
  >
158
- <dl-list class="select-list" :padding="false">
159
- <dl-list-item v-if="noOptions">
160
- <dl-item-section color="dl-color-medium">
161
- <slot name="no-options"> No options </slot>
162
- </dl-item-section>
163
- </dl-list-item>
164
- <dl-list-item v-if="hasBeforeOptions && !noOptions">
165
- <dl-item-section color="dl-color-medium">
166
- <slot name="before-options" />
167
- </dl-item-section>
168
- </dl-list-item>
158
+ <dl-list-item v-if="hasBeforeOptions && !noOptions">
159
+ <dl-item-section color="dl-color-medium">
160
+ <slot name="before-options" />
161
+ </dl-item-section>
162
+ </dl-list-item>
163
+ <dl-list-item v-if="noOptions">
164
+ <dl-item-section color="dl-color-medium">
165
+ <slot name="no-options"> No options </slot>
166
+ </dl-item-section>
167
+ </dl-list-item>
168
+ <dl-list
169
+ class="select-list"
170
+ :padding="false"
171
+ :style="
172
+ optionsCount > MAX_ITEMS_PER_LIST
173
+ ? ''
174
+ : `width: 100%; max-height: calc(${calculatedDropdownMaxHeight} - 20px); overflow-y: scroll;`
175
+ "
176
+ >
169
177
  <dl-select-option
170
178
  v-if="showAllItems"
171
179
  :multiselect="multiselect"
@@ -194,7 +202,7 @@
194
202
  :virtual-scroll-item-size="28"
195
203
  :virtual-scroll-sticky-size-start="28"
196
204
  :virtual-scroll-sticky-size-end="20"
197
- :style="`width: 100%; max-height: calc(${dropdownMaxHeight} - 20px);`"
205
+ :style="`width: 100%; max-height: calc(${calculatedDropdownMaxHeight} - 20px);`"
198
206
  >
199
207
  <dl-select-option
200
208
  :key="getKeyForOption(item)"
@@ -290,12 +298,12 @@
290
298
  </slot>
291
299
  </dl-select-option>
292
300
  </div>
293
- <dl-list-item v-if="hasAfterOptions && !noOptions">
294
- <dl-item-section>
295
- <slot name="after-options" />
296
- </dl-item-section>
297
- </dl-list-item>
298
301
  </dl-list>
302
+ <dl-list-item v-if="hasAfterOptions && !noOptions">
303
+ <dl-item-section>
304
+ <slot name="after-options" />
305
+ </dl-item-section>
306
+ </dl-list-item>
299
307
  </dl-menu>
300
308
  </div>
301
309
  <div
@@ -487,46 +495,6 @@ export default defineComponent({
487
495
  if (this.customFilter || this.searchTerm === '') {
488
496
  return this.options
489
497
  }
490
-
491
- // alternate version here it shows from child down
492
- // const labelIncluded = (
493
- // options: DlSelectOptionType[],
494
- // term: string
495
- // ): DlSelectOptionType[] => {
496
- // const filteredNodes: DlSelectOptionType[] = []
497
-
498
- // for (const op of options) {
499
- // const queue: DlSelectOptionType[] = [op]
500
- // while (queue.length) {
501
- // const node = queue.shift()
502
- // let shouldPush = false
503
-
504
- // const label = getLabel(node)
505
-
506
- // if (
507
- // label &&
508
- // label
509
- // .toLowerCase()
510
- // .includes(term.toLowerCase().trim())
511
- // ) {
512
- // filteredNodes.push(node)
513
- // shouldPush = true
514
- // }
515
-
516
- // if (
517
- // !shouldPush &&
518
- // (node as DlSelectOptionEntry)?.children?.length
519
- // ) {
520
- // queue.push(
521
- // ...(node as DlSelectOptionEntry).children
522
- // )
523
- // }
524
- // }
525
- // }
526
-
527
- // return filteredNodes
528
- // }
529
-
530
498
  const labelIncluded = (
531
499
  options: DlSelectOptionType[],
532
500
  term: string
@@ -574,6 +542,27 @@ export default defineComponent({
574
542
 
575
543
  return labelIncluded(cloneDeep(this.options), this.searchTerm)
576
544
  },
545
+ calculatedDropdownMaxHeight(): string {
546
+ const knownValuePhrases = ['vh', 'px', 'vw', 'em', 'rem', '%']
547
+ let val = this.dropdownMaxHeight
548
+
549
+ for (const phrase of knownValuePhrases) {
550
+ if (val.includes(phrase)) {
551
+ val = val.replace(phrase, '')
552
+ let value = parseInt(val)
553
+ if (this.hasAfterOptions) {
554
+ value -= 5
555
+ }
556
+ if (this.hasBeforeOptions) {
557
+ value -= 5
558
+ }
559
+ return String(value + phrase)
560
+ }
561
+ }
562
+
563
+ // :shrug: if it's not a known value, just return it
564
+ return `calc(${this.dropdownMaxHeight} - 20px)`
565
+ },
577
566
  computedMenuStyle(): string {
578
567
  let style = this.menuStyle ?? ''
579
568
  if (this.optionsCount > this.MAX_ITEMS_PER_LIST) {
@@ -165,6 +165,13 @@ export default defineComponent({
165
165
  type: Boolean,
166
166
  default: false
167
167
  },
168
+ /**
169
+ * identifier As Tooltip form row object
170
+ */
171
+ identifierAsTooltip: {
172
+ type: Boolean,
173
+ default: false
174
+ },
168
175
  /**
169
176
  * Function to generate the label visible when selecting rows
170
177
  */
@@ -530,6 +537,7 @@ export default defineComponent({
530
537
  computedCols: tableRootRef.value.computedCols,
531
538
  modelValue: isRowSelected(props.rowKey, getRowKey.value(row)),
532
539
  scopedSlots: currentSlots,
540
+ tooltip: props.identifierAsTooltip ? row.identifier : null,
533
541
  'onUpdate:modelValue': (adding: boolean, evt: Event) => {
534
542
  updateSelectionHierarchy(adding, evt, row)
535
543
  },
@@ -6,7 +6,10 @@
6
6
  :data-col-index="colIndex"
7
7
  >
8
8
  <slot name="icon" />
9
- <dl-tooltip v-if="hasEllipsis">
9
+ <dl-tooltip v-if="tooltip">
10
+ {{ tooltip }}
11
+ </dl-tooltip>
12
+ <dl-tooltip v-else-if="hasEllipsis">
10
13
  <slot />
11
14
  </dl-tooltip>
12
15
  <slot />
@@ -39,6 +42,10 @@ export default defineComponent({
39
42
  colIndex: {
40
43
  type: Number,
41
44
  default: null
45
+ },
46
+ tooltip: {
47
+ type: String,
48
+ default: null
42
49
  }
43
50
  },
44
51
  setup(props) {
@@ -53,6 +53,7 @@
53
53
  }px;`
54
54
  "
55
55
  :col-index="colIndex"
56
+ :tooltip="tooltip"
56
57
  >
57
58
  <template v-if="!hasSlotByName(`body-cell-${col.name}`)">
58
59
  {{ getCellValue(col, row) }}
@@ -149,6 +150,10 @@ export default defineComponent({
149
150
  modelValue: {
150
151
  type: [String, Boolean],
151
152
  default: null
153
+ },
154
+ tooltip: {
155
+ type: String,
156
+ default: null
152
157
  }
153
158
  },
154
159
  emits: [
@@ -26,17 +26,17 @@ const rows: DlLabelPickerItem[] = [
26
26
  color: '#ff0000',
27
27
  children: [
28
28
  {
29
- identifier: 'b',
29
+ identifier: 'a.a',
30
30
  displayLabel: 'hello',
31
31
  color: '#ffff00',
32
32
  children: [
33
33
  {
34
- identifier: 'c',
34
+ identifier: 'a.a.a',
35
35
  displayLabel: 'test 2',
36
36
  color: '#00ff00',
37
37
  children: [
38
38
  {
39
- identifier: 'd',
39
+ identifier: 'a.a.a.a',
40
40
  displayLabel: 'test 3',
41
41
  color: '#ff00aa',
42
42
  children: []
@@ -44,7 +44,7 @@ const rows: DlLabelPickerItem[] = [
44
44
  ]
45
45
  },
46
46
  {
47
- identifier: 'd',
47
+ identifier: 'a.a.b',
48
48
  displayLabel: 'test 4',
49
49
  color: '#ff00ff',
50
50
  children: []
@@ -156,10 +156,7 @@
156
156
  all-items-option
157
157
  >
158
158
  <template #prepend>
159
- <dl-icon
160
- size="12px"
161
- icon="icon-dl-filter"
162
- />
159
+ <dl-icon size="12px" icon="icon-dl-filter" />
163
160
  </template>
164
161
  </dl-select>
165
162
  custom search
@@ -594,13 +591,47 @@
594
591
  multiselect
595
592
  style="margin-bottom: 150px"
596
593
  />
594
+
595
+ <dl-select
596
+ :options="searchOptions"
597
+ title="With before and after options"
598
+ >
599
+ <template #before-options>
600
+ <dl-button label="Button" />
601
+ </template>
602
+ <template #after-options>
603
+ <dl-button label="Button" />
604
+ </template>
605
+ </dl-select>
606
+ <dl-select
607
+ :options="alotOfOptions"
608
+ title="With before and after options - lots of options"
609
+ >
610
+ <template #before-options>
611
+ <dl-button label="Button" />
612
+ </template>
613
+ <template #after-options>
614
+ <dl-button label="Button" />
615
+ </template>
616
+ </dl-select>
617
+ <dl-select
618
+ :options="someOptions"
619
+ title="With before and after options - some options"
620
+ >
621
+ <template #before-options>
622
+ <dl-button label="Button" />
623
+ </template>
624
+ <template #after-options>
625
+ <dl-button label="Button" />
626
+ </template>
627
+ </dl-select>
597
628
  </div>
598
629
  </template>
599
630
 
600
631
  <script lang="ts">
601
632
  import { cloneDeep } from 'lodash'
602
633
  import { defineComponent } from 'vue-demi'
603
- import { DlChip, DlSelect, DlIcon, DlBadge } from '../components'
634
+ import { DlChip, DlSelect, DlIcon, DlBadge, DlButton } from '../components'
604
635
  import { DlSelectOptionType } from '../components/compound/DlSelect/utils'
605
636
 
606
637
  const defaultOptions = [
@@ -828,7 +859,7 @@ const treeOptionsExpanded: DlSelectOptionType[] = [
828
859
  ]
829
860
 
830
861
  export default defineComponent({
831
- components: { DlSelect, DlIcon, DlChip, DlBadge },
862
+ components: { DlSelect, DlIcon, DlChip, DlBadge, DlButton },
832
863
  data() {
833
864
  return {
834
865
  selectedWithFit: [],
@@ -883,6 +914,21 @@ export default defineComponent({
883
914
 
884
915
  return arr
885
916
  },
917
+ someOptions(): DlSelectOptionType[] {
918
+ const arr = [] as any[]
919
+
920
+ for (let i = 0; i < 10; ++i) {
921
+ arr.push({
922
+ key: i,
923
+ subLabel: 'not so high',
924
+ label: 'High ' + i,
925
+ value: 'high',
926
+ bgColor: 'dl-color-negative'
927
+ })
928
+ }
929
+
930
+ return arr
931
+ },
886
932
  alotOfOptionsExpanded(): DlSelectOptionType[] {
887
933
  const arr = cloneDeep(this.alotOfOptions)
888
934
  arr.push(treeOptionsExpanded[0])