Feat: Add a form with data operations operators #10427 (#11001)

### What problem does this PR solve?

Feat: Add a form with data operations operators #10427

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-11-04 19:42:59 +08:00
committed by GitHub
parent 880a6a0428
commit db9fa3042b
16 changed files with 433 additions and 49 deletions

View File

@ -4,14 +4,14 @@ import { JsonSchemaDataType } from '../constant';
export function hasSpecificTypeChild(
data: Record<string, any> | Array<any>,
type: string,
types: string[] = [],
) {
if (Array.isArray(data)) {
for (const value of data) {
if (isPlainObject(value) && value.type === type) {
if (isPlainObject(value) && types.some((x) => x === value.type)) {
return true;
}
if (hasSpecificTypeChild(value, type)) {
if (hasSpecificTypeChild(value, types)) {
return true;
}
}
@ -19,11 +19,11 @@ export function hasSpecificTypeChild(
if (isPlainObject(data)) {
for (const value of Object.values(data)) {
if (isPlainObject(value) && value.type === type) {
if (isPlainObject(value) && types.some((x) => x === value.type)) {
return true;
}
if (hasSpecificTypeChild(value, type)) {
if (hasSpecificTypeChild(value, types)) {
return true;
}
}
@ -33,7 +33,7 @@ export function hasSpecificTypeChild(
}
export function hasArrayChild(data: Record<string, any> | Array<any>) {
return hasSpecificTypeChild(data, JsonSchemaDataType.Array);
return hasSpecificTypeChild(data, [JsonSchemaDataType.Array]);
}
export function hasJsonSchemaChild(data: JSONSchema) {