refactor: adjust rich text filter to Input component (#4888)

* refactor: adjust rich text filter with Input component

* refactor: adjust rich text filter with Input component
This commit is contained in:
Katherine 2024-07-16 17:50:02 +08:00 committed by GitHub
parent 32b8bf6cdf
commit 84bc06d529
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 43 additions and 2 deletions

View File

@ -183,3 +183,41 @@ export const collection = [
{ label: '{{t("is empty")}}', value: '$empty', noValue: true },
{ label: '{{t("is not empty")}}', value: '$notEmpty', noValue: true },
];
export const richText = [
{
label: '{{t("contains")}}',
value: '$includes',
selected: true,
schema: {
type: 'string',
'x-component': 'Input',
},
},
{
label: '{{t("does not contain")}}',
value: '$notIncludes',
schema: {
type: 'string',
'x-component': 'Input',
},
},
{
label: '{{t("is")}}',
value: '$eq',
schema: {
type: 'string',
'x-component': 'Input',
},
},
{
label: '{{t("is not")}}',
value: '$ne',
schema: {
type: 'string',
'x-component': 'Input',
},
},
{ label: '{{t("is empty")}}', value: '$empty', noValue: true },
{ label: '{{t("is not empty")}}', value: '$notEmpty', noValue: true },
];

View File

@ -79,6 +79,6 @@ export class RichTextFieldInterface extends CollectionFieldInterface {
};
};
filterable = {
operators: operators.string,
operators: operators.richText,
};
}

View File

@ -30,6 +30,7 @@ import { useDataSourceManager } from '../data-source/data-source/DataSourceManag
import { isAssocField } from '../filter-provider/utils';
import { useActionContext, useCompile, useDesignable } from '../schema-component';
import { useSchemaTemplateManager } from '../schema-templates';
export const itemsMerge = (items1) => {
return items1;
};
@ -382,7 +383,9 @@ export const useFilterFormItemInitializerFields = (options?: any) => {
'x-decorator': 'FormItem',
'x-use-decorator-props': 'useFormItemProps',
'x-collection-field': `${name}.${field.name}`,
'x-component-props': {},
'x-component-props': {
component: interfaceConfig?.filterable?.operators?.[0]?.schema?.['x-component'],
},
};
if (isAssocField(field)) {
schema = {