import * as i0 from '@angular/core';
import { InjectionToken, PipeTransform, OnDestroy, ChangeDetectorRef, AfterViewInit, QueryList, EventEmitter } from '@angular/core';
import { SdSearch, SdCustomValidator } from '@sdcorejs/angular/forms/models';
import { SdTableColumn, SdTableOption, SdTable } from '@sdcorejs/angular/components/table';
import { SdUploadFile } from '@sdcorejs/angular/components/upload-file';
import { Operator as Operator$1, ValidationPatternType, Color } from '@sdcorejs/utils/models';
import { SdUnwrapSignal } from '@sdcorejs/angular/utilities/models';
import { CdkDragMove, CdkDragDrop } from '@angular/cdk/drag-drop';
import { FormGroup } from '@angular/forms';
import { SdModal } from '@sdcorejs/angular/components/modal';
import { Subject } from 'rxjs';
import { SdSideDrawer } from '@sdcorejs/angular/components/side-drawer';
import { SdSearch as SdSearch$1 } from '@sdcorejs/angular/forms';
import * as _sdcorejs_angular_components_form_generic from '@sdcorejs/angular/components/form-generic';
import { SdFormatNumberPipe } from '@sdcorejs/angular/pipes';

type SdFormRenderEntity = Record<string, any> & {
    sdRaw?: Record<string, any>;
};

interface SdFormGenericSelectionItem<T = any> {
    value: string;
    display: string;
    disabled?: boolean;
    template?: string;
    data?: T;
}
interface SdFormGenericSelectionStaticItem {
    value: string;
    label: string;
}
type SdFormGenericDefinitionSelection<T = any, TArgs = any> = SelectionValues<T> | SelectionLazyValues<T> | SelectionValuesKey<TArgs> | SelectionLazyValuesKey<TArgs>;
interface SelectionVariables<T = any> {
    items?: {
        value: Extract<keyof T, string>;
        display: string;
    }[];
    detail?: (values: string | number | string[] | number[], args: SdFormGenericArgs) => Promise<T | undefined>;
}
interface SelectionQueries {
    items?: {
        value: string;
        display: string;
    }[];
}
interface SelecttionBase {
    value: string;
    display: string;
    viewed?: (values: (string | number)[], args: SdFormGenericArgs) => Promise<string>;
    queries?: SelectionQueries;
    variables?: SelectionVariables;
}
interface SelectionValuesKey<TArgs> extends SelecttionBase {
    valuesKey: string;
    args?: TArgs;
}
interface SelectionLazyValuesKey<TArgs> extends SelecttionBase {
    lazyValuesKey: string;
    args?: TArgs;
}
interface SelectionValues<T = any> extends SelecttionBase {
    values: (args: SdFormGenericArgs) => Promise<SdFormGenericSelectionItem<T>[]>;
}
interface SelectionLazyValues<T = any> extends SelecttionBase {
    lazyValues: (searchArgs: Parameters<SdSearch>[0], args: SdFormGenericArgs) => Promise<SdFormGenericSelectionItem<T>[]>;
}

interface SdFormGenericExpression {
    key: string;
    type: 'combinator';
    combinator: '&&' | '||';
    conditions: (SdFormGenericExpression | SdFormGenericExpressionCondition)[];
}
interface SdFormGenericExpressionCondition {
    key: string;
    type: 'condition';
    field?: string;
    operator: Operator$1;
    value: any;
    dayInfo: DayInfo;
}
type Operator = 'EQUAL' | 'NOT_EQUAL' | 'GREATER_THAN' | 'LESS_THAN' | 'GREATER_OR_EQUAL' | 'LESS_OR_EQUAL' | 'NULL' | 'NOT_NULL';
declare const Operators: {
    value: Operator;
    symbol?: string;
    display: string;
}[];
type Attribute = AttributeBase | AttributeBoolean | AttributeDate | AttributeValues;
interface AttributeBase {
    value: string;
    display: string;
    type: 'string' | 'number';
}
interface AttributeBoolean {
    value: string;
    display: string;
    type: 'boolean';
    displayOnTrue: string;
    displayOnFalse: string;
}
interface AttributeDate {
    value: string;
    display: string;
    type: 'datetime';
}
interface DayInfo {
    type?: 'RELATED' | 'NOW' | 'DATETIME' | 'ATTRIBUTE';
    related?: 'LASTDAY' | 'NEXTDAY' | 'LASTWEEK' | 'NEXTWEEK' | 'LASTMONTH' | 'NEXTMONTH';
    relatedValue?: number;
}
declare const DayInfoTypes: {
    value: string;
    display: string;
}[];
declare const DayInfoPreviouses: {
    value: string;
    display: string;
    format: (n: number) => string;
}[];
declare const GetDatetimeValue: (value: string) => string | undefined;
interface AttributeValues {
    value: string;
    display: string;
    type: 'values';
    values: {
        value: string;
        display: string;
    }[];
}
declare const AttributeOperators: Record<Attribute['type'], {
    value: Operator;
    symbol?: string;
    display: string;
}[]>;
declare const GetAttributes: (components: (SdFormGenericComponent | SdFormGenericGroup)[]) => Attribute[];
declare const TemplateToCondition: (template: string | undefined | null, entity: Record<string, any>) => string | undefined;
declare const EvaluateExpression: (condition: SdFormGenericExpression | SdFormGenericExpressionCondition, entity: Record<string, any>) => boolean | undefined;
declare const ExpressionToJavascriptExpression: (condition: SdFormGenericExpression | SdFormGenericExpressionCondition) => string | undefined;

