d2coreui 23.0.53 → 23.0.54

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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 23.0.54
4
+
5
+ - `DataGrid` / `ExtendedDataGrid`: typed by the row data type. `DataGridProps<TData>` and
6
+ `ExtendedDataGridProps<TData>` pass it to the ag-grid `GridOptions` (`rowData`, `getRowId`, events, `gridRef`), and
7
+ `DataGrid<TData>` uses it for `gridApi` and `columnTypes`. Without an explicit type argument the type is inferred from
8
+ `rowData` and the handlers, so rows must have an `id` of type `number | string`, and handlers typed for another row
9
+ type no longer compile. The default type argument is `any`.
10
+ - `DataGrid` / `ExtendedDataGrid`: `columnDefs` may contain column groups (`DataGridColGroupDef`). The group is only a
11
+ header; its children are adapted like top-level columns (header menu, resizing, cell style, drag & drop in the grid
12
+ header) and the columns configuration dialog lists them by their own `group`. Reordering in the dialog does not
13
+ respect group boundaries.
14
+ - `DataGrid`: the fill-handle highlight uses the displayed column order, the same as the filled range.
15
+
3
16
  ## 23.0.53
4
17
 
5
18
  - `DateRangeInput`: time shift by month or year keeps an interval end that lies at the end of a month at the end of
@@ -1,7 +1,9 @@
1
1
  import { ColDef, ColumnState } from "ag-grid-community";
2
- import { DataGridColDef } from "./dataGrid";
2
+ import type { DataGridColDef, DataGridColGroupDef } from "./dataGrid";
3
3
  /** Helpers for ag-grid column state. */
4
4
  export declare class ColumnUtils {
5
+ /** Returns the columns of `columnDefs` with every column group replaced by its columns. */
6
+ static getLeafColumnDefs(columnDefs: (DataGridColDef | DataGridColGroupDef)[]): DataGridColDef[];
5
7
  /**
6
8
  * Adds a state for every column definition whose `colId` is missing in `columnsState` (e.g. a column added after the
7
9
  * state was saved). The added state is built from the definition's `initial*` properties and inserted, in place,
@@ -1,5 +1,9 @@
1
1
  /** Helpers for ag-grid column state. */
2
2
  export class ColumnUtils {
3
+ /** Returns the columns of `columnDefs` with every column group replaced by its columns. */
4
+ static getLeafColumnDefs(columnDefs) {
5
+ return columnDefs.flatMap((columnDef) => "children" in columnDef ? ColumnUtils.getLeafColumnDefs(columnDef.children) : [columnDef]);
6
+ }
3
7
  /**
4
8
  * Adds a state for every column definition whose `colId` is missing in `columnsState` (e.g. a column added after the
5
9
  * state was saved). The added state is built from the definition's `initial*` properties and inserted, in place,
@@ -1 +1 @@
1
- {"version":3,"file":"columnUtils.js","sourceRoot":"","sources":["../../../../components/grid/columnUtils.ts"],"names":[],"mappings":"AAGA,wCAAwC;AACxC,MAAM,OAAO,WAAW;IACpB;;;;;OAKG;IACH,MAAM,CAAC,iBAAiB,CAAC,YAA0B,EAAE,iBAA8C;QAC/F,MAAM,YAAY,GAAG,iBAAiB,CAAC,GAAG,CAAC,SAAS,CAAA,EAAE;YAClD,OAAO;gBACH,OAAO,EAAE,SAAS,CAAC,OAAO;gBAC1B,KAAK,EAAE,SAAS,CAAC,KAAK;gBACtB,IAAI,EAAE,SAAS,CAAC,WAAW;gBAC3B,IAAI,EAAE,SAAS,CAAC,WAAW;gBAC3B,MAAM,EAAE,SAAS,CAAC,aAAa;gBAC/B,KAAK,EAAE,SAAS,CAAC,YAAY;gBAC7B,UAAU,EAAE,SAAS,CAAC,iBAAiB;gBACvC,QAAQ,EAAE,SAAS,CAAC,eAAe;gBACnC,aAAa,EAAE,SAAS,CAAC,oBAAoB;gBAC7C,IAAI,EAAE,SAAS,CAAC,WAAW;gBAC3B,SAAS,EAAE,SAAS,CAAC,gBAAgB;gBACrC,KAAK,EAAE,SAAS,CAAC,YAAY;aACjB,CAAC;QACrB,CAAC,CAAC,CAAC;QACH,YAAY,CAAC,OAAO,CAAC,CAAC,kBAAkB,EAAE,KAAK,EAAC,EAAE;YAC9C,MAAM,kBAAkB,GAAG,YAAY,CAAC,IAAI,CAAC,WAAW,CAAA,EAAE,CAAC,WAAW,CAAC,KAAK,KAAK,kBAAkB,CAAC,KAAK,CAAC,CAAC;YAC3G,IAAG,CAAC,kBAAkB,EAAE,CAAC;gBACrB,YAAY,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,kBAAkB,CAAC,CAAC;YACtD,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ","sourcesContent":["import {ColDef, ColumnState} from \"ag-grid-community\";\r\nimport {DataGridColDef} from \"./dataGrid\";\r\n\r\n/** Helpers for ag-grid column state. */\r\nexport class ColumnUtils {\r\n /**\r\n * Adds a state for every column definition whose `colId` is missing in `columnsState` (e.g. a column added after the\r\n * state was saved). The added state is built from the definition's `initial*` properties and inserted, in place,\r\n * at the definition's index. Existing entries are left unchanged.\r\n * @param columnsState - saved column state; modified in place\r\n */\r\n static mergeColumnsState(columnsState:ColumnState[], columnsDefinition: ColDef[] | DataGridColDef[]) {\r\n const defaultState = columnsDefinition.map(columnDef=> {\r\n return {\r\n aggFunc: columnDef.aggFunc,\r\n colId: columnDef.colId,\r\n flex: columnDef.initialFlex,\r\n hide: columnDef.initialHide,\r\n pinned: columnDef.initialPinned,\r\n pivot: columnDef.initialPivot,\r\n pivotIndex: columnDef.initialPivotIndex,\r\n rowGroup: columnDef.initialRowGroup,\r\n rowGroupIndex: columnDef.initialRowGroupIndex,\r\n sort: columnDef.initialSort,\r\n sortIndex: columnDef.initialSortIndex,\r\n width: columnDef.initialWidth,\r\n } as ColumnState;\r\n });\r\n defaultState.forEach((defaultColumnState, index)=>{\r\n const definedColumnState = columnsState.find(columnState=> columnState.colId === defaultColumnState.colId);\r\n if(!definedColumnState) {\r\n columnsState.splice(index, 0, defaultColumnState);\r\n }\r\n });\r\n }\r\n}"]}
1
+ {"version":3,"file":"columnUtils.js","sourceRoot":"","sources":["../../../../components/grid/columnUtils.ts"],"names":[],"mappings":"AAGA,wCAAwC;AACxC,MAAM,OAAO,WAAW;IACpB,2FAA2F;IAC3F,MAAM,CAAC,iBAAiB,CAAC,UAAoD;QACzE,OAAO,UAAU,CAAC,OAAO,CAAC,CAA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r\nimport type {DataGridColDef, DataGridColGroupDef} from \"./dataGrid\";\r\n\r\n/** Helpers for ag-grid column state. */\r\nexport class ColumnUtils {\r\n /** Returns the columns of `columnDefs` with every column group replaced by its columns. */\r\n static getLeafColumnDefs(columnDefs: (DataGridColDef | DataGridColGroupDef)[]): DataGridColDef[] {\r\n return columnDefs.flatMap((columnDef) => \"children\" in columnDef ? ColumnUtils.getLeafColumnDefs(columnDef.children) : [columnDef]);\r\n }\r\n\r\n /**\r\n * Adds a state for every column definition whose `colId` is missing in `columnsState` (e.g. a column added after the\r\n * state was saved). The added state is built from the definition's `initial*` properties and inserted, in place,\r\n * at the definition's index. Existing entries are left unchanged.\r\n * @param columnsState - saved column state; modified in place\r\n */\r\n static mergeColumnsState(columnsState:ColumnState[], columnsDefinition: ColDef[] | DataGridColDef[]) {\r\n const defaultState = columnsDefinition.map(columnDef=> {\r\n return {\r\n aggFunc: columnDef.aggFunc,\r\n colId: columnDef.colId,\r\n flex: columnDef.initialFlex,\r\n hide: columnDef.initialHide,\r\n pinned: columnDef.initialPinned,\r\n pivot: columnDef.initialPivot,\r\n pivotIndex: columnDef.initialPivotIndex,\r\n rowGroup: columnDef.initialRowGroup,\r\n rowGroupIndex: columnDef.initialRowGroupIndex,\r\n sort: columnDef.initialSort,\r\n sortIndex: columnDef.initialSortIndex,\r\n width: columnDef.initialWidth,\r\n } as ColumnState;\r\n });\r\n defaultState.forEach((defaultColumnState, index)=>{\r\n const definedColumnState = columnsState.find(columnState=> columnState.colId === defaultColumnState.colId);\r\n if(!definedColumnState) {\r\n columnsState.splice(index, 0, defaultColumnState);\r\n }\r\n });\r\n }\r\n}"]}
@@ -31,14 +31,15 @@ function generateSimpleTree(treeNodes = []) {
31
31
  return (Object.assign(Object.assign({}, props), { key: props.key, children: generateSimpleTree(children) }));
32
32
  });
