UNPKG

cocori-ng

Version:

Cocori-ng is an Angular full of great components & utilites based on Material

90 lines (89 loc) 5.48 kB
import { ViewContainerRef } from '@angular/core'; import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms'; import { BroadcastEventService, ButtonIconPositon, ConfigComponentInputs, ConfigInputComponent, DataSourceInput, FormInputComponents, HelperService, InjectComponentService, InputFieldAppearance, OutputCallback, TypeButtonEnum } from 'cocori-ng/src/feature-core'; import * as i0 from "@angular/core"; /** * https://www.typescriptlang.org/play?#code/C4TwDgpgBAggTgcwK4FsIDtgBVwQM4A8WAfFALxRZQQAewGAJnlABQB0HUAhongFxQAlugBmEOFACqASnKlhYiQCUoAfikD0EAG7iA3AChQkKEohgANlwDGEM8CRx0OSAQDyAGigA5UhXYcXALwyGiYLvjuxLJkpN6GRrhQAEJIghYM4gQA0tR0jMwA1hAgAPYiUADCpejWcBD0qemZcH5QAN4GUFAA2pJC6FDZALoC-bT06ExQAOQARmkZM2pVNXUNEE0Z4n3DUAJmljZ2DY7OuARd3au19Y2LLbseV91bLQQAojTWFkiZOV5JKQJgUoFpdBJ1PMHssBF8fn8IACpMRiFc0QBfBIiJC1YCCGpQBbNcQsaQCN5ZeG-f7FMoVaq3DaUuBeaHNGaojpXO5nMEQADuN3W9xJcDJ3GYXHQIEMGIMBh+XDwzEZIs2D3E3O6XDJAmAAAtBMxOtcoLynFBDcbDN15Vc5nqrUaTS9zadLda8LaoPbusSMk68MA4MIENrrhbBjMRKVSjMffL7QGWmS2LrpGxHZmU2S9FAAPQFqClQoGFOknNpjNZh55wvF0vlzXinN16T5ovUOBwUpwZti6tp3Mdhvd3v9iutrPD9ud4viCcD7bTms1kfz8d95epqt72vNetdxfbqdD-fZg+B0fHnunlvn9PD2eHm8Lu9wIA * https://medium.com/@bensammons/building-a-fluent-interface-with-typescript-using-generics-in-typescript-3-4d206f00dba5 */ declare type AddInput<Builder, InputName extends string> = Builder extends FormBuilderService<infer InputNames, infer ButtonNames> ? FormBuilderService<InputNames | InputName, ButtonNames> : never; declare type InferInputNames<Builder> = Builder extends FormBuilderService<infer InputNames> ? InputNames : never; declare class InputConfigBuilder<Builder> { _isRequired: boolean; _styleCompact: boolean; _appearance: InputFieldAppearance; _nameLabel: string; _icon: string; _maxlength: number; _inRelationWith: string; _type: FormInputComponents; _dataSource: DataSourceInput; _callbackComponent: OutputCallback; isRequired(): this; styleCompact(): this; appearance(appearance: InputFieldAppearance): this; nameLabel(nameLabel: string): this; inRelationWith<InputName extends InferInputNames<Builder>>(inputName: InputName): this; dataSource(dataSource: DataSourceInput): this; maxlength(value: number): this; icon(materialIconName: string): this; typeInput(type: FormInputComponents): this; outputCallback(outputCallback: OutputCallback): this; } declare class ButtonConfigBuilder<Builder> { _type: TypeButtonEnum; _icon: string; _className: string; _iconPosition: ButtonIconPositon; _callbackComponent: OutputCallback; _url: string; _openNewTab: boolean; isTypeSubmit(is?: boolean): this; type(typeOfTheBtn?: TypeButtonEnum): this; icon(materialIconName: string, buttonIconPosition?: ButtonIconPositon): this; url(url: string): this; openNewTab(openNewTab: boolean): this; class(className: string): this; outputCallback(outputCallback: OutputCallback): this; } export declare class FormBuilderService<InputNames extends string = never, ButtonNames extends string = never, NodeNames extends string = never> { private fb; private helperService; private broadcastEventService; generateComponentViewService: GenerateComponentViewService; formId: string; /** error handler */ formName: string; /** mapping details */ private currentForm; private _configInputsForm; private _appearance; private _styleCompact; constructor(fb: UntypedFormBuilder, helperService: HelperService, broadcastEventService: BroadcastEventService, generateComponentViewService: GenerateComponentViewService); set form(form: UntypedFormGroup); get form(): UntypedFormGroup; get styleCompact(): boolean; getAppearance(): InputFieldAppearance; get configInputsForm(): ConfigInputComponent[]; newForm(): this; appearance(value: InputFieldAppearance): this; identityForm(id: string, name?: string): this; setViewContainerRef(containerRef: ViewContainerRef): this; addInput<InputName extends string, ReturnType extends AddInput<this, InputName>>(inputName: Exclude<InputName, InputNames>, configBuilder: (b: InputConfigBuilder<this>) => InputConfigBuilder<this>): ReturnType; /** Déclenche manuellement la création des champs dans la vue */ generateFormInView(): this; addButton<ButtonName extends string>(buttonName: Exclude<ButtonName, ButtonNames>, configBuilder: (b: ButtonConfigBuilder<this>) => ButtonConfigBuilder<this>): FormBuilderService<never, never, never>; onClickSubmit(): void; static ɵfac: i0.ɵɵFactoryDeclaration<FormBuilderService<any, any, any>, never>; static ɵprov: i0.ɵɵInjectableDeclaration<FormBuilderService<any, any, any>>; } export declare class GenerateComponentViewService { private injectComponentService; private formContainerRef; constructor(injectComponentService: InjectComponentService); setViewContainerRef(containerRef: ViewContainerRef): this; getViewContainerRef(): ViewContainerRef; addComponentToView(componentType: FormInputComponents, configComponent: ConfigComponentInputs, callback: OutputCallback): void; private returnComponentClassFromType; static ɵfac: i0.ɵɵFactoryDeclaration<GenerateComponentViewService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<GenerateComponentViewService>; } export {};