type SdFormGenericValidation = ValidationExpression | ValidationFunction;
interface ValidationBase {
    alert: 'warning' | 'error';
}
interface ValidationExpression extends ValidationBase {
    type: 'expression';
    expression: SdFormGenericExpression;
    message: string;
}
interface ValidationFunction extends ValidationBase {
    type: 'function';
    code: string;
}
interface ValidateArgs {
    entity: Record<string, any>;
}
interface SdFormGenericValidationFunction {
    value: string;
    display: string;
    validate: (args: ValidateArgs) => Promise<string | undefined | null>;
}
interface SdFormGenericValidationConfiguration {
    functions?: SdFormGenericValidationFunction[];
}

interface SdFormGeneric {
    components: (SdFormGenericComponent | SdFormGenericGroup)[];
    variables?: SdFormGenericVariable[];
    validations?: SdFormGenericValidation[];
}

interface SdFormRenderConfiguration {
    onLoaded?: () => void;
    components: SdFormGeneric['components'];
    validations?: SdFormGeneric['validations'];
    variables?: SdFormGenericVariable[];
    beforeSubmit?: (entity: Record<string, any>) => Promise<Record<string, any>>;
}
interface SdFormGenericLayout {
    row?: string;
    columns: '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12' | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
    mobileColumns?: '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12' | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
}
declare const GenerateId: () => string;
declare const GenerateKey: () => string;
declare const SdFormatComponent: (component: SdFormGenericComponent | SdFormGenericGroup) => void;
interface SdFormGenericVariable {
    id: string;
    key: string;
    label: string;
}
type SdFormGenericComponent = SdFormGenericTextfield | SdFormGenericChipString | SdFormGenericChipCalendar | SdFormGenericTextarea | SdFormGenericNumber | SdFormGenericCheckbox | SdFormGenericDatetime | SdFormGenericValues | SdFormGenericUpload | SdFormGenericTable | SdFormGenericHtml | SdFormGenericBreak;
type SdFormGenericValues = SdFormGenericRadio | SdFormGenericSelect | SdFormGenericChecklist;
interface SdFormGenericComponentBase {
    template?: string;
    id: string;
    key: string;
    label: string;
    helperText?: string;
    layout?: SdFormGenericLayout;
    validate?: {
        required?: boolean;
    };
    disabled?: boolean;
    properties?: {
        viewed?: boolean;
        hyperlink?: string;
        hidden?: boolean;
        hiddenWhenExpression?: SdFormGenericExpression;
        visibleWhenExpression?: SdFormGenericExpression;
        disabledWhenExpression?: SdFormGenericExpression;
        requiredWhenExpression?: SdFormGenericExpression;
        onChange?: {
            setValues?: Record<string, any>;
        };
    } & Record<string, any>;
}
interface SdFormGenericTextfield extends SdFormGenericComponentBase {
    type: 'textfield';
    defaultValue?: string;
    validate?: {
        maxlength?: number;
        minlength?: number;
        pattern?: ValidationPatternType | string;
        patternErrorMessage?: string;
    } & SdFormGenericComponentBase['validate'];
}
interface SdFormGenericChipString extends SdFormGenericComponentBase {
    type: 'chip-string';
    defaultValue?: string[];
    validate?: {
        maxlength?: number;
        minlength?: number;
        pattern?: ValidationPatternType | string;
        patternErrorMessage?: string;
        maxOfItems?: number;
    } & SdFormGenericComponentBase['validate'];
}
interface SdFormGenericChipCalendar extends SdFormGenericComponentBase {
    type: 'chip-calendar';
    defaultValue?: string[];
    validate?: {
        maxlength?: number;
        minlength?: number;
        pattern?: ValidationPatternType | string;
        patternErrorMessage?: string;
        maxOfItems?: number;
    } & SdFormGenericComponentBase['validate'];
}
interface SdFormGenericTextarea extends SdFormGenericComponentBase {
    type: 'textarea';
    defaultValue?: string;
    validate?: {
        maxlength?: number;
        minlength?: number;
    } & SdFormGenericComponentBase['validate'];
}
interface SdFormGenericNumber extends SdFormGenericComponentBase {
    type: 'number';
    defaultValue?: number;
    validate?: {
        min?: number;
        max?: number;
    } & SdFormGenericComponentBase['validate'];
}
interface SdFormGenericCheckbox extends SdFormGenericComponentBase {
    type: 'checkbox';
    defaultValue?: boolean;
}
interface SdFormGenericDatetime extends SdFormGenericComponentBase {
    type: 'datetime';
    subtype: 'date' | 'datetime';
    defaultValue?: string;
    validate?: {
        min?: 'TODAY' | string;
        max?: 'TODAY' | string;
    } & SdFormGenericComponentBase['validate'];
}
interface SdFormGenericRadio extends SdFormGenericComponentBase {
    type: 'radio';
    values?: SdFormGenericSelectionStaticItem[];
    valuesKey?: string;
    defaultValue?: string;
    properties?: {
        direction?: 'row' | 'column';
    } & SdFormGenericComponentBase['properties'];
}
interface SdFormGenericSelect extends SdFormGenericComponentBase {
    type: 'select';
    values?: SdFormGenericSelectionStaticItem[];
    valuesKey?: string;
    defaultValue?: string | string[];
    properties?: {
        query?: Record<string, any>;
        multiple?: boolean;
        setVariables?: Record<string, string>;
    } & SdFormGenericComponentBase['properties'];
}
interface SdFormGenericChecklist extends SdFormGenericComponentBase {
    type: 'checklist';
    values?: SdFormGenericSelectionStaticItem[];
    valuesKey?: string;
    defaultValue?: string[];
    properties?: {
        query?: Record<string, any>;
    } & SdFormGenericComponentBase['properties'];
}
interface SdFormGenericGroup {
    id: string;
    type: 'group';
    label: string;
    layout: SdFormGenericLayout;
    components: SdFormGenericComponent[];
    properties: {
        icon: string;
        color: Color;
        hidden?: boolean;
        hiddenWhenExpression?: SdFormGenericExpression;
        visibleWhenExpression?: SdFormGenericExpression;
    };
}
interface SdFormGenericUpload extends SdFormGenericComponentBase {
    type: 'upload';
    properties?: {
        type?: SdUnwrapSignal<SdUploadFile['type']>;
        maxSize?: SdUnwrapSignal<SdUploadFile['maxSize']>;
        max?: SdUnwrapSignal<SdUploadFile['max']>;
        extensions?: SdUnwrapSignal<SdUploadFile['extensions']>;
        args?: Record<string, any>;
        source?: 'ALL' | 'PHOTO_LIBRARY' | 'CAPTURE';
    } & SdFormGenericComponentBase['properties'];
}
interface FormRenderComponentTableColumnValues {
    valuesKey: string;
    query?: Record<string, any>;
}
type SdFormGenericTableColumn<T = any> = TableColumnString<T> | TableColumnNumber<T> | TableColumnBool<T> | TableColumnDate<T> | TableColumnDatetime<T> | TableColumnRadio<T> | TableColumnValues<T> | TableColumnImage<T> | TableColumnFile<T>;
declare const TableColumnTypes: {
    value: string;
    display: string;
}[];
interface TableColumnBase<T = any> {
    key: Extract<keyof T, string>;
    label: string;
    width?: SdTableColumn['width'];
    validate?: {
        required?: boolean;
    };
}
interface TableColumnString<T = any> extends TableColumnBase<T> {
    type: 'string';
    validate?: {
        minlength?: number;
        maxlength?: number;
        pattern?: string;
        patternErrorMessage?: string;
    } & TableColumnBase['validate'];
}
interface TableColumnNumber<T = any> extends TableColumnBase<T> {
    type: 'number';
    validate?: {
        min?: number;
        max?: number;
    } & TableColumnBase['validate'];
}
interface TableColumnDate<T = any> extends TableColumnBase<T> {
    type: 'date';
    validate?: {
        min?: 'TODAY' | string;
        max?: 'TODAY' | string;
    } & TableColumnBase['validate'];
}
interface TableColumnDatetime<T = any> extends TableColumnBase<T> {
    type: 'datetime';
    validate?: {
        min?: 'TODAY' | string;
        max?: 'TODAY' | string;
    } & TableColumnBase['validate'];
}
interface TableColumnBool<T = any> extends TableColumnBase<T> {
    type: 'boolean';
    displayOnTrue?: string;
    displayOnFalse?: string;
}
interface TableColumnRadio<T = any> extends TableColumnBase<T> {
    type: 'radio';
    values?: SdFormGenericSelectionStaticItem[];
}
interface TableColumnValues<T = any> extends TableColumnBase<T> {
    type: 'values';
    valuesKey: string;
    query?: Record<string, any>;
    values?: SdFormGenericSelectionStaticItem[];
}
interface TableColumnImage<T = any> extends TableColumnBase<T> {
    type: 'image';
    args?: Record<string, any>;
    validate?: {
        max?: number;
        maxSize?: number;
    } & TableColumnBase['validate'];
}
interface TableColumnFile<T = any> extends TableColumnBase<T> {
    type: 'file';
    args?: Record<string, any>;
    validate?: {
        max?: number;
        maxSize?: number;
    } & TableColumnBase['validate'];
}
interface SdFormGenericTable extends SdFormGenericComponentBase {
    type: 'table';
    columnsKey?: string;
    columns?: SdFormGenericTableColumn[];
    properties?: {
        type?: SdTableOption['type'];
        titleButtonCreate?: string;
    } & SdFormGenericComponentBase['properties'];
}
/**
 * Break component — invisible runtime element ép xuống dòng mới. Dùng khi layout có
 * vùng cố định và việc ẩn/hiện trường khác không nên xáo trộn vị trí các trường còn lại.
 * Ở canvas (design) render thanh ngang mảnh; ở runtime render empty 12-col cell.
 *
 * Extend SdFormGenericComponentBase để tương thích với union narrowing trong các pipe/render
 * (key, validate, disabled, properties full) — runtime sẽ ignore mọi field ngoài id/type/layout.
 */