33
33
  }
34
- function getColumns(columnDefinitions) {
34
+ function getColumns(columnDefinitions, gridApi) {
35
35
  // noinspection UnnecessaryLocalVariableJS
36
36
  const columns = columnDefinitions.map((columnDef) => {
37
37
  const id = columnDef.colId ? columnDef.colId : (columnDef.field ? columnDef.field : "");
38
38
  const group = columnDef.group;
39
+ const column = id ? gridApi.getColumn(id) : null;
39
40
  return {
40
41
  key: id,
41
- title: columnDef.headerName ? columnDef.headerName : "unknown",
42
+ title: (column && gridApi.getDisplayNameForColumn(column, "columnToolPanel")) || columnDef.headerName || id,
42
43
  description: columnDef.headerTooltip,
43
44
  group: group
44
45
  };
@@ -54,9 +55,13 @@ function getColumnsTree(columns, filteredItems = undefined) {
54
55
  if (!itemPresent) {
55
56
  return;
56
57
  }
58
+ if (!column.group) {
59
+ columnsDefinitionTree.push({ key: column.key, title: column.title });
60
+ return;
61
+ }
57
62
  let parent = _head(columnsDefinitionTree.filter((parentNode) => parentNode.key === ("_group_" + column.group)));
58
63
  if (!parent) {
59
- parent = { key: "_group_" + column.group, title: column.group ? column.group : "unknown" };
64
+ parent = { key: "_group_" + column.group, title: column.group };
60
65
  columnsDefinitionTree.push(parent);
61
66
  }
62
67
  if (!parent.children) {
@@ -89,7 +94,7 @@ class ColumnTransfer extends React.Component {
89
94
  moveKeys.forEach((columnKey) => {
90
95
  if (typeof columnKey === "string") {
91
96
  if (columnKey.indexOf("_group_") >= 0) {
92
- const columnsTree = getColumnsTree(getColumns(this.props.columnDefinitions));
97
+ const columnsTree = getColumnsTree(getColumns(this.props.columnDefinitions, this.props.gridApi));
93
98
  const columnGroup = _head(columnsTree.filter((columnGroup) => {
94
99
  return columnGroup.key === columnKey;
95
100
  }));
@@ -108,7 +113,7 @@ class ColumnTransfer extends React.Component {
108
113
  ;
109
114
  render() {
110
115
  const _a = this.props, { columnDefinitions, columnModel, gridApi, type } = _a, restProps = __rest(_a, ["columnDefinitions", "columnModel", "gridApi", "type"]);
111
- const columns = getColumns(columnDefinitions);
116
+ const columns = getColumns(columnDefinitions, gridApi);
112
117
  const visibleColumnIds = columnModel.filter((column) => !column.hide).map((column) => column.colId);
113
118
  if (type === "simple" /* ColumnTransferType.SIMPLE */) {
114
119
  const columnsTree = getColumnsTree(columns);
@@ -146,20 +151,25 @@ class ColumnTransfer extends React.Component {
146
151
  if (direction === 'left') {
147
152
  const checkedKeys = [...selectedKeys];
148
153
  const columnsTree = getColumnsTree(columns, filteredItems);
154
+ const selectNode = (node, checked) => {
155
+ var _a;
156
+ if ((_a = node.children) === null || _a === void 0 ? void 0 : _a.length) {
157
+ onItemSelectAll(node.children.map((child) => child.key), checked);
158
+ }
159
+ else {
160
+ onItemSelect(node.key, checked);
161
+ }
162
+ };
149
163
  return (React.createElement("div", { style: {
150
164
  overflowY: "auto",
151
165
  height: (this.props.height ? this.props.height : 100) - 100
152
166
  } },
153
- React.createElement(Tree, { blockNode: true, checkable: true, defaultExpandAll: true, checkedKeys: checkedKeys, onCheck: (_, { node, }) => {
154
- var _a;
155
- if ((_a = node.props) === null || _a === void 0 ? void 0 : _a.eventKey) {
156
- onItemSelect(node.props.eventKey, !isChecked(checkedKeys, node.props.eventKey));
157
- }
167
+ React.createElement(Tree, { key: columnsTree.filter((node) => node.children).map((node) => node.key).join(), blockNode: true, checkable: true, defaultExpandAll: true, checkedKeys: checkedKeys, onCheck: (_, { node, checked }) => {
168
+ selectNode(node, checked);
158
169
  }, onSelect: (_, { node }) => {
159
170
  var _a;
160
- if ((_a = node.props) === null || _a === void 0 ? void 0 : _a.eventKey) {
161
- onItemSelect(node.props.eventKey, !isChecked(checkedKeys, node.props.eventKey));
162
- }
171
+ const keys = ((_a = node.children) === null || _a === void 0 ? void 0 : _a.length) ? node.children.map((child) => child.key) : [node.key];
172
+ selectNode(node, !keys.every((key) => isChecked(checkedKeys, key)));
163
173
  }, treeData: generateTree(columnsTree, visibleColumnIds) })));
164
174
  }
165
175
  else {
@@ -167,22 +177,17 @@ class ColumnTransfer extends React.Component {
167
177
  getCheckboxProps: item => {
168
178
  return { disabled: !!item.disabled };
169
179
  },
170
- onSelectAll(selected, selectedRows) {
171
- const treeSelectedKeys = selectedRows
172
- .filter(item => !item.disabled)
173
- .map(({ key }) => key);
174
- let diffKeys;
175
- if (selected) {
176
- diffKeys = difference(treeSelectedKeys, selectedKeys);
180
+ onChange(selectedRowKeys) {
181
+ const addedKeys = difference(selectedRowKeys, selectedKeys);
182
+ const removedKeys = difference(selectedKeys, selectedRowKeys);
183
+ if (addedKeys.length > 0) {
184
+ onItemSelectAll(addedKeys, true);
177
185
  }
178
- else {
179
- diffKeys = difference(selectedKeys, treeSelectedKeys);
186
+ if (removedKeys.length > 0) {
187
+ onItemSelectAll(removedKeys, false);
180
188
  }
181
- onItemSelectAll(diffKeys, selected);
182
- },
183
- onSelect({ key }, selected) {
184
- onItemSelect(key, selected);
185
189
  },
190
+ preserveSelectedRowKeys: true,
186
191
  selectedRowKeys: selectedKeys,
187
192
  };
188
193
  return (React.createElement("div", { style: {
@@ -1 +1 @@
1
- {"version":3,"file":"columnTransfer.js","sourceRoot":"","sources":["../../../../../components/grid/config/columnTransfer.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,QAAQ,EAAE,IAAI,EAAe,MAAM,MAAM,CAAA;AACjD,OAAO,KAAK,MAAM,aAAa,CAAC;AAChC,OAAO,IAAI,MAAM,kBAAkB,CAAA;AACnC,OAAO,gBAAgB,MAAM,4CAA4C,CAAC;AAI1E,OAAO,UAAU,MAAM,mBAAmB,CAAC;AAE3C,gCAAgC;AAChC,MAAM,SAAS,GAAG,CAAC,YAAyB,EAAE,QAAgB,EAAE,EAAE;IAC9D,OAAO,YAAY,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;AACjD,CAAC,CAAC;AAIF,SAAS,YAAY,CAAC,YAA0B,EAAE,EAAE,cAAwB,EAAE;IAC1E,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,EAAoB,EAAgB,EAAE;YAAtC,EAAC,QAAQ,OAAW,EAAN,KAAK,cAAnB,YAAoB,CAAD;QAAoB,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,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG;yBAC9D;wBACG,oBAAC,gBAAgB,IACb,UAAU,EAAE,KAAK,EACjB,UAAU,EAAE,KAAK,EACjB,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE;gCACL;oCACI,SAAS,EAAE,OAAO;oCAClB,KAAK,EAAE,MAAM;iCAChB;6BACJ,EACD,UAAU,EAAE,aAAa,EACzB,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE,CAAC,EAAC,GAAG,EAAE,QAAQ,EAAE,YAAY,EAAC,EAAE,EAAE,CAAC,CAAC;gCACvC,OAAO,EAAE,GAAG,EAAE;oCACV,IAAI,YAAY,EAAE,CAAC;wCACf,OAAO;oCACX,CAAC;oCACD,YAAY,CAAC,GAAa,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAa,CAAC,CAAC,CAAC;gCACvE,CAAC;6BACJ,CAAC,EACF,SAAS,EAAE,CAAC,MAAkB,EAAE,CAAS,EAAE,OAAe,EAAE,EAAE;gCAC1D,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,GAAa,CAAC,EAAE,OAAO,CAAC,CAAC;4BACpE,CAAC,GACH,CACA,CACT,CAAC;gBACN,CAAC;YACL,CAAC,CACM,CACd,CAAC;QACN,CAAC;IACL,CAAC;IAAA,CAAC;;AAtKY,2BAAY,GAAG;IACzB,IAAI,sCAAyB;CAChC,CAAC;eAHe,cAAc","sourcesContent":["import React from \"react\";\r\nimport {Transfer, Tree, TreeDataNode} from 'antd'\r\nimport _head from \"lodash/head\";\r\nimport i18n from \"d2core/i18n/i18n\"\r\nimport DragSortingTable from \"d2coreui/components/table/dragSortingTable\";\r\nimport {ColDef, ColumnState, GridApi} from \"ag-grid-community\";\r\nimport {TableRowSelection} from \"antd/es/table/interface\";\r\nimport {TransferItem} from \"antd/lib/transfer\";\r\nimport difference from \"lodash/difference\";\r\n\r\n// Customize ColumnNode Transfer\r\nconst isChecked = (selectedKeys: React.Key[], eventKey: string) => {\r\n return selectedKeys.indexOf(eventKey) !== -1;\r\n};\r\n\r\ntype TreeNodeType = TreeDataNode & ColumnNode;\r\n\r\nfunction generateTree(treeNodes: ColumnNode[] = [], checkedKeys: string[] = []): TreeNodeType[] {\r\n return treeNodes.map(({children, ...props}): TreeNodeType => ({\r\n ...props,\r\n key: props.key as string,\r\n disabled: checkedKeys.includes(props.key as string),\r\n children: generateTree(children, checkedKeys),\r\n }));\r\n}\r\n\r\nfunction generateSimpleTree(treeNodes: ColumnNode[] = []): TreeNodeType[] {\r\n return treeNodes.map(({children, ...props}) => ({\r\n ...props,\r\n key: props.key as string,\r\n children: generateSimpleTree(children)\r\n }));\r\n}\r\n\r\nfunction getColumns(columnDefinitions: ColDef[]): ColumnNode[] {\r\n // noinspection UnnecessaryLocalVariableJS\r\n const columns = columnDefinitions.map((columnDef) => {\r\n const id = columnDef.colId ? columnDef.colId : (columnDef.field ? columnDef.field : \"\");\r\n const group = (columnDef as any).group;\r\n return {\r\n key: id,\r\n title: columnDef.headerName ? columnDef.headerName : \"unknown\",\r\n description: columnDef.headerTooltip,\r\n group: group\r\n };\r\n });\r\n return columns;\r\n}\r\n\r\nfunction getColumnsTree(columns: ColumnNode[], filteredItems: ColumnNode[] | undefined = undefined): ColumnNode[] {\r\n const columnsDefinitionTree: ColumnNode[] = [];\r\n columns.forEach((column) => {\r\n const itemPresent = filteredItems ? (filteredItems.filter((filteredItem) => {\r\n return filteredItem.key === column.key\r\n }).length > 0) : true;\r\n if (!itemPresent) {\r\n return;\r\n }\r\n let parent = _head(columnsDefinitionTree.filter((parentNode) => parentNode.key === (\"_group_\" + column.group)));\r\n if (!parent) {\r\n parent = {key: \"_group_\" + column.group, title: column.group ? column.group : \"unknown\"};\r\n columnsDefinitionTree.push(parent)\r\n }\r\n if (!parent.children) {\r\n parent.children = [];\r\n }\r\n parent.children.push({key: column.key, title: column.title});\r\n });\r\n return columnsDefinitionTree;\r\n}\r\n\r\ninterface ColumnNode extends TransferItem {\r\n group?: string\r\n children?: ColumnNode[]\r\n}\r\n\r\n/** Layout of {@link ColumnTransfer}. */\r\nexport const enum ColumnTransferType {\r\n /** Checkable tree of columns grouped by `DataGridColDef.group`; checking a column shows it. Column order cannot be changed. */\r\n SIMPLE = \"simple\",\r\n /** Two-list transfer: hidden columns as a grouped tree on the left, shown columns on the right, where they can be reordered by drag and drop. */\r\n FULL = \"full\"\r\n}\r\n\r\n/** Properties of {@link ColumnTransfer}. */\r\nexport interface ColumnTransferProps {\r\n /** Column definitions of the grid; a column is identified by `colId`, or by `field` when `colId` is not set, and grouped by its `group` (see `DataGridColDef`). */\r\n columnDefinitions: ColDef[]\r\n /** Current column state of the grid; columns without `hide` are shown as visible. */\r\n columnModel: ColumnState[]\r\n /** API of the grid whose columns are edited; every change is applied to it immediately. */\r\n gridApi: GridApi\r\n /**\r\n * Layout of the editor.\r\n * @default ColumnTransferType.FULL\r\n */\r\n type?: ColumnTransferType,\r\n /** Height in pixels of the {@link ColumnTransferType.FULL} layout; the lists get 100 pixels less. Also forwarded to the antd `Transfer`. */\r\n height?: number\r\n}\r\n\r\n/**\r\n * Editor of the visibility and order of ag-grid columns, used by the grid's column configuration dialog and settings drawer.\r\n * It does not keep its own copy of the changes: showing, hiding and moving a column is applied to `gridApi` at once,\r\n * so the caller re-renders it with the new `columnModel` (e.g. from ag-grid column events).\r\n */\r\nexport default class ColumnTransfer extends React.Component<ColumnTransferProps> {\r\n public static defaultProps = {\r\n type: ColumnTransferType.FULL\r\n };\r\n\r\n constructor(props: Readonly<ColumnTransferProps>) {\r\n super(props);\r\n this.onChange = this.onChange.bind(this);\r\n }\r\n\r\n /** antd `Transfer` change handler: shows (`direction` `\"right\"`) or hides the moved columns; a moved group key applies to all columns of the group. */\r\n onChange(_: React.Key[], direction: string, moveKeys: React.Key[]) {\r\n moveKeys.forEach((columnKey) => {\r\n if (typeof columnKey === \"string\") {\r\n if (columnKey.indexOf(\"_group_\") >= 0) {\r\n const columnsTree: ColumnNode[] = getColumnsTree(getColumns(this.props.columnDefinitions));\r\n const columnGroup: ColumnNode | undefined = _head(columnsTree.filter((columnGroup) => {\r\n return columnGroup.key === columnKey;\r\n }));\r\n if (columnGroup && columnGroup.children) {\r\n columnGroup.children.forEach((column) => {\r\n this.props.gridApi.setColumnsVisible([column.key as string], direction === \"right\");\r\n });\r\n }\r\n } else {\r\n this.props.gridApi.setColumnsVisible([columnKey], direction === \"right\");\r\n }\r\n }\r\n });\r\n };\r\n\r\n render() {\r\n const {columnDefinitions, columnModel, gridApi, type, ...restProps} = this.props;\r\n const columns = getColumns(columnDefinitions);\r\n const visibleColumnIds = columnModel.filter((column) => !column.hide).map((column) => column.colId) as string[];\r\n if (type === ColumnTransferType.SIMPLE) {\r\n const columnsTree = getColumnsTree(columns);\r\n return (<Tree<TreeNodeType>\r\n blockNode\r\n checkable\r\n defaultExpandAll\r\n checkedKeys={visibleColumnIds}\r\n onCheck={(selectedKeys, {node,},) => {\r\n const selectedColumnId: string = (node as any).props?.eventKey ? (node as any).props.eventKey : \"\";\r\n const visible = Array.isArray(selectedKeys) && selectedKeys.indexOf(selectedColumnId) >= 0;\r\n if (selectedColumnId.indexOf(\"_group_\") >= 0) {\r\n const columnGroup: ColumnNode | undefined = _head(columnsTree.filter((columnGroup) => {\r\n return columnGroup.key === selectedColumnId;\r\n }));\r\n if (columnGroup && columnGroup.children) {\r\n columnGroup.children.forEach((column) => {\r\n this.props.gridApi.setColumnsVisible([column.key as string], visible);\r\n });\r\n }\r\n } else {\r\n this.props.gridApi.setColumnsVisible([selectedColumnId], visible);\r\n }\r\n }}\r\n treeData={generateSimpleTree(columnsTree)}\r\n />);\r\n } else {\r\n const titles = [<b>{i18n(\"Hidden Columns\")}:</b>, <b>{i18n(\"Shown Columns\")}:</b>] as unknown as string[]; // special hack to overcome typescript titles attribute in Transfer component could be also [ReactElement, ReactElement]\r\n return (\r\n <Transfer {...restProps}\r\n style={{height: this.props.height, minHeight: 100}}\r\n locale={{\r\n itemUnit: \"\",\r\n itemsUnit: \"\",\r\n notFoundContent: i18n('The column list is empty'),\r\n searchPlaceholder: i18n('Column Name')\r\n }}\r\n targetKeys={visibleColumnIds}\r\n dataSource={columns}\r\n className=\"tree-transfer\"\r\n render={item => item.title ? item.title : null}\r\n showSelectAll={true}\r\n titles={titles}\r\n filterOption={(inputValue, item) => !!item.title && item.title.toLowerCase().indexOf(inputValue.toLowerCase()) > -1}\r\n showSearch\r\n onChange={this.onChange}>\r\n {({direction, onItemSelect, selectedKeys, filteredItems, onItemSelectAll}) => {\r\n if (direction === 'left') {\r\n const checkedKeys = [...selectedKeys];\r\n const columnsTree = getColumnsTree(columns, filteredItems);\r\n return (\r\n <div style={{\r\n overflowY: \"auto\",\r\n height: (this.props.height ? this.props.height : 100) - 100\r\n }}>\r\n <Tree<TreeNodeType>\r\n blockNode\r\n checkable\r\n defaultExpandAll\r\n checkedKeys={checkedKeys}\r\n onCheck={(_, {node,},) => {\r\n if ((node as any).props?.eventKey) {\r\n onItemSelect((node as any).props.eventKey, !isChecked(checkedKeys, (node as any).props.eventKey));\r\n }\r\n }}\r\n onSelect={(_, {node},) => {\r\n if ((node as any).props?.eventKey) {\r\n onItemSelect((node as any).props.eventKey, !isChecked(checkedKeys, (node as any).props.eventKey));\r\n }\r\n }}\r\n treeData={generateTree(columnsTree, visibleColumnIds)}\r\n />\r\n </div>\r\n );\r\n } else {\r\n const rowSelection: TableRowSelection<ColumnNode> = {\r\n getCheckboxProps: item => {\r\n return {disabled: !!item.disabled};\r\n },\r\n onSelectAll(selected, selectedRows) {\r\n const treeSelectedKeys = selectedRows\r\n .filter(item => !item.disabled)\r\n .map(({key}) => key);\r\n let diffKeys: any;\r\n if (selected) {\r\n diffKeys = difference(treeSelectedKeys, selectedKeys);\r\n } else {\r\n diffKeys = difference(selectedKeys, treeSelectedKeys);\r\n }\r\n onItemSelectAll(diffKeys, selected);\r\n },\r\n onSelect({key}, selected) {\r\n onItemSelect(key as string, selected);\r\n },\r\n selectedRowKeys: selectedKeys,\r\n };\r\n\r\n return (\r\n <div style={{\r\n overflowY: \"auto\",\r\n height: (this.props.height ? this.props.height : 100) - 100\r\n }}>\r\n <DragSortingTable<ColumnNode>\r\n showHeader={false}\r\n pagination={false}\r\n rowSelection={rowSelection}\r\n columns={[\r\n {\r\n dataIndex: 'title',\r\n title: 'Name',\r\n },\r\n ]}\r\n dataSource={filteredItems}\r\n size=\"small\"\r\n onRow={({key, disabled: itemDisabled}) => ({\r\n onClick: () => {\r\n if (itemDisabled) {\r\n return;\r\n }\r\n onItemSelect(key as string, !selectedKeys.includes(key as string));\r\n },\r\n })}\r\n onMoveRow={(column: ColumnNode, _: number, toIndex: number) => {\r\n this.props.gridApi.moveColumns([column.key as string], toIndex);\r\n }}\r\n />\r\n </div>\r\n );\r\n }\r\n }}\r\n </Transfer>\r\n );\r\n }\r\n };\r\n}\r\n\r\n"]}
1
+ {"version":3,"file":"columnTransfer.js","sourceRoot":"","sources":["../../../../../components/grid/config/columnTransfer.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,QAAQ,EAAE,IAAI,EAAe,MAAM,MAAM,CAAA;AACjD,OAAO,KAAK,MAAM,aAAa,CAAC;AAChC,OAAO,IAAI,MAAM,kBAAkB,CAAA;AACnC,OAAO,gBAAgB,MAAM,4CAA4C,CAAC;AAI1E,OAAO,UAAU,MAAM,mBAAmB,CAAC;AAE3C,gCAAgC;AAChC,MAAM,SAAS,GAAG,CAAC,YAAyB,EAAE,QAAgB,EAAE,EAAE;IAC9D,OAAO,YAAY,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;AACjD,CAAC,CAAC;AAIF,SAAS,YAAY,CAAC,YAA0B,EAAE,EAAE,cAAwB,EAAE;IAC1E,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,EAAoB,EAAgB,EAAE;YAAtC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C;wCACf,OAAO;oCACX,CAAC;oCACD,YAAY,CAAC,GAAa,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAa,CAAC,CAAC,CAAC;gCACvE,CAAC;6BACJ,CAAC,EACF,SAAS,EAAE,CAAC,MAAkB,EAAE,CAAS,EAAE,OAAe,EAAE,EAAE;gCAC1D,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,GAAa,CAAC,EAAE,OAAO,CAAC,CAAC;4BACpE,CAAC,GACH,CACA,CACT,CAAC;gBACN,CAAC;YACL,CAAC,CACM,CACd,CAAC;QACN,CAAC;IACL,CAAC;IAAA,CAAC;;AAvKY,2BAAY,GAAG;IACzB,IAAI,sCAAyB;CAChC,CAAC;eAHe,cAAc","sourcesContent":["import React from \"react\";\r\nimport {Transfer, Tree, TreeDataNode} from 'antd'\r\nimport _head from \"lodash/head\";\r\nimport i18n from \"d2core/i18n/i18n\"\r\nimport DragSortingTable from \"d2coreui/components/table/dragSortingTable\";\r\nimport {ColDef, ColumnState, GridApi} from \"ag-grid-community\";\r\nimport {TableRowSelection} from \"antd/es/table/interface\";\r\nimport {TransferItem} from \"antd/lib/transfer\";\r\nimport difference from \"lodash/difference\";\r\n\r\n// Customize ColumnNode Transfer\r\nconst isChecked = (selectedKeys: React.Key[], eventKey: string) => {\r\n return selectedKeys.indexOf(eventKey) !== -1;\r\n};\r\n\r\ntype TreeNodeType = TreeDataNode & ColumnNode;\r\n\r\nfunction generateTree(treeNodes: ColumnNode[] = [], checkedKeys: string[] = []): TreeNodeType[] {\r\n return treeNodes.map(({children, ...props}): TreeNodeType => ({\r\n ...props,\r\n key: props.key as string,\r\n disabled: checkedKeys.includes(props.key as string),\r\n children: generateTree(children, checkedKeys),\r\n }));\r\n}\r\n\r\nfunction generateSimpleTree(treeNodes: ColumnNode[] = []): TreeNodeType[] {\r\n return treeNodes.map(({children, ...props}) => ({\r\n ...props,\r\n key: props.key as string,\r\n children: generateSimpleTree(children)\r\n }));\r\n}\r\n\r\nfunction getColumns(columnDefinitions: ColDef[], gridApi: GridApi): ColumnNode[] {\r\n // noinspection UnnecessaryLocalVariableJS\r\n const columns = columnDefinitions.map((columnDef) => {\r\n const id = columnDef.colId ? columnDef.colId : (columnDef.field ? columnDef.field : \"\");\r\n const group = (columnDef as any).group;\r\n const column = id ? gridApi.getColumn(id) : null;\r\n return {\r\n key: id,\r\n title: (column && gridApi.getDisplayNameForColumn(column, \"columnToolPanel\")) || columnDef.headerName || id,\r\n description: columnDef.headerTooltip,\r\n group: group\r\n };\r\n });\r\n return columns;\r\n}\r\n\r\nfunction getColumnsTree(columns: ColumnNode[], filteredItems: ColumnNode[] | undefined = undefined): ColumnNode[] {\r\n const columnsDefinitionTree: ColumnNode[] = [];\r\n columns.forEach((column) => {\r\n const itemPresent = filteredItems ? (filteredItems.filter((filteredItem) => {\r\n return filteredItem.key === column.key\r\n }).length > 0) : true;\r\n if (!itemPresent) {\r\n return;\r\n }\r\n if (!column.group) {\r\n columnsDefinitionTree.push({key: column.key, title: column.title});\r\n return;\r\n }\r\n let parent = _head(columnsDefinitionTree.filter((parentNode) => parentNode.key === (\"_group_\" + column.group)));\r\n if (!parent) {\r\n parent = {key: \"_group_\" + column.group, title: column.group};\r\n columnsDefinitionTree.push(parent)\r\n }\r\n if (!parent.children) {\r\n parent.children = [];\r\n }\r\n parent.children.push({key: column.key, title: column.title});\r\n });\r\n return columnsDefinitionTree;\r\n}\r\n\r\ninterface ColumnNode extends TransferItem {\r\n group?: string\r\n children?: ColumnNode[]\r\n}\r\n\r\n/** Layout of {@link ColumnTransfer}. */\r\nexport const enum ColumnTransferType {\r\n /** Checkable tree of columns grouped by `DataGridColDef.group`; checking a column shows it. Column order cannot be changed. */\r\n SIMPLE = \"simple\",\r\n /** Two-list transfer: hidden columns as a grouped tree on the left, shown columns on the right, where they can be reordered by drag and drop. */\r\n FULL = \"full\"\r\n}\r\n\r\n/** Properties of {@link ColumnTransfer}. */\r\nexport interface ColumnTransferProps {\r\n /** Column definitions of the grid; a column is identified by `colId`, or by `field` when `colId` is not set, and grouped by its `group` (see `DataGridColDef`). */\r\n columnDefinitions: ColDef[]\r\n /** Current column state of the grid; columns without `hide` are shown as visible. */\r\n columnModel: ColumnState[]\r\n /** API of the grid whose columns are edited; every change is applied to it immediately. */\r\n gridApi: GridApi\r\n /**\r\n * Layout of the editor.\r\n * @default ColumnTransferType.FULL\r\n */\r\n type?: ColumnTransferType,\r\n /** Height in pixels of the {@link ColumnTransferType.FULL} layout; the lists get 100 pixels less. Also forwarded to the antd `Transfer`. */\r\n height?: number\r\n}\r\n\r\n/**\r\n * Editor of the visibility and order of ag-grid columns, used by the grid's column configuration dialog and settings drawer.\r\n * It does not keep its own copy of the changes: showing, hiding and moving a column is applied to `gridApi` at once,\r\n * so the caller re-renders it with the new `columnModel` (e.g. from ag-grid column events).\r\n */\r\nexport default class ColumnTransfer extends React.Component<ColumnTransferProps> {\r\n public static defaultProps = {\r\n type: ColumnTransferType.FULL\r\n };\r\n\r\n constructor(props: Readonly<ColumnTransferProps>) {\r\n super(props);\r\n this.onChange = this.onChange.bind(this);\r\n }\r\n\r\n /** antd `Transfer` change handler: shows (`direction` `\"right\"`) or hides the moved columns; a moved group key applies to all columns of the group. */\r\n onChange(_: React.Key[], direction: string, moveKeys: React.Key[]) {\r\n moveKeys.forEach((columnKey) => {\r\n if (typeof columnKey === \"string\") {\r\n if (columnKey.indexOf(\"_group_\") >= 0) {\r\n const columnsTree: ColumnNode[] = getColumnsTree(getColumns(this.props.columnDefinitions, this.props.gridApi));\r\n const columnGroup: ColumnNode | undefined = _head(columnsTree.filter((columnGroup) => {\r\n return columnGroup.key === columnKey;\r\n }));\r\n if (columnGroup && columnGroup.children) {\r\n columnGroup.children.forEach((column) => {\r\n this.props.gridApi.setColumnsVisible([column.key as string], direction === \"right\");\r\n });\r\n }\r\n } else {\r\n this.props.gridApi.setColumnsVisible([columnKey], direction === \"right\");\r\n }\r\n }\r\n });\r\n };\r\n\r\n render() {\r\n const {columnDefinitions, columnModel, gridApi, type, ...restProps} = this.props;\r\n const columns = getColumns(columnDefinitions, gridApi);\r\n const visibleColumnIds = columnModel.filter((column) => !column.hide).map((column) => column.colId) as string[];\r\n if (type === ColumnTransferType.SIMPLE) {\r\n const columnsTree = getColumnsTree(columns);\r\n return (<Tree<TreeNodeType>\r\n blockNode\r\n checkable\r\n defaultExpandAll\r\n checkedKeys={visibleColumnIds}\r\n onCheck={(selectedKeys, {node,},) => {\r\n const selectedColumnId: string = (node as any).props?.eventKey ? (node as any).props.eventKey : \"\";\r\n const visible = Array.isArray(selectedKeys) && selectedKeys.indexOf(selectedColumnId) >= 0;\r\n if (selectedColumnId.indexOf(\"_group_\") >= 0) {\r\n const columnGroup: ColumnNode | undefined = _head(columnsTree.filter((columnGroup) => {\r\n return columnGroup.key === selectedColumnId;\r\n }));\r\n if (columnGroup && columnGroup.children) {\r\n columnGroup.children.forEach((column) => {\r\n this.props.gridApi.setColumnsVisible([column.key as string], visible);\r\n });\r\n }\r\n } else {\r\n this.props.gridApi.setColumnsVisible([selectedColumnId], visible);\r\n }\r\n }}\r\n treeData={generateSimpleTree(columnsTree)}\r\n />);\r\n } else {\r\n const titles = [<b>{i18n(\"Hidden Columns\")}:</b>, <b>{i18n(\"Shown Columns\")}:</b>] as unknown as string[]; // special hack to overcome typescript titles attribute in Transfer component could be also [ReactElement, ReactElement]\r\n return (\r\n <Transfer {...restProps}\r\n style={{height: this.props.height, minHeight: 100}}\r\n locale={{\r\n itemUnit: \"\",\r\n itemsUnit: \"\",\r\n notFoundContent: i18n('The column list is empty'),\r\n searchPlaceholder: i18n('Column Name')\r\n }}\r\n targetKeys={visibleColumnIds}\r\n dataSource={columns}\r\n className=\"tree-transfer\"\r\n render={item => item.title ? item.title : null}\r\n showSelectAll={true}\r\n titles={titles}\r\n filterOption={(inputValue, item) => !!item.title && item.title.toLowerCase().indexOf(inputValue.toLowerCase()) > -1}\r\n showSearch\r\n onChange={this.onChange}>\r\n {({direction, onItemSelect, selectedKeys, filteredItems, onItemSelectAll}) => {\r\n if (direction === 'left') {\r\n const checkedKeys = [...selectedKeys];\r\n const columnsTree = getColumnsTree(columns, filteredItems);\r\n const selectNode = (node: ColumnNode, checked: boolean) => {\r\n if (node.children?.length) {\r\n onItemSelectAll(node.children.map((child) => child.key as string), checked);\r\n } else {\r\n onItemSelect(node.key as string, checked);\r\n }\r\n };\r\n return (\r\n <div style={{\r\n overflowY: \"auto\",\r\n height: (this.props.height ? this.props.height : 100) - 100\r\n }}>\r\n <Tree<TreeNodeType>\r\n key={columnsTree.filter((node) => node.children).map((node) => node.key).join()}\r\n blockNode\r\n checkable\r\n defaultExpandAll\r\n checkedKeys={checkedKeys}\r\n onCheck={(_, {node, checked}) => {\r\n selectNode(node, checked);\r\n }}\r\n onSelect={(_, {node}) => {\r\n const keys = node.children?.length ? node.children.map((child) => child.key as string) : [node.key as string];\r\n selectNode(node, !keys.every((key) => isChecked(checkedKeys, key)));\r\n }}\r\n treeData={generateTree(columnsTree, visibleColumnIds)}\r\n />\r\n </div>\r\n );\r\n } else {\r\n const rowSelection: TableRowSelection<ColumnNode> = {\r\n getCheckboxProps: item => {\r\n return {disabled: !!item.disabled};\r\n },\r\n onChange(selectedRowKeys) {\r\n const addedKeys = difference(selectedRowKeys, selectedKeys) as string[];\r\n const removedKeys = difference(selectedKeys, selectedRowKeys) as string[];\r\n if (addedKeys.length > 0) {\r\n onItemSelectAll(addedKeys, true);\r\n }\r\n if (removedKeys.length > 0) {\r\n onItemSelectAll(removedKeys, false);\r\n }\r\n },\r\n preserveSelectedRowKeys: true,\r\n selectedRowKeys: selectedKeys,\r\n };\r\n\r\n return (\r\n <div style={{\r\n overflowY: \"auto\",\r\n height: (this.props.height ? this.props.height : 100) - 100\r\n }}>\r\n <DragSortingTable<ColumnNode>\r\n showHeader={false}\r\n pagination={false}\r\n rowSelection={rowSelection}\r\n columns={[\r\n {\r\n dataIndex: 'title',\r\n title: 'Name',\r\n },\r\n ]}\r\n dataSource={filteredItems}\r\n size=\"small\"\r\n onRow={({key, disabled: itemDisabled}) => ({\r\n onClick: () => {\r\n if (itemDisabled) {\r\n return;\r\n }\r\n onItemSelect(key as string, !selectedKeys.includes(key as string));\r\n },\r\n })}\r\n onMoveRow={(column: ColumnNode, _: number, toIndex: number) => {\r\n this.props.gridApi.moveColumns([column.key as string], toIndex);\r\n }}\r\n />\r\n </div>\r\n );\r\n }\r\n }}\r\n </Transfer>\r\n );\r\n }\r\n };\r\n}\r\n\r\n"]}
@@ -3,7 +3,7 @@ import { MenuProps } from "antd";
3
3
  import { AgGridReact } from "ag-grid-react";
4
4
  import 'd2coreui/style/ag-grid/aggrid-adaptations.css';
5
5
  import { ContextMenuProps, PageOrientation } from "d2coreui/components/grid/export/contextMenu";
6
- import { CellClassParams, CellFocusedEvent, CellMouseDownEvent, CellMouseOverEvent, ColDef, Column, ColumnEvent, ColumnState, FilterChangedEvent, FilterModifiedEvent, GridApi, GridOptions, GridReadyEvent, IRowNode, PaginationChangedEvent, RowClassParams, RowPinnedType, RowStyle, ViewportChangedEvent } from "ag-grid-community";
6
+ import { CellClassParams, CellFocusedEvent, CellMouseDownEvent, CellMouseOverEvent, ColDef, ColTypeDef, ColGroupDef, Column, ColumnEvent, NewColumnsLoadedEvent, ColumnState, FilterChangedEvent, FilterModifiedEvent, GridApi, GridOptions, GridReadyEvent, IRowNode, PaginationChangedEvent, RowClassParams, RowPinnedType, RowStyle, ViewportChangedEvent } from "ag-grid-community";
7
7
  import { GridRowStyle, RowStyleRule } from "d2coreui/components/grid/cell/tableDefaultRowStyleRules";
8
8
  import ProgressPopup from "d2coreui/components/grid/export/progressPopup";
9
9
  import WildcardQuickFilterEngine from "./filter/wildcardQuickFilterEngine";
@@ -83,6 +83,13 @@ export interface DataGridColDef extends Omit<ColDef, "cellStyle"> {
83
83
  /** Custom floating filter renderer; used by columns of type `customColumnServerFilter`. */
84
84
  renderFilter?: FilterRenderer;
85
85
  }
86
+ /**
87
+ * Column group of {@link DataGrid}: a common header above its children, which are adapted like top-level columns.
88
+ * Not to be confused with {@link DataGridColDef.group}, which is the column's category in the columns configuration dialog.
89
+ */
90
+ export interface DataGridColGroupDef extends Omit<ColGroupDef, "children"> {
91
+ children: (DataGridColDef | DataGridColGroupDef)[];
92
+ }
86
93
  /** Column (floating) filter configuration of {@link DataGrid}, see `DataGridProps.filter`. */
87
94
  export interface DataGridFilterProps {
88
95
  /**
@@ -143,22 +150,24 @@ export interface DataGridSearchProps {
143
150
  export type OnLoadDataCallback = (totalRecords: number) => void;
144
151
  /**
145
152
  * Props of {@link DataGrid}. All other ag-grid `GridOptions` are passed through to `AgGridReact`, with these differences:
146
- * - `columnDefs` are {@link DataGridColDef}s and column groups are not supported;
153
+ * - `columnDefs` are {@link DataGridColDef}s, optionally wrapped in {@link DataGridColGroupDef}s;
147
154
  * - `paginationPageSize` is not available, use `paging.pageSize`;
148
155
  * - `getRowStyle` is combined with {@link DataGridProps.rowStyleRules};
149
156
  * - `getRowId` is fixed to `String(data.id)`, so every row object must have a unique `id`;
150
157
  * - the pagination panel, overlays, header component, column types, `context` and several event handlers are provided
151
158
  * by DataGrid (the handlers listed here are still called).
159
+ *
160
+ * @typeParam TData - row data type, passed to the ag-grid `GridOptions` (`rowData`, `getRowId`, events, ...)
152
161
  */
153
- export interface DataGridProps extends Omit<GridOptions, "columnDefs" | "paginationPageSize" | "getRowStyle" | "cellStyle"> {
162
+ export interface DataGridProps<TData = any> extends Omit<GridOptions<TData>, "columnDefs" | "paginationPageSize" | "getRowStyle" | "cellStyle"> {
154
163
  /** ag-grid options object passed to `AgGridReact`, e.g. to link grids for the aligned grids feature. */
155
- gridOptions?: GridOptions;
156
- /** Column definitions; see {@link DataGridColDef} for how they are adapted. */
157
- columnDefs: DataGridColDef[];
164
+ gridOptions?: GridOptions<TData>;
165
+ /** Column definitions; see {@link DataGridColDef} for how they are adapted. Columns may be wrapped in {@link DataGridColGroupDef}s. */
166
+ columnDefs: (DataGridColDef | DataGridColGroupDef)[];
158
167
  /** Passes `columnDefs` to ag-grid unchanged (no header component, cell style or floating filter adaptation); used for aligned grids. */
159
168
  disableColumnDefsPreprocessing?: boolean;
160
169
  /** Called asynchronously with the adapted column definitions each time they are rebuilt (not called when preprocessing is disabled). */
161
- onColumnDefsAdapted?(columnDefs: ColDef[]): void;
170
+ onColumnDefsAdapted?(columnDefs: (ColDef | ColGroupDef)[]): void;
162
171
  /**
163
172
  * Visibility of the advanced table configuration panel (page size, date format, row styles). Controlled: the panel
164
173
  * is shown only while this is `true`; update it from {@link DataGridProps.onTableConfigVisible}.
@@ -308,7 +317,7 @@ export interface DataGridProps extends Omit<GridOptions, "columnDefs" | "paginat
308
317
  /** Additional row style merged over the style computed from {@link DataGridProps.rowStyleRules}; may return `undefined`. */
309
318
  getRowStyle?(params: any): GridRowStyle | undefined;
310
319
  /** Ref receiving the underlying `AgGridReact` instance. */
311
- gridRef?: React.RefObject<AgGridReact>;
320
+ gridRef?: React.RefObject<AgGridReact<TData>>;
312
321
  /**
313
322
  * Enables an Excel-like fill handle on the focused cell: dragging from its bottom-right corner selects a cell range
314
323
  * and reports it through {@link DataGridProps.onFillHandleComplete}. The grid does not modify any data itself.
@@ -374,8 +383,12 @@ interface DataGridState {
374
383
  * onChangeRowStyleRules={setRowStyleRules}
375
384
  * onLoadData={(callback) => loadRows().then((rows) => { setRows(rows); callback(rows.length); })}
376
385
  * />
386
+ *
387
+ * @typeParam TData - row data type, see {@link DataGridProps}
377
388
  */
378
- export default class DataGrid extends React.Component<DataGridProps, DataGridState> {
389
+ export default class DataGrid<TData extends {
390
+ id: number | string;
391
+ } = any> extends React.Component<DataGridProps<TData>, DataGridState> {
379
392
  /** Default `paging` (automatic page size) and `rowStyleRules` ({@link tableDefaultRowStyleRules}). */
380
393
  static defaultProps: {
381
394
  paging: {
@@ -390,10 +403,10 @@ export default class DataGrid extends React.Component<DataGridProps, DataGridSta
390
403
  wildcardQuickFilter: WildcardQuickFilterEngine;
391
404
  /** Custom ag-grid column types registered by the grid (see {@link DataGridColDef}). */
392
405
  columnTypes: {
393
- [key: string]: ColDef;
406
+ [key: string]: ColTypeDef<TData>;
394
407
  };
395
408
  /** ag-grid API; `undefined` until the grid is ready. */
396
- gridApi?: GridApi;
409
+ gridApi?: GridApi<TData>;
397
410
  /** Column state saved when the columns configuration dialog opens, restored when it is cancelled. */
398
411
  columnModelBeforeEdit?: ColumnState[];
399
412
  /** Row index to focus after the pending page change. */
@@ -412,7 +425,7 @@ export default class DataGrid extends React.Component<DataGridProps, DataGridSta
412
425
  */
413
426
  table_context: any;
414
427
  private readonly getTheme;
415
- constructor(props: Readonly<DataGridProps>);
428
+ constructor(props: Readonly<DataGridProps<TData>>);
416
429
  private static getCellValue;
417
430
  /**
418
431
  * Case-insensitive `textCustomComparator` used by the grid's text filters; `contains` supports `*` and `?` wildcards.
@@ -420,7 +433,7 @@ export default class DataGrid extends React.Component<DataGridProps, DataGridSta
420
433
  * @returns whether `value` passes the filter
421
434
  */
422
435
  textCustomComparator(filter: string, value: any, filterText: string): boolean;
423
- componentDidUpdate(prevProps: DataGridProps): void;
436
+ componentDidUpdate(prevProps: DataGridProps<TData>): void;
424
437
  componentWillUnmount(): void;
425
438
  /**
426
439
  * Applies a column state (order, width, visibility, pinning, sorting) to the grid, e.g. one saved from
@@ -448,7 +461,7 @@ export default class DataGrid extends React.Component<DataGridProps, DataGridSta
448
461
  /** Synchronizes the table configuration panel visibility with the `tableConfigVisible` prop when it is set. */
449
462
  static getDerivedStateFromProps(props: DataGridProps, state: DataGridState): Partial<DataGridState>;
450
463
  /** ag-grid `gridReady` handler: stores the grid API, forwards the event to `props.onGridReady` and initializes sort/column state. */
451
- onGridReady(gridReadyEvent: GridReadyEvent): void;
464
+ onGridReady(gridReadyEvent: GridReadyEvent<TData>): void;
452
465
  /**
453
466
  * ag-grid `paginationChanged` handler: updates the pager, reports page size changes through
454
467
  * `paging.onPaginationChanged`, triggers the initial data load and forwards the event to `props.onPaginationChanged`.
@@ -486,6 +499,11 @@ export default class DataGrid extends React.Component<DataGridProps, DataGridSta
486
499
  isActive(): boolean;
487
500
  /** Handler of ag-grid column visible/pinned/resized/moved events; stores the column state and calls `props.onColumnsChanged`. */
488
501
  onColumnsChanged(event: ColumnEvent): void;
502
+ /**
503
+ * ag-grid `newColumnsLoaded` handler: refreshes the stored column state after `columnDefs` change, without calling
504
+ * `props.onColumnsChanged`, and forwards the event to `props.onNewColumnsLoaded`.
505
+ */
506
+ onNewColumnsLoaded(event: NewColumnsLoadedEvent): void;
489
507
  /**
490
508
  * Requests showing/hiding the floating column filters: re-applies `filter.getFilterModel()` and calls
491
509
  * `filter.onColumnSearchVisible`; the actual visibility follows `filter.columnSearchVisible`.
@@ -26,6 +26,7 @@ import LoadingOverlay from "d2coreui/components/grid/panel/loadingOverlay";
26
26
  import NoRecordsOverlay from "d2coreui/components/grid/panel/noRecordsOverlay";
27
27
  import at from "lodash/at";
28
28
  import ColumnTransfer from "d2coreui/components/grid/config/columnTransfer";
29
+ import { ColumnUtils } from "d2coreui/components/grid/columnUtils";
29
30
  import cloneDeep from "lodash/cloneDeep";
30
31
  import { RangeSelector } from "d2coreui/components/grid/cell/rangeSelector";
31
32
  import { CellControl } from "d2coreui/components/grid/cell/cellControl";
@@ -60,9 +61,9 @@ import WithCss from "../style/withCss";
60
61
  import { createStyles } from "antd-style";
61
62
  const useStyles = createStyles(({ css }) => {
62
63
  return {
63
- baseLayout: css `
64
- width: 100%;
65
- height: 100%;
64
+ baseLayout: css `
65
+ width: 100%;
66
+ height: 100%;
66
67
  `
67
68
  };
68
69
  });
@@ -136,6 +137,8 @@ var NavigationEventEnum;
136
137
  * onChangeRowStyleRules={setRowStyleRules}
137
138
  * onLoadData={(callback) => loadRows().then((rows) => { setRows(rows); callback(rows.length); })}
138
139
  * />
140
+ *
141
+ * @typeParam TData - row data type, see {@link DataGridProps}
139
142
  */
140
143
  class DataGrid extends React.Component {
141
144
  constructor(props) {
@@ -180,6 +183,7 @@ class DataGrid extends React.Component {
180
183
  this.loadingOverlayRenderer = this.loadingOverlayRenderer.bind(this);
181
184
  this.changePagination = this.changePagination.bind(this);
182
185
  this.onColumnsChanged = this.onColumnsChanged.bind(this);
186
+ this.onNewColumnsLoaded = this.onNewColumnsLoaded.bind(this);
183
187
  this.onFilterModified = this.onFilterModified.bind(this);
184
188
  this.onFilterChanged = this.onFilterChanged.bind(this);
185
189
  this.onFilterConfirmed = this.onFilterConfirmed.bind(this);
@@ -910,6 +914,15 @@ class DataGrid extends React.Component {
910
914
  }
911
915
  this.setState({ columnModel: columnModel });
912
916
  }
917
+ /**
918
+ * ag-grid `newColumnsLoaded` handler: refreshes the stored column state after `columnDefs` change, without calling
919
+ * `props.onColumnsChanged`, and forwards the event to `props.onNewColumnsLoaded`.
920
+ */
921
+ onNewColumnsLoaded(event) {
922
+ var _a, _b;
923
+ this.setState({ columnModel: event.api.getColumnState() });
924
+ (_b = (_a = this.props).onNewColumnsLoaded) === null || _b === void 0 ? void 0 : _b.call(_a, event);
925
+ }
913
926
  /**
914
927
  * Requests showing/hiding the floating column filters: re-applies `filter.getFilterModel()` and calls
915
928
  * `filter.onColumnSearchVisible`; the actual visibility follows `filter.columnSearchVisible`.
@@ -1771,9 +1784,12 @@ class DataGrid extends React.Component {
1771
1784
  if (disableColumnDefsPreprocessing) {
1772
1785
  return columnDefs;
1773
1786
  }
1774
- const adaptedColumnDefs = columnDefs ? columnDefs.map((columnDef) => {
1787
+ const adaptColumnDefs = (columnDefs) => columnDefs.map((columnDef) => {
1775
1788
  var _a, _b, _c, _d;
1776
- const _e = columnDef, { group, floatingFilter, hide, cellEditorPopup, editable, headerComponent, headerComponentParams } = _e, rest = __rest(_e, ["group", "floatingFilter", "hide", "cellEditorPopup", "editable", "headerComponent", "headerComponentParams"]);
1789
+ if ("children" in columnDef) {
1790
+ return Object.assign(Object.assign({}, columnDef), { children: adaptColumnDefs(columnDef.children) });
1791
+ }
1792
+ const { group, floatingFilter, hide, cellEditorPopup, editable, headerComponent, headerComponentParams } = columnDef, rest = __rest(columnDef, ["group", "floatingFilter", "hide", "cellEditorPopup", "editable", "headerComponent", "headerComponentParams"]);
1777
1793
  let floatingFilterEnabledForColumn = !!floatingFilter;
1778
1794
  if (typeof columnDef.type === "string") {
1779
1795
  if (!!((_a = this.columnTypes[columnDef.type]) === null || _a === void 0 ? void 0 : _a.floatingFilter)) {
@@ -1794,21 +1810,19 @@ class DataGrid extends React.Component {
1794
1810
  'cell-has-handle': (p) => { var _a, _b; return ((_a = this.state.focusedCell) === null || _a === void 0 ? void 0 : _a.rowIndex) === p.rowIndex && ((_b = this.state.focusedCell) === null || _b === void 0 ? void 0 : _b.colId) === p.colDef.colId && !this.state.isDragging; },
1795
1811
  'cell-drag-selected': (params) => (this.state.startCoord !== null && this.state.endCoord !== null) ? this.isInRange(params.rowIndex, params.colDef.colId) : false,
1796
1812
  } });
1797
- }) : undefined;
1798
- if (adaptedColumnDefs) {
1799
- setTimeout(() => {
1800
- var _a, _b;
1801
- (_b = (_a = this.props).onColumnDefsAdapted) === null || _b === void 0 ? void 0 : _b.call(_a, adaptedColumnDefs);
1802
- }, 0);
1803
- }
1813
+ });
1814
+ const adaptedColumnDefs = adaptColumnDefs(columnDefs);
1815
+ setTimeout(() => {
1816
+ var _a, _b;
1817
+ (_b = (_a = this.props).onColumnDefsAdapted) === null || _b === void 0 ? void 0 : _b.call(_a, adaptedColumnDefs);
1818
+ }, 0);
1804
1819
  return adaptedColumnDefs;
1805
1820
  }
1806
1821
  isInRange(rowIndex, colId) {
1807
- var _a;
1808
1822
  const { startCoord, endCoord } = this.state;
1809
1823
  if (startCoord === null || endCoord === null)
1810
1824
  return false;
1811
- const allCols = ((_a = this.gridApi.getColumnDefs()) === null || _a === void 0 ? void 0 : _a.map(c => c.colId)) || [];
1825
+ const allCols = this.gridApi.getAllDisplayedColumns().map(c => c.getColId());
1812
1826
  const startColIdx = allCols.indexOf(startCoord.colId);
1813
1827
  const endColIdx = allCols.indexOf(endCoord.colId);
1814
1828
  const currentColIdx = allCols.indexOf(colId);
@@ -1841,6 +1855,8 @@ class DataGrid extends React.Component {
1841
1855
  // nejde
1842
1856
  const floatingFilterEnabled = !!filter && !!filter.columnSearchVisible;
1843
1857
  const adaptedColumnDefs = this.getAdaptedColumnDefs(columnDefs, floatingFilterEnabled, !!disableColumnDefsPreprocessing);
1858
+ // the configuration dialogs list columns only, groups are just headers in the grid
1859
+ const leafColumnDefs = ColumnUtils.getLeafColumnDefs(columnDefs);
1844
1860
  const customComponents = this.getCustomComponents(components);
1845
1861
  const debugMode = process.env.NODE_ENV === 'development';
1846
1862
  const bodyStyle = {
@@ -1891,7 +1907,7 @@ class DataGrid extends React.Component {
1891
1907
  React.createElement(ConfigProvider.ConfigContext.Consumer, null, (context) => {
1892
1908
  var _a;
1893
1909
  const defaultTheme = theme !== null && theme !== void 0 ? theme : this.getTheme((_a = context.theme) === null || _a === void 0 ? void 0 : _a.algorithm, styles.theme);
1894
- return (React.createElement(AgGridReact, Object.assign({ key: key, debug: debugMode, ref: gridRef, theme: defaultTheme, paginationPageSize: paginationPageSize, maxConcurrentDatasourceRequests: this.props.rowModelType === "infinite" ? 1 : undefined, onGridReady: this.onGridReady, onPaginationChanged: this.onPaginationChanged, onFilterModified: this.onFilterModified, onFilterChanged: this.onFilterChanged, onSortChanged: this.onSortChanged, defaultColDef: this.getDefaultColDefinition(defaultColDef), columnDefs: adaptedColumnDefs, rowData: !rowDataManualMode ? rowData : undefined }, passedProperties, { onCellFocused: this.onCellFocused, cellSelection: rowSelection === "multiple" || (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.mode) === "multiRow", rowSelection: rowSelection, suppressRowClickSelection: rowSelection === "multiple" || (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.mode) === "multiRow", suppressRowDeselection: rowSelection === "multiple" || (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.mode) === "multiRow", suppressPaginationPanel: true, getRowId: getRowId, maintainColumnOrder: true, components: customComponents, columnTypes: this.columnTypes, onColumnVisible: this.onColumnsChanged, onColumnPinned: this.onColumnsChanged, onColumnResized: this.onColumnsChanged, onColumnMoved: this.onColumnsChanged, onCellMouseOver: this.onCellMouseOver, onCellMouseDown: this.onCellMouseDown, navigateToNextCell: this.navigateToNextCell, onViewportChanged: this.onViewportChanged, onCellContextMenu: this.onCellContextMenu, loadingOverlayComponent: 'loadingOverlay', noRowsOverlayComponent: 'noRecordsOverlay', onRowDataUpdated: this.onRowDataUpdated, context: this.table_context, rowHeight: this.state.rowHeight, getRowStyle: this._getRowStyle, getRowHeight: this._getRowHeight, headerHeight: headerHeight !== undefined ? headerHeight : headerFilterRowHeight, floatingFiltersHeight: headerFilterRowHeight, suppressLoadingOverlay: this.props.loadingOverlayRenderer ? true : this.props.suppressLoadingOverlay, quickFilterParser: this.wildcardQuickFilter.quickFilterParser, quickFilterMatcher: this.wildcardQuickFilter.quickFilterMatcher })));
1910
+ return (React.createElement(AgGridReact, Object.assign({ key: key, debug: debugMode, ref: gridRef, theme: defaultTheme, paginationPageSize: paginationPageSize, maxConcurrentDatasourceRequests: this.props.rowModelType === "infinite" ? 1 : undefined, onGridReady: this.onGridReady, onPaginationChanged: this.onPaginationChanged, onFilterModified: this.onFilterModified, onFilterChanged: this.onFilterChanged, onSortChanged: this.onSortChanged, defaultColDef: this.getDefaultColDefinition(defaultColDef), columnDefs: adaptedColumnDefs, rowData: !rowDataManualMode ? rowData : undefined }, passedProperties, { onCellFocused: this.onCellFocused, cellSelection: rowSelection === "multiple" || (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.mode) === "multiRow", rowSelection: rowSelection, suppressRowClickSelection: rowSelection === "multiple" || (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.mode) === "multiRow", suppressRowDeselection: rowSelection === "multiple" || (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.mode) === "multiRow", suppressPaginationPanel: true, getRowId: getRowId, maintainColumnOrder: true, components: customComponents, columnTypes: this.columnTypes, onColumnVisible: this.onColumnsChanged, onColumnPinned: this.onColumnsChanged, onColumnResized: this.onColumnsChanged, onColumnMoved: this.onColumnsChanged, onNewColumnsLoaded: this.onNewColumnsLoaded, onCellMouseOver: this.onCellMouseOver, onCellMouseDown: this.onCellMouseDown, navigateToNextCell: this.navigateToNextCell, onViewportChanged: this.onViewportChanged, onCellContextMenu: this.onCellContextMenu, loadingOverlayComponent: 'loadingOverlay', noRowsOverlayComponent: 'noRecordsOverlay', onRowDataUpdated: this.onRowDataUpdated, context: this.table_context, rowHeight: this.state.rowHeight, getRowStyle: this._getRowStyle, getRowHeight: this._getRowHeight, headerHeight: headerHeight !== undefined ? headerHeight : headerFilterRowHeight, floatingFiltersHeight: headerFilterRowHeight, suppressLoadingOverlay: this.props.loadingOverlayRenderer ? true : this.props.suppressLoadingOverlay, quickFilterParser: this.wildcardQuickFilter.quickFilterParser, quickFilterMatcher: this.wildcardQuickFilter.quickFilterMatcher })));
1895
1911
  }),
1896
1912
  this.state.loading && this.props.loadingOverlayRenderer &&
1897
1913
  React.createElement("div", { className: "ag-overlay", "aria-hidden": "true" },
@@ -1901,7 +1917,7 @@ class DataGrid extends React.Component {
1901
1917
  }), tableOverlayRenderer === null || tableOverlayRenderer === void 0 ? void 0 :
1902
1918
  tableOverlayRenderer())),
1903
1919
  !!this.gridApi && !!this.gridApi && this.state.pageSize !== null &&
1904
- React.createElement(DataGridEditor, { dataGrid: this, gridApi: this.gridApi, columnDefinitions: columnDefs, columnModel: this.state.columnModel, visible: !!this.props.tableConfigVisible, onTableConfigVisible: this.showTableConfiguration, paginationPageSize: paging.pageSize, paginationDefaultPageSize: paging.defaultPageSize, currentPageSize: this.state.pageSize, showMilliseconds: !!this.props.showMilliseconds, defaultShowMilliseconds: !!this.props.defaultShowMilliseconds, showYear: !this.props.hideYear, defaultShowYear: !this.props.defaultHideYear, showUtcOffset: !!this.props.showUtcOffset, defaultShowUtcOffset: !!this.props.defaultShowUtcOffset, rowStyleRules: this.props.rowStyleRules, defaultRowStyleRules: this.props.defaultRowStyleRules, onChangeRowStyleRules: onChangeRowStyleRules }),
1920
+ React.createElement(DataGridEditor, { dataGrid: this, gridApi: this.gridApi, columnDefinitions: leafColumnDefs, columnModel: this.state.columnModel, visible: !!this.props.tableConfigVisible, onTableConfigVisible: this.showTableConfiguration, paginationPageSize: paging.pageSize, paginationDefaultPageSize: paging.defaultPageSize, currentPageSize: this.state.pageSize, showMilliseconds: !!this.props.showMilliseconds, defaultShowMilliseconds: !!this.props.defaultShowMilliseconds, showYear: !this.props.hideYear, defaultShowYear: !this.props.defaultHideYear, showUtcOffset: !!this.props.showUtcOffset, defaultShowUtcOffset: !!this.props.defaultShowUtcOffset, rowStyleRules: this.props.rowStyleRules, defaultRowStyleRules: this.props.defaultRowStyleRules, onChangeRowStyleRules: onChangeRowStyleRules }),
1905
1921
  !!this.gridApi && React.createElement(ModalDialog, { mode: "OK_CANCEL" /* ModalDialogMode.OK_CANCEL */, open: this.state.columnsConfigVisible, initialWidth: 700, initialHeight: this.state.columnTransferHeight, title: React.createElement("span", null,
1906
1922
  React.createElement(ControlOutlined, { style: {
1907
1923
  color: "#faad14",
@@ -1920,7 +1936,7 @@ class DataGrid extends React.Component {
1920
1936
  }, onResize: ({ height }) => {
1921
1937
  this.setState({ columnTransferHeight: height });
1922
1938
  } },
1923
- React.createElement(ColumnTransfer, { columnDefinitions: columnDefs, columnModel: this.state.columnModel, gridApi: this.gridApi, height: this.state.columnTransferHeight - 154 }))));
1939
+ React.createElement(ColumnTransfer, { columnDefinitions: leafColumnDefs, columnModel: this.state.columnModel, gridApi: this.gridApi, height: this.state.columnTransferHeight - 154 }))));
1924
1940
  }
1925
1941
  }
1926
1942
  /** Default `paging` (automatic page size) and `rowStyleRules` ({@link tableDefaultRowStyleRules}). */