@uxf/data-grid
Advanced tools
Comparing version 11.23.2 to 11.24.0
@@ -11,2 +11,3 @@ export type GridType = { | ||
dayAndTime: "datetime"; | ||
hidden: "hidden"; | ||
}; | ||
@@ -13,0 +14,0 @@ filters: { |
@@ -14,2 +14,3 @@ "use strict"; | ||
{ name: "dayAndTime", type: "datetime", label: "Datetime" }, | ||
{ name: "hidden", type: "hidden", label: "Hidden", hidden: true }, | ||
], | ||
@@ -16,0 +17,0 @@ filters: [ |
@@ -37,2 +37,25 @@ "use strict"; | ||
const use_data_grid_fetching_1 = require("./use-data-grid-fetching"); | ||
const actionCell = { | ||
width: 100, | ||
Component: () => { | ||
const actionCellActions = (0, buildArray_1.buildArray)() | ||
.add({ | ||
icon: "arrow-right", | ||
isIconButton: true, | ||
href: "https://www.uxf.cz", | ||
target: "_blank", | ||
}) | ||
.add({ | ||
icon: "file", | ||
label: "Download", | ||
onClick: console.log, | ||
}) | ||
.add({ | ||
icon: "cloud", | ||
label: "Reload", | ||
onClick: console.log, | ||
}); | ||
return react_1.default.createElement(table_1.ActionCell, { buttons: actionCellActions, visibleButtonsCount: 1 }); | ||
}, | ||
}; | ||
function Default() { | ||
@@ -58,27 +81,5 @@ const [noBorder, setNoBorder] = (0, react_1.useState)(false); | ||
react_1.default.createElement(toggle_1.Toggle, { label: "No border", value: noBorder, onChange: (value) => setNoBorder(!!value), name: "noBorder" }), | ||
react_1.default.createElement(data_grid_1.DataGrid, { onReload: onReload, state: state, actions: actions, data: data, isLoading: isLoading, error: error, schema: schema_1.schema, onCsvDownload: console.log, noBorder: noBorder, isRowSelectable: true, actionCell: { | ||
width: 100, | ||
Component: () => { | ||
const actionCellActions = (0, buildArray_1.buildArray)() | ||
.add({ | ||
icon: "arrow-right", | ||
isIconButton: true, | ||
href: "https://www.uxf.cz", | ||
target: "_blank", | ||
}) | ||
.add({ | ||
icon: "file", | ||
label: "Download", | ||
onClick: console.log, | ||
}) | ||
.add({ | ||
icon: "cloud", | ||
label: "Reload", | ||
onClick: console.log, | ||
}); | ||
return react_1.default.createElement(table_1.ActionCell, { buttons: actionCellActions, visibleButtonsCount: 1 }); | ||
}, | ||
} }), | ||
react_1.default.createElement(data_grid_1.DataGrid, { onReload: onReload, state: state, actions: actions, data: data, isLoading: isLoading, error: error, schema: schema_1.schema, onCsvDownload: console.log, isRowSelectable: true, actionCell: actionCell }), | ||
react_1.default.createElement(json_renderer_1.JsonRenderer, { value: state }))); | ||
} | ||
exports.Default = Default; |
@@ -11,3 +11,5 @@ "use strict"; |
function HiddenColumns(props) { |
return (react_1.default.createElement("div", { className: "uxf-data-grid__toolbar-control-columns" }, props.schema.columns.map((column) => { |
return (react_1.default.createElement("div", { className: "uxf-data-grid__toolbar-control-columns" }, props.schema.columns |
.filter((column) => !column.hidden) |
.map((column) => { |
var _a, _b, _c, _d; |
@@ -14,0 +16,0 @@ return (react_1.default.createElement(toggle_1.Toggle, { key: column.name, label: typeof column.label === "string" ? column.label : "", value: !((_c = (_b = (_a = props.state.userConfig.columns) === null || _a === void 0 ? void 0 : _a[column.name]) === null || _b === void 0 ? void 0 : _b.isHidden) !== null && _c !== void 0 ? _c : (_d = column.config) === null || _d === void 0 ? void 0 : _d.isHidden), onChange: (value) => value ? props.actions.showColumn(column.name) : props.actions.hideColumn(column.name), name: column.name })); |
{ | ||
"name": "@uxf/data-grid", | ||
"version": "11.23.2", | ||
"version": "11.24.0", | ||
"description": "UXF DataGrid", | ||
@@ -36,3 +36,3 @@ "homepage": "https://gitlab.com/uxf-npm/data-grid#readme", | ||
"@uxf/core-react": "11.22.0", | ||
"@uxf/ui": "11.23.0", | ||
"@uxf/ui": "11.24.0", | ||
"dayjs": "1.11.10", | ||
@@ -39,0 +39,0 @@ "deepmerge": "4.3.1", |
@@ -21,3 +21,5 @@ "use strict"; | ||
const keyExtractor = (_a = props.keyExtractor) !== null && _a !== void 0 ? _a : defaultKeyExtractor; | ||
const visibleColumns = props.schema.columns.filter((column) => { var _a, _b, _c, _d; return !((_c = (_b = (_a = props.state.userConfig.columns) === null || _a === void 0 ? void 0 : _a[column.name]) === null || _b === void 0 ? void 0 : _b.isHidden) !== null && _c !== void 0 ? _c : (_d = column.config) === null || _d === void 0 ? void 0 : _d.isHidden); }); | ||
const visibleColumns = props.schema.columns | ||
.filter((column) => !column.hidden) | ||
.filter((column) => { var _a, _b, _c, _d; return !((_c = (_b = (_a = props.state.userConfig.columns) === null || _a === void 0 ? void 0 : _a[column.name]) === null || _b === void 0 ? void 0 : _b.isHidden) !== null && _c !== void 0 ? _c : (_d = column.config) === null || _d === void 0 ? void 0 : _d.isHidden); }); | ||
const { tableRef, columnRefs, onResizeStart } = (0, use_resizable_columns_1.useResizableColumns)(visibleColumns, props.actionCell, props.actions); | ||
@@ -24,0 +26,0 @@ const gridTemplateRows = (0, get_grid_template_rows_1.getGridTemplateRows)(props.data, (_b = props.headerRowHeight) !== null && _b !== void 0 ? _b : 36, (_c = props.rowHeight) !== null && _c !== void 0 ? _c : 44); |
@@ -40,2 +40,5 @@ "use strict"; | ||
for (const schemaColumn of schema.columns) { | ||
if (schemaColumn.hidden) { | ||
continue; | ||
} | ||
const isHidden = (_b = (_a = userConfigColumns === null || userConfigColumns === void 0 ? void 0 : userConfigColumns[schemaColumn.name]) === null || _a === void 0 ? void 0 : _a.isHidden) !== null && _b !== void 0 ? _b : (_c = schemaColumn.config) === null || _c === void 0 ? void 0 : _c.isHidden; | ||
@@ -42,0 +45,0 @@ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition |
import { Nullish } from "@uxf/core/types"; | ||
import { ActionCellComponent, BodyCellComponents } from "../types/components"; | ||
import { BodyCellComponents, DataGridActionCell } from "../types/components"; | ||
import { KeyExtractor } from "../types/core"; | ||
@@ -19,6 +19,3 @@ import { Schema } from "../types/schema"; | ||
bodyCells?: BodyCellComponents<any, any>; | ||
actionCell?: { | ||
width: number; | ||
Component: ActionCellComponent<Row>; | ||
}; | ||
actionCell?: DataGridActionCell<Row>; | ||
NoRowsFallback?: NoRowsFallbackComponent; | ||
@@ -25,0 +22,0 @@ isRowSelectable?: boolean; |
import { ComponentType, FC } from "react"; | ||
import { BaseGridType, Columns, Filter } from "./schema"; | ||
export type DataGridActionCell<Row> = { | ||
width: number; | ||
Component: ActionCellComponent<Row>; | ||
}; | ||
export interface ActionCellProps<R> { | ||
@@ -4,0 +8,0 @@ row: R; |
@@ -26,2 +26,3 @@ import { ReactElement } from "react"; | ||
sort?: boolean; | ||
hidden?: boolean; | ||
config?: ColumnConfig; | ||
@@ -28,0 +29,0 @@ }; |
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
233821
4979
+ Added@uxf/ui@11.24.0(transitive)
- Removed@uxf/ui@11.23.0(transitive)
Updated@uxf/ui@11.24.0