@dataloop-ai/components 0.18.106 → 0.18.108

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.106",
3
+ "version": "0.18.108",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -36,168 +36,241 @@
36
36
  />
37
37
  </template>
38
38
  <template #table-body="tableBodyProps">
39
- <template v-if="virtualScroll && !isEmpty">
40
- <DlTrTreeView
41
- :row="tableBodyProps.item"
42
- :is-row-selected="
43
- isRowSelected(rowKey, getRowKey(tableBodyProps.item))
44
- ? 'selected'
45
- : ''
46
- "
47
- :has-any-action="dlTableRef.hasAnyAction"
48
- :no-hover="dlTableRef.noHover"
49
- :page-index="tableBodyProps.index"
50
- :has-draggable-rows="dlTableRef.hasDraggableRows"
51
- :has-selection-mode="dlTableRef.hasSelectionMode"
52
- :bind-body-selection="
53
- dlTableRef.getBodySelectionScope({
54
- key: getRowKey(tableBodyProps.item),
55
- row: tableBodyProps.item,
56
- pageIndex: tableBodyProps.index
57
- })
58
- "
59
- :bind-body-cell-scope="
60
- (col) =>
61
- dlTableRef.getBodyCellScope({
62
- key: getRowKey(tableBodyProps.item),
63
- row: tableBodyProps.item,
64
- pageIndex: tableBodyProps.index,
65
- col
66
- })
67
- "
68
- :color="color"
69
- :computed-cols="dlTableRef.computedCols"
70
- :slot-name="dlTableRef.slotNames"
71
- :computed-rows="computedRows"
72
- :model-value="
73
- isRowSelected(rowKey, getRowKey(tableBodyProps.item))
74
- "
75
- @update:model-value="
76
- (adding, evt) =>
77
- updateSelectionHierarchy(
78
- adding,
79
- evt,
80
- tableBodyProps.item
81
- )
82
- "
83
- @rowClick="
84
- dlTableRef.onTrClick(
85
- $event,
86
- tableBodyProps.item,
87
- tableBodyProps.index
88
- )
89
- "
90
- @rowDoubleClick="
91
- dlTableRef.onTrDblClick(
92
- $event,
93
- tableBodyProps.item,
94
- tableBodyProps.index
95
- )
96
- "
97
- @rowContextMenu="
98
- dlTableRef.onTrContextMenu(
99
- $event,
100
- tableBodyProps.item,
101
- tableBodyProps.index
102
- )
103
- "
104
- @updateExpandedRow="
105
- updateExpandedRow(
106
- !tableBodyProps.item.expanded,
107
- getRowKey(tableBodyProps.item)
108
- )
109
- "
110
- >
111
- <template
112
- v-for="templateCol in dlTableRef.computedCols"
113
- #[getSlotByName(templateCol.name)]
114
- >
115
- <slot
116
- :name="getSlotByName(templateCol.name)"
117
- v-bind="
118
- dlTableRef.getBodyCellScope({
119
- key: getRowKey(tableBodyProps.item),
120
- row: tableBodyProps.item,
121
- pageIndex: tableBodyProps.index,
122
- col: templateCol
123
- })
124
- "
125
- />
126
- </template>
127
- </DlTrTreeView>
128
- </template>
129
- <template v-else>
130
- <template v-if="dlTableRef && !isEmpty">
131
- <DlTrTreeView
132
- v-for="(row, rowIndex) in computedRows"
39
+ <slot
40
+ name="table-body"
41
+ v-bind="tableBodyProps"
42
+ >
43
+ <template v-if="virtualScroll && !isEmpty">
44
+ <slot
45
+ v-for="(row, rowIndex) in dlTableRef.computedCols"
133
46
  :key="rowIndex"
