@dereekb/dbx-form 1.2.0 → 3.0.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.
Files changed (123) hide show
  1. package/README.md +1 -1
  2. package/esm2020/lib/form/action/form.action.directive.mjs +34 -19
  3. package/esm2020/lib/form/action/form.action.module.mjs +4 -4
  4. package/esm2020/lib/form/action/transition/form.action.transition.module.mjs +4 -4
  5. package/esm2020/lib/form/action/transition/form.action.transition.safety.directive.mjs +9 -9
  6. package/esm2020/lib/form/form.mjs +11 -1
  7. package/esm2020/lib/form/form.module.mjs +4 -4
  8. package/esm2020/lib/form/io/form.changes.directive.mjs +18 -7
  9. package/esm2020/lib/form/io/form.input.directive.mjs +36 -18
  10. package/esm2020/lib/form/io/form.io.module.mjs +4 -4
  11. package/esm2020/lib/form/io/form.loading.directive.mjs +27 -17
  12. package/esm2020/lib/form.module.mjs +4 -4
  13. package/esm2020/lib/formly/config/validation.mjs +3 -3
  14. package/esm2020/lib/formly/field/checklist/checklist.item.field.component.mjs +8 -8
  15. package/esm2020/lib/formly/field/checklist/checklist.item.field.content.default.component.mjs +3 -3
  16. package/esm2020/lib/formly/field/checklist/checklist.item.field.module.mjs +13 -13
  17. package/esm2020/lib/formly/field/component/component.field.component.mjs +8 -21
  18. package/esm2020/lib/formly/field/component/component.field.mjs +3 -5
  19. package/esm2020/lib/formly/field/component/component.field.module.mjs +14 -14
  20. package/esm2020/lib/formly/field/form.field.module.mjs +4 -4
  21. package/esm2020/lib/formly/field/selection/pickable/pickable.chip.field.component.mjs +7 -7
  22. package/esm2020/lib/formly/field/selection/pickable/pickable.field.directive.mjs +8 -6
  23. package/esm2020/lib/formly/field/selection/pickable/pickable.field.mjs +2 -2
  24. package/esm2020/lib/formly/field/selection/pickable/pickable.field.module.mjs +13 -13
  25. package/esm2020/lib/formly/field/selection/pickable/pickable.list.field.component.mjs +28 -21
  26. package/esm2020/lib/formly/field/selection/searchable/searchable.chip.field.component.mjs +4 -4
  27. package/esm2020/lib/formly/field/selection/searchable/searchable.field.autocomplete.item.component.mjs +16 -16
  28. package/esm2020/lib/formly/field/selection/searchable/searchable.field.directive.mjs +7 -8
  29. package/esm2020/lib/formly/field/selection/searchable/searchable.field.module.mjs +13 -13
  30. package/esm2020/lib/formly/field/selection/searchable/searchable.mjs +1 -1
  31. package/esm2020/lib/formly/field/selection/searchable/searchable.text.field.component.mjs +3 -3
  32. package/esm2020/lib/formly/field/selection/selection.module.mjs +4 -4
  33. package/esm2020/lib/formly/field/texteditor/texteditor.field.component.mjs +4 -5
  34. package/esm2020/lib/formly/field/texteditor/texteditor.field.module.mjs +4 -4
  35. package/esm2020/lib/formly/field/value/array/array.field.component.mjs +7 -7
  36. package/esm2020/lib/formly/field/value/array/array.field.module.mjs +4 -4
  37. package/esm2020/lib/formly/field/value/boolean/boolean.field.module.mjs +4 -4
  38. package/esm2020/lib/formly/field/value/date/date.field.module.mjs +4 -4
  39. package/esm2020/lib/formly/field/value/date/datetime.field.component.mjs +51 -40
  40. package/esm2020/lib/formly/field/value/date/datetime.field.mjs +7 -7
  41. package/esm2020/lib/formly/field/value/enum/enum.field.module.mjs +4 -4
  42. package/esm2020/lib/formly/field/value/phone/phone.field.component.mjs +3 -3
  43. package/esm2020/lib/formly/field/value/phone/phone.field.module.mjs +4 -4
  44. package/esm2020/lib/formly/field/value/text/text.additional.field.mjs +15 -18
  45. package/esm2020/lib/formly/field/value/text/text.address.field.mjs +2 -2
  46. package/esm2020/lib/formly/field/value/text/text.field.mjs +3 -2
  47. package/esm2020/lib/formly/field/value/text/text.field.module.mjs +4 -4
  48. package/esm2020/lib/formly/field/value/value.module.mjs +4 -4
  49. package/esm2020/lib/formly/field/wrapper/autotouch.wrapper.component.mjs +3 -3
  50. package/esm2020/lib/formly/field/wrapper/expandable.wrapper.component.mjs +3 -3
  51. package/esm2020/lib/formly/field/wrapper/expandable.wrapper.delegate.mjs +3 -3
  52. package/esm2020/lib/formly/field/wrapper/flex.wrapper.component.mjs +3 -3
  53. package/esm2020/lib/formly/field/wrapper/form.wrapper.module.mjs +18 -10
  54. package/esm2020/lib/formly/field/wrapper/index.mjs +2 -1
  55. package/esm2020/lib/formly/field/wrapper/info.wrapper.component.mjs +3 -3
  56. package/esm2020/lib/formly/field/wrapper/section.wrapper.component.mjs +3 -3
  57. package/esm2020/lib/formly/field/wrapper/style.wrapper.component.mjs +4 -4
  58. package/esm2020/lib/formly/field/wrapper/subsection.wrapper.component.mjs +3 -3
  59. package/esm2020/lib/formly/field/wrapper/toggle.wrapper.component.mjs +3 -3
  60. package/esm2020/lib/formly/field/wrapper/working.wrapper.component.mjs +45 -0
  61. package/esm2020/lib/formly/field/wrapper/wrapper.mjs +7 -1
  62. package/esm2020/lib/formly/formly.context.directive.mjs +3 -3
  63. package/esm2020/lib/formly/formly.context.mjs +19 -8
  64. package/esm2020/lib/formly/formly.directive.mjs +17 -14
  65. package/esm2020/lib/formly/formly.form.component.mjs +63 -22
  66. package/esm2020/lib/formly/formly.module.mjs +9 -6
  67. package/esm2020/lib/formly/index.mjs +2 -1
  68. package/esm2020/lib/formly/template/available.mjs +16 -0
  69. package/esm2020/lib/formly/template/index.mjs +3 -0
  70. package/esm2020/lib/formly/template/login.mjs +90 -0
  71. package/esm2020/lib/layout/form.layout.module.mjs +4 -4
  72. package/esm2020/lib/layout/form.spacer.component.mjs +3 -3
  73. package/esm2020/lib/validator/available.mjs +32 -0
  74. package/esm2020/lib/validator/field.mjs +31 -0
  75. package/esm2020/lib/validator/index.mjs +3 -1
  76. package/fesm2015/dereekb-dbx-form.mjs +818 -505
  77. package/fesm2015/dereekb-dbx-form.mjs.map +1 -1
  78. package/fesm2020/dereekb-dbx-form.mjs +834 -501
  79. package/fesm2020/dereekb-dbx-form.mjs.map +1 -1
  80. package/lib/form/action/form.action.directive.d.ts +13 -16
  81. package/lib/form/action/transition/form.action.transition.safety.directive.d.ts +3 -3
  82. package/lib/form/form.d.ts +30 -3
  83. package/lib/form/io/form.changes.directive.d.ts +7 -3
  84. package/lib/form/io/form.input.directive.d.ts +19 -7
  85. package/lib/form/io/form.loading.directive.d.ts +8 -2
  86. package/lib/formly/field/checklist/checklist.item.field.component.d.ts +2 -2
  87. package/lib/formly/field/checklist/checklist.item.field.module.d.ts +1 -1
  88. package/lib/formly/field/component/component.field.component.d.ts +8 -21
  89. package/lib/formly/field/component/component.field.d.ts +3 -5
  90. package/lib/formly/field/component/component.field.module.d.ts +1 -1
  91. package/lib/formly/field/selection/pickable/pickable.field.directive.d.ts +8 -3
  92. package/lib/formly/field/selection/pickable/pickable.field.module.d.ts +1 -1
  93. package/lib/formly/field/selection/pickable/pickable.list.field.component.d.ts +8 -6
  94. package/lib/formly/field/selection/searchable/searchable.chip.field.component.d.ts +2 -1
  95. package/lib/formly/field/selection/searchable/searchable.d.ts +3 -3
  96. package/lib/formly/field/selection/searchable/searchable.field.autocomplete.item.component.d.ts +3 -3
  97. package/lib/formly/field/selection/searchable/searchable.field.directive.d.ts +4 -4
  98. package/lib/formly/field/selection/searchable/searchable.field.module.d.ts +1 -1
  99. package/lib/formly/field/texteditor/_texteditor.scss +0 -2
  100. package/lib/formly/field/value/array/array.field.component.d.ts +2 -2
  101. package/lib/formly/field/value/date/datetime.field.component.d.ts +8 -10
  102. package/lib/formly/field/value/date/datetime.field.d.ts +2 -2
  103. package/lib/formly/field/value/phone/_phone.scss +4 -0
  104. package/lib/formly/field/value/text/text.additional.field.d.ts +1 -1
  105. package/lib/formly/field/value/text/text.field.d.ts +2 -0
  106. package/lib/formly/field/wrapper/form.wrapper.module.d.ts +9 -8
  107. package/lib/formly/field/wrapper/index.d.ts +1 -0
  108. package/lib/formly/field/wrapper/style.wrapper.component.d.ts +3 -3
  109. package/lib/formly/field/wrapper/working.wrapper.component.d.ts +22 -0
  110. package/lib/formly/field/wrapper/wrapper.d.ts +3 -0
  111. package/lib/formly/formly.context.d.ts +9 -6
  112. package/lib/formly/formly.directive.d.ts +2 -0
  113. package/lib/formly/formly.form.component.d.ts +13 -3
  114. package/lib/formly/index.d.ts +1 -0
  115. package/lib/formly/template/available.d.ts +7 -0
  116. package/lib/formly/template/index.d.ts +2 -0
  117. package/lib/formly/template/login.d.ts +59 -0
  118. package/lib/validator/available.d.ts +30 -0
  119. package/lib/validator/field.d.ts +32 -0
  120. package/lib/validator/index.d.ts +2 -0
  121. package/package.json +17 -44
  122. package/lib/formly/field/fields_TODO.scss +0 -4
  123. package/lib/formly/form_TODO.scss +0 -153
