@uxf/data-grid 11.60.2 → 11.60.4

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.
@@ -63,11 +63,12 @@ const schemaWithFrontendConfig = (0, merge_schema_with_config_1.mergeSchemaWithC
63
63
  perPage: 100,
64
64
  columns: {
65
65
  text: { width: 200 },
66
- tel: { minWidth: 160, width: 600 },
66
+ tel: { minWidth: 160, width: 400 },
67
67
  mail: { minWidth: 200 },
68
- bool: { width: 80 },
68
+ bool: { width: 120 },
69
69
  chips: { minWidth: 200 },
70
70
  toMany: { minWidth: 200 },
71
+ money: { width: "2fr" },
71
72
  },
72
73
  filters: {
73
74
  text: { placeholder: "Custom placeholder ..." },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxf/data-grid",
3
- "version": "11.60.2",
3
+ "version": "11.60.4",
4
4
  "description": "UXF DataGrid",
5
5
  "homepage": "https://gitlab.com/uxf-npm/data-grid#readme",
6
6
  "main": "index.js",
@@ -33,7 +33,7 @@
33
33
  "dependencies": {
34
34
  "@uxf/core": "11.60.1",
35
35
  "@uxf/core-react": "11.60.1",
36
- "@uxf/ui": "11.60.1",
36
+ "@uxf/ui": "11.60.4",
37
37
  "dayjs": "1.11.13",
38
38
  "deepmerge": "4.3.1",
39
39
  "fast-glob": "3.3.2",
@@ -9,6 +9,7 @@ const empty_array_1 = require("@uxf/core/constants/empty-array");
9
9
  const is_empty_1 = require("@uxf/core/utils/is-empty");
10
10
  const is_nil_1 = require("@uxf/core/utils/is-nil");
11
11
  const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
12
+ const format_css_value_1 = require("@uxf/styles/units/format-css-value");
12
13
  const rem_1 = require("@uxf/styles/units/rem");
13
14
  const react_1 = __importDefault(require("react"));
14
15
  const components_1 = require("./components");
@@ -31,11 +32,19 @@ function DataGridTableV2(props) {
31
32
  const { tableRef, columnRefs, onResizeStart } = (0, use_resizable_columns_1.useResizableColumns)(visibleColumns, props.actionCell, props.actions, selectedRowColumnWidth);
32
33
  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);
33
34
  const gridTemplateBasicColumns = visibleColumns
34
- .map((column) => { var _a, _b; return (_b = (_a = props.state.userConfig.columns) === null || _a === void 0 ? void 0 : _a[column.name]) !== null && _b !== void 0 ? _b : column.config; })
35
- .map((columnConfig) => ({
36
- width: (0, is_nil_1.isNil)(columnConfig === null || columnConfig === void 0 ? void 0 : columnConfig.width) ? "1fr" : (0, rem_1.rem)(columnConfig.width),
37
- minWidth: (0, is_nil_1.isNil)(columnConfig === null || columnConfig === void 0 ? void 0 : columnConfig.minWidth) ? null : (0, rem_1.rem)(columnConfig.minWidth),
38
- }));
35
+ .map((column) => {
36
+ var _a;
37
+ const userColumnConfig = (_a = props.state.userConfig.columns) === null || _a === void 0 ? void 0 : _a[column.name];
38
+ const hasUserConfigWidthOrMinWidth = (userColumnConfig === null || userColumnConfig === void 0 ? void 0 : userColumnConfig.width) || (userColumnConfig === null || userColumnConfig === void 0 ? void 0 : userColumnConfig.minWidth);
39
+ return hasUserConfigWidthOrMinWidth ? userColumnConfig : column.config;
40
+ })
41
+ .map((columnConfig) => {
42
+ var _a;
43
+ return ({
44
+ width: (0, is_nil_1.isNil)(columnConfig === null || columnConfig === void 0 ? void 0 : columnConfig.width) ? "1fr" : ((_a = (0, format_css_value_1.formatCssValue)(columnConfig.width)) !== null && _a !== void 0 ? _a : ""),
45
+ minWidth: (0, is_nil_1.isNil)(columnConfig === null || columnConfig === void 0 ? void 0 : columnConfig.minWidth) ? null : (0, rem_1.rem)(columnConfig.minWidth),
46
+ });
47
+ });
39
48
  const gridTemplateColumns = (0, get_grid_template_columns_1.getGridTemplateColumns)({
40
49
  columns: gridTemplateBasicColumns,
41
50
  selectRowColumnWidth: selectedRowColumnWidth,
@@ -11,9 +11,12 @@ function getGridTemplateColumns(config) {
11
11
  return (0, build_array_1.buildArray)()
12
12
  .when((0, is_not_nil_1.isNotNil)(config.selectRowColumnWidth), (0, rem_1.rem)((_a = config.selectRowColumnWidth) !== null && _a !== void 0 ? _a : 0))
13
13
  .add(config.columns
14
- .map((col) => col.minWidth
15
- ? `minmax(${col.minWidth},${col.width})`
16
- : `minmax(${COLUMN_DEFAULT_MIN_WIDTH},${col.width})`)
14
+ .map((col) => {
15
+ var _a;
16
+ return col.width.includes("fr")
17
+ ? `minmax(${(_a = col.minWidth) !== null && _a !== void 0 ? _a : COLUMN_DEFAULT_MIN_WIDTH}, ${col.width})`
18
+ : col.width;
19
+ })
17
20
  .join(" "))
18
21
  .when((0, is_not_nil_1.isNotNil)(config.actionColumnWidth), `minmax(${(0, rem_1.rem)((_b = config.actionColumnWidth) !== null && _b !== void 0 ? _b : 0)}, auto)`)
19
22
  .join(" ");
package/types/schema.d.ts CHANGED
@@ -13,9 +13,10 @@ export type BaseGridType = {
13
13
  columns: any;
14
14
  filters: any;
15
15
  };
16
+ export type ColumnWidthUnit = number | `${number}fr`;
16
17
  export type ColumnConfig = {
17
18
  isHidden?: boolean;
18
- width?: number;
19
+ width?: ColumnWidthUnit;
19
20
  minWidth?: number;
20
21
  };
21
22
  export type Column<Name, Type> = {