Merge branch 'main' into next

This commit is contained in:
nocobase[bot] 2025-02-17 05:35:07 +00:00
commit f9cbc01bd9
3 changed files with 14 additions and 2 deletions

View File

@ -52,6 +52,8 @@ export const ChartFilterForm: React.FC = memo((props) => {
setField(name, {
title: field.title,
operator: field.componentProps['filter-operator'],
dataSource: field.componentProps['data-source'],
collectionField: field.componentProps['collection-field'],
});
// parse field title

View File

@ -16,6 +16,8 @@ type FilterField = {
value: string;
noValue?: boolean;
};
dataSource?: string;
collectionField?: string;
};
export const ChartFilterContext = createContext<{

View File

@ -137,6 +137,8 @@ export const useChartFilter = () => {
'x-component-props': {
...field.uiSchema?.['x-component-props'],
'filter-operator': defaultOperator,
'data-source': dataSource,
'collection-field': `${fieldName}.${field.name}`,
},
'x-filter-operators': defaultOperator?.value,
};
@ -195,6 +197,8 @@ export const useChartFilter = () => {
title,
'x-component-props': {
'filter-operator': defaultOperator,
'data-source': dataSource,
'collection-field': `${fieldName}.${child.name}`,
},
'x-filter-operators': defaultOperator?.value,
};
@ -319,8 +323,12 @@ export const useChartFilter = () => {
.filter(([_, props]) => props)
.forEach(([name, props]) => {
const { operator } = props || {};
const { dataSource, fieldName: _fieldName } = parseFilterFieldName(name);
let fieldName = _fieldName;
let { dataSource, collectionField: fieldName } = props || {};
if (!fieldName) {
const parsed = parseFilterFieldName(name);
dataSource = parsed.dataSource;
fieldName = parsed.fieldName;
}
const ds = dm.getDataSource(dataSource);
const cm = ds.collectionManager;
const field = cm.getCollectionField(fieldName);