@@ -12,7 +12,7 @@ export declare function nameField({ key, label, placeholder, required, minLength
12
12
  export interface EmailFieldConfig extends Partial<LabeledFieldConfig>, DescriptionFieldConfig {
13
13
  rows?: number;
14
14
  }
15
- export declare function emailField({ key, label, placeholder, description, required, readonly }?: EmailFieldConfig): FormlyFieldConfig;
15
+ export declare function emailField(config?: EmailFieldConfig): FormlyFieldConfig;
16
16
  export declare function cityField({ key, required }?: Partial<TextFieldConfig>): FormlyFieldConfig;
17
17
  export declare function stateField({ key, required }?: Partial<TextFieldConfig>): FormlyFieldConfig;
18
18
  export declare function countryField({ key, required }?: Partial<TextFieldConfig>): FormlyFieldConfig;
@@ -4,7 +4,9 @@ export interface TextFieldLengthConfig {
4
4
  minLength?: number;
5
5
  maxLength?: number;
6
6
  }
7
+ export declare type TextFieldInputType = 'text' | 'password' | 'email';
7
8
  export interface TextFieldConfig extends LabeledFieldConfig, TextFieldLengthConfig, AttributesFieldConfig {
9
+ inputType?: TextFieldInputType;
8
10
  pattern?: string | RegExp;
9
11
  }
10
12
  export declare function textField(config: TextFieldConfig): FormlyFieldConfig;
@@ -7,15 +7,16 @@ import * as i5 from "./expandable.wrapper.component";
7
7
  import * as i6 from "./toggle.wrapper.component";
8
8
  import * as i7 from "./flex.wrapper.component";
9
9
  import * as i8 from "./style.wrapper.component";
10
- import * as i9 from "@angular/common";
11
- import * as i10 from "@dereekb/dbx-web";
12
- import * as i11 from "@angular/material/button";
13
- import * as i12 from "@angular/material/slide-toggle";
14
- import * as i13 from "@angular/material/icon";
15
- import * as i14 from "@angular/flex-layout";
16
- import * as i15 from "@ngx-formly/core";
10
+ import * as i9 from "./working.wrapper.component";
11
+ import * as i10 from "@angular/common";
12
+ import * as i11 from "@dereekb/dbx-web";
13
+ import * as i12 from "@angular/material/button";
14
+ import * as i13 from "@angular/material/slide-toggle";
15
+ import * as i14 from "@angular/material/icon";
16
+ import * as i15 from "@angular/flex-layout";
17
+ import * as i16 from "@ngx-formly/core";
17
18
  export declare class DbxFormFormlyWrapperModule {
18
19
  static ɵfac: i0.ɵɵFactoryDeclaration<DbxFormFormlyWrapperModule, never>;
19
- static ɵmod: i0.ɵɵNgModuleDeclaration<DbxFormFormlyWrapperModule, [typeof i1.AutoTouchFieldWrapperComponent, typeof i2.DbxFormSectionWrapperComponent, typeof i3.DbxFormSubsectionWrapperComponent, typeof i4.DbxFormInfoWrapperComponent, typeof i5.DbxFormExpandWrapperComponent, typeof i6.DbxFormToggleWrapperComponent, typeof i7.DbxFormFlexWrapperComponent, typeof i8.DbxFormStyleWrapperComponent], [typeof i9.CommonModule, typeof i10.DbxTextModule, typeof i10.DbxFlexLayoutModule, typeof i10.DbxSectionLayoutModule, typeof i11.MatButtonModule, typeof i12.MatSlideToggleModule, typeof i13.MatIconModule, typeof i14.FlexLayoutModule, typeof i15.FormlyModule], never>;
20
+ static ɵmod: i0.ɵɵNgModuleDeclaration<DbxFormFormlyWrapperModule, [typeof i1.AutoTouchFieldWrapperComponent, typeof i2.DbxFormSectionWrapperComponent, typeof i3.DbxFormSubsectionWrapperComponent, typeof i4.DbxFormInfoWrapperComponent, typeof i5.DbxFormExpandWrapperComponent, typeof i6.DbxFormToggleWrapperComponent, typeof i7.DbxFormFlexWrapperComponent, typeof i8.DbxFormStyleWrapperComponent, typeof i9.DbxFormWorkingWrapperComponent], [typeof i10.CommonModule, typeof i11.DbxTextModule, typeof i11.DbxLoadingModule, typeof i11.DbxFlexLayoutModule, typeof i11.DbxSectionLayoutModule, typeof i12.MatButtonModule, typeof i13.MatSlideToggleModule, typeof i14.MatIconModule, typeof i15.FlexLayoutModule, typeof i16.FormlyModule], never>;
20
21
  static ɵinj: i0.ɵɵInjectorDeclaration<DbxFormFormlyWrapperModule>;
21
22
  }
@@ -7,4 +7,5 @@ export * from './info.wrapper.component';
7
7
  export * from './section.wrapper.component';
8
8
  export * from './subsection.wrapper.component';
9
9
  export * from './toggle.wrapper.component';
10
+ export * from './working.wrapper.component';
10
11
  export * from './wrapper';
@@ -1,11 +1,11 @@
1
1
  import { OnInit, OnDestroy } from '@angular/core';
2
- import { ObservableGetter } from '@dereekb/rxjs';
2
+ import { ObservableOrValue } from '@dereekb/rxjs';
3
3
  import { Maybe } from '@dereekb/util';
4
4
  import { FieldWrapper, FormlyFieldConfig } from '@ngx-formly/core';
5
5
  import { Observable } from 'rxjs';
6
6
  import * as i0 from "@angular/core";
7
7
  export interface DbxFormStyleWrapperConfig {
8
- style: ObservableGetter<string>;
8
+ style: ObservableOrValue<string>;
9
9
  }
10
10
  export interface DbxFormStyleWrapperFormlyConfig extends FormlyFieldConfig {
11
11
  styleWrapper: DbxFormStyleWrapperConfig;
@@ -14,7 +14,7 @@ export declare class DbxFormStyleWrapperComponent extends FieldWrapper<DbxFormSt
14
14
  private _style;
15
15
  readonly style$: Observable<Maybe<string>>;
16
16
  get styleWrapper(): DbxFormStyleWrapperConfig;
17
- get styleGetter(): ObservableGetter<string>;
17
+ get styleGetter(): ObservableOrValue<string>;
18
18
  ngOnInit(): void;
19
19
  ngOnDestroy(): void;
20
20
  static ɵfac: i0.ɵɵFactoryDeclaration<DbxFormStyleWrapperComponent, never>;
@@ -0,0 +1,22 @@
1
+ import { OnInit, OnDestroy } from '@angular/core';
2
+ import { SimpleLoadingContext, SubscriptionObject } from '@dereekb/rxjs';
3
+ import { FieldWrapper, FormlyFieldConfig } from '@ngx-formly/core';
4
+ import * as i0 from "@angular/core";
5
+ export interface DbxFormWorkingWrapperConfig {
6
+ }
7
+ export interface DbxFormWorkingWrapperFormlyConfig extends FormlyFieldConfig {
8
+ styleWrapper: DbxFormWorkingWrapperConfig;
9
+ }
10
+ /**
11
+ * Adds a loading bar to help signify asynchronos work is occuring.
12
+ *
13
+ * By default shows loading during asynchronous validation of a field (FormControl status is "PENDING")
14
+ */
15
+ export declare class DbxFormWorkingWrapperComponent extends FieldWrapper<DbxFormWorkingWrapperFormlyConfig> implements OnInit, OnDestroy {
16
+ readonly sub: SubscriptionObject;
17
+ readonly workingContext: SimpleLoadingContext;
18
+ ngOnInit(): void;
19
+ ngOnDestroy(): void;
20
+ static ɵfac: i0.ɵɵFactoryDeclaration<DbxFormWorkingWrapperComponent, never>;
21
+ static ɵcmp: i0.ɵɵComponentDeclaration<DbxFormWorkingWrapperComponent, "ng-component", never, {}, {}, never, never>;
22
+ }
@@ -7,6 +7,7 @@ import { DbxFormSubsectionConfig } from './subsection.wrapper.component';
7
7
  import { DbxFormInfoConfig } from './info.wrapper.component';
8
8
  import { DbxFormExpandWrapperConfig } from './expandable.wrapper.component';
9
9
  import { DbxFlexSize } from '@dereekb/dbx-web';
10
+ import { DbxFormWorkingWrapperConfig } from './working.wrapper.component';
10
11
  export declare const EXPANDABLE_WRAPPER_KEY = "expandable";
11
12
  export declare const TOGGLE_WRAPPER_KEY = "toggle";
12
13
  export declare const SECTION_WRAPPER_KEY = "section";
@@ -14,6 +15,7 @@ export declare const SUBSECTION_WRAPPER_KEY = "subsection";
14
15
  export declare const INFO_WRAPPER_KEY = "info";
15
16
  export declare const FLEX_WRAPPER_KEY = "flex";
16
17
  export declare const STYLE_WRAPPER_KEY = "style";
18
+ export declare const WORKING_WRAPPER_KEY = "working";
17
19
  export declare function addWrapperToFormlyFieldConfig<T extends object>(fieldConfig: FormlyFieldConfig, wrapperKey: string, wrapperTemplateOptionsConfig: T): FormlyFieldConfig;
18
20
  export declare function expandWrapper(fieldConfig: FormlyFieldConfig, expandWrapper?: DbxFormExpandWrapperConfig): FormlyFieldConfig;
19
21
  export declare function toggleWrapper(fieldConfig: FormlyFieldConfig, expandWrapper?: DbxFormToggleWrapperConfig): FormlyFieldConfig;
@@ -21,6 +23,7 @@ export declare function sectionWrapper(fieldConfig: FormlyFieldConfig, sectionWr
21
23
  export declare function subsectionWrapper(fieldConfig: FormlyFieldConfig, subsectionWrapper?: DbxFormSubsectionConfig): FormlyFieldConfig;
22
24
  export declare function infoWrapper(fieldConfig: FormlyFieldConfig, infoWrapper: DbxFormInfoConfig): FormlyFieldConfig;
23
25
  export declare function styleWrapper(fieldConfig: FormlyFieldConfig, styleWrapper: DbxFormStyleWrapperConfig): FormlyFieldConfig;
26
+ export declare function workingWrapper(fieldConfig: FormlyFieldConfig, workingWrapper: DbxFormWorkingWrapperConfig): FormlyFieldConfig;
24
27
  export interface DbxFlexLayoutWrapperGroupFieldConfig {
25
28
  field: FormlyFieldConfig;
26
29
  /**
@@ -1,20 +1,20 @@
1
1
  import { Provider } from '@angular/core';
2
2
  import { Observable } from 'rxjs';
3
- import { DbxForm, DbxFormEvent, DbxMutableForm } from '../form/form';
3
+ import { DbxForm, DbxFormDisabledKey, DbxFormEvent, DbxMutableForm } from '../form/form';
4
4
  import { FormlyFieldConfig } from '@ngx-formly/core';
5
5
  import { LockSet } from '@dereekb/rxjs';
6
- import { Maybe } from '@dereekb/util';
6
+ import { BooleanStringKeyArray, Maybe } from '@dereekb/util';
7
7
  export interface DbxFormlyInitialize<T> {
8
8
  fields: Observable<FormlyFieldConfig[]>;
9
+ initialDisabled: BooleanStringKeyArray;
9
10
  initialValue: Maybe<Partial<T>>;
10
- initialDisabled: boolean;
11
11
  }
12
12
  /**
13
13
  * DbxFormlyContext delegate.
14
14
  *
15
15
  * This is usually the component or element that contains the form itself.
16
16
  */
17
- export interface DbxFormlyContextDelegate<T = any> extends Omit<DbxMutableForm<T>, 'lockSet' | 'setDisabled'> {
17
+ export interface DbxFormlyContextDelegate<T = any> extends Omit<DbxMutableForm<T>, 'lockSet'> {
18
18
  readonly stream$: Observable<DbxFormEvent>;
19
19
  init(initialize: DbxFormlyInitialize<T>): void;
20
20
  }
@@ -25,7 +25,7 @@ export declare function ProvideFormlyContext(): Provider[];
25
25
  /**
26
26
  * DbxForm Instance that registers a delegate and manages the state of that form/delegate.
27
27
  */
28
- export declare class DbxFormlyContext<T> implements DbxForm<T> {
28
+ export declare class DbxFormlyContext<T = any> implements DbxForm<T> {
29
29
  readonly lockSet: LockSet;
30
30
  private static INITIAL_STATE;
31
31
  private _fields;
@@ -33,6 +33,7 @@ export declare class DbxFormlyContext<T> implements DbxForm<T> {
33
33
  private _disabled;
34
34
  private _delegate;
35
35
  readonly fields$: Observable<FormlyFieldConfig[]>;
36
+ readonly disabled$: Observable<string[]>;
36
37
  readonly stream$: Observable<DbxFormEvent>;
37
38
  constructor();
38
39
  destroy(): void;
@@ -43,7 +44,9 @@ export declare class DbxFormlyContext<T> implements DbxForm<T> {
43
44
  getValue(): Observable<T>;
44
45
  setValue(value: Partial<T>): void;
45
46
  isDisabled(): boolean;
46
- setDisabled(disabled?: boolean): void;
47
+ get disabled(): BooleanStringKeyArray;
48
+ getDisabled(): Observable<BooleanStringKeyArray>;
49
+ setDisabled(key?: DbxFormDisabledKey, disabled?: boolean): void;
47
50
  resetForm(): void;
48
51
  forceFormUpdate(): void;
49
52
  }
@@ -3,6 +3,7 @@ import { FormlyFieldConfig } from '@ngx-formly/core/lib/core';
3
3
  import { OnInit, OnDestroy } from '@angular/core';
4
4
  import { DbxFormlyContext } from './formly.context';
5
5
  import { Maybe } from '@dereekb/util';
6
+ import { DbxFormDisabledKey } from '../form/form';
6
7
  import * as i0 from "@angular/core";
7
8
  /**
8
9
  * Abstract component for wrapping a form.
@@ -17,6 +18,7 @@ export declare abstract class AbstractFormlyFormDirective<T> implements OnDestro
17
18
  setValue(value: Partial<T>): void;
18
19
  resetForm(): void;
19
20
  clearValue(): void;
21
+ setDisabled(key?: DbxFormDisabledKey, disabled?: boolean): void;
20
22
  static ɵfac: i0.ɵɵFactoryDeclaration<AbstractFormlyFormDirective<any>, never>;
21
23
  static ɵdir: i0.ɵɵDirectiveDeclaration<AbstractFormlyFormDirective<any>, never, never, { "disabled": "disabled"; }, {}, never>;
22
24
  }
@@ -3,9 +3,15 @@ import { FormGroup } from '@angular/forms';
3
3
  import { FormlyFieldConfig, FormlyFormOptions } from '@ngx-formly/core';
4
4
  import { Observable } from 'rxjs';
5
5
  import { AbstractSubscriptionDirective } from '@dereekb/dbx-core';
6
- import { DbxForm, DbxFormEvent } from '../form/form';
6
+ import { DbxForm, DbxFormDisabledKey, DbxFormEvent } from '../form/form';
7
7
  import { DbxFormlyContext, DbxFormlyContextDelegate, DbxFormlyInitialize } from './formly.context';
8
+ import { BooleanStringKeyArray } from '@dereekb/util';
8
9
  import * as i0 from "@angular/core";
10
+ export interface DbxFormlyFormState {
11
+ changesSinceLastResetCount: number;
12
+ isFormValid: boolean;
13
+ isFormDisabled: boolean;
14
+ }
9
15
  /**
10
16
  * Used for rending a form from a DbxFormlyContext.
11
17
  */
@@ -13,8 +19,10 @@ export declare class DbxFormlyFormComponent<T extends object> extends AbstractSu
13
19
  private readonly context;
14
20
  private _fields;
15
21
  private _events;
22
+ private _disabled;
16
23
  private _reset;
17
24
  private _forceUpdate;
25
+ private _disabledSub;
18
26
  form: FormGroup;
19
27
  model: any;
20
28
  options: FormlyFormOptions;
@@ -27,8 +35,10 @@ export declare class DbxFormlyFormComponent<T extends object> extends AbstractSu
27
35
  getValue(): Observable<T>;
28
36
  setValue(value: T): void;
29
37
  resetForm(): void;
30
- get disabled(): boolean;
31
- setDisabled(disabled?: boolean): void;
38
+ get isDisabled(): boolean;
39
+ get disabled(): BooleanStringKeyArray;
40
+ getDisabled(): Observable<BooleanStringKeyArray>;
41
+ setDisabled(key?: DbxFormDisabledKey, disabled?: boolean): void;
32
42
  forceFormUpdate(): void;
33
43
  static ɵfac: i0.ɵɵFactoryDeclaration<DbxFormlyFormComponent<any>, never>;
34
44
  static ɵcmp: i0.ɵɵComponentDeclaration<DbxFormlyFormComponent<any>, "dbx-formly", ["formly"], {}, {}, never, never>;
@@ -1,5 +1,6 @@
1
1
  export * from './config';
2
2
  export * from './field';
3
+ export * from './template';
3
4
  export * from './formly.context';
4
5
  export * from './formly.context.directive';
5
6
  export * from './formly.directive';
@@ -0,0 +1,7 @@
1
+ import { FormlyFieldConfig } from '@ngx-formly/core/lib/core';
2
+ import { FieldValueIsAvailableValidatorConfig } from '../../validator/available';
3
+ import { TextFieldConfig } from '../field/value/text/text.field';
4
+ export interface TextAvailableFieldConfig extends TextFieldConfig, Omit<FieldValueIsAvailableValidatorConfig<string>, 'message'> {
5
+ isNotAvailableErrorMessage?: string;
6
+ }
7
+ export declare function textIsAvailableField(config: TextAvailableFieldConfig): FormlyFieldConfig;
@@ -0,0 +1,2 @@
1
+ export * from './login';
2
+ export * from './available';
@@ -0,0 +1,59 @@
1
+ import { TextFieldConfig } from '../field/value/text/text.field';
2
+ import { EmailFieldConfig } from '../field/value/text/text.additional.field';
3
+ import { FormlyFieldConfig } from "@ngx-formly/core";
4
+ import { Maybe } from '@dereekb/util';
5
+ /**
6
+ * Convenience interface for the password parameters configuration for a TextPasswordField.
7
+ */
8
+ export interface TextPasswordFieldPasswordParameters extends Partial<Pick<TextFieldConfig, 'maxLength' | 'minLength' | 'pattern'>> {
9
+ }
10
+ /**
11
+ * textPasswordField() configuration.
12
+ */
13
+ export interface TextPasswordFieldConfig extends Omit<TextFieldConfig, 'inputType' | 'key'>, Partial<Pick<TextFieldConfig, 'key'>> {
14
+ }
15
+ /**
16
+ * Configured simple text password field.
17
+ *
18
+ * @param config
19
+ * @returns
20
+ */
21
+ export declare function textPasswordField(config?: TextPasswordFieldConfig): FormlyFieldConfig;
22
+ /**
23
+ * Configured verify field for a password.
24
+ * @param config
25
+ * @returns
26
+ */
27
+ export declare function textVerifyPasswordField(config?: TextPasswordFieldConfig): FormlyFieldConfig;
28
+ export interface TextPasswordWithVerifyFieldConfig {
29
+ password?: TextPasswordFieldConfig;
30
+ verifyPassword?: TextPasswordFieldConfig;
31
+ }
32
+ export declare function textPasswordWithVerifyFieldGroup(config: TextPasswordWithVerifyFieldConfig): FormlyFieldConfig;
33
+ export interface UsernameLoginFieldUsernameConfig {
34
+ email?: Omit<EmailFieldConfig, 'key'>;
35
+ username?: Omit<TextFieldConfig, 'key'>;
36
+ }
37
+ /**
38
+ * usernamePasswordLoginFields() configuration.
39
+ */
40
+ export interface UsernameLoginFieldsConfig {
41
+ username: 'email' | 'username' | UsernameLoginFieldUsernameConfig;
42
+ password?: TextPasswordFieldConfig;
43
+ verifyPassword?: Maybe<boolean | TextPasswordFieldConfig>;
44
+ }
45
+ /**
46
+ * Value type exported by usernameLoginFields()
47
+ */
48
+ export interface DefaultUsernameLoginFieldsValue {
49
+ username: string;
50
+ password: string;
51
+ verifyPassword?: string;
52
+ }
53
+ /**
54
+ * Template for login field that takes in a username and password.
55
+ *
56
+ * @param param0
57
+ * @returns
58
+ */
59
+ export declare function usernamePasswordLoginFields({ username, password, verifyPassword }: UsernameLoginFieldsConfig): FormlyFieldConfig[];
@@ -0,0 +1,30 @@
1
+ import { Observable } from 'rxjs';
2
+ import { AsyncValidatorFn } from "@angular/forms";
3
+ export declare const FIELD_VALUE_IS_AVAILABLE_VALIDATION_KEY = "fieldValueIsAvailable";
4
+ export declare const FIELD_VALUE_IS_AVAILABLE_ERROR_VALIDATION_KEY = "fieldValueIsAvailableError";
5
+ export declare type FieldValueIsAvailableValidatorFunction<T> = (value: T) => Observable<boolean>;
6
+ export interface FieldValueIsAvailableValidatorConfig<T> {
7
+ /**
8
+ * How long to wait in between value changes.
9
+ */
10
+ throttle?: number;
11
+ /**
12
+ * Returns an observable that checks whether or not the value is currently available.
13
+ *
14
+ * @param value
15
+ */
16
+ readonly checkValueIsAvailable: FieldValueIsAvailableValidatorFunction<T>;
17
+ /**
18
+ * Custom message for this validator.
19
+ */
20
+ message?: string;
21
+ }
22
+ /**
23
+ * Validator for validating all values within an object.
24
+ *
25
+ * This is useful for validating a control group where two or more values are expected to be the same, such as a password and a password verification field.
26
+ *
27
+ * @param config
28
+ * @returns
29
+ */
30
+ export declare function fieldValueIsAvailableValidator<T>(config: FieldValueIsAvailableValidatorConfig<T>): AsyncValidatorFn;
@@ -0,0 +1,32 @@
1
+ import { ValidatorFn } from "@angular/forms";
2
+ import { KeyValueTupleFilter, IsEqualFunction } from "@dereekb/util";
3
+ export declare const FIELD_VALUES_ARE_EQUAL_VALIDATION_KEY = "fieldValuesAreEqual";
4
+ export interface FieldValuesAreEqualValidatorConfig<T extends object = any> {
5
+ /**
6
+ * Keys of the value to match on.
7
+ *
8
+ * If none are defined, then all fields from the control are matched.
9
+ */
10
+ keysFilter?: string[];
11
+ /**
12
+ * Full filter to use, if defined.
13
+ */
14
+ valuesFilter?: KeyValueTupleFilter<T, any>;
15
+ /**
16
+ * Optional equivalence comparator.
17
+ */
18
+ isEqual?: IsEqualFunction<T>;
19
+ /**
20
+ * Custom message for this validator.
21
+ */
22
+ message?: string;
23
+ }
24
+ /**
25
+ * Validator for validating all values within an object.
26
+ *
27
+ * This is useful for validating a control group where two or more values are expected to be the same, such as a password and a password verification field.
28
+ *
29
+ * @param config
30
+ * @returns
31
+ */
32
+ export declare function fieldValuesAreEqualValidator<T extends object = any>(config?: FieldValuesAreEqualValidatorConfig<T>): ValidatorFn;
@@ -1,3 +1,5 @@
1
1
  export * from './boolean';
2
2
  export * from './email';
3
+ export * from './field';
3
4
  export * from './number';
5
+ export * from './available';
package/package.json CHANGED
@@ -1,67 +1,40 @@
1
1
  {
2
2
  "name": "@dereekb/dbx-form",
3
- "version": "1.2.0",
3
+ "version": "3.0.0",
4
4
  "peerDependencies": {
5
- "@angular/common": "^13.1.0",
6
- "@angular/core": "^13.1.0",
7
- "@dereekb/dbx-core": "1.2.0",
8
- "@ngrx/component-store": "^13.0.2",
9
- "@ngrx/data": "^13.0.2",
10
- "@ngrx/effects": "^13.0.2",
11
- "@ngrx/entity": "^13.0.2",
12
- "@ngrx/store": "^13.0.2",
13
- "rxjs": "^7.5.2",
14
- "@dereekb/util": "1.2.0",
15
- "extra-set": "^2.2.11",
16
- "@dereekb/rxjs": "1.2.0",
17
- "ms": "^3.0.0-canary.1",
18
- "@angular/platform-browser": "^13.0.0",
19
- "date-fns": "^2.28.0",
20
- "@dereekb/date": "1.2.0",
21
- "class-transformer": "^0.5.1",
22
- "class-validator": "^0.13.2",
23
- "date-fns-tz": "^1.2.2",
24
- "rrule": "git+https://git@github.com/dereekb/rrule.git#17adf5708d6567b4d01a3a8afd106261421ea492",
25
- "@angular/router": "^13.0.0",
26
- "@uirouter/core": "^6.0.8",
27
- "@uirouter/angular": "^9.1.0",
5
+ "@angular/common": "^13.0.0",
6
+ "@angular/core": "^13.0.0",
7
+ "@dereekb/dbx-core": "3.0.0",
28
8
  "@angular/material": "^13.0.0",
29
- "@dereekb/dbx-web": "1.2.0",
30
- "mat-progress-buttons": "git+https://git@github.com/dereekb/mat-progress-buttons.git#60b0374a45644e8756f20b8d761738151ca3df64",
31
- "@angular/flex-layout": "^13.0.0-beta.38",
32
- "ng-overlay-container": "^13.0.0",
33
- "@angular/cdk": "^13.0.0",
34
- "angular-resize-event": "^3.1.1",
35
- "ngx-infinite-scroll": "^10.0.1",
36
- "linkify-string": "4.0.0-beta.3",
37
- "@ngx-formly/core": "6.0.0-next.8",
9
+ "@dereekb/dbx-web": "3.0.0",
38
10
  "@angular/forms": "^13.0.0",
39
- "@ngx-formly/material": "6.0.0-next.8",
40
- "change-case": "^4.1.2",
11
+ "@ngx-formly/core": "6.0.0-next.9",
12
+ "@ngx-formly/material": "6.0.0-next.9",
41
13
  "ngx-editor": "^12.1.1",
42
14
  "ngx-mat-intl-tel-input": "^4.1.0"
43
15
  },
44
16
  "dependencies": {
45
17
  "tslib": "^2.3.0"
46
18
  },
47
- "module": "fesm2015/dereekb-dbx-form.mjs",
48
- "es2020": "fesm2020/dereekb-dbx-form.mjs",
49
- "esm2020": "esm2020/dereekb-dbx-form.mjs",
50
- "fesm2020": "fesm2020/dereekb-dbx-form.mjs",
51
- "fesm2015": "fesm2015/dereekb-dbx-form.mjs",
52
- "typings": "dereekb-dbx-form.d.ts",
53
19
  "exports": {
54
- "./package.json": {
55
- "default": "./package.json"
56
- },
57
20
  ".": {
21
+ "sass": "./_index.scss",
58
22
  "types": "./dereekb-dbx-form.d.ts",
59
23
  "esm2020": "./esm2020/dereekb-dbx-form.mjs",
60
24
  "es2020": "./fesm2020/dereekb-dbx-form.mjs",
61
25
  "es2015": "./fesm2015/dereekb-dbx-form.mjs",
62
26
  "node": "./fesm2015/dereekb-dbx-form.mjs",
63
27
  "default": "./fesm2020/dereekb-dbx-form.mjs"
28
+ },
29
+ "./package.json": {
30
+ "default": "./package.json"
64
31
  }
65
32
  },
33
+ "module": "fesm2015/dereekb-dbx-form.mjs",
34
+ "es2020": "fesm2020/dereekb-dbx-form.mjs",
35
+ "esm2020": "esm2020/dereekb-dbx-form.mjs",
36
+ "fesm2020": "fesm2020/dereekb-dbx-form.mjs",
37
+ "fesm2015": "fesm2015/dereekb-dbx-form.mjs",
38
+ "typings": "dereekb-dbx-form.d.ts",
66
39
  "sideEffects": false
67
40
  }
@@ -1,4 +0,0 @@
1
-
2
- .form-wrapped-component {
3
- margin: 12px 0;
4
- }
@@ -1,153 +0,0 @@
1
- $dbx-form-container-margin: 10px;
2
-
3
- .dbx-formly {
4
- margin: $dbx-form-container-margin 0;
5
- }
6
-
7
- .dbx-form-spacer {
8
- margin-top: 24px;
9
- }
10
-
11
- // OLD. Remove
12
- $form-submit-view-margin: 8px;
13
- $material-form-margin: 16px;
14
-
15
- // MARK: Form Container
16
- .dbx-form-container {
17
- margin: $dbx-form-container-margin 0;
18
- }
19
-
20
- // .dbx-form-container-form-view {}
21
-
22
- // MARK: Form View
23
- .dbx-form-view-padded {
24
- padding: 0 $material-form-margin;
25
- }
26
-
27
- .required-text {
28
- content: "*";
29
- color: red;
30
- // color: mat-color($tallynote-dbx-warn);
31
- }
32
-
33
- .dbx-form-view {
34
- // margin-bottom: $material-form-margin;
35
-
36
- }
37
-
38
- .dbx-form-view-tools {
39
- text-align: right;
40
- }
41
-
42
- .dbx-form-view-control {
43
- width: 100%;
44
- }
45
-
46
- // .dbx-form-view-sub-form {}
47
-
48
- .mat-input-element {
49
- margin: 0; // Safari Fix
50
- }
51
-
52
- .mat-form-field {
53
- margin: 8px 0px 16px;
54
- }
55
-
56
- .mat-input-placeholder {
57
- text-transform: capitalize;
58
- }
59
-
60
- .required {
61
-
62
- .mat-checkbox-label::after,
63
- .mat-input-placeholder::after {
64
- @extend .required-text;
65
- }
66
- }
67
-
68
- .capitalized-field {
69
- .mat-input-element {
70
- text-transform: capitalize;
71
- }
72
- }
73
-
74
- .dbx-form-view-checkbox-control {
75
- margin: 12px 0;
76
- padding-left: 15px;
77
-
78
- .mat-checkbox-label {
79
- text-transform: capitalize;
80
- }
81
- }
82
-
83
- .form-select-align {
84
- padding-top: 24px;
85
- }
86
-
87
- .form-anti-padding {
88
- margin-top: -20px;
89
- }
90
-
91
- .warning {
92
- color: red;
93
- // color: mat-color($tallynote-dbx-warn);
94
- }
95
-
96
- .dbx-form-view-help {
97
- font-size: 75%;
98
- color: grey;
99
- }
100
-
101
- .dbx-form-view-hint {
102
- font-size: 75%;
103
- margin-top: 3px;
104
- }
105
-
106
- // MARK: Tabs
107
- .mat-tab-header {
108
- margin-bottom: $material-form-margin;
109
- }
110
-
111
- .dbx-form-view-tab-page {
112
- padding: 12px 0;
113
- }
114
-
115
- // MARK: Input
116
- .mat-form-field {
117
-
118
- .form-suffix-button {
119
- width: 1.8em;
120
- height: 1.8em;
121
- margin-top: -0.6em;
122
- }
123
-
124
- }
125
-
126
- // MARK: Controls
127
- .select-form-control {
128
- width: 100%;
129
- }
130
-
131
- .form-suffix-button {
132
- .mat-icon-button {
133
- width: 2em;
134
- height: 2em;
135
-
136
- .mat-icon {
137
- width: 1.8em;
138
- height: 1.8em;
139
- }
140
- }
141
- }
142
-
143
- .date-form-control {
144
-
145
- .mat-datepicker-toggle {
146
-
147
- .mat-icon-button {
148
- height: 2em;
149
- width: 2em;
150
- }
151
-
152
- }
153
- }