sprintify-ui 0.7.10 → 0.8.0

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.
Files changed (50) hide show
  1. package/dist/sprintify-ui.es.js +10776 -10630
  2. package/dist/style.css +1 -1
  3. package/dist/types/components/BaseAppDialogs.vue.d.ts +1 -0
  4. package/dist/types/components/BaseDataIterator.vue.d.ts +50 -4
  5. package/dist/types/components/BaseDataIteratorSectionColumns.vue.d.ts +156 -68
  6. package/dist/types/components/BaseDataTable.vue.d.ts +86 -6
  7. package/dist/types/components/BaseDataTableTemplate.vue.d.ts +44 -28
  8. package/dist/types/components/BaseDialog.vue.d.ts +9 -0
  9. package/dist/types/components/BaseTable.vue.d.ts +30 -7
  10. package/dist/types/components/BaseTableCell.vue.d.ts +19 -1
  11. package/dist/types/components/BaseTableColumn.vue.d.ts +50 -3
  12. package/dist/types/components/BaseTableHead.vue.d.ts +6 -5
  13. package/dist/types/components/BaseTableHeader.vue.d.ts +12 -2
  14. package/dist/types/components/BaseTableRow.vue.d.ts +5 -0
  15. package/dist/types/composables/isFirstColumn.d.ts +4 -0
  16. package/dist/types/composables/isLastColumn.d.ts +4 -0
  17. package/dist/types/composables/paginatedData.d.ts +5 -5
  18. package/dist/types/services/table/types.d.ts +6 -5
  19. package/dist/types/types/index.d.ts +9 -2
  20. package/dist/types/utils/getApiData.d.ts +1 -1
  21. package/package.json +2 -1
  22. package/src/assets/main.css +0 -1
  23. package/src/components/BaseAppDialogs.vue +1 -0
  24. package/src/components/BaseAvatar.vue +1 -0
  25. package/src/components/BaseDataIterator.stories.js +96 -1
  26. package/src/components/BaseDataIterator.vue +135 -11
  27. package/src/components/BaseDataIteratorSectionColumns.vue +2 -2
  28. package/src/components/BaseDataTable.stories.js +140 -50
  29. package/src/components/BaseDataTable.vue +82 -48
  30. package/src/components/BaseDataTableTemplate.vue +207 -372
  31. package/src/components/BaseDialog.stories.js +7 -0
  32. package/src/components/BaseDialog.vue +13 -1
  33. package/src/components/BaseTable.stories.js +57 -15
  34. package/src/components/BaseTable.vue +71 -9
  35. package/src/components/BaseTableBody.vue +1 -1
  36. package/src/components/BaseTableCell.vue +94 -36
  37. package/src/components/BaseTableColumn.vue +25 -2
  38. package/src/components/BaseTableHead.vue +17 -5
  39. package/src/components/BaseTableHeader.vue +39 -10
  40. package/src/components/BaseTableRow.vue +27 -6
  41. package/src/composables/isFirstColumn.ts +31 -0
  42. package/src/composables/isLastColumn.ts +31 -0
  43. package/src/composables/paginatedData.ts +22 -10
  44. package/src/services/table/classes.ts +13 -9
  45. package/src/services/table/types.ts +6 -5
  46. package/src/stores/dialogs.ts +1 -0
  47. package/src/stories/List.stories.js +5 -1
  48. package/src/types/index.ts +9 -2
  49. package/src/utils/getApiData.ts +1 -1
  50. package/src/assets/base-table.css +0 -17
@@ -1,7 +1,6 @@
1
1
  <template>
2
2
  <div
3
- class="base-table relative w-full overflow-hidden"
4
- :class="maxHeight ? 'base-table--has-max-height' : ''"
3
+ class="relative w-full overflow-hidden"
5
4
  >
6
5
  <div
7
6
  ref="slot"
@@ -10,282 +9,204 @@
10
9
  <slot />
11
10
  </div>
12
11
 
