@dataloop-ai/components 0.16.49 → 0.16.51

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.16.49",
3
+ "version": "0.16.51",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -415,15 +415,18 @@
415
415
  v-if="!hideBottom"
416
416
  :class="bottomClasses"
417
417
  >
418
- <div class="dl-table__control">
419
- <slot
420
- v-if="nothingToDisplay && !hideNoData"
421
- name="no-data"
422
- >
423
- {{ bottomMessage }}
418
+ <div
419
+ v-if="nothingToDisplay && !hideNoData"
420
+ class="dl-table__control"
421
+ >
422
+ <slot name="no-data">
423
+ {{ noDataMessage }}
424
424
  </slot>
425
425
  </div>
426
- <div class="dl-table__control">
426
+ <div
427
+ v-else
428
+ class="dl-table__control"
429
+ >
427
430
  <slot
428
431
  name="bottom"
429
432
  v-bind="marginalsScope"
@@ -438,12 +441,13 @@
438
441
  </div>
439
442
 
440
443
  <slot
441
- v-bind="marginalsScope"
442
444
  name="pagination"
445
+ v-bind="marginalsScope"
443
446
  >
444
447
  <dl-pagination
445
448
  v-if="displayPagination"
446
449
  v-bind="marginalsScope.pagination"
450
+ total-items="rows.length"
447
451
  @update:rowsPerPage="
448
452
  (v) => setPagination({ rowsPerPage: v })
449
453
  "
@@ -699,7 +703,7 @@ export default defineComponent({
699
703
  })
700
704
  //
701
705
 
