@dataloop-ai/components 0.20.113 → 0.20.116

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.116",
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,13 @@ export default defineComponent({
513
541
  isRowSelected: isRowSelected(props.rowKey, getRowKey.value(row))
514
542
  ? 'selected'
515
543
  : '',
544
+ isRowHighlighted:
545
+ props.highlightedRow &&
546
+ row[
547
+ typeof props.rowKey === 'string'
548
+ ? props.rowKey
549
+ : props.rowKey()
550
+ ] === props.highlightedRow,
516
551
  level,
517
552
  class: 'nested-element dl-tr',
518
553
  'data-level': level,
@@ -540,6 +575,9 @@ export default defineComponent({
540
575
  modelValue: isRowSelected(props.rowKey, getRowKey.value(row)),
541
576
  scopedSlots: currentSlots,
542
577
  tooltip: props.identifierAsTooltip ? row.identifier : null,
578
+ customIconExpandedRow: props.customIconExpandedRow,
579
+ customIconCompressedRow: props.customIconCompressedRow,
580
+ chevronIconColor: props.chevronIconColor,
543
581
  'onUpdate:modelValue': (adding: boolean, evt: Event) => {
544
582
  updateSelectionHierarchy(adding, evt, row)
545
583
  },
@@ -568,9 +606,14 @@ export default defineComponent({
568
606
  tableRootRef.value.onTrContextMenu(event, row, index)
569
607
  },
570
608
  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)
609
+ updateExpandedRow(
610
+ !row.isExpanded,
611
+ getRowKey.value(row)
612
+ ),
613
+ rowHoverStart: (...args: any) =>
614
+ emit('row-hover-start', ...args),
615
+ rowHoverEnd: (...args: any) =>
616
+ emit('row-hover-end', ...args)
574
617
  }
575
618
  })
576
619
  }
@@ -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 }"
@@ -16,17 +16,9 @@
16
16
  >
17
17
  <dl-icon class="draggable-icon" icon="icon-dl-drag" size="12px" />
18
18
  </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
19
  <td v-if="hasSelectionMode" class="dl-table--col-auto-width">
27
20
  <slot name="body-selection" v-bind="bindBodySelection">
28
21
  <DlCheckbox
29
- style="padding-left: 10px"
30
22
  :color="color"
31
23
  :model-value="modelValue"
32
24
  :indeterminate-value="true"
@@ -38,6 +30,20 @@
38
30
  />
39
31
  </slot>
40
32
  </td>
33
+ <td class="chevron-icon-container">
34
+ <div class="chevron-icon">
35
+ <DlIcon
36
+ v-if="(row.children || []).length > 0"
37
+ :icon="`${
38
+ row.isExpanded
39
+ ? customIconExpandedRow
40
+ : customIconCompressedRow
41
+ }`"
42
+ :style="`color: ${chevronIconColor};`"
43
+ @click.stop.prevent="emitUpdateExpandedRow"
44
+ />
45
+ </div>
46
+ </td>
41
47
  <DlTdTree
42
48
  v-for="(col, colIndex) in computedCols"
43
49
  :key="colIndex"
@@ -154,6 +160,31 @@ export default defineComponent({
154
160
  tooltip: {
155
161
  type: String,
156
162
  default: null
163
+ },
164
+ /**
165
+ * Custom icon class to use for expanded rows.
166
+ */
167
+ customIconExpandedRow: {
168
+ type: String,
169
+ default: 'icon-dl-down-chevron'
170
+ },
171
+ /**
172
+ * Custom icon class to use for compressed (collapsed) rows.
173
+ */
174
+ customIconCompressedRow: {
175
+ type: String,
176
+ default: 'icon-dl-right-chevron'
177
+ },
178
+ /**
179
+ * color of the chevron icon
180
+ */
181
+ chevronIconColor: {
182
+ type: String,
183
+ default: ''
184
+ },
185
+ isRowHighlighted: {
186
+ type: Boolean,
187
+ default: false
157
188
  }
158
189
  },
159
190
  emits: [
@@ -251,14 +282,9 @@ export default defineComponent({
251
282
  }
252
283
 
253
284
  const rowClass = (): string => {
254
- if (props.isRowSelected) {
255
- return 'selected'
285
+ if (props.isRowHighlighted) {
286
+ return 'highlighted'
256
287
  }
257
- if (props.hasAnyAction) {
258
- return ' cursor-pointer'
259
- }
260
-
261
- return 'dl-tr'
262
288
  }
263
289
 
264
290
  const getExpandedvisibleChildren = (): void => {
@@ -345,8 +371,15 @@ export default defineComponent({
345
371
  <style scoped lang="scss">
346
372
  @import '../../DlTable/styles/dl-table-styles.scss';
347
373
  .chevron-icon {
374
+ display: flex;
375
+ align-items: center;
376
+ justify-content: center;
348
377
  cursor: pointer;
349
- width: 25px;
350
378
  padding: 5px;
379
+ height: 100%;
380
+ }
381
+ .chevron-icon-container {
382
+ cursor: pointer;
383
+ width: 25px;
351
384
  }
352
385
  </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"