mirror of
https://github.com/lowdefy/lowdefy.git
synced 2025-01-30 13:50:55 +08:00
Merge branch 'develop' into renovate/npm-next-auth-vulnerability
This commit is contained in:
commit
60c3cae71e
@ -18,8 +18,8 @@ import React from 'react';
|
||||
|
||||
import { AgGridReact } from '@ag-grid-community/react';
|
||||
import { AllCommunityModules } from '@ag-grid-community/all-modules';
|
||||
import { renderHtml } from '@lowdefy/block-utils';
|
||||
import { type } from '@lowdefy/helpers';
|
||||
|
||||
import processColDefs from './processColDefs.js';
|
||||
|
||||
class AgGrid extends React.Component {
|
||||
constructor(props) {
|
||||
@ -127,20 +127,6 @@ class AgGrid extends React.Component {
|
||||
if (quickFilterValue && quickFilterValue === '') {
|
||||
this.gridApi.setQuickFilter(quickFilterValue); // check if empty string matches all
|
||||
}
|
||||
const newColDefs = (columnDefs || []).map((col) => {
|
||||
if (type.isFunction(col.cellRenderer)) {
|
||||
return {
|
||||
...col,
|
||||
cellRenderer: (params) => {
|
||||
return renderHtml({
|
||||
html: col.cellRenderer(params),
|
||||
methods: this.props.methods,
|
||||
});
|
||||
},
|
||||
};
|
||||
}
|
||||
return col;
|
||||
});
|
||||
return (
|
||||
<AgGridReact
|
||||
onFilterChanged={this.onFilterChanged}
|
||||
@ -150,7 +136,7 @@ class AgGrid extends React.Component {
|
||||
onCellClicked={this.onCellClicked}
|
||||
onGridReady={this.onGridReady}
|
||||
modules={AllCommunityModules}
|
||||
columnDefs={newColDefs}
|
||||
columnDefs={processColDefs(columnDefs)}
|
||||
{...someProperties}
|
||||
/>
|
||||
);
|
||||
|
@ -18,9 +18,8 @@ import React from 'react';
|
||||
|
||||
import { AgGridReact } from '@ag-grid-community/react';
|
||||
import { AllCommunityModules } from '@ag-grid-community/all-modules';
|
||||
import { renderHtml } from '@lowdefy/block-utils';
|
||||
import { type } from '@lowdefy/helpers';
|
||||
|
||||
import processColDefs from './processColDefs.js';
|
||||
class AgGridInput extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
@ -176,20 +175,6 @@ class AgGridInput extends React.Component {
|
||||
if (quickFilterValue && quickFilterValue === '') {
|
||||
this.gridApi.setQuickFilter(quickFilterValue); // check if empty string matches all
|
||||
}
|
||||
const newColDefs = (columnDefs || []).map((col) => {
|
||||
if (type.isFunction(col.cellRenderer)) {
|
||||
return {
|
||||
...col,
|
||||
cellRenderer: (params) => {
|
||||
return renderHtml({
|
||||
html: col.cellRenderer(params),
|
||||
methods: this.props.methods,
|
||||
});
|
||||
},
|
||||
};
|
||||
}
|
||||
return col;
|
||||
});
|
||||
return (
|
||||
<AgGridReact
|
||||
onSelectionChanged={this.onSelectionChanged}
|
||||
@ -201,7 +186,7 @@ class AgGridInput extends React.Component {
|
||||
onCellValueChanged={this.onCellValueChanged}
|
||||
postSort={this.postSort}
|
||||
modules={AllCommunityModules}
|
||||
columnDefs={newColDefs}
|
||||
columnDefs={processColDefs(columnDefs)}
|
||||
{...someProperties}
|
||||
rowData={this.props.value}
|
||||
/>
|
||||
|
45
packages/plugins/blocks/blocks-aggrid/src/processColDefs.js
Normal file
45
packages/plugins/blocks/blocks-aggrid/src/processColDefs.js
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
Copyright 2021 Lowdefy, Inc
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { renderHtml } from '@lowdefy/block-utils';
|
||||
import { type } from '@lowdefy/helpers';
|
||||
|
||||
function recProcessColDefs(columnDefs) {
|
||||
return columnDefs.map((col) => {
|
||||
const newColDef = {};
|
||||
if (type.isArray(col.children)) {
|
||||
newColDef.children = recProcessColDefs(col.children);
|
||||
}
|
||||
if (type.isFunction(col.cellRenderer)) {
|
||||
newColDef.cellRenderer = (params) => {
|
||||
return renderHtml({
|
||||
html: col.cellRenderer(params),
|
||||
methods: this.props.methods,
|
||||
});
|
||||
};
|
||||
}
|
||||
return {
|
||||
...col,
|
||||
...newColDef,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function processColDefs(columnDefs = []) {
|
||||
return recProcessColDefs(columnDefs);
|
||||
}
|
||||
|
||||
export default processColDefs;
|
Loading…
Reference in New Issue
Block a user