interface SdFormGenericBreak extends SdFormGenericComponentBase {
    type: 'break';
}
interface SdFormGenericHtml {
    template?: string;
    id: string;
    key?: string;
    type: 'html';
    content: string;
    validate?: {
        required?: boolean;
    };
    layout?: SdFormGenericLayout;
    properties?: {
        viewed?: boolean;
        hyperlink?: string;
        hidden?: boolean;
        hiddenWhenExpression?: SdFormGenericExpression;
        visibleWhenExpression?: SdFormGenericExpression;
        variables?: {
            key: string;
            label: string;
            value?: string;
        }[];
        queries?: {
            key: string;
            label: string;
        }[];
        query?: Record<string, any>;
    };
}
type FormBuilderComponentGroup = 'basic' | 'choice' | 'advanced' | 'layout';
interface FormBuilderComponent {
    type: string;
    /** Material Symbols Rounded icon name. Rendered via <span class="msi">{symbol}</span>. */
    symbol: string;
    /** Category group for the left palette grouping. */
    group: FormBuilderComponentGroup;
    name: string;
}
declare const FormBuilderComponents: FormBuilderComponent[];
/** Lookup: component type → Material Symbol + label, used by attribute panel header. */
declare const COMPONENT_ICONS: Record<string, {
    symbol: string;
    label: string;
}>;
declare const GetComponentAttributes: (components: (SdFormGenericComponent | SdFormGenericGroup)[]) => {
    value: string;
    display: string;
}[];
declare const GetVariableAttributes: (variables: SdFormGenericVariable[]) => {
    value: string;
    display: string;
}[];