13
- <div class="flex flex-col">
14
- <div
15
- ref="scrollable"
16
- class="overflow-x-auto overflow-y-auto"
17
- data-scroll-lock-scrollable
18
- :style="{ maxHeight: maxHeight ? maxHeight + 'px' : undefined }"
19
- >
20
- <div class="inline-block min-w-full align-middle">
21
- <div class="relative min-h-[300px]">
22
- <table class="min-w-full border-separate border-spacing-0">
23
- <thead
24
- v-if="newColumns.length"
25
- ref="thead"
12
+ <BaseTable
13
+ ref="baseTableRef"
14
+ class="min-w-full"
15
+ :size="size"
16
+ :fixed-header="(maxHeight && maxHeight > 0) == true"
17
+ :fixed-column="true"
18
+ :max-height="maxHeight"
19
+ :loading="loading"
20
+ >
21
+ <BaseTableHead v-if="newColumns.length">
22
+ <BaseTableRow>
23
+ <BaseTableHeader
24
+ v-for="(column, index) in visibleColumns"
25
+ :key="column.newKey + ':' + index + 'header'"
26
+ v-bind="column.thAttrs && column.thAttrs(column)"
27
+ :style="column.style"
28
+ class="bg-slate-50"
29
+ >
30
+ <div class="flex gap-4">
31
+ <template v-if="index == 0">
32
+ <div
33
+ v-if="showDetailRowIcon"
34
+ class="flex h-5 w-5 shrink-0 grow-0"
35
+ />
36
+
37
+ <div
38
+ v-if="checkable"
39
+ class="flex items-center cursor-pointer"
40
+ @click="checkAll"
41
+ >
42
+ <input
43
+ type="checkbox"
44
+ autocomplete="off"
45
+ :checked="isAllChecked"
46
+ :disabled="isAllUncheckable"
47
+ :class="checkboxStyle"
48
+ >
49
+ </div>
50
+ </template>
51
+
52
+ <button
53
+ type="button"
54
+ class="flex gap-1 w-full items-center bg-transparent text-left text-sm font-medium leading-tight text-slate-900"
55
+ :class="{
56
+ 'cursor-pointer': column.sortable,
57
+ }"
58
+ @click="sort(column, undefined, $event as any)"
26
59
  >
27
- <tr>
28
- <th
29
- v-if="showDetailRowIcon"
30
- class="th"
31
- :style="detailsStyles(true)"
32
- />
33
- <th
34
- v-if="checkable && checkboxPosition === 'left'"
35
- class="th group cursor-pointer py-0 pl-3"
36
- align="left"
37
- :style="checkStyles(true)"
38
- @click="checkAll"
60
+ <span
61
+ class="whitespace-nowrap text-slate-600"
62
+ :class="{
63
+ 'text-[12px]': size == 'sm',
64
+ 'text-xs': size == 'md',
65
+ }"
66
+ >
67
+ {{ column.label }}
68
+ </span>
69
+ <div
70
+ v-if="column.sortable"
71
+ :class="[
72
+ currentSortColumn === column
73
+ ? ''
74
+ : 'opacity-0 duration-200 group-hover:opacity-100',
75
+ ]"
76
+ >
77
+ <svg
78
+ viewBox="0 0 20 20"
79
+ class="h-5 w-5"
39
80
  >
