@dataloop-ai/components 0.18.50 → 0.18.52

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.18.50",
3
+ "version": "0.18.52",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -248,14 +248,14 @@
248
248
  <DlTr v-if="isEmpty">
249
249
  <DlTd colspan="100%">
250
250
  <div class="flex justify-center">
251
- <dl-empty-state v-bind="props">
251
+ <dl-empty-state v-bind="emptyStateProps">
252
252
  <template
253
253
  v-for="(_, slot) in $slots"
254
- #[slot]="emptyStateProps"
254
+ #[slot]="emptyStateSlotProps"
255
255
  >
256
256
  <slot
257
257
  :name="slot"
258
- v-bind="emptyStateProps"
258
+ v-bind="emptyStateSlotProps"
259
259
  />
260
260
  </template>
261
261
  </dl-empty-state>
@@ -460,17 +460,17 @@
460
460
  </slot>
461
461
  </slot>
462
462
 
463
- <DlTr v-if="isEmpty">
463
+ <DlTr v-if="isEmpty && hasEmptyStateProps">
464
464
  <DlTd colspan="100%">
465
465
  <div class="flex justify-center">
466
- <dl-empty-state v-bind="props">
466
+ <dl-empty-state v-bind="emptyStateProps">
467
467
  <template
468
468
  v-for="(_, slot) in $slots"
469
- #[slot]="emptyStateProps"
469
+ #[slot]="props"
470
470
  >
471
471
  <slot
472
472
  :name="slot"
473
- v-bind="emptyStateProps"
473
+ v-bind="props"
474
474
  />
475
475
  </template>
476
476
  </dl-empty-state>