interface SdFormGenericArgs {
    entity: Record<string, any>;
    component?: SdFormGenericComponent;
    column?: SdFormGenericTableColumn;
    query?: Record<string, any>;
}

interface SdFormGenericTemplate {
    value: string;
    display: string;
    component: Exclude<SdFormGenericComponent, SdFormGenericHtml>;
}

interface SdFormGenericDefinitionTable<T = any> {
    value: string;
    display: string;
    columns: () => SdFormGenericTableColumn<T>[];
}

type SdFormGenericDefinitionHtml = SdFormGenericDefinitionHtmlStatic | SdFormGenericDefinitionHtmlQuery;
interface SdFormGenericDefinitionHtmlStatic {
    type: 'static';
    value: string;
    display: string;
    content: string;
    variables?: {
        key: string;
        label: string;
        value?: string;
    }[];
}
interface SdFormGenericDefinitionHtmlQuery {
    type: 'query';
    value: string;
    display: string;
    queries: {
        key: string;
        label: string;
    }[];
    content: (query?: Record<string, any>) => Promise<string>;
    variables?: {
        key: string;
        label: string;
        value?: string;
    }[];
}

interface IWorkflowConfigurationForm<TSelectionArgs = any> {
    templates: SdFormGenericTemplate[];
    selections: SdFormGenericDefinitionSelection<any, TSelectionArgs>[] | (() => SdFormGenericDefinitionSelection<any, TSelectionArgs>[]) | (() => Promise<SdFormGenericDefinitionSelection[]>);
    getValues?: (key: string, selectionArgs?: TSelectionArgs) => Promise<SdFormGenericSelectionItem[]>;
    getLazyValues?: (key: string, selectionArgs?: TSelectionArgs) => ((searchArgs: Parameters<SdSearch>[0], args: SdFormGenericArgs) => Promise<SdFormGenericSelectionItem[]>);
    tables: SdFormGenericDefinitionTable[];
    htmls: SdFormGenericDefinitionHtml[] | (() => SdFormGenericDefinitionHtml[]) | (() => Promise<SdFormGenericDefinitionHtml[]>);
    validation?: SdFormGenericValidationConfiguration;
}

interface ISdFormGenericConfiguration {
    form?: IWorkflowConfigurationForm;
}
declare const SD_FORM_GENERIC_CONFIGURATION: InjectionToken<ISdFormGenericConfiguration>;