40
- <div class="flex items-center">
41
- <input
42
- type="checkbox"
43
- autocomplete="off"
44
- :checked="isAllChecked"
45
- :disabled="isAllUncheckable"
46
- :class="checkboxStyle"
47
- >
48
- </div>
49
- </th>
50
- <th
51
- v-for="(column, index) in visibleColumns"
52
- :key="column.newKey + ':' + index + 'header'"
53
- v-bind="column.thAttrs && column.thAttrs(column)"
54
- :style="[
55
- column.style,
56
- index == 0 ? firstColStyles(true) : {},
57
- ]"
58
- class="th group text-left px-3 py-2"
59
- :class="{
60
- 'cursor-pointer': column.sortable,
61
- }"
62
- @click.stop="sort(column, undefined, $event as any)"
81
+ <path
82
+ :opacity="!isAsc ? '0.5' : '1'"
83
+ fill="currentColor"
84
+ d="M9.116 4.823a1.25 1.25 0 0 1 1.768 0l2.646 2.647a.75.75 0 0 1-1.06 1.06l-2.47-2.47-2.47 2.47a.75.75 0 1 1-1.06-1.06l2.646-2.647Z"
85
+ ></path>
86
+ <path
87
+ :opacity="isAsc ? '0.5' : '1'"
88
+ fill="currentColor"
89
+ d="M9.116 15.177a1.25 1.25 0 0 0 1.768 0l2.646-2.647a.75.75 0 0 0-1.06-1.06l-2.47 2.47-2.47-2.47a.75.75 0 0 0-1.06 1.06l2.646 2.647Z"
90
+ ></path>
91
+ </svg>
92
+ </div>
93
+ </button>
94
+ </div>
95
+ </BaseTableHeader>
96
+ </BaseTableRow>
97
+ </BaseTableHead>
98
+
99
+ <BaseTableBody class="bg-white">
100
+ <template
101
+ v-for="(row, index) in data"
102
+ :key="getRowKey(row)"
103
+ >
104
+ <BaseTableRow
105
+ :to="rowTo ? rowTo(row) : undefined"
106
+ v-bind="rowBindings(row, index)"
107
+ >
108
+ <BaseTableCell
109
+ v-for="(column, columnIndex) in visibleColumns"
110
+ :key="column.newKey + index + ':' + columnIndex"
111
+ v-bind="column.tdAttrs && column.tdAttrs(row, column)"
112
+ :class="column.class"
113
+ :style="column.style"
114
+ :to="column.to ? column.to(row) : undefined"
115
+ :href="column.href ? column.href(row) : undefined"
116
+ :target="column.target"
117
+ :ignore-row-interactions="column.ignoreRowInteractions"
118
+ :on-click="onCellClick(row, index, column, columnIndex)"
119
+ >
120
+ <div :class="[columnIndex == 0 ? 'flex items-center gap-4' : '']">
121
+ <template v-if="columnIndex == 0">
122
+ <div
123
+ v-if="showDetailRowIcon"
124
+ class="relative z-[1] || flex h-5 w-5 shrink-0 grow-0 appearance-none items-center justify-center rounded-full border border-slate-300 bg-white text-slate-400 shadow duration-100 hover:text-slate-600 hover:shadow-md"
125
+ @click.stop="toggleDetails(row)"
63
126
  >
64
- <button
65
- type="button"
66
- class="flex w-full items-center bg-transparent text-left text-sm font-medium leading-tight text-slate-900"
127
+ <BaseIcon
128
+ v-if="hasDetailedVisible(row)"
129
+ icon="mdi:chevron-down"
130
+ class="h-5 w-5 duration-300"
67
131
  :class="{
68
- 'text-blue-600':
69
- column.sortable && currentSortColumn === column,
132
+ 'rotate-180': isVisibleDetailRow(row)
70
133
  }"
71
- >
72
- <span
73
- class="whitespace-nowrap text-slate-600"
74
- :class="{
75
- 'text-[12px]': size == 'sm',
76
- 'text-xs': size == 'md',
77
- }"
78
- >
79
- {{ column.label }}
80
- </span>
81
- <div
82
- v-if="column.sortable"
83
- class="w-3"
84
- :class="[
85
- currentSortColumn === column
86
- ? ''
87
- : 'opacity-0 duration-200 group-hover:opacity-100',
88
- ]"
89
- >
90
- <svg
91
- viewBox="0 0 20 20"
92
- class="absolute top-1/2 h-5 w-5 -translate-y-1/2"
93
- >
94
- <path
95
- :opacity="!isAsc ? '0.5' : '1'"
96
- fill="currentColor"
97
- d="M9.116 4.823a1.25 1.25 0 0 1 1.768 0l2.646 2.647a.75.75 0 0 1-1.06 1.06l-2.47-2.47-2.47 2.47a.75.75 0 1 1-1.06-1.06l2.646-2.647Z"
98
- ></path>
99
- <path
100
- :opacity="isAsc ? '0.5' : '1'"
101
- fill="currentColor"
102
- d="M9.116 15.177a1.25 1.25 0 0 0 1.768 0l2.646-2.647a.75.75 0 0 0-1.06-1.06l-2.47 2.47-2.47-2.47a.75.75 0 0 0-1.06 1.06l2.646 2.647Z"
103
- ></path>
104
- </svg>
105
- </div>
106
- </button>
107
- </th>
108
- <th
109
- v-if="checkable && checkboxPosition === 'right'"
110
- class="th group cursor-pointer pr-3"
111
- align="right"
112
- @click="checkAll"
134
+ />
135
+ </div>
136
+
137
+ <div
138
+ v-if="checkable"
139
+ class="relative z-[1] || flex items-center group cursor-pointer bg-white"
140
+ @click.stop="checkRow(row, index, $event as MouseEvent)"
113
141
  >
