@dataloop-ai/components 0.19.19 → 0.19.21

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.19",
3
+ "version": "0.19.21",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -601,6 +601,7 @@ export default defineComponent({
601
601
  showDatePicker.value = false
602
602
  showSuggestions.value = true
603
603
  datePickerSelection.value = null
604
+ setInputValue(searchQuery.value + ' ', { noEmit: true })
604
605
  setCaretAtTheEnd(input.value)
605
606
  return
606
607
  }
@@ -414,6 +414,7 @@
414
414
  class="dl-table__middle scroll"
415
415
  >
416
416
  <table
417
+ ref="tableRef"
417
418
  class="dl-table"
418
419
  :class="additionalClasses"
419
420
  >
@@ -1190,6 +1191,7 @@ export default defineComponent({
1190
1191
  const getTableKey = () => tableKey.value
1191
1192
 
1192
1193
  const rootRef = ref<HTMLDivElement>(null)
1194
+ const tableRef = ref<HTMLTableElement>(null)
1193
1195
  const virtScrollRef = ref(null)
1194
1196
  const hasVirtScroll = computed<boolean>(
1195
1197
  () => virtualScroll.value === true
@@ -1313,9 +1315,9 @@ export default defineComponent({
1313
1315
  })
1314
1316
 
1315
1317
  onMounted(() => {
1316
- tableEl = document.querySelector(
1317
- 'table.dl-table'
1318
- ) as HTMLTableElement
1318
+ tableEl =
1319
+ tableRef.value ||
1320
+ (document.querySelector('table.dl-table') as HTMLTableElement)
1319
1321
  nextTick(() => {
1320
1322
  setAllColumnWidths(
1321
1323
  tableEl,
@@ -1346,6 +1348,14 @@ export default defineComponent({
1346
1348
  applyResizableColumns(tableEl, vm)
1347
1349
  }
1348
1350
 
1351
+ nextTick(() => {
1352
+ setAllColumnWidths(
1353
+ tableRef.value,
1354
+ props.columns as DlTableColumn[],
1355
+ props.fitAllColumns
1356
+ )
1357
+ })
1358
+
1349
1359
  if (hasDraggableColumns.value === true) {
1350
1360
  applyDraggableColumns(
1351
1361
  tableEl,
@@ -1366,11 +1376,13 @@ export default defineComponent({
1366
1376
  watch(
1367
1377
  columns,
1368
1378
  (newColumns) => {
1369
- setAllColumnWidths(
1370
- rootRef.value,
1371
- newColumns as DlTableColumn[],
1372
- props.fitAllColumns
1373
- )
1379
+ nextTick(() => {
1380
+ setAllColumnWidths(
1381
+ tableRef.value,
1382
+ newColumns as DlTableColumn[],
1383
+ props.fitAllColumns
1384
+ )
1385
+ })
1374
1386
  },
1375
1387
  {
1376
1388
  flush: 'post'
@@ -1927,7 +1939,8 @@ export default defineComponent({
1927
1939
  handleVisibleColumnsUpdate,
1928
1940
  computedVisibleCols,
1929
1941
  totalItemsCount,
1930
- showRowActions
1942
+ showRowActions,
1943
+ tableRef
1931
1944
  }
1932
1945
  }
1933
1946
  })
@@ -15,7 +15,10 @@
15
15
  <slot />
16
16
  </dl-tooltip>
17
17
  <slot />
18
- <span class="th-icons">
18
+ <span
19
+ class="th-icons"
20
+ :style="{ top: props?.dense ? '5px' : '10px' }"
21
+ >
19
22
  <dl-icon
20
23
  v-if="hasHint"
21
24
  icon="icon-dl-info"
@@ -9,7 +9,6 @@
9
9
  }
10
10
 
11
11
  .inner-th {
12
- max-width: 70%;
13
12
  display: inline-block;
14
13
  overflow: hidden;
15
14
  margin-right: 5px;
@@ -18,7 +17,6 @@
18
17
  .th-icons {
19
18
  display: flex;
20
19
  align-items: center;
21
- top: 10px;
22
20
  right: 0;
23
21
  position: absolute;
24
22
  }
@@ -477,7 +477,6 @@ const columns = [
477
477
  field: 'name',
478
478
  sortable: true,
479
479
  textTransform: 'uppercase',
480
- width: 100,
481
480
  hint: 'test hint'
482
481
  },
483
482
  {
@@ -3,7 +3,7 @@ import { DlTableColumn } from '../types'
3
3
  import { browseNestedNodes } from './browse-nested-nodes'
4
4
  import { swapNodes } from './swap-nodes'
5
5
 
6
- const DEFAULT_COL_WIDTH = 10
6
+ const DEFAULT_COL_WIDTH = 'fit-content'
7
7
 
8
8
  export function setColumnVerticalBorder(
9
9
  table: HTMLTableElement,
@@ -171,16 +171,6 @@ export function justifyMouseInsideTargetCell(
171
171
  )
172
172
  }
173
173
 
174
- function fitWidthToContent(el: HTMLElement, colWidth: number) {
175
- if (el.tagName !== 'TH') return colWidth
176
- const textNode = Array.from(el.querySelector('.inner-th').childNodes).find(
177
- (node) => node.nodeType === 3
178
- )
179
- const fontSize = parseInt(window.getComputedStyle(el).fontSize)
180
- const width = (textNode.nodeValue.length * fontSize) / 2
181
- return width > 100 ? width : 100
182
- }
183
-
184
174
  export function setAllColumnWidths(
185
175
  table: HTMLElement,
186
176
  columns: DlTableColumn[],
@@ -196,8 +186,10 @@ export function setAllColumnWidths(
196
186
  (el.tagName === 'TH' || el.tagName === 'TD') &&
197
187
  parseInt(el.dataset.colIndex) === i,
198
188
  (targetEl) => {
199
- const width = fitWidthToContent(targetEl, col.width)
200
- targetEl.style.width = `${width ?? DEFAULT_COL_WIDTH}px` // then
189
+ targetEl.style.width = col.width
190
+ ? `${col.width}px`
191
+ : DEFAULT_COL_WIDTH
192
+ // then
201
193
  }
202
194
  )
203
195
  })