declare class FormGenericService {
    #private;
    private readonly configuration;
    constructor(configuration: ISdFormGenericConfiguration);
    get selections(): (() => Promise<SdFormGenericDefinitionSelection[]>) | SdFormGenericDefinitionSelection<any, any>[] | (() => SdFormGenericDefinitionSelection<any, any>[]);
    get tables(): _sdcorejs_angular_components_form_generic.SdFormGenericDefinitionTable<any>[];
    getSelection: (valuesKey: string | undefined | null) => Promise<SdFormGenericDefinitionSelection | undefined>;
    selection: {
        definitions: () => Promise<SdFormGenericDefinitionSelection[]>;
        getDefinition: (valuesKey: string | undefined | null) => Promise<SdFormGenericDefinitionSelection | undefined>;
        items: (valuesKey: string | undefined | null, args: SdFormGenericArgs) => Promise<SdFormGenericSelectionItem[] | SdSearch$1<SdFormGenericSelectionItem>>;
        variables: {
            detail: (valuesKey: string, values: string | number | string[] | number[], args: SdFormGenericArgs) => Promise<any>;
        };
    };
    html: {
        definitions: () => Promise<SdFormGenericDefinitionHtml[]>;
        getContent: (template: string, query?: Record<string, any>) => Promise<string>;
    };
    static ɵfac: i0.ɵɵFactoryDeclaration<FormGenericService, [{ optional: true; }]>;
    static ɵprov: i0.ɵɵInjectableDeclaration<FormGenericService>;
}

declare class ComponentViewedPipe implements PipeTransform {
    private readonly formatNumberPipe;
    private readonly formGenericService;
    constructor(formatNumberPipe: SdFormatNumberPipe, formGenericService: FormGenericService);
    transform: (value: any, entity: Record<string, any>, component: Exclude<SdFormGenericComponent, SdFormGenericHtml>) => Promise<string>;
    static ɵfac: i0.ɵɵFactoryDeclaration<ComponentViewedPipe, never>;
    static ɵpipe: i0.ɵɵPipeDeclaration<ComponentViewedPipe, "componentViewed", true>;
    static ɵprov: i0.ɵɵInjectableDeclaration<ComponentViewedPipe>;
}

declare class ExpressionFeelPipe implements PipeTransform {
    #private;
    transform(condition: SdFormGenericExpression | SdFormGenericExpressionCondition): string | undefined;
    static ɵfac: i0.ɵɵFactoryDeclaration<ExpressionFeelPipe, never>;
    static ɵpipe: i0.ɵɵPipeDeclaration<ExpressionFeelPipe, "expressionFeel", true>;
    static ɵprov: i0.ɵɵInjectableDeclaration<ExpressionFeelPipe>;
}

declare class SdFormRenderService {
    private readonly componentViewedPipe;
    constructor(componentViewedPipe: ComponentViewedPipe);
    viewEntities: (form: SdFormGeneric, entities: Record<string, any>[]) => Promise<Record<string, any>[]>;
    static ɵfac: i0.ɵɵFactoryDeclaration<SdFormRenderService, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<SdFormRenderService>;
}

declare class UploadComponent implements OnDestroy {
    #private;
    private readonly ref;
    setVariables: Subject<{
        key: string;
        value: any;
    }>;
    sdUploadFile?: SdUploadFile;
    form: FormGroup<{}>;
    value: any;
    entity: Record<string, any>;
    set _entity(val: Record<string, any>);
    component?: SdFormGenericUpload;
    set _component(val: SdFormGenericUpload);
    disabled: boolean;
    set _disabled(val: boolean | '' | undefined | null);
    required: boolean;
    set _required(val: boolean | '' | undefined | null);
    viewed: boolean;
    set _viewed(val: boolean | '' | undefined | null);
    validator?: SdCustomValidator;
    set _validator(validator: SdCustomValidator | undefined | null);
    constructor(ref: ChangeDetectorRef);
    ngOnDestroy(): void;
    ngOnInit(): void;
    upload: () => Promise<void | undefined>;
    static ɵfac: i0.ɵɵFactoryDeclaration<UploadComponent, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<UploadComponent, "lib-upload", never, { "setVariables": { "alias": "setVariables"; "required": true; }; "form": { "alias": "form"; "required": false; }; "_entity": { "alias": "entity"; "required": true; }; "_component": { "alias": "component"; "required": true; }; "_disabled": { "alias": "disabled"; "required": false; }; "_required": { "alias": "required"; "required": false; }; "_viewed": { "alias": "viewed"; "required": false; }; "_validator": { "alias": "validator"; "required": false; }; }, {}, never, never, true, never>;
}

declare class TableComponent implements AfterViewInit, OnDestroy {
    #private;
    private ref;
    private readonly formGenericService;
    uploadFiles?: QueryList<SdUploadFile>;
    table?: SdTable;
    sideDrawer?: SdSideDrawer;
    setVariables: Subject<{
        key: string;
        value: any;
    }>;
    form: FormGroup<{}>;
    component?: SdFormGenericTable;
    col: string;
    set _component(val: SdFormGenericTable);
    required: boolean;
    set _required(val: boolean | '');
    viewed: boolean;
    set _viewed(val: boolean | '' | undefined | null);
    model: any[];
    set _model(val: any[] | undefined | null);
    modelChange: EventEmitter<any[]>;
    tableOption?: SdTableOption;
    row: any;
    columnValues: Record<string, SdFormGenericSelectionItem[] | SdSearch$1>;
    formRenderColumn: Record<string, SdFormGenericTableColumn>;
    fileKeys: string[];
    imageKeys: string[];
    constructor(ref: ChangeDetectorRef, formGenericService: FormGenericService);
    ngOnInit(): void;
    ngAfterViewInit(): void;
    ngOnDestroy(): void;
    onDetail: (row?: any) => void;
    onCancel: () => void;
    onAccept: (addable?: boolean) => void;
    onFileUploadChange(item: any, key: string, newValue: any): void;
    getArgs(key: string): Record<string, any> | undefined;
    upload: () => Promise<void>;
    static ɵfac: i0.ɵɵFactoryDeclaration<TableComponent, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<TableComponent, "lib-table", never, { "setVariables": { "alias": "setVariables"; "required": true; }; "form": { "alias": "form"; "required": false; }; "_component": { "alias": "component"; "required": true; }; "_required": { "alias": "required"; "required": false; }; "_viewed": { "alias": "viewed"; "required": false; }; "_model": { "alias": "model"; "required": false; }; }, { "modelChange": "modelChange"; }, never, never, true, never>;
}

