Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 60 additions & 2 deletions projects/igniteui-angular/src/lib/grids/common/grid.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,19 +295,63 @@ export interface RowType {
*/
unpin?: () => void;
}

/**
* Describes a field that can be used in the Grid and QueryBuilder components.
*/
export interface FieldType {
/**
* Display label for the field.
*/
label?: string;

/**
* The internal field name, used in expressions and queries.
*/
field: string;

/**
* Optional column header for UI display purposes.
*/
header?: string;

/**
* The data type of the field.
*/
/* alternateType: GridColumnDataType */
dataType: DataType;

/**
* Options for the editor associated with this field.
*/
editorOptions?: IFieldEditorOptions;

/**
* Optional filtering operands that apply to this field.
*/
filters?: IgxFilteringOperand;

/**
* Optional arguments for any pipe applied to the field.
*/
pipeArgs?: IFieldPipeArgs;

/**
* Default time format for Date/Time fields.
*/
defaultTimeFormat?: string;

/**
* Default date/time format for Date/Time fields.
*/
defaultDateTimeFormat?: string;

/**
* Optional formatter function to transform the value before display.
*
* @param value - The value of the field.
* @param rowData - Optional row data that contains this field.
* @returns The formatted value.
*/
formatter?(value: any, rowData?: any): any;
}

Expand Down Expand Up @@ -1492,10 +1536,24 @@ export interface IClipboardOptions {
}

/**
* An interface describing entity
* Describes an entity in the QueryBuilder.
* An entity represents a logical grouping of fields and can have nested child entities.
*/
export interface EntityType {
/**
* The name of the entity.
* Typically used as an identifier in expressions.
*/
name: string;

/**
* The list of fields that belong to this entity.
*/
fields: FieldType[];

/**
* Optional child entities.
* This allows building hierarchical or nested query structures.
*/
childEntities?: EntityType[];
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,40 @@ export class IgxQueryBuilderComponent implements OnDestroy {
public showEntityChangeDialog = true;

/**
* Returns the entities.
* @hidden
* Gets the list of entities available for the IgxQueryBuilderComponent.
*
* Each entity describes a logical group of fields that can be used in queries.
* An entity can optionally have child entities, allowing nested sub-queries.
*
* @returns An array of {@link EntityType} objects.
*/
public get entities(): EntityType[] {
return this._entities;
}

/**
* Sets the entities.
* @hidden
* Sets the list of entities for the IgxQueryBuilderComponent.
* If the `expressionTree` is defined, it will be recreated with the new entities.
*
* Each entity should be an {@link EntityType} object describing the fields and optionally child entities.
*
* Example:
* ```ts
* [
* {
* name: 'Orders',
* fields: [{ field: 'OrderID', dataType: 'number' }],
* childEntities: [
* {
* name: 'OrderDetails',
* fields: [{ field: 'ProductID', dataType: 'number' }]
* }
* ]
* }
* ]
* ```
*
* @param entities - The array of entities to set.
*/
@Input()
public set entities(entities: EntityType[]) {
Expand All @@ -73,18 +97,22 @@ export class IgxQueryBuilderComponent implements OnDestroy {
}

/**
* Returns the fields.
* Gets the list of fields for the QueryBuilder.
*
* @deprecated since version 19.1.0. Use the `entities` property instead.
* @hidden
* @deprecated in version 19.1.0. Use the `entities` property instead.
*/
public get fields(): FieldType[] {
return this._fields;
}

/**
* Sets the fields.
* Sets the list of fields for the QueryBuilder.
* Automatically wraps them into a single entity to maintain backward compatibility.
*
* @param fields - The array of fields to set.
* @deprecated since version 19.1.0. Use the `entities` property instead.
* @hidden
* @deprecated in version 19.1.0. Use the `entities` property instead.
*/
@Input()
public set fields(fields: FieldType[]) {
Expand Down
Loading