@dataloop-ai/components 0.18.106 → 0.18.107

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.107",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -36,168 +36,234 @@
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
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"
46
+ :key="rowIndex"
47
+ name="row-body"
48
+ v-bind="
49
+ dlTableRef.getBodyScope({
50
+ key: getRowKey(row),
51
+ row,
52
+ pageIndex,
53
+ trClass: isRowSelected(getRowKey(row))
54
+ ? 'selected'
55
+ : ''
66
56
  })
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)]
57
+ "
114
58
  >
115
- <slot
116
- :name="getSlotByName(templateCol.name)"
117
- v-bind="
118
- dlTableRef.getBodyCellScope({
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({
119
76
  key: getRowKey(tableBodyProps.item),
120
77
  row: tableBodyProps.item,
121
- pageIndex: tableBodyProps.index,
122
- col: templateCol
78
+ pageIndex: tableBodyProps.index
123
79
  })
124
80
  "
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"
133
- :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({
148
- key: getRowKey(row),
149
- row,
150
- pageIndex: rowIndex
151
- })
152
- "
153
- :bind-body-cell-scope="
154
- (col) =>
155
- dlTableRef.getBodyCellScope({
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
+ "
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
+ <slot
158
+ v-for="(row, rowIndex) in dlTableRef.computedCols"
159
+ :key="rowIndex"
160
+ name="row-body"
161
+ v-bind="
162
+ dlTableRef.getBodyScope({
156
163
  key: getRowKey(row),
157
164
  row,
158
- pageIndex: rowIndex,
159
- col
165
+ pageIndex,
166
+ trClass: isRowSelected(getRowKey(row))
167
+ ? 'selected'
168
+ : ''
160
169
  })
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
- >
182
- <template
183
- v-for="templateCol in dlTableRef.computedCols"
184
- #[getSlotByName(templateCol.name)]
170
+ "
185
171
  >
186
- <slot
187
- :name="getSlotByName(templateCol.name)"
188
- v-bind="
172
+ <DlTrTreeView
173
+ v-for="(row, rowIndex) in computedRows"
174
+ :key="rowIndex"
175
+ :row="row"
176
+ :row-index="rowIndex"
177
+ :row-key="rowKey"
178
+ :is-row-selected="
179
+ isRowSelected(rowKey, getRowKey(row))
180
+ ? 'selected'
181
+ : ''
182
+ "
183
+ :has-any-action="dlTableRef.hasAnyAction"
184
+ :no-hover="dlTableRef.noHover"
185
+ :has-draggable-rows="
186
+ dlTableRef.hasDraggableRows
187
+ "
188
+ :has-selection-mode="
189
+ dlTableRef.hasSelectionMode
190
+ "
191
+ :bind-body-selection="
189
192
  dlTableRef.getBodySelectionScope({
190
193
  key: getRowKey(row),
191
194
  row,
192
- col: templateCol,
193
195
  pageIndex: rowIndex
194
196
  })
195
197
  "
196
- />
197
- </template>
198
- </DlTrTreeView>
198
+ :bind-body-cell-scope="
199
+ (col) =>
200
+ dlTableRef.getBodyCellScope({
201
+ key: getRowKey(row),
202
+ row,
203
+ pageIndex: rowIndex,
204
+ col
205
+ })
206
+ "
207
+ :color="color"
208
+ :computed-cols="dlTableRef.computedCols"
209
+ :slot-name="dlTableRef.slotNames"
210
+ :computed-rows="computedRows"
211
+ :model-value="
212
+ isRowSelected(rowKey, getRowKey(row))
213
+ "
214
+ @update:model-value="
215
+ (adding, evt) =>
216
+ updateSelectionHierarchy(
217
+ adding,
218
+ evt,
219
+ row
220
+ )
221
+ "
222
+ @rowClick="
223
+ dlTableRef.onTrClick($event, row, rowIndex)
224
+ "
225
+ @rowDoubleClick="
226
+ dlTableRef.onTrDblClick(
227
+ $event,
228
+ row,
229
+ rowIndex
230
+ )
231
+ "
232
+ @rowContextMenu="
233
+ dlTableRef.onTrContextMenu(
234
+ $event,
235
+ row,
236
+ rowIndex
237
+ )
238
+ "
239
+ @updateExpandedRow="
240
+ updateExpandedRow(
241
+ !row.expanded,
242
+ getRowKey(row)
243
+ )
244
+ "
245
+ >
246
+ <template
247
+ v-for="templateCol in dlTableRef.computedCols"
248
+ #[getSlotByName(templateCol.name)]
249
+ >
250
+ <slot
251
+ :name="getSlotByName(templateCol.name)"
252
+ v-bind="
253
+ dlTableRef.getBodySelectionScope({
254
+ key: getRowKey(row),
255
+ row,
256
+ col: templateCol,
257
+ pageIndex: rowIndex
258
+ })
259
+ "
260
+ />
261
+ </template>
262
+ </DlTrTreeView>
263
+ </slot>
264
+ </template>
199
265
  </template>
200
- </template>
266
+ </slot>
201
267
  </template>
202
268
  <template #no-data>
203
269
  <slot name="no-data" />
@@ -168,6 +168,41 @@
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
+ color="dl-color-secondary"
194
+ style="height: 500px"
195
+ >
196
+ <template #row-body="{ row }">
197
+ <tr>
198
+ Custom row slot, row name:
199
+ {{
200
+ row.name
201
+ }}
202
+ </tr>
203
+ </template>
204
+ </DlTreeTable>
205
+ </div>
171
206
  <div style="margin-top: 100px">
172
207
  <p>Empty State</p>
173
208
  <DlTreeTable
@@ -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>