@semcore/data-table 3.0.8 → 3.1.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.
package/src/DataTable.tsx CHANGED
@@ -1,17 +1,17 @@
1
1
  import React from 'react';
2
- import createComponent, { Component, sstyled, Root, PropGetterFn } from '@semcore/core';
2
+ import createComponent, { Component, PropGetterFn, Root, sstyled } from '@semcore/core';
3
3
  import { Box, IBoxProps, IFlexProps } from '@semcore/flex-box';
4
4
  import syncScroll from '@semcore/utils/lib/syncScroll';
5
5
  import { callAllEventHandlers } from '@semcore/utils/lib/assignProps';
6
6
  import fire from '@semcore/utils/lib/fire';
7
7
  import { flattenColumns } from './utils';
8
8
  import type {
9
+ Column,
10
+ NestedCells,
11
+ PropsLayer,
12
+ PseudoChildPropsGetter,
9
13
  RowData,
10
14
  SortDirection,
11
- PseudoChildPropsGetter,
12
- PropsLayer,
13
- NestedCells,
14
- Column,
15
15
  } from './types';
16
16
  import Head from './Head';
17
17
  import Body from './Body';
@@ -117,6 +117,10 @@ export interface IDataTableBodyProps extends IBoxProps {
117
117
  * @default { tollerance: 2 }
118
118
  */
119
119
  virtualScroll?: boolean | { tollerance?: number; rowHeight?: number };
120
+ /**
121
+ * Called every time user scrolls area
122
+ */
123
+ onScroll?: (event: React.SyntheticEvent<HTMLElement>) => void;
120
124
  }
121
125
 
122
126
  export interface IDataTableRowProps extends IBoxProps {
@@ -230,7 +234,6 @@ class RootDefinitionTable extends Component<AsProps> {
230
234
  }
231
235
 
232
236
  const column = this.columns.find((column) => column.name === name);
233
-
234
237
  columnsChildren.push({
235
238
  get width() {
236
239
  return this.props.ref.current?.getBoundingClientRect().width || 0;
@@ -301,7 +304,7 @@ class RootDefinitionTable extends Component<AsProps> {
301
304
  }
302
305
  });
303
306
 
304
- const result = {
307
+ return {
305
308
  columns: this.columns,
306
309
  rows: this.dataToRows(data, cellPropsLayers),
307
310
  uniqueKey,
@@ -309,8 +312,6 @@ class RootDefinitionTable extends Component<AsProps> {
309
312
  rowPropsLayers,
310
313
  $scrollRef: this.scrollBodyRef,
311
314
  };
312
-
313
- return result;
314
315
  }
315
316
 
316
317
  dataToRows(data: RowData[], cellPropsLayers: { [columnName: string]: PropsLayer[] }) {
package/src/Head.tsx CHANGED
@@ -105,8 +105,8 @@ class Head extends Component<AsProps> {
105
105
 
106
106
  render() {
107
107
  const SHead = Root;
108
- const { Children, styles, columnsChildren, onResize, $scrollRef, sticky } = this.asProps;
109
108
  const SHeadWrapper = Box;
109
+ const { Children, styles, columnsChildren, onResize, $scrollRef, sticky } = this.asProps;
110
110
 
111
111
  this.columns = flattenColumns(columnsChildren);
112
112
 
@@ -288,6 +288,8 @@ SScrollAreaBar[orientation='horizontal'] {
288
288
  SHeightHold {
289
289
  position: absolute;
290
290
  top: 0;
291
- width: 0;
291
+ width: 100%;
292
292
  pointer-events: none;
293
+ /* should be under other layers */
294
+ z-index: -1;
293
295
  }