@true-engineering/true-react-common-ui-kit 4.0.0-alpha18 → 4.0.0-alpha19
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/dist/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.d.ts +4 -3
- package/dist/components/FlexibleTable/types.d.ts +7 -7
- package/dist/true-react-common-ui-kit.js +11 -6
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +11 -6
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/src/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.tsx +8 -5
- package/src/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.tsx +5 -5
- package/src/components/FlexibleTable/types.ts +7 -7
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { ICommonProps } from '../../../../types';
|
|
3
3
|
import { ITableRow, IValueComponentProps, IFlexibleTableConfigType, IFlexibleTableRenderMode, IHeaderContent } from '../../types';
|
|
4
4
|
import { IFlexibleTableCellStyles } from './FlexibleTableCell.styles';
|
|
5
|
-
export interface IFlexibleTableCellProps<Row extends ITableRow, HeaderContent extends IHeaderContent<Row>> extends Pick<ICommonProps<IFlexibleTableCellStyles>, 'tweakStyles'>, Pick<IValueComponentProps<Row, unknown>, 'isFocusedRow' | 'isActiveRow' | 'isNestedComponentExpanded' | 'isRowNestedComponentExpanded'
|
|
5
|
+
export interface IFlexibleTableCellProps<Row extends ITableRow, HeaderContent extends IHeaderContent<Row>> extends Pick<ICommonProps<IFlexibleTableCellStyles>, 'tweakStyles'>, Pick<IValueComponentProps<Row, unknown>, 'isFocusedRow' | 'isActiveRow' | 'isNestedComponentExpanded' | 'isRowNestedComponentExpanded'> {
|
|
6
6
|
row: Row;
|
|
7
7
|
columnName: keyof Row;
|
|
8
|
+
updateNestedComponent: (component: ReactNode, cellKey: keyof Row) => void;
|
|
8
9
|
config: IFlexibleTableConfigType<Row, HeaderContent>;
|
|
9
10
|
renderMode: IFlexibleTableRenderMode;
|
|
10
11
|
isSecond?: boolean;
|
|
11
12
|
isSticky?: boolean;
|
|
12
13
|
isLoading?: boolean;
|
|
13
14
|
}
|
|
14
|
-
export declare function FlexibleTableCell<Row extends ITableRow, HeaderContent extends IHeaderContent<Row>>({ row, columnName, config, renderMode, isSecond, isSticky: isOldSticky, isLoading, tweakStyles, ...valueComponentProps }: IFlexibleTableCellProps<Row, HeaderContent>): JSX.Element;
|
|
15
|
+
export declare function FlexibleTableCell<Row extends ITableRow, HeaderContent extends IHeaderContent<Row>>({ row, columnName, config, renderMode, isSecond, isSticky: isOldSticky, isLoading, updateNestedComponent, tweakStyles, ...valueComponentProps }: IFlexibleTableCellProps<Row, HeaderContent>): JSX.Element;
|
|
@@ -21,16 +21,16 @@ export interface IFlexibleTableRowConfig<Values extends ITableRow, Key extends k
|
|
|
21
21
|
title?: IRenderNode<ITitleComponentProps<HeaderContent[Key]>>;
|
|
22
22
|
component?: IRenderNode<IValueComponentProps<Values, NonNullable<Values[Key]>>>;
|
|
23
23
|
dateFormat?: string;
|
|
24
|
-
minWidth?:
|
|
25
|
-
width?:
|
|
26
|
-
maxWidth?:
|
|
24
|
+
minWidth?: CSSProperties['minWidth'];
|
|
25
|
+
width?: CSSProperties['width'];
|
|
26
|
+
maxWidth?: CSSProperties['maxWidth'];
|
|
27
27
|
/** @default 'left' */
|
|
28
28
|
titleAlign?: CSSProperties['textAlign'];
|
|
29
29
|
cellAlign?: CSSProperties['textAlign'];
|
|
30
30
|
cellVerticalAlign?: CSSProperties['verticalAlign'];
|
|
31
31
|
position?: CSSProperties['position'];
|
|
32
|
-
right?:
|
|
33
|
-
left?:
|
|
32
|
+
right?: CSSProperties['right'];
|
|
33
|
+
left?: CSSProperties['left'];
|
|
34
34
|
shouldRenderDataId?: boolean;
|
|
35
35
|
/**
|
|
36
36
|
* Проверка, нужно ли отрисовать component
|
|
@@ -50,8 +50,8 @@ export interface IInfinityScrollConfig {
|
|
|
50
50
|
isLastPage: boolean;
|
|
51
51
|
onInfinityScroll: (skip: number) => void;
|
|
52
52
|
}
|
|
53
|
-
export interface INestedComponent {
|
|
53
|
+
export interface INestedComponent<T extends PropertyKey = string> {
|
|
54
54
|
isOpen: boolean;
|
|
55
55
|
component?: ReactNode;
|
|
56
|
-
cellKey?:
|
|
56
|
+
cellKey?: T;
|
|
57
57
|
}
|
|
@@ -27165,7 +27165,7 @@ function _object_without_properties_loose$9(source, excluded) {
|
|
|
27165
27165
|
return target;
|
|
27166
27166
|
}
|
|
27167
27167
|
function FlexibleTableCell(_param) {
|
|
27168
|
-
var row = _param.row, columnName = _param.columnName, config = _param.config, renderMode = _param.renderMode, isSecond = _param.isSecond, isOldSticky = _param.isSticky, isLoading = _param.isLoading, tweakStyles = _param.tweakStyles, valueComponentProps = _object_without_properties$9(_param, [
|
|
27168
|
+
var row = _param.row, columnName = _param.columnName, config = _param.config, renderMode = _param.renderMode, isSecond = _param.isSecond, isOldSticky = _param.isSticky, isLoading = _param.isLoading, updateNestedComponent = _param.updateNestedComponent, tweakStyles = _param.tweakStyles, valueComponentProps = _object_without_properties$9(_param, [
|
|
27169
27169
|
"row",
|
|
27170
27170
|
"columnName",
|
|
27171
27171
|
"config",
|
|
@@ -27173,6 +27173,7 @@ function FlexibleTableCell(_param) {
|
|
|
27173
27173
|
"isSecond",
|
|
27174
27174
|
"isSticky",
|
|
27175
27175
|
"isLoading",
|
|
27176
|
+
"updateNestedComponent",
|
|
27176
27177
|
"tweakStyles"
|
|
27177
27178
|
]);
|
|
27178
27179
|
var classes = useStyles$i({
|
|
@@ -27184,6 +27185,12 @@ function FlexibleTableCell(_param) {
|
|
|
27184
27185
|
var isSticky = isOldSticky || position === "sticky";
|
|
27185
27186
|
var isClickable = !isLoading && isNotEmpty(onCellClick);
|
|
27186
27187
|
var cellComponentProps = _object_spread_props$l(_object_spread$m({}, valueComponentProps), {
|
|
27188
|
+
onSetNestedComponent: useCallback(function(node) {
|
|
27189
|
+
return updateNestedComponent(node, columnName);
|
|
27190
|
+
}, [
|
|
27191
|
+
columnName,
|
|
27192
|
+
updateNestedComponent
|
|
27193
|
+
]),
|
|
27187
27194
|
value,
|
|
27188
27195
|
row
|
|
27189
27196
|
});
|
|
@@ -27382,7 +27389,7 @@ function FlexibleTableRowInner(param) {
|
|
|
27382
27389
|
isOpen: false
|
|
27383
27390
|
});
|
|
27384
27391
|
};
|
|
27385
|
-
var updateNestedComponent = function(component, cellKey) {
|
|
27392
|
+
var updateNestedComponent = useCallback(function(component, cellKey) {
|
|
27386
27393
|
if (isEmpty(component)) {
|
|
27387
27394
|
closeNestedComponent();
|
|
27388
27395
|
} else {
|
|
@@ -27392,7 +27399,7 @@ function FlexibleTableRowInner(param) {
|
|
|
27392
27399
|
cellKey
|
|
27393
27400
|
});
|
|
27394
27401
|
}
|
|
27395
|
-
};
|
|
27402
|
+
}, []);
|
|
27396
27403
|
var handleRowClick = function() {
|
|
27397
27404
|
if (isNotEmpty(uniqueField)) {
|
|
27398
27405
|
onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(item[uniqueField]);
|
|
@@ -27439,9 +27446,7 @@ function FlexibleTableRowInner(param) {
|
|
|
27439
27446
|
isActiveRow: isActive,
|
|
27440
27447
|
isNestedComponentExpanded: isNestedComponentExpanded && nestedComponentCellKey === key,
|
|
27441
27448
|
isRowNestedComponentExpanded: isNestedComponentExpanded && isEmpty(nestedComponentCellKey),
|
|
27442
|
-
|
|
27443
|
-
return updateNestedComponent(component, key);
|
|
27444
|
-
}
|
|
27449
|
+
updateNestedComponent
|
|
27445
27450
|
}, key);
|
|
27446
27451
|
})
|
|
27447
27452
|
})),
|