@dataloop-ai/components 0.20.113 → 0.20.117

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.113",
3
+ "version": "0.20.117",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -23,7 +23,7 @@
23
23
  "check-only": "if grep -E -H -r --exclude-dir=.git --exclude-dir=node_modules --exclude=*.json --exclude=*.yml '^(describe|it).only' .; then echo 'Found only in test files' && exit 1; fi"
24
24
  },
25
25
  "dependencies": {
26
- "@dataloop-ai/icons": "^3.1.11",
26
+ "@dataloop-ai/icons": "^3.1.12",
27
27
  "@types/flat": "^5.0.2",
28
28
  "@types/lodash": "^4.14.184",
29
29
  "@types/sortablejs": "^1.15.7",
@@ -68,6 +68,7 @@
68
68
  :style="!isExpanded ? 'display: none;' : 'width: 100%;'"
69
69
  :disabled="disabled"
70
70
  :readonly="readonly"
71
+ :placeholder="computedPlaceholder"
71
72
  @input="handleSearchInput"
72
73
  @focus="handleSearchFocus"
73
74
  @blur="handleSearchBlur"
@@ -126,6 +127,7 @@
126
127
  @click.prevent.stop="clearSelection"
127
128
  />
128
129
  <dl-icon
130
+ v-if="!hideChevron"
129
131
  :icon="dropdownIcon"
130
132
  :color="chevronIconColor"
131
133
  class="expand-icon"
@@ -166,6 +168,7 @@
166
168
  </dl-item-section>
167
169
  </dl-list-item>
168
170
  <dl-list
171
+ v-if="showMenuList"
169
172
  class="select-list"
170
173
  :padding="false"
171
174
  :style="
@@ -448,6 +451,21 @@ export default defineComponent({
448
451
  selectedResourceLabel: {
449
452
  type: String,
450
453
  default: 'Selected Items'
454
+ },
455
+ hideChevron: {
456
+ type: Boolean,
457
+ default: false
458
+ },
459
+ disableSearchHighlighting: {
460
+ type: Boolean,
461
+ default: false
462
+ },
463
+ /**
464
+ * shows search results only when there is some user input
465
+ */
466
+ openMenuDuringSearch: {
467
+ type: Boolean,
468
+ default: false
451
469
  }
452
470
  },
453
471
  emits: [
@@ -592,6 +610,9 @@ export default defineComponent({
592
610
  if (this.optionsCount > this.MAX_ITEMS_PER_LIST) {
593
611
  style += '; overflow-y: hidden'
594
612
  }
613
+ if (!this.showMenuList) {
614
+ style += '; border: none;'
615
+ }
595
616
  return style
596
617
  },
597
618
  computedNoOptionsStyle(): string {
@@ -811,6 +832,16 @@ export default defineComponent({
811
832
  },
812
833
  chevronIconColor(): string {
813
834
  return `${this.disabled ? 'dl-color-disabled' : null}`
835
+ },
836
+ showMenuList(): boolean {
837
+ if (
838
+ this.openMenuDuringSearch &&
839
+ this.searchable &&
840
+ this.searchInputValue.length === 0
841
+ ) {
842
+ return false
843
+ }
844
+ return true
814
845
  }
815
846
  },
816
847
  watch: {
@@ -1011,7 +1042,10 @@ export default defineComponent({
1011
1042
  const label = `${this.getOptionLabel(option)}`
1012
1043
  let highlightedHtml = label
1013
1044
 
1014
- if (this.searchInputValue?.length) {
1045
+ if (
1046
+ this.searchInputValue?.length &&
1047
+ !this.disableSearchHighlighting
1048
+ ) {
1015
1049
  const toReplace = new RegExp(this.searchInputValue, 'gi')
1016
1050
 
1017
1051
  highlightedHtml = label.replace(
@@ -1369,6 +1403,10 @@ export default defineComponent({
1369
1403
  white-space: nowrap;
1370
1404
  border: 0;
1371
1405
  }
1406
+
1407
+ &::placeholder {
1408
+ color: var(--dl-color-lighter);
1409
+ }
1372
1410
  }
1373
1411
  .bottom-message-container {
1374
1412
  display: flex;
@@ -139,6 +139,12 @@
139
139
  }
140
140
  }
141
141
 
142
+ tbody tr.highlighted {
143
+ td {
144
+ background-color: var(--dl-color-fill);
145
+ }
146
+ }
147
+
142
148
  .dl-table-cell-inner-div {
143
149
  text-overflow: ellipsis;
144
150
  white-space: nowrap;
@@ -266,6 +266,34 @@ export default defineComponent({
266
266
  icon: 'icon-dl-dataset-filled'
267
267
  } as unknown as PropType<DlEmptyStateProps>)
268
268
  },
269
+ /**
270
+ * Custom icon class to use for expanded rows.
271
+ */
272
+ customIconExpandedRow: {
273
+ type: String,
274
+ default: 'icon-dl-down-chevron'
275
+ },
276
+ /**
277
+ * Custom icon class to use for compressed (collapsed) rows.
278
+ */
279
+ customIconCompressedRow: {
280
+ type: String,
281
+ default: 'icon-dl-right-chevron'
282
+ },
283
+ /**
284
+ * color of the chevron icon
285
+ */
286
+ chevronIconColor: {
287
+ type: String,
288
+ default: ''
289
+ },
290
+ /**
291
+ * identifier (rowKey) to highlight a row.
292
+ */
293
+ highlightedRow: {
294
+ type: String,
295
+ default: ''
296
+ },
269
297
  /**
270
298
  * Scrolling delay
271
299
  */
@@ -513,6 +541,11 @@ export default defineComponent({
513
541
  isRowSelected: isRowSelected(props.rowKey, getRowKey.value(row))
514
542
  ? 'selected'
515
543
  : '',
544
+ isRowHighlighted:
545
+ props.highlightedRow &&
546
+ (typeof props.rowKey === 'string'
547
+ ? row[props.rowKey] === props.highlightedRow
548
+ : false),
516
549
  level,
517
550
  class: 'nested-element dl-tr',
518
551
  'data-level': level,
@@ -540,6 +573,9 @@ export default defineComponent({
540
573
  modelValue: isRowSelected(props.rowKey, getRowKey.value(row)),
541
574
  scopedSlots: currentSlots,
542
575
  tooltip: props.identifierAsTooltip ? row.identifier : null,
576
+ customIconExpandedRow: props.customIconExpandedRow,
577
+ customIconCompressedRow: props.customIconCompressedRow,
578
+ chevronIconColor: props.chevronIconColor,
543
579
  'onUpdate:modelValue': (adding: boolean, evt: Event) => {
544
580
  updateSelectionHierarchy(adding, evt, row)
545
581
  },
@@ -568,9 +604,14 @@ export default defineComponent({
568
604
  tableRootRef.value.onTrContextMenu(event, row, index)
569
605
  },
570
606
  updateExpandedRow: () =>
571
- updateExpandedRow(!row.isExpanded, getRowKey.value(row)),
572
- rowHoverStart: (...args: any) => emit('row-hover-start', ...args),
573
- rowHoverEnd: (...args: any) => emit('row-hover-end', ...args)
607
+ updateExpandedRow(
608
+ !row.isExpanded,
609
+ getRowKey.value(row)
610
+ ),
611
+ rowHoverStart: (...args: any) =>
612
+ emit('row-hover-start', ...args),
613
+ rowHoverEnd: (...args: any) =>
614
+ emit('row-hover-end', ...args)
574
615
  }
575
616
  })
576
617
  }
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <DlTrTree
3
- :class="rowClass"
3
+ :class="rowClass()"
4
4
  :no-hover="noHover"
5
5
  :children="childrenCount"
6
6
  :props="{ row }"
@@ -12,21 +12,15 @@
12
12
  >
13
13
  <td
14
14
  v-if="hasDraggableRows"
15
- :style="`width: 25px; opacity: ${isDragIconVisible ? '1' : '0'}`"
15
+ :style="`width: 25px; opacity: ${
16
+ isDragIconVisible || isRowHighlighted ? '1' : '0'
17
+ }`"
16
18
  >
17
19
  <dl-icon class="draggable-icon" icon="icon-dl-drag" size="12px" />
18
20
  </td>
19
- <td class="chevron-icon">
20
- <DlIcon
21
- v-if="(row.children || []).length > 0"
22
- :icon="`icon-dl-${row.isExpanded ? 'down' : 'right'}-chevron`"
23
- @click.stop.prevent="emitUpdateExpandedRow"
24
- />
25
- </td>
26
21
  <td v-if="hasSelectionMode" class="dl-table--col-auto-width">
27
22
  <slot name="body-selection" v-bind="bindBodySelection">
28
23
  <DlCheckbox
29
- style="padding-left: 10px"
30
24
  :color="color"
31
25
  :model-value="modelValue"
32
26
  :indeterminate-value="true"
@@ -38,6 +32,20 @@
38
32
  />
39
33
  </slot>
40
34
  </td>
35
+ <td class="chevron-icon-container">
36
+ <div class="chevron-icon">
37
+ <DlIcon
38
+ v-if="(row.children || []).length > 0"
39
+ :icon="`${
40
+ row.isExpanded
41
+ ? customIconExpandedRow
42
+ : customIconCompressedRow
43
+ }`"
44
+ :style="`color: ${chevronIconColor};`"
45
+ @click.stop.prevent="emitUpdateExpandedRow"
46
+ />
47
+ </div>
48
+ </td>
41
49
  <DlTdTree
42
50
  v-for="(col, colIndex) in computedCols"
43
51
  :key="colIndex"
@@ -154,6 +162,31 @@ export default defineComponent({
154
162
  tooltip: {
155
163
  type: String,
156
164
  default: null
165
+ },
166
+ /**
167
+ * Custom icon class to use for expanded rows.
168
+ */
169
+ customIconExpandedRow: {
170
+ type: String,
171
+ default: 'icon-dl-down-chevron'
172
+ },
173
+ /**
174
+ * Custom icon class to use for compressed (collapsed) rows.
175
+ */
176
+ customIconCompressedRow: {
177
+ type: String,
178
+ default: 'icon-dl-right-chevron'
179
+ },
180
+ /**
181
+ * color of the chevron icon
182
+ */
183
+ chevronIconColor: {
184
+ type: String,
185
+ default: ''
186
+ },
187
+ isRowHighlighted: {
188
+ type: Boolean,
189
+ default: false
157
190
  }
158
191
  },
159
192
  emits: [
@@ -251,14 +284,9 @@ export default defineComponent({
251
284
  }
252
285
 
253
286
  const rowClass = (): string => {
254
- if (props.isRowSelected) {
255
- return 'selected'
287
+ if (props.isRowHighlighted) {
288
+ return 'highlighted'
256
289
  }
257
- if (props.hasAnyAction) {
258
- return ' cursor-pointer'
259
- }
260
-
261
- return 'dl-tr'
262
290
  }
263
291
 
264
292
  const getExpandedvisibleChildren = (): void => {
@@ -345,8 +373,15 @@ export default defineComponent({
345
373
  <style scoped lang="scss">
346
374
  @import '../../DlTable/styles/dl-table-styles.scss';
347
375
  .chevron-icon {
376
+ display: flex;
377
+ align-items: center;
378
+ justify-content: center;
348
379
  cursor: pointer;
349
- width: 25px;
350
380
  padding: 5px;
381
+ height: 100%;
382
+ }
383
+ .chevron-icon-container {
384
+ cursor: pointer;
385
+ width: 25px;
351
386
  }
352
387
  </style>
@@ -181,6 +181,28 @@
181
181
  searchable
182
182
  />
183
183
 
184
+ normal search without hightlights
185
+ <dl-select
186
+ v-model="selectedByFilteringSearch"
187
+ :options="searchOptions"
188
+ size="m"
189
+ multiselect
190
+ placeholder="contributors"
191
+ searchable
192
+ disable-search-highlighting
193
+ />
194
+
195
+ normal search open menu during search
196
+ <dl-select
197
+ v-model="selectedByFilteringSearch"
198
+ :options="searchOptions"
199
+ size="m"
200
+ multiselect
201
+ placeholder="contributors"
202
+ searchable
203
+ open-menu-during-search
204
+ />
205
+
184
206
  selected ellipsis
185
207
  <div style="width: 200px">
186
208
  <dl-select
@@ -57,10 +57,7 @@
57
57
  </div>
58
58
 
59
59
  <div class="right-panel">
60
- <button
61
- class="btn"
62
- @click="addRowPerPage"
63
- >
60
+ <button class="btn" @click="addRowPerPage">
64
61
  Add Rows/Page
65
62
  </button>
66
63
 
@@ -111,6 +108,7 @@
111
108
  :virtual-scroll="vScroll"
112
109
  style="height: 500px"
113
110
  :rows-per-page-options="rowsPerPageOptions"
111
+ highlighted-row="Frozen Yogurt"
114
112
  @row-click="onRowClick"
115
113
  @th-click="log"
116
114
  @selected-items="selectedItems"