114
142
  <input
115
- autocomplete="off"
116
143
  type="checkbox"
117
- :checked="isAllChecked"
118
- :disabled="isAllUncheckable"
144
+ autocomplete="off"
145
+ :disabled="!isRowCheckable(row)"
146
+ :checked="isRowChecked(row)"
119
147
  :class="checkboxStyle"
120
148
  >
121
- </th>
122
- </tr>
123
- </thead>
124
-
125
- <tbody class="bg-white">
126
- <template
127
- v-for="(row, index) in data"
128
- :key="getRowKey(row)"
129
- >
130
- <tr class="item-row">
131
- <td
132
- v-if="showDetailRowIcon"
133
- class="group cursor-pointer bg-white pl-3"
134
- :class="borderBottomClasses(index, row)"
135
- :style="detailsStyles(false)"
136
- @click.stop="toggleDetails(row)"
137
- >
138
- <button
139
- type="button"
140
- class="mr-0 flex h-5 w-5 appearance-none items-center justify-center rounded-full border border-slate-300 bg-white text-slate-400 shadow duration-100 group-hover:text-slate-600 group-hover:shadow-md"
141
- >
142
- <BaseIcon
143
- v-if="hasDetailedVisible(row)"
144
- icon="mdi:chevron-down"
145
- class="h-5 w-5 duration-300"
146
- :class="{
147
- 'rotate-180': isVisibleDetailRow(row),
148
- }"
149
- />
150
- </button>
151
- </td>
152
-
153
- <td
154
- v-if="checkable && checkboxPosition === 'left'"
155
- class="group z-[1] cursor-pointer bg-white pl-3"
156
- :class="borderBottomClasses(index, row)"
157
- :style="checkStyles(false)"
158
- @click="checkRow(row, index, $event as MouseEvent)"
159
- >
160
- <div class="flex items-center">
161
- <input
162
- type="checkbox"
163
- autocomplete="off"
164
- :disabled="!isRowCheckable(row)"
165
- :checked="isRowChecked(row)"
166
- :class="checkboxStyle"
167
- >
168
- </div>
169
- </td>
170
-
171
- <SlotComponent
172
- v-for="(column, colindex) in visibleColumns"
173
- :key="column.newKey + index + ':' + colindex"
174
- v-bind="column.tdAttrs && column.tdAttrs(row, column)"
175
- :component="column"
176
- scoped
177
- name="default"
178
- tag="td"
179
- class="bg-white text-sm"
180
- :class="[
181
- borderBottomClasses(index, row),
182
- column.clickable ? 'cursor-pointer' : '',
183
- {
184
- 'py-1 px-3': size == 'sm',
185
- 'py-2 px-3': size == 'md',
186
- }
187
- ]"
188
- :style="[
189
- column.style,
190
- colindex === 0 ? firstColStyles(false) : {}
191
- ]"
192
- :data-label="column.label"
193
- :props="{ row, column, index, colindex, toggleDetails }"
194
- @click="onColumnClick(row, column, index, colindex, $event)"
195
- />
196
-
197
- <td
198
- v-if="checkable && checkboxPosition === 'right'"
199
- class="group cursor-pointer"
200
- :class="[
201
- borderBottomClasses(index, row),
202
- {
203
- 'px-3 py-1': size == 'sm',
204
- 'p-3': size == 'md',
205
- }
206
- ]"
207
- align="right"
208
- @click="checkRow(row, index, $event as MouseEvent)"
209
- >
210
- <input
211
- type="checkbox"
212
- autocomplete="off"
213
- :disabled="!isRowCheckable(row)"
214
- :checked="isRowChecked(row)"
215
- :class="checkboxStyle"
216
- >
217
- </td>
218
- </tr>
219
-
220
- <transition :name="detailTransition">
221
- <tr
222
- v-if="isActiveDetailRow(row)"
223
- :key="getRowKey(row) + 'detail'"
224
- >
225
- <td
226
- :colspan="columnCount"
227
- :class="borderBottomDetailClasses(index)"
228
- >
229
- <slot
230
- name="detail"
231
- :row="row"
232
- :index="index"
233
- />
234
- </td>
235
- </tr>
236
- </transition>
149
+ </div>
237
150
  </template>
