@true-engineering/true-react-common-ui-kit 3.37.0 → 3.39.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 +12 -0
- package/dist/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.styles.d.ts +1 -1
- package/dist/components/FlexibleTable/types.d.ts +3 -1
- package/dist/true-react-common-ui-kit.js +19 -8
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +19 -8
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/src/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.styles.ts +4 -0
- package/src/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.tsx +11 -1
- package/src/components/FlexibleTable/types.ts +7 -1
- package/src/components/Select/Select.stories.tsx +1 -0
- package/src/components/Select/Select.tsx +5 -1
package/README.md
CHANGED
|
@@ -11,6 +11,18 @@
|
|
|
11
11
|
|
|
12
12
|
# Release Notes
|
|
13
13
|
|
|
14
|
+
## 3.39.0
|
|
15
|
+
|
|
16
|
+
### Changes
|
|
17
|
+
|
|
18
|
+
- **FlexibleTableCell**: Добавляет `onCellClick` в `config`
|
|
19
|
+
|
|
20
|
+
## 3.38.0
|
|
21
|
+
|
|
22
|
+
### Changes
|
|
23
|
+
|
|
24
|
+
- **Select**: Запрещает открывать `SelectList` при `isReadonly`
|
|
25
|
+
|
|
14
26
|
## 3.37.0
|
|
15
27
|
|
|
16
28
|
### Changes
|
package/dist/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.styles.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ITweakStyles } from '../../../../theme';
|
|
2
|
-
export declare const useStyles: import("../../../../theme").IUseStyles<"root" | "sticky" | "loading" | "second" | "skeleton", unknown>;
|
|
2
|
+
export declare const useStyles: import("../../../../theme").IUseStyles<"root" | "sticky" | "loading" | "clickable" | "second" | "skeleton", unknown>;
|
|
3
3
|
export type IFlexibleTableCellStyles = ITweakStyles<typeof useStyles>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CSSProperties, ReactNode } from 'react';
|
|
1
|
+
import { CSSProperties, MouseEvent, ReactNode } from 'react';
|
|
2
2
|
import { IRenderNode } from '../../types';
|
|
3
3
|
export type IFlexibleTableRenderMode = 'table' | 'divs';
|
|
4
4
|
export type IFlexibleTableRender = Record<'Root' | 'Head' | 'Body' | 'Row' | 'Header' | 'Cell', keyof JSX.IntrinsicElements>;
|
|
@@ -16,6 +16,7 @@ export interface IValueComponentProps<Values, Value> {
|
|
|
16
16
|
isRowNestedComponentExpanded: boolean;
|
|
17
17
|
onSetNestedComponent: (component?: ReactNode) => void;
|
|
18
18
|
}
|
|
19
|
+
export type ICellClickHandler<Values, Value> = (event: MouseEvent, cellComponentProps: IValueComponentProps<Values, Value>) => void;
|
|
19
20
|
export interface IFlexibleTableRowConfig<Values extends ITableRow, Key extends keyof Values, HeaderContent extends IHeaderContent<Values> = IHeaderContent<Values>> {
|
|
20
21
|
title?: IRenderNode<ITitleComponentProps<HeaderContent[Key]>>;
|
|
21
22
|
component?: IRenderNode<IValueComponentProps<Values, NonNullable<Values[Key]>>>;
|
|
@@ -37,6 +38,7 @@ export interface IFlexibleTableRowConfig<Values extends ITableRow, Key extends k
|
|
|
37
38
|
* @default isNotEmpty
|
|
38
39
|
*/
|
|
39
40
|
shouldRenderComponent?: boolean | ((value: Values[Key], values: Values, key: Key) => boolean);
|
|
41
|
+
onCellClick?: ICellClickHandler<Values, Values[Key]>;
|
|
40
42
|
}
|
|
41
43
|
export type IFlexibleTableConfigType<Values extends ITableRow, HeaderContent extends IHeaderContent<Values> = IHeaderContent<Values>> = {
|
|
42
44
|
[Key in keyof Values]?: IFlexibleTableRowConfig<Values, Key, HeaderContent>;
|
|
@@ -11778,6 +11778,9 @@ function Select(props) {
|
|
|
11778
11778
|
onBlur
|
|
11779
11779
|
]);
|
|
11780
11780
|
var handleListOpen = function() {
|
|
11781
|
+
if (isReadonly) {
|
|
11782
|
+
return;
|
|
11783
|
+
}
|
|
11781
11784
|
if (!isListOpen) {
|
|
11782
11785
|
setIsListOpen(true);
|
|
11783
11786
|
if (!(dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.shouldUsePopper)) {
|
|
@@ -12085,7 +12088,7 @@ function Select(props) {
|
|
|
12085
12088
|
children: [
|
|
12086
12089
|
/* @__PURE__ */ jsxs("div", {
|
|
12087
12090
|
className: clsx(classes.inputWrapper, isDisabled && classes.disabled),
|
|
12088
|
-
onClick: isDisabled ? void 0 : handleOnClick,
|
|
12091
|
+
onClick: isDisabled || isReadonly ? void 0 : handleOnClick,
|
|
12089
12092
|
ref: inputWrapper,
|
|
12090
12093
|
children: [
|
|
12091
12094
|
/* @__PURE__ */ jsx(Input, _object_spread$G({
|
|
@@ -25952,6 +25955,9 @@ var useStyles$i = createThemedStyles("FlexibleTableCell", {
|
|
|
25952
25955
|
loading: {},
|
|
25953
25956
|
skeleton: {
|
|
25954
25957
|
height: 21
|
|
25958
|
+
},
|
|
25959
|
+
clickable: {
|
|
25960
|
+
cursor: "pointer"
|
|
25955
25961
|
}
|
|
25956
25962
|
});
|
|
25957
25963
|
function _define_property$l(obj, key, value) {
|
|
@@ -26054,12 +26060,17 @@ function FlexibleTableCell(_param) {
|
|
|
26054
26060
|
});
|
|
26055
26061
|
var value = row[columnName];
|
|
26056
26062
|
var _config_columnName;
|
|
26057
|
-
var _ref = (_config_columnName = config[columnName]) !== null && _config_columnName !== void 0 ? _config_columnName : {}, _ref_component = _ref.component, component = _ref_component === void 0 ? formatCellContent(value, config[columnName]) : _ref_component, width = _ref.width, maxWidth = _ref.maxWidth, minWidth = _ref.minWidth, left2 = _ref.left, right2 = _ref.right, position = _ref.position, cellAlign = _ref.cellAlign, cellVerticalAlign = _ref.cellVerticalAlign, shouldRenderDataId = _ref.shouldRenderDataId, _ref_shouldRenderComponent = _ref.shouldRenderComponent, shouldRenderComponent = _ref_shouldRenderComponent === void 0 ? isNotEmpty : _ref_shouldRenderComponent;
|
|
26063
|
+
var _ref = (_config_columnName = config[columnName]) !== null && _config_columnName !== void 0 ? _config_columnName : {}, _ref_component = _ref.component, component = _ref_component === void 0 ? formatCellContent(value, config[columnName]) : _ref_component, width = _ref.width, maxWidth = _ref.maxWidth, minWidth = _ref.minWidth, left2 = _ref.left, right2 = _ref.right, position = _ref.position, cellAlign = _ref.cellAlign, cellVerticalAlign = _ref.cellVerticalAlign, shouldRenderDataId = _ref.shouldRenderDataId, _ref_shouldRenderComponent = _ref.shouldRenderComponent, shouldRenderComponent = _ref_shouldRenderComponent === void 0 ? isNotEmpty : _ref_shouldRenderComponent, onCellClick = _ref.onCellClick;
|
|
26058
26064
|
var isSticky = isOldSticky || position === "sticky";
|
|
26065
|
+
var isClickable = !isLoading && isNotEmpty(onCellClick);
|
|
26066
|
+
var cellComponentProps = _object_spread_props$j(_object_spread$k({}, valueComponentProps), {
|
|
26067
|
+
value,
|
|
26068
|
+
row
|
|
26069
|
+
});
|
|
26059
26070
|
var Table = TableRenders[renderMode];
|
|
26060
26071
|
var _obj2;
|
|
26061
26072
|
return /* @__PURE__ */ jsx(Table.Cell, _object_spread_props$j(_object_spread$k({
|
|
26062
|
-
className: clsx(classes.root, (_obj2 = {}, _define_property$l(_obj2, classes.sticky, isSticky), _define_property$l(_obj2, classes.second, isSecond), _define_property$l(_obj2, classes.loading, isLoading), _obj2)),
|
|
26073
|
+
className: clsx(classes.root, (_obj2 = {}, _define_property$l(_obj2, classes.sticky, isSticky), _define_property$l(_obj2, classes.second, isSecond), _define_property$l(_obj2, classes.loading, isLoading), _define_property$l(_obj2, classes.clickable, isClickable), _obj2)),
|
|
26063
26074
|
style: {
|
|
26064
26075
|
textAlign: cellAlign,
|
|
26065
26076
|
position: isSticky ? "sticky" : position,
|
|
@@ -26069,17 +26080,17 @@ function FlexibleTableCell(_param) {
|
|
|
26069
26080
|
right: right2,
|
|
26070
26081
|
left: left2,
|
|
26071
26082
|
verticalAlign: cellVerticalAlign
|
|
26072
|
-
}
|
|
26083
|
+
},
|
|
26084
|
+
onClick: isClickable ? function(event) {
|
|
26085
|
+
return onCellClick === null || onCellClick === void 0 ? void 0 : onCellClick(event, cellComponentProps);
|
|
26086
|
+
} : void 0
|
|
26073
26087
|
}, addDataAttributes({
|
|
26074
26088
|
id: shouldRenderDataId ? columnName : void 0
|
|
26075
26089
|
})), {
|
|
26076
26090
|
children: isLoading ? /* @__PURE__ */ jsx("div", {
|
|
26077
26091
|
className: classes.skeleton,
|
|
26078
26092
|
children: /* @__PURE__ */ jsx(Skeleton, {})
|
|
26079
|
-
}) : applyAction(shouldRenderComponent, value, row, columnName) && applyAction(component,
|
|
26080
|
-
value,
|
|
26081
|
-
row
|
|
26082
|
-
}))
|
|
26093
|
+
}) : applyAction(shouldRenderComponent, value, row, columnName) && applyAction(component, cellComponentProps)
|
|
26083
26094
|
}));
|
|
26084
26095
|
}
|
|
26085
26096
|
var useStyles$h = createThemedStyles("FlexibleTableRow", {
|