@olafvv/ngx-dynamic-form 20.1.0 → 20.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -1,7 +1,9 @@
1
+ import * as _olafvv_ngx_dynamic_form from '@olafvv/ngx-dynamic-form';
1
2
  import * as i0 from '@angular/core';
2
3
  import { WritableSignal, InputSignal, InjectionToken, Type } from '@angular/core';
3
4
  import { ValidatorFn, FormGroup, AbstractControl, FormControl, FormBuilder } from '@angular/forms';
4
5
  import { Observable } from 'rxjs';
6
+ import { MatButtonAppearance } from '@angular/material/button';
5
7
 
6
8
  declare enum RelationActionType {
7
9
  DISABLED = "DISABLED",
@@ -128,15 +130,13 @@ declare abstract class DynamicFormFieldModel {
128
130
  set hidden(hidden: boolean);
129
131
  }
130
132
 
131
- type DynamicFormConfig = DynamicFormFieldModel[][];
133
+ type DynamicFormConfig = DynamicFormFieldModel[];
132
134
 
133
135
  declare class DynamicFormComponent {
134
136
  group: i0.InputSignal<FormGroup<any>>;
135
137
  formConfig: i0.InputSignal<DynamicFormConfig>;
136
- /**
137
- * Get the formConfig as flat array.
138
- */
139
- get flatFormConfig(): DynamicFormFieldModel[];
138
+ layout: i0.InputSignal<string[]>;
139
+ layoutRows: i0.Signal<_olafvv_ngx_dynamic_form.DynamicFormFieldModel[][] | null>;
140
140
  /**
141
141
  * Get the current value of the form.
142
142
  * @param includeDisabledFields Include the disabled fields of the form, is enabled by default
@@ -150,7 +150,7 @@ declare class DynamicFormComponent {
150
150
  */
151
151
  onControlChange(name: string): Observable<unknown>;
152
152
  static ɵfac: i0.ɵɵFactoryDeclaration<DynamicFormComponent, never>;
153
- static ɵcmp: i0.ɵɵComponentDeclaration<DynamicFormComponent, "dynamic-form", never, { "group": { "alias": "group"; "required": true; "isSignal": true; }; "formConfig": { "alias": "formConfig"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
153
+ static ɵcmp: i0.ɵɵComponentDeclaration<DynamicFormComponent, "dynamic-form", never, { "group": { "alias": "group"; "required": true; "isSignal": true; }; "formConfig": { "alias": "formConfig"; "required": true; "isSignal": true; }; "layout": { "alias": "layout"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
154
154
  }
155
155
 
156
156
  interface DynamicFormFieldValueConfig<T> extends DynamicFormFieldConfig {
@@ -249,6 +249,10 @@ type DynamicButtonConfig = Omit<DynamicFormFieldConfig, OmittedProperties> & {
249
249
  * Label shown inside the button
250
250
  */
251
251
  label: string;
252
+ /**
253
+ * Variant of the button
254
+ */
255
+ variant?: MatButtonAppearance;
252
256
  /**
253
257
  * Function called when the button is clicked.
254
258
  * Provides no parameters.
@@ -258,6 +262,7 @@ type DynamicButtonConfig = Omit<DynamicFormFieldConfig, OmittedProperties> & {
258
262
  };
259
263
  declare class DynamicButton extends DynamicFormFieldModel {
260
264
  label: string | null;
265
+ variant: MatButtonAppearance;
261
266
  clicked: () => any;
262
267
  readonly type = "button";
263
268
  constructor(config: DynamicButtonConfig);
@@ -275,7 +280,6 @@ declare class DynamicCheckbox extends DynamicFormFieldValueModel<boolean> {
275
280
  constructor(config: DynamicCheckboxConfig);
276
281
  get checked(): boolean;
277
282
  set checked(checked: boolean);
278
- toggle(): void;
279
283
  }
280
284
 
281
285
  declare const DYNAMIC_FORM_FIELD_DATEPICKER = "datepicker";
@@ -349,7 +353,7 @@ declare class DynamicRadioGroup extends DynamicFormFieldOptionModel<string | num
349
353
 
350
354
  declare const DYNAMIC_FORM_FIELD_READONLY = "readonly";
351
355
  type DynamicReadonlyValue = string | number | null;
352
- type DynamicReadonlyConfig = Omit<DynamicFormFieldValueConfig<DynamicReadonlyValue>, 'validators' | 'relations' | 'updateOn'>;
356
+ type DynamicReadonlyConfig = DynamicFormFieldValueConfig<DynamicReadonlyValue>;
353
357
  declare class DynamicReadonly extends DynamicFormFieldValueModel<DynamicReadonlyValue> {
354
358
  readonly type = "readonly";
355
359
  constructor(config: DynamicReadonlyConfig);
@@ -374,50 +378,20 @@ declare class DynamicSelect<T = string> extends DynamicFormFieldOptionModel<T> {
374
378
  constructor(config: DynamicSelectConfig<T>);
375
379
  }
376
380
 
377
- declare const DYNAMIC_FORM_FIELD_TEXTAREA = "textarea";
378
- type DynamicTextareaValue = string | null;
379
- type DynamicTextareaConfig = DynamicFormFieldValueConfig<DynamicTextareaValue> & {
380
- /**
381
- * Placeholder text inside the textarea.
382
- * Only visible when the field is empty and in focus.
383
- */
384
- placeholder?: string;
385
- /**
386
- * Minimum amount of characters needed in the textarea
387
- */
388
- minLength?: number;
389
- /**
390
- * Maximum amount of characters it is possible to fill in the textarea
391
- */
392
- maxLength?: number;
393
- /**
394
- * Enables or disabled the browser natie autocomplete bubble when the control is in focus.
395
- * Default value is 'off'
396
- */
397
- autocomplete?: 'on' | 'off';
381
+ declare const DYNAMIC_FORM_FIELD_SLIDE_TOGGLE = "slide-toggle";
382
+ type DynamicSlideToggleConfig = DynamicFormFieldValueConfig<boolean> & {
398
383
  /**
399
- * Amount of rows the textarea initializes on
384
+ * Whether the label appears before or after the slide toggle.
385
+ * @default 'after'
400
386
  */
401
- rows?: number;
402
- /**
403
- * Whether the textare automatically resizes to fit its content
404
- */
405
- resize?: boolean;
406
- /**
407
- * Maximum amount of rows the textarea show resize to
408
- */
409
- resizeMaxRows?: number;
387
+ labelPosition?: 'before' | 'after';
410
388
  };
411
- declare class DynamicTextarea extends DynamicFormFieldValueModel<DynamicTextareaValue> {
412
- placeholder: string;
413
- minLength: number | null;
414
- maxLength: number | null;
415
- autocomplete: 'on' | 'off';
416
- rows: number;
417
- resize: boolean;
418
- resizeMaxRows: number | null;
419
- readonly type = "textarea";
420
- constructor(config: DynamicTextareaConfig);
389
+ declare class DynamicSlideToggle extends DynamicFormFieldValueModel<boolean> {
390
+ labelPosition: 'before' | 'after';
391
+ readonly type: string;
392
+ constructor(config: DynamicSlideToggleConfig);
393
+ get checked(): boolean;
394
+ set checked(checked: boolean);
421
395
  }
422
396
 
423
397
  interface DynamicFormField<M extends DynamicFormFieldModel = DynamicFormFieldModel> {
@@ -488,6 +462,64 @@ declare class DynamicFormValidators {
488
462
 
489
463
  declare const DYNAMIC_FORM_FIELD_MAP: InjectionToken<Record<string, Type<DynamicFormField<any>>>>;
490
464
 
465
+ declare const DYNAMIC_FORM_FIELD_STATIC_TEXT = "static-text";
466
+ type DynamicStaticTextValue = {
467
+ title?: string;
468
+ text?: string;
469
+ };
470
+ type DynamicStaticTextConfig = DynamicFormFieldValueConfig<DynamicStaticTextValue>;
471
+ declare class DynamicStaticText extends DynamicFormFieldValueModel<DynamicStaticTextValue> {
472
+ readonly type = "static-text";
473
+ constructor(config: DynamicStaticTextConfig);
474
+ }
475
+
476
+ declare const DYNAMIC_FORM_FIELD_TEXTAREA = "textarea";
477
+ type DynamicTextareaValue = string | null;
478
+ type DynamicTextareaConfig = DynamicFormFieldValueConfig<DynamicTextareaValue> & {
479
+ /**
480
+ * Placeholder text inside the textarea.
481
+ * Only visible when the field is empty and in focus.
482
+ */
483
+ placeholder?: string;
484
+ /**
485
+ * Minimum amount of characters needed in the textarea
486
+ */
487
+ minLength?: number;
488
+ /**
489
+ * Maximum amount of characters it is possible to fill in the textarea
490
+ */
491
+ maxLength?: number;
492
+ /**
493
+ * Enables or disabled the browser natie autocomplete bubble when the control is in focus.
494
+ * Default value is 'off'
495
+ */
496
+ autocomplete?: 'on' | 'off';
497
+ /**
498
+ * Amount of rows the textarea initializes on
499
+ */
500
+ rows?: number;
501
+ /**
502
+ * Whether the textare automatically resizes to fit its content
503
+ */
504
+ resize?: boolean;
505
+ /**
506
+ * Maximum amount of rows the textarea show resize to
507
+ */
508
+ resizeMaxRows?: number;
509
+ };
510
+ declare class DynamicTextarea extends DynamicFormFieldValueModel<DynamicTextareaValue> {
511
+ placeholder: string;
512
+ minLength: number | null;
513
+ maxLength: number | null;
514
+ autocomplete: 'on' | 'off';
515
+ rows: number;
516
+ resize: boolean;
517
+ resizeMaxRows: number | null;
518
+ readonly type = "textarea";
519
+ constructor(config: DynamicTextareaConfig);
520
+ }
521
+
522
+ /** @ignore */
491
523
  declare class DynamicFormValidationsService {
492
524
  /**
493
525
  * Get all Validator Functions from the validator configuration
@@ -559,5 +591,5 @@ declare function arrToDynamicFormOptions<T, K = string>(arr: T[], labelFn: (item
559
591
  */
560
592
  declare function obsToDynamicFormOptions<T, K = string>(obs: Observable<T[]>, labelFn: (item: T) => string, valueFn: (item: T) => K): Observable<DynamicFormFieldOption<K>[]>;
561
593
 
562
- export { DYNAMIC_FORM_FIELD_BUTTON, DYNAMIC_FORM_FIELD_BUTTON_TOGGLES, DYNAMIC_FORM_FIELD_CHECKBOX, DYNAMIC_FORM_FIELD_DATEPICKER, DYNAMIC_FORM_FIELD_INPUT, DYNAMIC_FORM_FIELD_MAP, DYNAMIC_FORM_FIELD_RADIO_GROUP, DYNAMIC_FORM_FIELD_READONLY, DYNAMIC_FORM_FIELD_SELECT, DYNAMIC_FORM_FIELD_TEXTAREA, DynamicButton, DynamicButtonToggles, DynamicCheckbox, DynamicDatepicker, DynamicFormComponent, DynamicFormFieldBase, DynamicFormFieldModel, DynamicFormFieldOptionModel, DynamicFormFieldValueModel, DynamicFormService, DynamicFormValidators, DynamicInput, DynamicRadioGroup, DynamicReadonly, DynamicSelect, DynamicTextarea, RelationActionType, RelationOperator, arrToDynamicFormOptions, obsToDynamicFormOptions };
563
- export type { DynamicButtonConfig, DynamicButtonTogglesConfig, DynamicCheckboxConfig, DynamicDatepickerConfig, DynamicDatepickerControlValue, DynamicFormConfig, DynamicFormField, DynamicFormFieldConfig, DynamicFormFieldOption, DynamicFormFieldOptionConfig, DynamicFormFieldOptionGroup, DynamicFormFieldRelation, DynamicFormFieldValueConfig, DynamicFormValidator, DynamicGroupedOptionList, DynamicInputConfig, DynamicInputValue, DynamicOptionList, DynamicRadioGroupConfig, DynamicReadonlyConfig, DynamicReadonlyValue, DynamicSelectConfig, DynamicTextareaConfig, DynamicTextareaValue, HtmlInputType, RelationCondition };
594
+ export { DYNAMIC_FORM_FIELD_BUTTON, DYNAMIC_FORM_FIELD_BUTTON_TOGGLES, DYNAMIC_FORM_FIELD_CHECKBOX, DYNAMIC_FORM_FIELD_DATEPICKER, DYNAMIC_FORM_FIELD_INPUT, DYNAMIC_FORM_FIELD_MAP, DYNAMIC_FORM_FIELD_RADIO_GROUP, DYNAMIC_FORM_FIELD_READONLY, DYNAMIC_FORM_FIELD_SELECT, DYNAMIC_FORM_FIELD_SLIDE_TOGGLE, DYNAMIC_FORM_FIELD_STATIC_TEXT, DYNAMIC_FORM_FIELD_TEXTAREA, DynamicButton, DynamicButtonToggles, DynamicCheckbox, DynamicDatepicker, DynamicFormComponent, DynamicFormFieldBase, DynamicFormFieldModel, DynamicFormFieldOptionModel, DynamicFormFieldValueModel, DynamicFormService, DynamicFormValidators, DynamicInput, DynamicRadioGroup, DynamicReadonly, DynamicSelect, DynamicSlideToggle, DynamicStaticText, DynamicTextarea, RelationActionType, RelationOperator, arrToDynamicFormOptions, obsToDynamicFormOptions };
595
+ export type { DynamicButtonConfig, DynamicButtonTogglesConfig, DynamicCheckboxConfig, DynamicDatepickerConfig, DynamicDatepickerControlValue, DynamicFormConfig, DynamicFormField, DynamicFormFieldConfig, DynamicFormFieldOption, DynamicFormFieldOptionConfig, DynamicFormFieldOptionGroup, DynamicFormFieldRelation, DynamicFormFieldValueConfig, DynamicFormValidator, DynamicGroupedOptionList, DynamicInputConfig, DynamicInputValue, DynamicOptionList, DynamicRadioGroupConfig, DynamicReadonlyConfig, DynamicReadonlyValue, DynamicSelectConfig, DynamicSlideToggleConfig, DynamicStaticTextConfig, DynamicStaticTextValue, DynamicTextareaConfig, DynamicTextareaValue, HtmlInputType, RelationCondition };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olafvv/ngx-dynamic-form",
3
- "version": "20.1.0",
3
+ "version": "20.2.0",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^20.3.16",
6
6
  "@angular/core": "^20.3.16",