@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 +13 -0
- package/dist/components/FlexibleTable/FlexibleTable.d.ts +1 -1
- package/dist/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.d.ts +5 -4
- package/dist/components/FlexibleTable/constants.d.ts +18 -2
- package/dist/components/FlexibleTable/types.d.ts +1 -1
- package/dist/components/Select/Select.d.ts +5 -3
- package/dist/true-react-common-ui-kit.js +2 -1
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +2 -1
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/src/components/FlexibleTable/FlexibleTable.tsx +1 -0
- package/src/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.tsx +6 -3
- package/src/components/FlexibleTable/constants.ts +6 -3
- package/src/components/FlexibleTable/types.ts +1 -5
- package/src/components/Select/Select.tsx +6 -1
package/package.json
CHANGED
|
@@ -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 {
|
|
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
|
|
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 {
|
|
1
|
+
import { IFlexibleTableRenderElement, IFlexibleTableRenderMode } from './types';
|
|
2
2
|
|
|
3
3
|
export const DEFAULT_DATE_FORMAT = 'dd.MM.yyyy';
|
|
4
4
|
|
|
5
|
-
export const TableRenders
|
|
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?: {
|
|
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,
|