declare class LibItemComponent {
    itemUpload?: UploadComponent;
    itemTable?: TableComponent;
    setVariables: Subject<{
        key: string;
        value: any;
    }>;
    form: FormGroup<{}>;
    value: any;
    entity: Record<string, any>;
    set _entity(val: Record<string, any>);
    col: string;
    component?: SdFormGenericComponent;
    set _component(val: SdFormGenericComponent);
    disabled: boolean;
    set _disabled(val: boolean | '' | undefined);
    required: boolean;
    set _required(val: boolean | '' | undefined);
    viewed: boolean;
    set _viewed(val: boolean | '' | undefined);
    validator?: SdCustomValidator;
    set _validator(validator: SdCustomValidator);
    upload: () => Promise<void>;
    static ɵfac: i0.ɵɵFactoryDeclaration<LibItemComponent, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<LibItemComponent, "lib-item", never, { "setVariables": { "alias": "setVariables"; "required": true; }; "form": { "alias": "form"; "required": false; }; "_entity": { "alias": "entity"; "required": true; }; "_component": { "alias": "component"; "required": true; }; "_disabled": { "alias": "disabled"; "required": false; }; "_required": { "alias": "required"; "required": false; }; "_viewed": { "alias": "viewed"; "required": false; }; "_validator": { "alias": "validator"; "required": false; }; }, {}, never, never, true, never>;
}

declare class SdFormRender implements OnDestroy, AfterViewInit {
    #private;
    private ref;
    private formGenericConfiguration;
    formRenderItems: QueryList<LibItemComponent>;
    form: FormGroup;
    configuration: SdFormRenderConfiguration;
    set _configuration(val: SdFormRenderConfiguration);
    set _default(defaultEntity: Record<string, any>);
    entity: Record<string, any>;
    set _entity(val: Record<string, any>);
    properties: string[];
    set _properties(val: string[]);
    viewed: boolean;
    set _viewed(val: boolean | '');
    loadCompleted: boolean;
    hashedValues?: string;
    formValue: Record<string, any>;
    setVariables: Subject<{
        key: string;
        value: any;
    }>;
    constructor(ref: ChangeDetectorRef, formGenericConfiguration: ISdFormGenericConfiguration | null);
    ngAfterViewInit(): void;
    ngOnDestroy(): void;
    upload: () => Promise<void>;
    getValidationMessages: (alert: SdFormGenericValidation["alert"]) => Promise<string[] | undefined>;
    static ɵfac: i0.ɵɵFactoryDeclaration<SdFormRender, [null, { optional: true; }]>;
    static ɵcmp: i0.ɵɵComponentDeclaration<SdFormRender, "sd-form-render", never, { "form": { "alias": "form"; "required": false; }; "_configuration": { "alias": "configuration"; "required": true; }; "_default": { "alias": "defaultEntity"; "required": false; }; "_entity": { "alias": "entity"; "required": false; }; "_properties": { "alias": "properties"; "required": false; }; "_viewed": { "alias": "viewed"; "required": false; }; }, {}, never, never, true, never>;
}

declare class ConfigureValidationComponent {
    private ref;
    private formGenericConfiguration;
    modal?: SdModal;
    form: FormGroup<{}>;
    attributes: Attribute[];
    validations: SdFormGenericValidation[];
    functions: SdFormGenericValidationFunction[];
    alerts: {
        value: string;
        display: string;
    }[];
    accept: EventEmitter<SdFormGenericValidation[]>;
    constructor(ref: ChangeDetectorRef, formGenericConfiguration: ISdFormGenericConfiguration | null);
    ngAfterViewInit(): void;
    ngOnDestroy(): void;
    open: (formGeneric: SdFormGeneric) => void;
    addValidation: (type: SdFormGenericValidation["type"]) => void;
    removaValidation: (index: number) => void;
    updateValidations: () => void;
    static ɵfac: i0.ɵɵFactoryDeclaration<ConfigureValidationComponent, [null, { optional: true; }]>;
    static ɵcmp: i0.ɵɵComponentDeclaration<ConfigureValidationComponent, "configure-validation", never, {}, { "accept": "accept"; }, never, never, true, never>;
}

