@dartech/arsenal-ui 1.4.10 → 1.4.11

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/index.js CHANGED
@@ -3026,6 +3026,7 @@ function TableInner({
3026
3026
  pagination = true,
3027
3027
  loading = false,
3028
3028
  onRowClick,
3029
+ emptyDataText,
3029
3030
  verticalAlign = 'middle'
3030
3031
  }, ref) {
3031
3032
  const {
@@ -3079,7 +3080,7 @@ function TableInner({
3079
3080
  })
3080
3081
  })
3081
3082
  }), jsx(TableBody, {
3082
- children: rows.map((row, index) => jsx(TableRow, Object.assign({
3083
+ children: rows.length ? rows.map((row, index) => jsx(TableRow, Object.assign({
3083
3084
  hover: true,
3084
3085
  onClick: onRowClick ? () => onRowClick(row) : row.onClick,
3085
3086
  sx: {
@@ -3094,7 +3095,18 @@ function TableInner({
3094
3095
  }, {
3095
3096
  children: column.renderCell ? column.renderCell(row, index) : row[column.id]
3096
3097
  }), idx))
3097
- }), index))
3098
+ }), index)) : jsx(TableRow, Object.assign({
3099
+ sx: {
3100
+ verticalAlign
3101
+ }
3102
+ }, {
3103
+ children: jsx(TableCell, Object.assign({
3104
+ align: "center",
3105
+ colSpan: columns.length
3106
+ }, {
3107
+ children: emptyDataText !== null && emptyDataText !== void 0 ? emptyDataText : 'Нет данных'
3108
+ }))
3109
+ }))
3098
3110
  }), pagination || children ? jsx(TableFooter, {
3099
3111
  children: jsxs(TableRow, {
3100
3112
  children: [children && jsx(TableCell, Object.assign({
@@ -3106,7 +3118,7 @@ function TableInner({
3106
3118
  }
3107
3119
  }, {
3108
3120
  children: children
3109
- })), pagination && rows.length && jsx(MuiTablePagination, {
3121
+ })), pagination && !!rows.length ? jsx(MuiTablePagination, {
3110
3122
  rowsPerPageOptions: [5, 10, 25],
3111
3123
  count: totalCount,
3112
3124
  rowsPerPage: +size,
@@ -3116,7 +3128,7 @@ function TableInner({
3116
3128
  },
3117
3129
  onPageChange: (_, page) => onPageChange(page),
3118
3130
  onRowsPerPageChange: event => onSizeChange(+event.target.value)
3119
- })]
3131
+ }) : null]
3120
3132
  })
3121
3133
  }) : null]
3122
3134
  }))]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dartech/arsenal-ui",
3
- "version": "1.4.10",
3
+ "version": "1.4.11",
4
4
  "author": "DAR",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -9,8 +9,9 @@ interface Props<T> {
9
9
  onRowClick?: (row: Row<T>) => void;
10
10
  children?: ReactNode;
11
11
  verticalAlign?: 'top' | 'middle' | 'bottom' | 'sub' | 'baseline';
12
+ emptyDataText?: string;
12
13
  }
13
- declare function TableInner<T>({ columns, rows, totalCount, children, pagination, loading, onRowClick, verticalAlign }: Props<T>, ref: ForwardedRef<HTMLTableElement>): JSX.Element;
14
+ declare function TableInner<T>({ columns, rows, totalCount, children, pagination, loading, onRowClick, emptyDataText, verticalAlign }: Props<T>, ref: ForwardedRef<HTMLTableElement>): JSX.Element;
14
15
  export declare const SimpleTable: <T>(props: Props<T> & {
15
16
  ref?: ForwardedRef<HTMLTableElement>;
16
17
  }) => ReturnType<typeof TableInner>;