238
151
 
239
- <tr v-if="data.length == 0">
240
- <td :colspan="columnCount">
241
- <slot name="empty" />
242
- </td>
243
- </tr>
244
- </tbody>
245
- </table>
246
-
247
- <slot name="loading">
248
- <Transition
249
- enter-active-class="transition ease-out duration-200"
250
- enter-from-class="opacity-0"
251
- enter-to-class="opacity-100"
252
- leave-active-class="transition ease-in duration-200"
253
- leave-from-class="opacity-100"
254
- leave-to-class="opacity-0"
152
+ <SlotComponent
153
+ :component="column"
154
+ scoped
155
+ name="default"
156
+ tag="div"
157
+ class="text-sm"
158
+ :data-label="column.label"
159
+ :props="{ row, column, index, columnIndex, toggleDetails }"
160
+ />
161
+ </div>
162
+ </BaseTableCell>
163
+ </BaseTableRow>
164
+
165
+ <transition :name="detailTransition">
166
+ <BaseTableRow
167
+ v-if="isActiveDetailRow(row)"
168
+ :key="getRowKey(row) + 'detail'"
169
+ >
170
+ <BaseTableCell
171
+ :colspan="columnCount"
255
172
  >
256
- <div
257
- v-if="loading"
258
- class="absolute inset-0 z-[1] flex h-full w-full items-start justify-center"
259
- >
260
- <div class="absolute h-full w-full bg-white bg-opacity-60" />
261
-
262
- <div class="pt-20">
263
- <BaseSpinnerLarge class="h-10 w-10 text-blue-500" />
264
- </div>
265
- </div>
266
- </Transition>
267
- </slot>
268
- </div>
269
- </div>
270
- </div>
271
- </div>
173
+ <slot
174
+ name="detail"
175
+ :row="row"
176
+ :index="index"
177
+ />
178
+ </BaseTableCell>
179
+ </BaseTableRow>
180
+ </transition>
181
+ </template>
182
+
183
+ <BaseTableRow v-if="data.length == 0">
184
+ <BaseTableCell :colspan="columnCount">
185
+ <slot name="empty" />
186
+ </BaseTableCell>
187
+ </BaseTableRow>
188
+ </BaseTableBody>
189
+ </BaseTable>
272
190
  </div>
273
191
  </template>
274
192
 
275
193
  <script lang="ts" setup>
276
- import { PropType, StyleValue, ref } from 'vue';
277
- import { BaseTableColumnData, Row } from '@/types';
194
+ import { PropType, ref } from 'vue';
195
+ import { BaseTableColumnData, CollectionItem, Row } from '@/types';
278
196
  import SlotComponent from './SlotComponent';
279
- import { useResizeObserver, useScroll } from '@vueuse/core';
280
- import { debounce, isArray } from 'lodash';
281
- import BaseSpinnerLarge from '../svg/BaseSpinnerLarge.vue';
197
+ import { isArray } from 'lodash';
282
198
  import { Size } from '@/utils/sizes';
283
199
  import objectHash from 'object-hash';
