@true-engineering/true-react-common-ui-kit 3.46.0 → 3.48.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/README.md CHANGED
@@ -11,6 +11,19 @@
11
11
 
12
12
  # Release Notes
13
13
 
14
+ ## 3.48.0
15
+
16
+ ### Changes
17
+
18
+ - **FlexibleTable**: Добавлен rowRef
19
+
20
+ ## 3.47.0
21
+
22
+ ### Changes
23
+
24
+ - **Select**: Добавлен ref в пропсу `searchInput` Select-а
25
+ - **Select**: Добавлен shouldFocusOnMount в пропсу `searchInput` Select-а
26
+
14
27
  ## 3.46.0
15
28
 
16
29
  ### Changes
@@ -3,7 +3,7 @@ import { ICommonProps } from '../../types';
3
3
  import { IFlexibleTableRowProps } from './components';
4
4
  import { ITableRow, IFlexibleTableConfigType, IInfinityScrollConfig, IFlexibleTableRenderMode, IHeaderContent } from './types';
5
5
  import { IFlexibleTableStyles } from './FlexibleTable.styles';
6
- export interface IFlexibleTableProps<Row extends ITableRow, HeaderContent extends IHeaderContent<Row>, UniqueField extends keyof Row> extends ICommonProps<IFlexibleTableStyles>, Pick<IFlexibleTableRowProps<Row, HeaderContent, UniqueField>, 'uniqueField' | 'rowAttributes' | 'isFirstColumnSticky' | 'isExpandableRowComponentInitiallyOpen' | 'expandableRowComponent' | 'onRowClick' | 'onRowHover'> {
6
+ export interface IFlexibleTableProps<Row extends ITableRow, HeaderContent extends IHeaderContent<Row>, UniqueField extends keyof Row> extends ICommonProps<IFlexibleTableStyles>, Pick<IFlexibleTableRowProps<Row, HeaderContent, UniqueField>, 'uniqueField' | 'rowAttributes' | 'isFirstColumnSticky' | 'isExpandableRowComponentInitiallyOpen' | 'expandableRowComponent' | 'onRowClick' | 'onRowHover' | 'rowRef'> {
7
7
  content: Row[];
8
8
  /** @default 'table' */
9
9
  renderMode?: IFlexibleTableRenderMode;
@@ -1,8 +1,8 @@
1
- import { ReactNode } from 'react';
2
- import { ICommonProps } from '../../../../types';
1
+ import { ReactNode, RefCallback } from 'react';
2
+ import { ITweakStylesProps } from '../../../../types';
3
3
  import { ITableRow, IFlexibleTableConfigType, IFlexibleTableRenderMode, IHeaderContent } from '../../types';
4
4
  import { IFlexibleTableRowStyles } from './FlexibleTableRow.styles';
5
- export interface IFlexibleTableRowProps<Row extends ITableRow, HeaderContent extends IHeaderContent<Row>, UniqueField extends keyof Row> extends Pick<ICommonProps<IFlexibleTableRowStyles>, 'tweakStyles'> {
5
+ export interface IFlexibleTableRowProps<Row extends ITableRow, HeaderContent extends IHeaderContent<Row>, UniqueField extends keyof Row> extends ITweakStylesProps<IFlexibleTableRowStyles> {
6
6
  item: Row;
7
7
  index: number;
8
8
  uniqueField?: UniqueField;
@@ -21,11 +21,12 @@ export interface IFlexibleTableRowProps<Row extends ITableRow, HeaderContent ext
21
21
  rowAttributes?: Array<keyof Row>;
22
22
  /** @default false */
23
23
  isExpandableRowComponentInitiallyOpen?: boolean | ((row: Row, index: number) => boolean);
24
+ rowRef?: RefCallback<HTMLTableRowElement>;
24
25
  /** Возвращает React-элемент, который отрисуется под строкой при нажатии на неё */
25
26
  expandableRowComponent?: (item: Row, isOpen: boolean, close: () => void) => ReactNode;
26
27
  onRowHover?: (id?: Row[UniqueField]) => void;
27
28
  onRowClick?: (id: Row[UniqueField]) => void;
28
29
  }
29
- declare function FlexibleTableRowInner<Row extends ITableRow, HeaderContent extends IHeaderContent<Row>, UniqueField extends keyof Row>({ item, index, config, columns, uniqueField, renderMode, isActive, isFocusable, isFirstColumnSticky, isLoading, rowAttributes, isExpandableRowComponentInitiallyOpen, tweakStyles, expandableRowComponent, onRowHover, onRowClick, }: IFlexibleTableRowProps<Row, HeaderContent, UniqueField>): JSX.Element;
30
+ declare function FlexibleTableRowInner<Row extends ITableRow, HeaderContent extends IHeaderContent<Row>, UniqueField extends keyof Row>({ item, index, config, columns, uniqueField, renderMode, isActive, isFocusable, isFirstColumnSticky, isLoading, rowAttributes, isExpandableRowComponentInitiallyOpen, rowRef, tweakStyles, expandableRowComponent, onRowHover, onRowClick, }: IFlexibleTableRowProps<Row, HeaderContent, UniqueField>): JSX.Element;
30
31
  export declare const FlexibleTableRow: typeof FlexibleTableRowInner;
31
32
  export {};
@@ -1,3 +1,19 @@
1
- import { IFlexibleTableRenderMode, IFlexibleTableRender } from './types';
2
1
  export declare const DEFAULT_DATE_FORMAT = "dd.MM.yyyy";
3
- export declare const TableRenders: Record<IFlexibleTableRenderMode, IFlexibleTableRender>;
2
+ export declare const TableRenders: {
3
+ table: {
4
+ Root: "table";
5
+ Head: "thead";
6
+ Body: "tbody";
7
+ Row: "tr";
8
+ Header: "th";
9
+ Cell: "td";
10
+ };
11
+ divs: {
12
+ Root: "div";
13
+ Head: "div";
14
+ Body: "div";
15
+ Row: "div";
16
+ Header: "div";
17
+ Cell: "div";
18
+ };
19
+ };
@@ -1,7 +1,7 @@
1
1
  import { CSSProperties, MouseEvent, ReactNode } from 'react';
2
2
  import { IRenderNode } from '../../types';
3
3
  export type IFlexibleTableRenderMode = 'table' | 'divs';
4
- export type IFlexibleTableRender = Record<'Root' | 'Head' | 'Body' | 'Row' | 'Header' | 'Cell', keyof JSX.IntrinsicElements>;
4
+ export type IFlexibleTableRenderElement = 'Root' | 'Head' | 'Body' | 'Row' | 'Header' | 'Cell';
5
5
  export type ITableRow = Record<string, any>;
6
6
  export type IHeaderContent<T extends ITableRow> = Partial<Record<keyof T, unknown>>;
7
7
  export interface ITitleComponentProps<Value> {
@@ -1,4 +1,4 @@
1
- import { ChangeEvent, FormEvent, KeyboardEvent, MouseEvent, ReactNode, SyntheticEvent } from 'react';
1
+ import { ChangeEvent, FormEvent, KeyboardEvent, MouseEvent, ReactNode, SyntheticEvent, Ref } from 'react';
2
2
  import { IDropdownWithPopperOptions, ICommonProps } from '../../types';
3
3
  import { IIcon } from '../Icon';
4
4
  import { IInputProps } from '../Input';
@@ -27,8 +27,10 @@ export interface ISelectProps<Value> extends Omit<IInputProps, 'value' | 'onChan
27
27
  shouldScrollToList?: boolean;
28
28
  isMultiSelect?: false;
29
29
  searchInput?: {
30
- shouldRenderInList: true;
31
- } & Pick<ISearchInputProps, 'placeholder'>;
30
+ /** @default false */
31
+ shouldRenderInList?: boolean;
32
+ ref?: Ref<HTMLInputElement>;
33
+ } & Pick<ISearchInputProps, 'placeholder' | 'shouldFocusOnMount'>;
32
34
  isOptionDisabled?: (option: Value) => boolean;
33
35
  onChange: (value: Value | undefined, event: MouseEvent<HTMLElement> | KeyboardEvent | ChangeEvent<HTMLElement> | FormEvent<HTMLElement>) => void;
34
36
  onBlur?: (event: Event | SyntheticEvent) => void;
@@ -26296,7 +26296,7 @@ function _unsupported_iterable_to_array$7(o, minLen) {
26296
26296
  return _array_like_to_array$7(o, minLen);
26297
26297
  }
26298
26298
  function FlexibleTableRowInner(param) {
26299
- var item = param.item, index = param.index, config = param.config, columns = param.columns, uniqueField = param.uniqueField, renderMode = param.renderMode, _param_isActive = param.isActive, isActive = _param_isActive === void 0 ? false : _param_isActive, _param_isFocusable = param.isFocusable, isFocusable = _param_isFocusable === void 0 ? false : _param_isFocusable, _param_isFirstColumnSticky = param.isFirstColumnSticky, isFirstColumnSticky = _param_isFirstColumnSticky === void 0 ? false : _param_isFirstColumnSticky, _param_isLoading = param.isLoading, isLoading = _param_isLoading === void 0 ? false : _param_isLoading, rowAttributes = param.rowAttributes, _param_isExpandableRowComponentInitiallyOpen = param.isExpandableRowComponentInitiallyOpen, isExpandableRowComponentInitiallyOpen = _param_isExpandableRowComponentInitiallyOpen === void 0 ? false : _param_isExpandableRowComponentInitiallyOpen, tweakStyles = param.tweakStyles, expandableRowComponent = param.expandableRowComponent, onRowHover = param.onRowHover, onRowClick = param.onRowClick;
26299
+ var item = param.item, index = param.index, config = param.config, columns = param.columns, uniqueField = param.uniqueField, renderMode = param.renderMode, _param_isActive = param.isActive, isActive = _param_isActive === void 0 ? false : _param_isActive, _param_isFocusable = param.isFocusable, isFocusable = _param_isFocusable === void 0 ? false : _param_isFocusable, _param_isFirstColumnSticky = param.isFirstColumnSticky, isFirstColumnSticky = _param_isFirstColumnSticky === void 0 ? false : _param_isFirstColumnSticky, _param_isLoading = param.isLoading, isLoading = _param_isLoading === void 0 ? false : _param_isLoading, rowAttributes = param.rowAttributes, _param_isExpandableRowComponentInitiallyOpen = param.isExpandableRowComponentInitiallyOpen, isExpandableRowComponentInitiallyOpen = _param_isExpandableRowComponentInitiallyOpen === void 0 ? false : _param_isExpandableRowComponentInitiallyOpen, rowRef = param.rowRef, tweakStyles = param.tweakStyles, expandableRowComponent = param.expandableRowComponent, onRowHover = param.onRowHover, onRowClick = param.onRowClick;
26300
26300
  var classes = useStyles$h({
26301
26301
  theme: tweakStyles
26302
26302
  });
@@ -26373,6 +26373,7 @@ function FlexibleTableRowInner(param) {
26373
26373
  return /* @__PURE__ */ jsxs(Fragment, {
26374
26374
  children: [
26375
26375
  /* @__PURE__ */ jsx(Table.Row, _object_spread_props$k(_object_spread$l({
26376
+ ref: rowRef,
26376
26377
  className: clsx(classes.root, (_obj2 = {}, _define_property$m(_obj2, classes.active, isActive), _define_property$m(_obj2, classes.editable, isEditable), _define_property$m(_obj2, classes.clickable, isClickable), _obj2))
26377
26378
  }, !isLoading && {
26378
26379
  onClick: handleRowClick,