134
- :row="row"
135
- :row-index="rowIndex"
136
- :row-key="rowKey"
137
- :is-row-selected="
138
- isRowSelected(rowKey, getRowKey(row))
139
- ? 'selected'
140
- : ''
141
- "
142
- :has-any-action="dlTableRef.hasAnyAction"
143
- :no-hover="dlTableRef.noHover"
144
- :has-draggable-rows="dlTableRef.hasDraggableRows"
145
- :has-selection-mode="dlTableRef.hasSelectionMode"
146
- :bind-body-selection="
147
- dlTableRef.getBodySelectionScope({
47
+ name="row-body"
48
+ v-bind="
49
+ dlTableRef.getBodyScope({
148
50
  key: getRowKey(row),
149
51
  row,
150
- pageIndex: rowIndex
52
+ pageIndex,
53
+ trClass: isRowSelected(getRowKey(row))
54
+ ? 'selected'
55
+ : ''
151
56
  })
152
57
  "
153
- :bind-body-cell-scope="
154
- (col) =>
155
- dlTableRef.getBodyCellScope({
156
- key: getRowKey(row),
157
- row,
158
- pageIndex: rowIndex,
159
- col
160
- })
161
- "
162
- :color="color"
163
- :computed-cols="dlTableRef.computedCols"
164
- :slot-name="dlTableRef.slotNames"
165
- :computed-rows="computedRows"
166
- :model-value="isRowSelected(rowKey, getRowKey(row))"
167
- @update:model-value="
168
- (adding, evt) =>
169
- updateSelectionHierarchy(adding, evt, row)
170
- "
171
- @rowClick="dlTableRef.onTrClick($event, row, rowIndex)"
172
- @rowDoubleClick="
173
- dlTableRef.onTrDblClick($event, row, rowIndex)
174
- "
175
- @rowContextMenu="
176
- dlTableRef.onTrContextMenu($event, row, rowIndex)
177
- "
178
- @updateExpandedRow="
179
- updateExpandedRow(!row.expanded, getRowKey(row))
180
- "
181
58
  >
182
- <template
183
- v-for="templateCol in dlTableRef.computedCols"
184
- #[getSlotByName(templateCol.name)]
59
+ <DlTrTreeView
60
+ :row="tableBodyProps.item"
61
+ :is-row-selected="
62
+ isRowSelected(
63
+ rowKey,
64
+ getRowKey(tableBodyProps.item)
65
+ )
66
+ ? 'selected'
67
+ : ''
68
+ "
69
+ :has-any-action="dlTableRef.hasAnyAction"
70
+ :no-hover="dlTableRef.noHover"
71
+ :page-index="tableBodyProps.index"
72
+ :has-draggable-rows="dlTableRef.hasDraggableRows"
73
+ :has-selection-mode="dlTableRef.hasSelectionMode"
74
+ :bind-body-selection="
75
+ dlTableRef.getBodySelectionScope({
76
+ key: getRowKey(tableBodyProps.item),
77
+ row: tableBodyProps.item,
78
+ pageIndex: tableBodyProps.index
79
+ })
80
+ "
81
+ :bind-body-cell-scope="
82
+ (col) =>
83
+ dlTableRef.getBodyCellScope({
84
+ key: getRowKey(tableBodyProps.item),
85
+ row: tableBodyProps.item,
86
+ pageIndex: tableBodyProps.index,
87
+ col
88
+ })
89
+ "
90
+ :color="color"
91
+ :computed-cols="dlTableRef.computedCols"
92
+ :slot-name="dlTableRef.slotNames"
93
+ :computed-rows="computedRows"
94
+ :model-value="
95
+ isRowSelected(
96
+ rowKey,
97
+ getRowKey(tableBodyProps.item)
98
+ )
99
+ "
100
+ @update:model-value="
101
+ (adding, evt) =>
102
+ updateSelectionHierarchy(
103
+ adding,
104
+ evt,
105
+ tableBodyProps.item
106
+ )
107
+ "
108
+ @rowClick="
109
+ dlTableRef.onTrClick(
110
+ $event,
111
+ tableBodyProps.item,
112
+ tableBodyProps.index
113
+ )
114
+ "
115
+ @rowDoubleClick="
116
+ dlTableRef.onTrDblClick(
117
+ $event,
118
+ tableBodyProps.item,
119
+ tableBodyProps.index
120
+ )
121
+ "
122
+ @rowContextMenu="
123
+ dlTableRef.onTrContextMenu(
124
+ $event,
125
+ tableBodyProps.item,
126
+ tableBodyProps.index
127
+ )
128
+ "
129
+ @updateExpandedRow="
130
+ updateExpandedRow(
131
+ !tableBodyProps.item.expanded,
132
+ getRowKey(tableBodyProps.item)
133
+ )
134
+ "
185
135
  >
136
+ <template
137
+ v-for="templateCol in dlTableRef.computedCols"
138
+ #[getSlotByName(templateCol.name)]
139
+ >
140
+ <slot
141
+ :name="getSlotByName(templateCol.name)"
142
+ v-bind="
143
+ dlTableRef.getBodyCellScope({
144
+ key: getRowKey(tableBodyProps.item),
145
+ row: tableBodyProps.item,
146
+ pageIndex: tableBodyProps.index,
147
+ col: templateCol
148
+ })
149
+ "
150
+ />
151
+ </template>
152
+ </DlTrTreeView>
153
+ </slot>
154
+ </template>
155
+ <template v-else>
156
+ <template v-if="dlTableRef && !isEmpty">
157
+ <template v-for="(row, rowIndex) in computedRows">
186
158
  <slot
187
- :name="getSlotByName(templateCol.name)"
159
+ name="row-body"
188
160
  v-bind="
189
- dlTableRef.getBodySelectionScope({
161
+ dlTableRef.getBodyScope({
190
162
  key: getRowKey(row),
191
163
  row,
192
- col: templateCol,
193
- pageIndex: rowIndex
164
+ pageIndex,
165
+ trClass: isRowSelected(getRowKey(row))
166
+ ? 'selected'
167
+ : ''
194
168
  })
195
169
  "
196
- />
170
+ >
171
+ <DlTrTreeView
172
+ :key="rowIndex"
173
+ :row="row"
174
+ :row-index="rowIndex"
175
+ :row-key="rowKey"
176
+ :is-row-selected="
177
+ isRowSelected(rowKey, getRowKey(row))
178
+ ? 'selected'
179
+ : ''
180
+ "
181
+ :has-any-action="dlTableRef.hasAnyAction"
182
+ :no-hover="dlTableRef.noHover"
183
+ :has-draggable-rows="
184
+ dlTableRef.hasDraggableRows
185
+ "
186
+ :has-selection-mode="
187
+ dlTableRef.hasSelectionMode
188
+ "
189
+ :bind-body-selection="
190
+ dlTableRef.getBodySelectionScope({
191
+ key: getRowKey(row),
192
+ row,
193
+ pageIndex: rowIndex
194
+ })
195
+ "
196
+ :bind-body-cell-scope="
197
+ (col) =>
198
+ dlTableRef.getBodyCellScope({
199
+ key: getRowKey(row),
200
+ row,
201
+ pageIndex: rowIndex,
202
+ col
203
+ })
204
+ "
205
+ :color="color"
206
+ :computed-cols="dlTableRef.computedCols"
207
+ :slot-name="dlTableRef.slotNames"
208
+ :computed-rows="computedRows"
209
+ :model-value="
210
+ isRowSelected(rowKey, getRowKey(row))
211
+ "
212
+ @update:model-value="
213
+ (adding, evt) =>
214
+ updateSelectionHierarchy(
215
+ adding,
216
+ evt,
217
+ row
218
+ )
219
+ "
220
+ @rowClick="
221
+ dlTableRef.onTrClick(
222
+ $event,
223
+ row,
224
+ rowIndex
225
+ )
226
+ "
227
+ @rowDoubleClick="
228
+ dlTableRef.onTrDblClick(
229
+ $event,
230
+ row,
231
+ rowIndex
232
+ )
233
+ "
234
+ @rowContextMenu="
235
+ dlTableRef.onTrContextMenu(
236
+ $event,
237
+ row,
238
+ rowIndex
239
+ )
240
+ "
241
+ @updateExpandedRow="
242
+ updateExpandedRow(
243
+ !row.expanded,
244
+ getRowKey(row)
245
+ )
246
+ "
247
+ >
248
+ <template
249
+ v-for="templateCol in dlTableRef.computedCols"
250
+ #[getSlotByName(templateCol.name)]
251
+ >
252
+ <slot
253
+ :name="
254
+ getSlotByName(templateCol.name)
255
+ "
256
+ v-bind="
257
+ dlTableRef.getBodySelectionScope(
258
+ {
259
+ key: getRowKey(row),
260
+ row,
261
+ col: templateCol,
262
+ pageIndex: rowIndex
263
+ }
264
+ )
265
+ "
266
+ />
267
+ </template>
268
+ </DlTrTreeView>
269
+ </slot>
197
270
  </template>
198
- </DlTrTreeView>
271
+ </template>
199
272
  </template>
200
- </template>
273
+ </slot>
201
274
  </template>
202
275
  <template #no-data>
203
276
  <slot name="no-data" />
@@ -212,7 +285,8 @@ import {
212
285
  defineComponent,
213
286
  isVue2,
214
287
  set,
215
- ref
288
+ ref,
289
+ h
216
290
  } from 'vue-demi'
217
291
  import { DlTable } from '../../../components'
218
292
  import DlTrTreeView from './views/DlTrTreeView.vue'
@@ -168,6 +168,42 @@
168
168
  style="height: 500px"
169
169
  />
170
170
  </div>
171
+ <div style="margin-top: 100px">
172
+ <p>Custom table body slot</p>
173
+ <DlTreeTable
174
+ class="sticky-header"
175
+ :separator="separator"
176
+ :columns="tableColumns"
177
+ color="dl-color-secondary"
178
+ style="height: 500px"
179
+ >
180
+ <template #table-body>
181
+ <div class="custom-body-slot">
182
+ Custom body slot inside tree table
183
+ </div>
184
+ </template>
185
+ </DlTreeTable>
186
+ </div>
187
+ <div style="margin-top: 100px">
188
+ <p>Custom row body slot</p>
189
+ <DlTreeTable
190
+ class="sticky-header"
191
+ :separator="separator"
192
+ :columns="tableColumns"
193
+ :rows="tableRows"
194
+ color="dl-color-secondary"
195
+ style="height: 500px"
196
+ >
197
+ <template #row-body="{ row }">
198
+ <tr>
199
+ Custom row slot, row name:
200
+ {{
201
+ row.name
202
+ }}
203
+ </tr>
204
+ </template>
205
+ </DlTreeTable>
206
+ </div>
171
207
  <div style="margin-top: 100px">
172
208
  <p>Empty State</p>
173
209
  <DlTreeTable
@@ -706,7 +742,6 @@ export default defineComponent({
706
742
  const onRowClick = (item: any) => {
707
743
  // console.log('onRowClick TreeTableDemo: ', item)
708
744
  }
709
-
710
745
  return {
711
746
  filter,
712
747
  selectedData,
@@ -805,4 +840,12 @@ export default defineComponent({
805
840
  top: 40px;
806
841
  }
807
842
  }
843
+ .custom-body-slot {
844
+ padding: 20px;
845
+ font-size: 35px;
846
+ text-align: center;
847
+ width: 100%;
848
+ display: flex;
849
+ justify-content: center;
850
+ }
808
851
  </style>