702
- const bottomMessage = computed(() => {
706
+ const noDataMessage = computed(() => {
703
707
  if (props.loading) {
704
708
  return props.loadingLabel
705
709
  }
@@ -1257,7 +1261,7 @@ export default defineComponent({
1257
1261
  bottomClasses,
1258
1262
  hasTopSlots,
1259
1263
  nothingToDisplay,
1260
- bottomMessage,
1264
+ noDataMessage,
1261
1265
  paginationState,
1262
1266
  hasTopSelectionMode,
1263
1267
  hasBotomSelectionBanner,
@@ -1,34 +1,108 @@
1
1
  <template>
2
- <div style="width: 700px">
3
- <dl-pagination
4
- v-model="page"
5
- :max="max"
6
- :boundary-numbers="boundaryNumbers"
7
- :boundary-links="boundaryLinks"
8
- :direction-links="directionLinks"
9
- :max-pages="maxPages"
10
- :disabled="disabled"
11
- :with-legend="withLegend"
12
- :total-items="total"
13
- :items-name="itemsName"
14
- :with-quick-navigation="withQuickNavigation"
15
- :with-rows-per-page="withRowsPerPage"
16
- />
2
+ <div style="align-items: stretch">
3
+ <div class="row">
4
+ <dl-input
5
+ v-model="rowsPerPage"
6
+ title="rowsPerPage"
7
+ />
8
+ <dl-input
9
+ v-model="total"
10
+ title="total items"
11
+ />
12
+ <dl-input
13
+ v-model="max"
14
+ title="max"
15
+ />
16
+ <dl-input
17
+ v-model="maxPages"
18
+ title="maxPages"
19
+ />
20
+ <dl-input
21
+ v-model="itemsName"
22
+ title="itemsName"
23
+ />
24
+ </div>
25
+ <div class="row">
26
+ <dl-checkbox
27
+ v-model="boundaryNumbers"
28
+ label="boundaryNumbers"
29
+ />
30
+ <dl-checkbox
31
+ v-model="boundaryLinks"
32
+ label="boundaryLinks"
33
+ />
34
+ <dl-checkbox
35
+ v-model="directionLinks"
36
+ label="directionLinks"
37
+ />
38
+ <dl-checkbox
39
+ v-model="disabled"
40
+ label="disabled"
41
+ />
42
+ <dl-checkbox
43
+ v-model="withLegend"
44
+ label="withLegend"
45
+ />
46
+ <dl-checkbox
47
+ v-model="withQuickNavigation"
48
+ label="withQuickNavigation"
49
+ />
50
+ <dl-checkbox
51
+ v-model="withRowsPerPage"
52
+ label="withRowsPerPage"
53
+ />
54
+ </div>
55
+ <div style="width: 700px">
56
+ <dl-pagination
57
+ v-model="page"
58
+ :max="max"
59
+ :rows-per-page="rowsPerPage"
60
+ :boundary-numbers="boundaryNumbers"
61
+ :boundary-links="boundaryLinks"
62
+ :direction-links="directionLinks"
63
+ :max-pages="maxPages"
64
+ :disabled="disabled"
65
+ :with-legend="withLegend"
66
+ :total-items="total"
67
+ :items-name="itemsName"
68
+ :with-quick-navigation="withQuickNavigation"
69
+ :with-rows-per-page="withRowsPerPage"
70
+ />
71
+ </div>
72
+ <div>
73
+ <h4>case 1</h4>
74
+ <p>with exactly 30 items, 15 per row. should be exactly 2 pages</p>
75
+ <dl-pagination
76
+ v-model="page"
77
+ :total-items="30"
78
+ :rows-per-page="15"
79
+ />
80
+ <h4>case 2</h4>
81
+ <p>with 31 items, 15 per row. should be exactly 3 pages</p>
82
+ <dl-pagination
83
+ v-model="page"
84
+ :total-items="31"
85
+ :rows-per-page="15"
86
+ />
87
+ </div>
17
88
  </div>
18
89
  </template>
19
90
 
20
91
  <script lang="ts">
21
92
  import { defineComponent } from 'vue-demi'
22
93
  import { DlPagination } from '../components'
94
+ import DlInput from '../components/compound/DlInput/DlInput.vue'
95
+ import DlCheckbox from '../components/essential/DlCheckbox/DlCheckbox.vue'
23
96
 
24
97
  export default defineComponent({
25
98
  name: 'DlPaginationDemo',
26
- components: { DlPagination },
99
+ components: { DlCheckbox, DlInput, DlPagination },
27
100
  data() {
28
101
  return {
29
102
  page: 18,
30
103
  max: 119,
31
104
  maxPages: 6,
105
+ rowsPerPage: 10,
32
106
  boundaryNumbers: true,
33
107
  boundaryLinks: true,
34
108
  directionLinks: true,
@@ -241,7 +241,48 @@
241
241
  </div>
242
242
  </div>
243
243
  <div>
244
- <p>#no-data & #pagination declare together</p>
244
+ <h3>slots #no-data & #pagination declare together</h3>
245
+ <h4>case 1: table with data</h4>
246
+ <p>
247
+ rows should appear with slot#pagination, slot#no-data should
248
+ not
249
+ </p>
250
+ <DlTable
251
+ :rows="tableRows"
252
+ :selected="selected"
253
+ :separator="separator"
254
+ :columns="columns"
255
+ :bordered="bordered"
256
+ :draggable="draggable"
257
+ :dense="dense"
258
+ class="sticky-header"
259
+ :filter="filter"
260
+ :selection="selection"
261
+ :loading="loading"
262
+ :resizable="resizable"
263
+ row-key="name"
264
+ color="dl-color-secondary"
265
+ title="Table Title"
266
+ :virtual-scroll="vScroll"
267
+ style="height: 200px"
268
+ :rows-per-page-options="rowsPerPageOptions"
269
+ @row-click="log"
270
+ @update:selected="updateSeleted"
271
+ >
272
+ <template #pagination>
273
+ <div style="background-color: #4db1d3">
274
+ &lt slot#pagination >
275
+ </div>
276
+ </template>
277
+ <template #no-data>
278
+ <div style="background-color: #734145">
279
+ &lt slot#no-data > should not be visible
280
+ </div>
281
+ </template>
282
+ </DlTable>
283
+ <h4>case 2: table with no data</h4>
284
+ <p>slot#no-data should appear, slot#pagination not</p>
285
+
245
286
  <DlTable
246
287
  :selected="selected"
247
288
  :separator="separator"
@@ -264,10 +305,14 @@
264
305
  @update:selected="updateSeleted"
265
306
  >
266
307
  <template #pagination>
267
- pagination slot, no-data slot should be visible too
308
+ <div style="background-color: #734145">
309
+ &lt slot#pagination > should not be visible
310
+ </div>
268
311
  </template>
269
312
  <template #no-data>
270
- no-data slot, pagination slot should be visible too
313
+ <div style="background-color: #2f3c4b">
314
+ &lt slot#no-data >
315
+ </div>
271
316
  </template>
272
317
  </DlTable>
273
318
  </div>