@frui.ts/dataviews
Advanced tools
Comparing version 0.15.0-beta.6 to 0.15.0-rc.1
@@ -45,7 +45,7 @@ "use strict"; | ||
return (React.createElement(Item, __assign({ key: key, className: "sortable", onClick: function () { var _a; return (_a = props.onColumnSort) === null || _a === void 0 ? void 0 : _a.call(props, column); } }, props.itemCellProps, { style: column.headerStyle }), | ||
column.title, | ||
column.titleFactory ? column.titleFactory(context) : column.title, | ||
React.createElement("span", { className: getSortIndicatorClass(props.pagingFilter, column.property) }))); | ||
} | ||
else { | ||
return (React.createElement(Item, __assign({ key: key }, props.itemCellProps, { style: column.headerStyle }), column.title)); | ||
return (React.createElement(Item, __assign({ key: key }, props.itemCellProps, { style: column.headerStyle }), column.titleFactory ? column.titleFactory(context) : column.title)); | ||
} | ||
@@ -52,0 +52,0 @@ }))); |
/// <reference types="react" /> | ||
import { DataTablePropsBase } from "../dataTypes"; | ||
export interface DataTableProps<TItem, TContext> extends DataTablePropsBase<TItem, TContext> { | ||
import { TableRowProps } from "./tableRow"; | ||
export interface DataTableProps<TItem, TContext> extends DataTablePropsBase<TItem, TContext>, Pick<TableRowProps<TItem, TContext>, "rowProps"> { | ||
className?: string; | ||
@@ -5,0 +6,0 @@ headerRowClassName?: string; |
@@ -25,3 +25,3 @@ "use strict"; | ||
React.createElement(tableHeader_1.default, { columns: props.columns, context: props.context, pagingFilter: props.pagingFilter, onColumnSort: props.onColumnSort, className: props.headerRowClassName, cellClassName: props.headerCellClassName }))), | ||
React.createElement("tbody", null, (_a = props.items) === null || _a === void 0 ? void 0 : _a.map(function (item) { return (React.createElement(tableRow_1.default, { key: String(item[props.itemKey]), item: item, columns: props.columns, context: props.context })); })))); | ||
React.createElement("tbody", null, (_a = props.items) === null || _a === void 0 ? void 0 : _a.map(function (item) { return (React.createElement(tableRow_1.default, { key: String(item[props.itemKey]), item: item, columns: props.columns, context: props.context, rowProps: props.rowProps })); })))); | ||
} | ||
@@ -28,0 +28,0 @@ dataTable.defaultProps = defaultProps; |
@@ -30,7 +30,7 @@ "use strict"; | ||
return (React.createElement("th", { key: key, className: "sortable", style: column.headerStyle, onClick: function () { var _a; return (_a = props.onColumnSort) === null || _a === void 0 ? void 0 : _a.call(props, column); } }, | ||
column.title, | ||
column.titleFactory ? column.titleFactory(props.context) : column.title, | ||
React.createElement("span", { className: getSortIndicatorClass(props.pagingFilter, column.property) }))); | ||
} | ||
else { | ||
return (React.createElement("th", { key: key, className: props.cellClassName, style: column.headerStyle }, column.title)); | ||
return (React.createElement("th", { key: key, className: props.cellClassName, style: column.headerStyle }, column.titleFactory ? column.titleFactory(props.context) : column.title)); | ||
} | ||
@@ -37,0 +37,0 @@ }))); |
@@ -1,10 +0,10 @@ | ||
/// <reference types="react" /> | ||
import * as React from "react"; | ||
import { PropsWithColumns } from "../dataTypes"; | ||
export interface DataRowProps<TItem, TContext> extends PropsWithColumns<TItem, TContext> { | ||
export interface TableRowProps<TItem, TContext> extends PropsWithColumns<TItem, TContext> { | ||
item: TItem; | ||
className?: string; | ||
cellClassName?: string; | ||
rowProps?: (item: TItem, context: TContext) => React.ComponentPropsWithoutRef<"tr">; | ||
} | ||
declare function tableRow<TItem, TContext>({ item, columns, context, className, cellClassName }: DataRowProps<TItem, TContext>): JSX.Element; | ||
declare function tableRow<TItem, TContext>({ item, columns, context, rowProps, cellClassName }: TableRowProps<TItem, TContext>): JSX.Element; | ||
declare const TableRow: typeof tableRow; | ||
export default TableRow; |
"use strict"; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
@@ -13,4 +24,4 @@ if (mod && mod.__esModule) return mod; | ||
function tableRow(_a) { | ||
var item = _a.item, columns = _a.columns, context = _a.context, className = _a.className, cellClassName = _a.cellClassName; | ||
return (React.createElement("tr", { className: className }, columns.map(function (column, i) { | ||
var item = _a.item, columns = _a.columns, context = _a.context, rowProps = _a.rowProps, cellClassName = _a.cellClassName; | ||
return (React.createElement("tr", __assign({}, rowProps === null || rowProps === void 0 ? void 0 : rowProps(item, context)), columns.map(function (column, i) { | ||
var _a; | ||
@@ -17,0 +28,0 @@ var key = (_a = column.property) !== null && _a !== void 0 ? _a : i; |
@@ -9,3 +9,3 @@ import { IPagingFilter } from "@frui.ts/data"; | ||
column: ColumnDefinition<TItem, TContext, TProperty>; | ||
context?: TContext; | ||
context: TContext; | ||
} | ||
@@ -18,2 +18,3 @@ export interface ValueRenderProps<TItem, TContext, TProperty extends PropertyKey<TItem>> extends ColumnRenderProps<TItem, TContext, TProperty> { | ||
title?: ReactNode; | ||
titleFactory?: (context: TContext) => ReactNode; | ||
property?: TProperty; | ||
@@ -29,3 +30,3 @@ sortable?: boolean; | ||
columns: ColumnDefinition<TItem, TContext>[]; | ||
context?: TContext; | ||
context: TContext; | ||
} | ||
@@ -32,0 +33,0 @@ export interface PropsWithItems<TItem> { |
@@ -6,3 +6,3 @@ { | ||
}, | ||
"version": "0.15.0-beta.6", | ||
"version": "0.15.0-rc.1", | ||
"description": "View components for data display", | ||
@@ -51,3 +51,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "80cf5a737f5eb5403a155fd4a2e2f36d81c50264" | ||
"gitHead": "94f63f6550f4893c2bbf0ca038560fb2f4b6f2aa" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44819
381