200
+ import BaseTable from './BaseTable.vue';
201
+ import BaseTableHead from './BaseTableHead.vue';
202
+ import BaseTableHeader from './BaseTableHeader.vue';
203
+ import BaseTableBody from './BaseTableBody.vue';
204
+ import BaseTableRow from './BaseTableRow.vue';
205
+ import BaseTableCell from './BaseTableCell.vue';
206
+ import { RouteLocationRaw } from 'vue-router';
284
207
 
285
208
  const checkboxStyle =
286
209
  'disabled:bg-slate-100 group-hover:shadow-md disabled:border-slate-300 disabled:cursor-not-allowed duration-300 cursor-pointer focus:ring-blue-300 border border-slate-300 shadow h-[18px] w-[18px] rounded';
287
- const DETAIL_ROW_WIDTH = 36;
288
- const CHECK_ROW_WIDTH = 36;
289
210
 
290
211
  defineOptions({
291
212
  name: 'BaseDataTableTemplate',
@@ -307,7 +228,7 @@ const props = defineProps({
307
228
  },
308
229
  visibleColumns: {
309
230
  default: undefined,
310
- type: Array as PropType<number[]>,
231
+ type: Array as PropType<string[]>,
311
232
  },
312
233
  /** Allow row details */
313
234
  detailed: {
@@ -319,14 +240,6 @@ const props = defineProps({
319
240
  default: false,
320
241
  type: Boolean,
321
242
  },
322
- /**
323
- * Position of the checkbox (if checkable is true)
324
- * @values left, right
325
- */
326
- checkboxPosition: {
327
- type: String as PropType<'left' | 'right'>,
328
- default: 'left',
329
- },
330
243
  /** Custom method to verify if a row is checkable, works when is checkable */
331
244
  isRowCheckable: {
332
245
  type: Function,
@@ -369,6 +282,18 @@ const props = defineProps({
369
282
  type: String as PropType<Size>,
370
283
  default: 'md',
371
284
  },
285
+ rowTo: {
286
+ default: undefined,
287
+ type: Function as PropType<((row: CollectionItem) => RouteLocationRaw) | undefined>,
288
+ },
289
+ rowHref: {
290
+ default: undefined,
291
+ type: Function as PropType<((row: CollectionItem) => string) | undefined>,
292
+ },
293
+ onRowClick: {
294
+ default: undefined,
295
+ type: Function as PropType<((row: CollectionItem, index: number, event: MouseEvent) => void) | undefined>,
296
+ },
372
297
  });
373
298
 
374
299
  const emit = defineEmits([
@@ -380,6 +305,7 @@ const emit = defineEmits([
380
305
  'update:openedDetailed',
381
306
  'sort',
382
307
  'cell-click',
308
+ 'row-click',
383
309
  ]);
384
310
 
385
311
  const visibleDetailRows = ref<string[]>([]);
@@ -392,20 +318,6 @@ const defaultSlots = ref<BaseTableColumnData[]>([]);
392
318
  const sequence = ref(1);
393
319
 
394
320
  const slot = ref<HTMLElement | null>(null);
395
- const thead = ref<HTMLElement | null>(null);
396
- const theadHeight = ref(0);
397
-
398
- useResizeObserver(thead, () => setTheadHeightDebounce());
399
-
400
- const setTheadHeightDebounce = debounce(() => {
401
- setTheadHeight();
402
- }, 100);
403
-
404
- function setTheadHeight() {
405
- if (thead.value) {
406
- theadHeight.value = thead.value.clientHeight;
407
- }
408
- }
409
321
 
410
322
  const newColumns = computed(() => {
411
323
  return defaultSlots.value;
@@ -749,38 +661,24 @@ function removeColumn(column: BaseTableColumnData) {
749
661
  );
750
662
  }
751
663
 
752
- const borderClasses = 'border-b border-slate-200';
753
-
754
- function borderBottomClasses(index: number, row: Row): string {
755
- if (index < props.data.length - 1) {
756
- return borderClasses;
757
- }
758
-
759
- if (isActiveDetailRow(row)) {
760
- return borderClasses;
664
+ function rowBindings(row: CollectionItem, index: number) {
665
+ return {
666
+ onClick: props.onRowClick ? (event: MouseEvent) => props.onRowClick && props.onRowClick(row, index, event) : undefined,
761
667
  }
762
-
763
- return '';
764
668
  }
765
669
 
766
- function borderBottomDetailClasses(index: number): string {
767
- if (index < props.data.length - 1) {
768
- return borderClasses;
670
+ function onCellClick(row: CollectionItem, index: number, column: BaseTableColumnData, columnIndex: number) {
671
+ if (!column.onClick) {
672
+ return undefined;
769
673
  }
770
674
 
771
- return '';
772
- }
675
+ return (event: MouseEvent) => {
676
+ if (!column.onClick) {
677
+ return;
678
+ }
773
679
 
774
- function onColumnClick(
775
- row: Row,
776
- column: BaseTableColumnData,
777
- index: number,
778
- colindex: number,
779
- event: MouseEvent
780
- ) {
781
- if (column.clickable) {
782
- emit('cell-click', row, column, index, colindex, event);
783
- }
680
+ column.onClick(row, index, column, columnIndex, event);
681
+ };
784
682
  }
785
683
 
786
684
  function nextSequence() {
@@ -800,80 +698,17 @@ function getRowKey(row: Row): string {
800
698
  return objectHash(row);
801
699
  }
802
700
 
803
- // Sticky styles
804
-
805
- const horizontalScrolling = ref(false);
806
- const scrollable = ref<null | HTMLElement>(null);
807
-
808
- const { x } = useScroll(scrollable);
809
- watch(x, (value) => {
810
- horizontalScrolling.value = value > 0;
811
- });
812
-
813
- function zIndex(th: boolean) {
814
- if (th) {
815
- return props.maxHeight ? 3 : 2;
816
- }
817
- return 1;
818
- }
819
-
820
- function detailsStyles(th: boolean): StyleValue {
821
- if (props.detailed) {
822
- return {
823
- zIndex: zIndex(th) + 1,
824
- position: 'sticky',
825
- left: 0,
826
- width: DETAIL_ROW_WIDTH + 'px',
827
- minWidth: DETAIL_ROW_WIDTH + 'px',
828
- maxWidth: DETAIL_ROW_WIDTH + 'px',
829
- };
830
- }
831
- return {};
832
- }
833
-
834
- function checkStyles(th: boolean): StyleValue {
835
- if (props.checkable) {
836
- return {
837
- zIndex: zIndex(th) + 1,
838
- position: 'sticky',
839
- left: props.detailed ? DETAIL_ROW_WIDTH + 'px' : 0,
840
- width: CHECK_ROW_WIDTH + 'px',
841
- minWidth: CHECK_ROW_WIDTH + 'px',
842
- maxWidth: CHECK_ROW_WIDTH + 'px',
843
- };
844
- }
845
- return {};
846
- }
847
-
848
- function firstColStyles(th: boolean): StyleValue {
849
- let left = 0;
850
- if (props.checkable) {
851
- left += CHECK_ROW_WIDTH;
852
- }
853
- if (props.detailed) {
854
- left += DETAIL_ROW_WIDTH;
855
- }
856
- return {
857
- zIndex: zIndex(th) + 1,
858
- position: 'sticky',
859
- left: left + 'px',
860
- borderRight: horizontalScrolling.value ? '1px solid #e2e8f0' : 'none',
861
- };
862
- }
863
-
864
- function scrollTop() {
865
- if (scrollable.value) {
866
- scrollable.value.scrollTo({ top: 0, behavior: 'smooth' });
867
- }
868
- }
869
-
870
701
  provide('addColumn', addColumn);
871
702
  provide('removeColumn', removeColumn);
872
703
  provide('nextSequence', nextSequence);
873
704
 
705
+ const baseTableRef = ref<InstanceType<typeof BaseTable> | null>(null);
706
+
874
707
  defineExpose({
875
708
  newColumns,
876
709
  uncheckAll,
877
- scrollTop,
710
+ scrollTop: () => {
711
+ baseTableRef.value?.scrollTop();
712
+ },
878
713
  });
879
714
  </script>