@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@true-engineering/true-react-common-ui-kit",
3
- "version": "3.46.0",
3
+ "version": "3.48.0",
4
4
  "description": "True Engineering React UI Kit with theming support",
5
5
  "author": "True Engineering (https://trueengineering.ru)",
6
6
  "keywords": [
@@ -38,6 +38,7 @@ export interface IFlexibleTableProps<
38
38
  | 'expandableRowComponent'
39
39
  | 'onRowClick'
40
40
  | 'onRowHover'
41
+ | 'rowRef'
41
42
  > {
42
43
  content: Row[];
43
44
  /** @default 'table' */
@@ -1,9 +1,9 @@
1
- import { ReactNode, useState, memo, MouseEvent } from 'react';
1
+ import { ReactNode, useState, memo, MouseEvent, RefCallback } from 'react';
2
2
  import clsx from 'clsx';
3
3
  import { applyAction, isEmpty, isNotEmpty } from '@true-engineering/true-react-platform-helpers';
4
4
  import { addDataAttributes } from '../../../../helpers';
5
5
  import { useTweakStyles } from '../../../../hooks';
6
- import { ICommonProps, IDataAttributes } from '../../../../types';
6
+ import { IDataAttributes, ITweakStylesProps } from '../../../../types';
7
7
  import { TableRenders } from '../../constants';
8
8
  import {
9
9
  ITableRow,
@@ -19,7 +19,7 @@ export interface IFlexibleTableRowProps<
19
19
  Row extends ITableRow,
20
20
  HeaderContent extends IHeaderContent<Row>,
21
21
  UniqueField extends keyof Row,
22
- > extends Pick<ICommonProps<IFlexibleTableRowStyles>, 'tweakStyles'> {
22
+ > extends ITweakStylesProps<IFlexibleTableRowStyles> {
23
23
  item: Row;
24
24
  index: number;
25
25
  uniqueField?: UniqueField;
@@ -38,6 +38,7 @@ export interface IFlexibleTableRowProps<
38
38
  rowAttributes?: Array<keyof Row>;
39
39
  /** @default false */
40
40
  isExpandableRowComponentInitiallyOpen?: boolean | ((row: Row, index: number) => boolean);
41
+ rowRef?: RefCallback<HTMLTableRowElement>;
41
42
  /** Возвращает React-элемент, который отрисуется под строкой при нажатии на неё */
42
43
  expandableRowComponent?: (item: Row, isOpen: boolean, close: () => void) => ReactNode;
43
44
  onRowHover?: (id?: Row[UniqueField]) => void;
@@ -61,6 +62,7 @@ function FlexibleTableRowInner<
61
62
  isLoading = false,
62
63
  rowAttributes,
63
64
  isExpandableRowComponentInitiallyOpen = false,
65
+ rowRef,
64
66
  tweakStyles,
65
67
  expandableRowComponent,
66
68
  onRowHover,
@@ -139,6 +141,7 @@ function FlexibleTableRowInner<
139
141
  return (
140
142
  <>
141
143
  <Table.Row
144
+ ref={rowRef}
142
145
  className={clsx(classes.root, {
143
146
  [classes.active]: isActive,
144
147
  [classes.editable]: isEditable,
@@ -1,8 +1,11 @@
1
- import { IFlexibleTableRenderMode, IFlexibleTableRender } from './types';
1
+ import { IFlexibleTableRenderElement, IFlexibleTableRenderMode } from './types';
2
2
 
3
3
  export const DEFAULT_DATE_FORMAT = 'dd.MM.yyyy';
4
4
 
5
- export const TableRenders: Record<IFlexibleTableRenderMode, IFlexibleTableRender> = {
5
+ export const TableRenders = {
6
6
  table: { Root: 'table', Head: 'thead', Body: 'tbody', Row: 'tr', Header: 'th', Cell: 'td' },
7
7
  divs: { Root: 'div', Head: 'div', Body: 'div', Row: 'div', Header: 'div', Cell: 'div' },
8
- };
8
+ } satisfies Record<
9
+ IFlexibleTableRenderMode,
10
+ Record<IFlexibleTableRenderElement, keyof JSX.IntrinsicElements>
11
+ >;
@@ -2,11 +2,7 @@ import { CSSProperties, MouseEvent, ReactNode } from 'react';
2
2
  import { IRenderNode } from '../../types';
3
3
 
4
4
  export type IFlexibleTableRenderMode = 'table' | 'divs';
5
-
6
- export type IFlexibleTableRender = Record<
7
- 'Root' | 'Head' | 'Body' | 'Row' | 'Header' | 'Cell',
8
- keyof JSX.IntrinsicElements
9
- >;
5
+ export type IFlexibleTableRenderElement = 'Root' | 'Head' | 'Body' | 'Row' | 'Header' | 'Cell';
10
6
 
11
7
  // TODO: Заменить Record<string, any> на Record<string, unknown>
12
8
  export type ITableRow = Record<string, any>;
@@ -12,6 +12,7 @@ import {
12
12
  MouseEvent,
13
13
  ReactNode,
14
14
  SyntheticEvent,
15
+ Ref,
15
16
  } from 'react';
16
17
  import { Portal } from 'react-overlays';
17
18
  import clsx from 'clsx';
@@ -64,7 +65,11 @@ export interface ISelectProps<Value>
64
65
  /** @default true */
65
66
  shouldScrollToList?: boolean;
66
67
  isMultiSelect?: false;
67
- searchInput?: { shouldRenderInList: true } & Pick<ISearchInputProps, 'placeholder'>;
68
+ searchInput?: {
69
+ /** @default false */
70
+ shouldRenderInList?: boolean;
71
+ ref?: Ref<HTMLInputElement>;
72
+ } & Pick<ISearchInputProps, 'placeholder' | 'shouldFocusOnMount'>;
68
73
  isOptionDisabled?: (option: Value) => boolean;
69
74
  onChange: (
70
75
  value: Value | undefined,