@@ -879,9 +879,6 @@ export default defineComponent({
879
879
  )
880
880
 
881
881
  const computedRows = computed(() => {
882
- /*if(props.virtualScrollRows.length) {
883
- return props.virtualScrollRows
884
- }*/
885
882
  let rows = filteredSortedRows.value
886
883
 
887
884
  const { rowsPerPage } = computedPagination.value
@@ -1229,6 +1226,9 @@ export default defineComponent({
1229
1226
  const updatePagination = (value: any, key: string) => {
1230
1227
  return setPagination({ [`${key}`]: value })
1231
1228
  }
1229
+ const hasEmptyStateProps = computed(
1230
+ () => Object.keys(props.emptyStateProps).length > 0
1231
+ )
1232
1232
 
1233
1233
  return {
1234
1234
  uuid: `dl-table-${v4()}`,
@@ -1282,7 +1282,8 @@ export default defineComponent({
1282
1282
  hasSlotBody,
1283
1283
  hasSlotHeaderSelection,
1284
1284
  stopAndPrevent,
1285
- updatePagination
1285
+ updatePagination,
1286
+ hasEmptyStateProps
1286
1287
  }
1287
1288
  }
1288
1289
  })
@@ -18,6 +18,10 @@
18
18
  :title="title"
19
19
  :virtual-scroll="virtualScroll"
20
20
  :rows-per-page-options="rowsPerPageOptions"
21
+ :hide-pagination="hidePagination"
22
+ :is-empty="isEmpty"
23
+ :empty-state-props="emptyStateProps"
24
+ :no-data-label="noDataLabel"
21
25
  @row-click="emitRowClick"
22
26
  @th-click="emitThClick"
23
27
  @update:selected="updateSelected"
@@ -32,7 +36,7 @@
32
36
  />
33
37
  </template>
34
38
  <template #table-body="props">
35
- <template v-if="virtualScroll">
39
+ <template v-if="virtualScroll && !isEmpty">
36
40
  <DlTrTreeView
37
41
  :row="props.item"
38
42
  :is-row-selected="
@@ -172,27 +176,11 @@
172
176
  </template>
173
177
  </DlTrTreeView>
174
178
  </template>
175
- <template v-else>
176
- <DlTr>
177
- <DlTd colspan="100%">
178
- <div class="flex justify-center">
179
- <dl-empty-state v-bind="props">
180
- <template
181
- v-for="(_, slot) in $slots"
182
- #[slot]="emptyStateProps"
183
- >
184
- <slot
185
- :name="slot"
186
- v-bind="emptyStateProps"
187
- />
188
- </template>
189
- </dl-empty-state>
190
- </div>
191
- </DlTd>
192
- </DlTr>
193
- </template>
194
179
  </template>
195
180
  </template>
181
+ <template #no-data>
182
+ <slot name="no-data" />
183
+ </template>
196
184
  </DlTable>
197
185
  </template>
198
186
 
@@ -205,7 +193,7 @@ import {
205
193
  set,
206
194
  ref
207
195
  } from 'vue-demi'
208
- import { DlTable, DlEmptyState, DlTr, DlTd } from '../../../components'
196
+ import { DlTable } from '../../../components'
209
197
  import DlTrTreeView from './views/DlTrTreeView.vue'
210
198
  import { cloneDeep } from 'lodash'
211
199
  import { DlTableProps, DlTableRow } from '../DlTable/types'
@@ -220,10 +208,7 @@ export default defineComponent({
220
208
  components: {
221
209
  DlTable,
222
210
  DlTrTreeView,
223
- DlCheckbox,
224
- DlEmptyState,
225
- DlTr,
226
- DlTd
211
+ DlCheckbox
227
212
  },
228
213
  props,
229
214
  emits,
@@ -237,8 +222,13 @@ export default defineComponent({
237
222
  const tableRows = ref(cloneDeep(props.rows))
238
223
  const tableColumns = ref(props.columns)
239
224
  const hasFlatTreeData = true
225
+ const hasEmptyStateProps = computed(
226
+ () => Object.keys(props.emptyStateProps).length > 0
227
+ )
240
228
 
241
- const computedRows = computed(() => dlTableRef.value.computedRows)
229
+ const computedRows = computed(() =>
230
+ dlTableRef.value?.computedRows ? dlTableRef.value?.computedRows : []
231
+ )
242
232
 
243
233
  const getRowKey = computed(() =>
244
234
  typeof props.rowKey === 'function'
@@ -380,6 +370,7 @@ export default defineComponent({
380
370
  computedRows,
381
371
  getRowKey,
382
372
  updateSelection,
373
+ hasEmptyStateProps,
383
374
  updateExpandedRow,
384
375
  updateSelectionHierarchy,
385
376
  onMultipleSelectionSet,
@@ -17,7 +17,7 @@
17
17
  width="45vw"
18
18
  height="75vh"
19
19
  :language="language"
20
- :theme="theme"
20
+ :theme="'atom-one-dark'"
21
21
  :readonly="readonly"
22
22
  :options="options"
23
23
  />
@@ -180,6 +180,43 @@
180
180
  </DlTable>
181
181
  </div>
182
182
 
183
+ <div style="margin-top: 100px">
184
+ Custom Slot `row-body`
185
+ <DlTable
186
+ :selected="selected"
187
+ :separator="separator"
188
+ :columns="tableColumns"
189
+ :bordered="bordered"
190
+ :dense="dense"
191
+ class="sticky-header"
192
+ :filter="filter"
193
+ :selection="selection"
194
+ :loading="loading"
195
+ :rows="tableRows"
196
+ :resizable="resizable"
197
+ row-key="id"
198
+ color="dl-color-secondary"
199
+ title="Table Title"
200
+ :virtual-scroll="vScroll"
201
+ style="height: 500px"
202
+ :rows-per-page-options="rowsPerPageOptions"
203
+ @row-click="log"
204
+ @th-click="log"
205
+ @update:selected="updateSeleted"
206
+ >
207
+ <template #row-body="props">
208
+ <dl-tr :props="props">
209
+ <dl-td
210
+ v-for="(value, key) in Object.keys(props.row)"
211
+ :key="key"
212
+ >
213
+ {{ props.row[value] }}
214
+ </dl-td>
215
+ </dl-tr>
216
+ </template>
217
+ </DlTable>
218
+ </div>
219
+
183
220
  <div style="margin-top: 100px">
184
221
  <DlTable
185
222
  :selected="selected"
@@ -405,7 +442,9 @@ import {
405
442
  DlOptionGroup,
406
443
  DlSwitch,
407
444
  DlInput,
408
- DlButton
445
+ DlButton,
446
+ DlTr,
447
+ DlTd
409
448
  } from '../components'
410
449
  import { defineComponent, ref, computed, nextTick } from 'vue-demi'
411
450
  import { times, cloneDeep, isNumber } from 'lodash'
@@ -577,7 +616,9 @@ export default defineComponent({
577
616
  DlSwitch,
578
617
  DlOptionGroup,
579
618
  DlInput,
580
- DlButton
619
+ DlButton,
620
+ DlTr,
621
+ DlTd
581
622
  },
582
623
  setup() {
583
624
  const filter = ref('')
@@ -168,6 +168,75 @@
168
168
  style="height: 500px"
169
169
  />
170
170
  </div>
171
+ <div style="margin-top: 100px">
172
+ <p>Empty State</p>
173
+ <DlTreeTable
174
+ :separator="separator"
175
+ :columns="tableColumns"
176
+ :bordered="bordered"
177
+ :draggable="draggable"
178
+ :dense="dense"
179
+ class="sticky-header"
180
+ :filter="filter"
181
+ :selection="selection"
182
+ :loading="loading"
183
+ :rows="[]"
184
+ :resizable="resizable"
185
+ row-key="name"
186
+ color="dl-color-secondary"
187
+ title="Table Title"
188
+ :virtual-scroll="vScroll"
189
+ style="height: 500px"
190
+ :rows-per-page-options="rowsPerPageOptions"
191
+ is-empty
192
+ hide-pagination
193
+ @row-click="onRowClick"
194
+ @th-click="log"
195
+ @selectedItems="selectedItems"
196
+ >
197
+ <template #no-data>
198
+ <div class="flex justify-center">
199
+ &lt slot#no-data > customizabled
200
+ </div>
201
+ </template>
202
+ </DlTreeTable>
203
+ <div>
204
+ <DlTreeTable
205
+ :separator="separator"
206
+ :columns="tableColumns"
207
+ :bordered="bordered"
208
+ :draggable="draggable"
209
+ :dense="dense"
210
+ class="sticky-header"
211
+ :filter="filter"
212
+ :selection="selection"
213
+ :loading="loading"
214
+ :rows="tableRows"
215
+ :resizable="resizable"
216
+ row-key="name"
217
+ color="dl-color-secondary"
218
+ title="Table Title"
219
+ :virtual-scroll="vScroll"
220
+ style="height: 500px"
221
+ :rows-per-page-options="rowsPerPageOptions"
222
+ is-empty
223
+ hide-pagination
224
+ :empty-state-props="{
225
+ responsive: false,
226
+ style: 'min-height: 350px; width: 300px;',
227
+ bgSize: '130px',
228
+ bgImage: `url(https://raw.githubusercontent.com/dataloop-ai/icons/main/assets/usage.svg)`,
229
+ title: 'Lorem ipsum',
230
+ subtitle:
231
+ 'Lorem ipsum dolor sit amet consectetur. Senectus condimentum dolor sit',
232
+ info: 'To learn more about this analytics, read our documentation.'
233
+ }"
234
+ @row-click="onRowClick"
235
+ @th-click="log"
236
+ @selectedItems="selectedItems"
237
+ />
238
+ </div>
239
+ </div>
171
240
  </div>
172
241
  </div>
173
242
  </template>