@true-engineering/true-react-common-ui-kit 4.0.0-alpha17 → 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.
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { ICommonProps } from '../../types';
3
+ import { IIcon } from '../Icon';
3
4
  import { IFiltersPaneSearchProps } from './components';
4
5
  import { ConfigType, IFilterLocaleKey, IPartialFilterLocale } from './types';
5
6
  import { IFiltersPaneStyles } from './FiltersPane.styles';
@@ -17,8 +18,10 @@ export interface IFiltersPaneProps<Values extends Record<string, unknown>, Conte
17
18
  hasClearButton?: boolean;
18
19
  /** @default false */
19
20
  shouldRenderDataId?: boolean;
21
+ /** @default 'filter' */
22
+ settingsIcon?: IIcon;
20
23
  onChangeFilters: (values: Partial<Values>) => void;
21
24
  onSettingsButtonClick?: () => void;
22
25
  onClear?: () => void;
23
26
  }
24
- export declare function FiltersPane<Values extends Record<string, unknown>, Content = Values>({ data, tweakStyles, filtersConfig, enabledFilters, values, localeKey, locale, search, isDisabled, hasClearButton, shouldRenderDataId, testId, onChangeFilters, onSettingsButtonClick, onClear, }: IFiltersPaneProps<Values, Content>): JSX.Element;
27
+ export declare function FiltersPane<Values extends Record<string, unknown>, Content = Values>({ data, tweakStyles, filtersConfig, enabledFilters, values, localeKey, locale, search, isDisabled, hasClearButton, shouldRenderDataId, settingsIcon, testId, onChangeFilters, onSettingsButtonClick, onClear, }: IFiltersPaneProps<Values, Content>): JSX.Element;
@@ -1,14 +1,15 @@
1
- /// <reference types="react" />
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' | 'onSetNestedComponent'> {
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?: string | number;
25
- width?: string | number;
26
- maxWidth?: string | number;
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?: number;
33
- left?: number;
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?: string;
56
+ cellKey?: T;
57
57
  }
@@ -20544,7 +20544,7 @@ function _object_spread_props$n(target, source) {
20544
20544
  return target;
20545
20545
  }
20546
20546
  function FiltersPane(param) {
20547
- var data = param.data, tweakStyles = param.tweakStyles, filtersConfig = param.filtersConfig, enabledFilters = param.enabledFilters, _param_values = param.values, values = _param_values === void 0 ? {} : _param_values, localeKey = param.localeKey, locale2 = param.locale, search = param.search, _param_isDisabled = param.isDisabled, isDisabled = _param_isDisabled === void 0 ? false : _param_isDisabled, _param_hasClearButton = param.hasClearButton, hasClearButton = _param_hasClearButton === void 0 ? true : _param_hasClearButton, _param_shouldRenderDataId = param.shouldRenderDataId, shouldRenderDataId = _param_shouldRenderDataId === void 0 ? false : _param_shouldRenderDataId, testId = param.testId, onChangeFilters = param.onChangeFilters, onSettingsButtonClick = param.onSettingsButtonClick, onClear = param.onClear;
20547
+ var data = param.data, tweakStyles = param.tweakStyles, filtersConfig = param.filtersConfig, enabledFilters = param.enabledFilters, _param_values = param.values, values = _param_values === void 0 ? {} : _param_values, localeKey = param.localeKey, locale2 = param.locale, search = param.search, _param_isDisabled = param.isDisabled, isDisabled = _param_isDisabled === void 0 ? false : _param_isDisabled, _param_hasClearButton = param.hasClearButton, hasClearButton = _param_hasClearButton === void 0 ? true : _param_hasClearButton, _param_shouldRenderDataId = param.shouldRenderDataId, shouldRenderDataId = _param_shouldRenderDataId === void 0 ? false : _param_shouldRenderDataId, _param_settingsIcon = param.settingsIcon, settingsIcon = _param_settingsIcon === void 0 ? "filter" : _param_settingsIcon, testId = param.testId, onChangeFilters = param.onChangeFilters, onSettingsButtonClick = param.onSettingsButtonClick, onClear = param.onClear;
20548
20548
  var classes = useStyles$u({
20549
20549
  theme: tweakStyles
20550
20550
  });
@@ -20603,9 +20603,7 @@ function FiltersPane(param) {
20603
20603
  onClick: !isDisabled ? onSettingsButtonClick : void 0,
20604
20604
  children: /* @__PURE__ */ jsx("div", {
20605
20605
  className: classes.settingsIcon,
20606
- children: /* @__PURE__ */ jsx(Icon, {
20607
- type: "filter"
20608
- })
20606
+ children: renderIcon(settingsIcon)
20609
20607
  })
20610
20608
  })),
20611
20609
  search !== void 0 && /* @__PURE__ */ jsx(FiltersPaneSearch, _object_spread_props$n(_object_spread$o({}, search), {
@@ -27167,7 +27165,7 @@ function _object_without_properties_loose$9(source, excluded) {
27167
27165
  return target;
27168
27166
  }
27169
27167
  function FlexibleTableCell(_param) {
27170
- 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, [
27171
27169
  "row",
27172
27170
  "columnName",
27173
27171
  "config",
@@ -27175,6 +27173,7 @@ function FlexibleTableCell(_param) {
27175
27173
  "isSecond",
27176
27174
  "isSticky",
27177
27175
  "isLoading",
27176
+ "updateNestedComponent",
27178
27177
  "tweakStyles"
27179
27178
  ]);
27180
27179
  var classes = useStyles$i({
@@ -27186,6 +27185,12 @@ function FlexibleTableCell(_param) {
27186
27185
  var isSticky = isOldSticky || position === "sticky";
27187
27186
  var isClickable = !isLoading && isNotEmpty(onCellClick);
27188
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
+ ]),
27189
27194
  value,
27190
27195
  row
27191
27196
  });
@@ -27384,7 +27389,7 @@ function FlexibleTableRowInner(param) {
27384
27389
  isOpen: false
27385
27390
  });
27386
27391
  };
27387
- var updateNestedComponent = function(component, cellKey) {
27392
+ var updateNestedComponent = useCallback(function(component, cellKey) {
27388
27393
  if (isEmpty(component)) {
27389
27394
  closeNestedComponent();
27390
27395
  } else {
@@ -27394,7 +27399,7 @@ function FlexibleTableRowInner(param) {
27394
27399
  cellKey
27395
27400
  });
27396
27401
  }
27397
- };
27402
+ }, []);
27398
27403
  var handleRowClick = function() {
27399
27404
  if (isNotEmpty(uniqueField)) {
27400
27405
  onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(item[uniqueField]);
@@ -27441,9 +27446,7 @@ function FlexibleTableRowInner(param) {
27441
27446
  isActiveRow: isActive,
27442
27447
  isNestedComponentExpanded: isNestedComponentExpanded && nestedComponentCellKey === key,
27443
27448
  isRowNestedComponentExpanded: isNestedComponentExpanded && isEmpty(nestedComponentCellKey),
27444
- onSetNestedComponent: function(component) {
27445
- return updateNestedComponent(component, key);
27446
- }
27449
+ updateNestedComponent
27447
27450
  }, key);
27448
27451
  })
27449
27452
  })),