@lowdefy/blocks-aggrid 4.0.0-alpha.18 → 4.0.0-alpha.19

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/dist/AgGrid.js CHANGED
@@ -29,6 +29,8 @@ function _extends() {
29
29
  */ import React from 'react';
30
30
  import { AgGridReact } from '@ag-grid-community/react';
31
31
  import { AllCommunityModules } from '@ag-grid-community/all-modules';
32
+ import { renderHtml } from '@lowdefy/block-utils';
33
+ import { type } from '@lowdefy/helpers';
32
34
  let AgGrid = class AgGrid extends React.Component {
33
35
  // see https://stackoverflow.com/questions/55182118/ag-grid-resize-detail-height-when-data-changes
34
36
  componentDidUpdate() {
@@ -120,10 +122,24 @@ let AgGrid = class AgGrid extends React.Component {
120
122
  }
121
123
  }
122
124
  render() {
123
- const { quickFilterValue , ...someProperties } = this.props.properties;
125
+ const { quickFilterValue , columnDefs , ...someProperties } = this.props.properties;
124
126
  if (quickFilterValue && quickFilterValue === '') {
125
127
  this.gridApi.setQuickFilter(quickFilterValue); // check if empty string matches all
126
128
  }
129
+ const newColDefs = (columnDefs || []).map((col)=>{
130
+ if (type.isFunction(col.cellRenderer)) {
131
+ return {
132
+ ...col,
133
+ cellRenderer: (params)=>{
134
+ return renderHtml({
135
+ html: col.cellRenderer(params),
136
+ methods: this.props.methods
137
+ });
138
+ }
139
+ };
140
+ }
141
+ return col;
142
+ });
127
143
  return /*#__PURE__*/ React.createElement(AgGridReact, _extends({
128
144
  onFilterChanged: this.onFilterChanged,
129
145
  onSelectionChanged: this.onSelectionChanged,
@@ -131,7 +147,8 @@ let AgGrid = class AgGrid extends React.Component {
131
147
  onRowClicked: this.onRowClick,
132
148
  onCellClicked: this.onCellClicked,
133
149
  onGridReady: this.onGridReady,
134
- modules: AllCommunityModules
150
+ modules: AllCommunityModules,
151
+ columnDefs: newColDefs
135
152
  }, someProperties));
136
153
  }
137
154
  constructor(props){
@@ -29,6 +29,8 @@ function _extends() {
29
29
  */ import React from 'react';
30
30
  import { AgGridReact } from '@ag-grid-community/react';
31
31
  import { AllCommunityModules } from '@ag-grid-community/all-modules';
32
+ import { renderHtml } from '@lowdefy/block-utils';
33
+ import { type } from '@lowdefy/helpers';
32
34
  let AgGridInput = class AgGridInput extends React.Component {
33
35
  // see https://stackoverflow.com/questions/55182118/ag-grid-resize-detail-height-when-data-changes
34
36
  componentDidUpdate() {
@@ -162,10 +164,24 @@ let AgGridInput = class AgGridInput extends React.Component {
162
164
  });
163
165
  }
164
166
  render() {
165
- const { quickFilterValue , ...someProperties } = this.props.properties;
167
+ const { quickFilterValue , columnDefs , ...someProperties } = this.props.properties;
166
168
  if (quickFilterValue && quickFilterValue === '') {
167
169
  this.gridApi.setQuickFilter(quickFilterValue); // check if empty string matches all
168
170
  }
171
+ const newColDefs = (columnDefs || []).map((col)=>{
172
+ if (type.isFunction(col.cellRenderer)) {
173
+ return {
174
+ ...col,
175
+ cellRenderer: (params)=>{
176
+ return renderHtml({
177
+ html: col.cellRenderer(params),
178
+ methods: this.props.methods
179
+ });
180
+ }
181
+ };
182
+ }
183
+ return col;
184
+ });
169
185
  return /*#__PURE__*/ React.createElement(AgGridReact, _extends({
170
186
  onSelectionChanged: this.onSelectionChanged,
171
187
  onRowSelected: this.onRowSelected,
@@ -175,7 +191,8 @@ let AgGridInput = class AgGridInput extends React.Component {
175
191
  onRowDragEnd: this.onRowDragEnd,
176
192
  onCellValueChanged: this.onCellValueChanged,
177
193
  postSort: this.postSort,
178
- modules: AllCommunityModules
194
+ modules: AllCommunityModules,
195
+ columnDefs: newColDefs
179
196
  }, someProperties, {
180
197
  rowData: this.props.value
181
198
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/blocks-aggrid",
3
- "version": "4.0.0-alpha.18",
3
+ "version": "4.0.0-alpha.19",
4
4
  "license": "Apache-2.0",
5
5
  "description": "AgGrid Blocks for Lowdefy.",
6
6
  "homepage": "https://lowdefy.com",
@@ -54,14 +54,15 @@
54
54
  "@ag-grid-community/all-modules": "27.3.0",
55
55
  "@ag-grid-community/core": "27.3.0",
56
56
  "@ag-grid-community/react": "27.3.0",
57
- "@lowdefy/block-utils": "4.0.0-alpha.18",
57
+ "@lowdefy/block-utils": "4.0.0-alpha.19",
58
+ "@lowdefy/helpers": "4.0.0-alpha.19",
58
59
  "react": "18.1.0",
59
60
  "react-dom": "18.1.0"
60
61
  },
61
62
  "devDependencies": {
62
63
  "@emotion/jest": "11.9.1",
63
- "@lowdefy/block-dev": "4.0.0-alpha.18",
64
- "@lowdefy/jest-yaml-transform": "4.0.0-alpha.18",
64
+ "@lowdefy/block-dev": "4.0.0-alpha.19",
65
+ "@lowdefy/jest-yaml-transform": "4.0.0-alpha.19",
65
66
  "@swc/cli": "0.1.57",
66
67
  "@swc/core": "1.2.194",
67
68
  "@swc/jest": "0.2.21",
@@ -76,5 +77,5 @@
76
77
  "publishConfig": {
77
78
  "access": "public"
78
79
  },
79
- "gitHead": "9ba94a9ab39be2a165b3a58043fbb33f26b48ae3"
80
+ "gitHead": "5240a074f7225295a8c92aaf0236b7680c296b57"
80
81
  }