interface DragDropRowItem {
    items: (SdFormGenericComponent | SdFormGenericGroup)[];
    rowIndex?: number;
}
declare class SdFormBuilder {
    #private;
    readonly popupViewJSON: i0.Signal<SdModal | undefined>;
    readonly popupConfigureVariables: i0.Signal<SdModal | undefined>;
    readonly configureValidation: i0.Signal<ConfigureValidationComponent | undefined>;
    readonly formRender: i0.Signal<SdFormRender | undefined>;
    form: FormGroup<{}>;
    /** Input chính: schema form. Mỗi lần ref thay đổi → effect sẽ clone về local arrays. */
    readonly formGeneric: i0.InputSignal<SdFormGeneric | undefined>;
    readonly formBuilderComponents: FormBuilderComponent[];
    readonly componentIcons: Record<string, {
        symbol: string;
        label: string;
    }>;
    readonly paletteSearch: i0.WritableSignal<string>;
    readonly paletteGroups: i0.Signal<{
        key: FormBuilderComponentGroup;
        label: string;
        items: FormBuilderComponent[];
    }[]>;
    components: Required<SdFormGeneric>['components'];
    variables: Required<SdFormGeneric>['variables'];
    validations: Required<SdFormGeneric>['validations'];
    /** Cloned variables — dùng cho modal "Configure variables" (huỷ thì discard, ok thì gán ngược). */
    clonedVariables: SdFormGenericVariable[];
    readonly selectedComponent: i0.WritableSignal<SdFormGenericComponent | SdFormGenericGroup | undefined>;
    readonly isPreview: i0.WritableSignal<boolean>;
    readonly editingGroupId: i0.WritableSignal<string | undefined>;
    /** Group đang được Detail (tìm ở TOP-LEVEL theo id), undefined = đang ở canvas chính. */
    readonly editingGroup: i0.Signal<SdFormGenericGroup | undefined>;
    /** Signal toàn cục: TRUE khi BẤT KỲ cdkDrag nào đang active (palette, canvas, group, resize).
     *  Trigger class `.fb-shell--dragging` để ẩn hover/actions/resize toàn diện, không phụ thuộc :has(). */
    readonly isAnyDragging: i0.WritableSignal<boolean>;
    expand: boolean;
    dragDropRows: DragDropRowItem[];
    isDragging: boolean;
    targetItem?: DragDropRowItem;
    private lastDragPointer?;
    /** Handler chung cho mọi cdkDragStarted — set signal global true. */
    onAnyDragStarted: () => void;
    onAnyDragMoved: (event: CdkDragMove<any>) => void;
    /** Handler chung cho mọi cdkDragEnded — set signal global false (dùng setTimeout 0
     *  để chờ CDK xử lý xong drop event trước khi UI re-enable). */
    onAnyDragEnded: () => void;
    constructor();
    ngOnInit(): void;
    ngOnDestroy(): void;
    addComponent: (item: FormBuilderComponent, index?: number) => void;
    /** Symbol Material để render trên canvas item / attribute header. */
    symbolFor: (item: SdFormGenericComponent | SdFormGenericGroup) => string;
    /** Human-readable type label (e.g. "Text field", "Date"). */
    typeLabelFor: (item: SdFormGenericComponent | SdFormGenericGroup) => string;
    /** True nếu component có expression điều kiện — drives the "conditional" status chip. */
    hasConditional: (item: SdFormGenericComponent | SdFormGenericGroup) => boolean;
    /** Map SdColor preset → 2 CSS var names cho header-bg và header-fg của group card. */
    groupColorVars: (color: string | undefined | null) => {
        bg: string;
        fg: string;
    };
    /** Segmented Design/Preview toggle (replaces play_circle/stop_circle). */
    setMode: (preview: boolean) => void;
    /** Mở canvas thiết kế riêng cho 1 group (chỉ children của nó). Snapshot để Cancel revert. */
    enterGroupEdit: (group: SdFormGenericGroup) => void;
    /** OK: giữ thay đổi children, quay về canvas chính. */
    confirmGroupEdit: () => void;
    /** Cancel: revert children về snapshot lúc vào Detail, rồi quay về canvas chính. */
    cancelGroupEdit: () => void;
    /** Quick-add break sau row chỉ định (theo scope hiện tại — top-level hoặc group).
     *  Tính component index cuối cùng của row đó trong scope, splice break vào sau.
     */
    insertBreakAfter: (row: DragDropRowItem) => void;
    /** Xoá component theo scope hiện tại (top-level hoặc children của group đang Detail). */
    removeComponent: (id: string) => void;
    selectComponent: (item?: SdFormGenericComponent | SdFormGenericGroup) => void;
    onClickedOutside: (e: any) => void;
    clickFormContentEmpty: () => void;
    drop: (event: CdkDragDrop<any[]>) => void;
    dragStartComponentItem: (event: any) => void;
    dragEndComponentItem: (event: any) => void;
    onMouseover: (event: MouseEvent, rowItem: DragDropRowItem) => void;
    onFocus: (event: FocusEvent) => void;
    xuLyKeoCheo: (dragItem?: SdFormGenericComponent | SdFormGenericGroup) => void;
    noReturnPredicate: () => boolean;
    changeSizeControl: (event: CdkDragMove<SdFormGenericComponent | SdFormGenericGroup>, item: SdFormGenericComponent | SdFormGenericGroup, items: (SdFormGenericComponent | SdFormGenericGroup)[], currentIndex: number) => Promise<void>;
    dragEndChangeSizeControl: (event: any) => void;
    onChangeViewed: (component: SdFormGenericComponent) => void;
    onChangeHidden: (component: SdFormGenericComponent | SdFormGenericGroup) => void;
    onDuplicate: (component: SdFormGenericComponent | SdFormGenericGroup) => void;
    jsonString?: string;
    viewJSON: () => void;
    updateJSON: () => void;
    configureVariables: () => void;
    addVariables: () => void;
    removeVariables: (id: string) => void;
    updateVariables: () => void;
    getComponents: () => (SdFormGenericComponent | SdFormGenericGroup)[];
    getVariables: () => SdFormGenericVariable[];
    getForm: () => SdFormGeneric;
    openConfigureValidation: () => void;
    onUpdateValidations: (validations: SdFormGenericValidation[]) => void;
    onValidate: () => Promise<void>;
    static ɵfac: i0.ɵɵFactoryDeclaration<SdFormBuilder, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<SdFormBuilder, "sd-form-builder", never, { "formGeneric": { "alias": "formGeneric"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
}

declare class SdFeelExpression {
    #private;
    private ref;
    private expressionFeelPipe;
    private formGenericService;
    modal?: SdModal;
    form: FormGroup<{}>;
    attributeOperators: Record<"string" | "number" | "boolean" | "datetime" | "values", {
        value: _sdcorejs_angular_components_form_generic.Operator;
        symbol?: string;
        display: string;
    }[]>;
    attributes: Attribute[];
    attribute: Record<string, Attribute>;
    components: (SdFormGenericComponent | SdFormGenericGroup)[];
    expression?: SdFormGenericExpression;
    set _expression(expression: SdFormGenericExpression | undefined);
    expressionChange: EventEmitter<SdFormGenericExpression>;
    model?: string;
    set _model(model: string | undefined);
    modelChange: EventEmitter<string>;
    sdChange: EventEmitter<{
        model?: string;
        expression?: SdFormGenericExpression;
    }>;
    constructor(ref: ChangeDetectorRef, expressionFeelPipe: ExpressionFeelPipe, formGenericService: FormGenericService);
    ngOnInit(): void;
    edit: () => Promise<void>;
    addCondition: (conditions: SdFormGenericExpression["conditions"]) => void;
    addCombinator: (conditions: SdFormGenericExpression["conditions"]) => void;
    remove: (conditions: SdFormGenericExpression["conditions"], idx: number) => void;
    onAccept: () => void;
    static ɵfac: i0.ɵɵFactoryDeclaration<SdFeelExpression, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<SdFeelExpression, "sd-feel-expression", never, { "components": { "alias": "components"; "required": true; }; "_expression": { "alias": "expression"; "required": true; }; "_model": { "alias": "model"; "required": true; }; }, { "expressionChange": "expressionChange"; "modelChange": "modelChange"; "sdChange": "sdChange"; }, never, never, true, never>;
}

export { AttributeOperators, COMPONENT_ICONS, DayInfoPreviouses, DayInfoTypes, EvaluateExpression, ExpressionToJavascriptExpression, FormBuilderComponents, GenerateId, GenerateKey, GetAttributes, GetComponentAttributes, GetDatetimeValue, GetVariableAttributes, Operators, SD_FORM_GENERIC_CONFIGURATION, SdFeelExpression, SdFormBuilder, SdFormRender, SdFormRenderService, SdFormatComponent, TableColumnTypes, TemplateToCondition };
export type { Attribute, DayInfo, FormBuilderComponent, FormBuilderComponentGroup, FormRenderComponentTableColumnValues, ISdFormGenericConfiguration, IWorkflowConfigurationForm, Operator, SdFormGeneric, SdFormGenericArgs, SdFormGenericBreak, SdFormGenericCheckbox, SdFormGenericChecklist, SdFormGenericChipCalendar, SdFormGenericChipString, SdFormGenericComponent, SdFormGenericComponentBase, SdFormGenericDatetime, SdFormGenericDefinitionHtml, SdFormGenericDefinitionSelection, SdFormGenericDefinitionTable, SdFormGenericExpression, SdFormGenericExpressionCondition, SdFormGenericGroup, SdFormGenericHtml, SdFormGenericLayout, SdFormGenericNumber, SdFormGenericRadio, SdFormGenericSelect, SdFormGenericSelectionItem, SdFormGenericSelectionStaticItem, SdFormGenericTable, SdFormGenericTableColumn, SdFormGenericTemplate, SdFormGenericTextarea, SdFormGenericTextfield, SdFormGenericUpload, SdFormGenericValues, SdFormGenericVariable, SdFormRenderConfiguration, SdFormRenderEntity };
