@dereekb/dbx-form 1.2.0 → 2.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.
- package/README.md +1 -1
- package/esm2020/lib/form/action/form.action.directive.mjs +33 -18
- package/esm2020/lib/form/action/transition/form.action.transition.safety.directive.mjs +7 -7
- package/esm2020/lib/form/form.mjs +2 -1
- package/esm2020/lib/form/io/form.input.directive.mjs +1 -1
- package/esm2020/lib/formly/field/component/component.field.component.mjs +7 -20
- package/esm2020/lib/formly/field/component/component.field.mjs +3 -5
- package/esm2020/lib/formly/field/component/component.field.module.mjs +8 -8
- package/esm2020/lib/formly/field/selection/searchable/searchable.field.autocomplete.item.component.mjs +5 -5
- package/esm2020/lib/formly/field/value/array/array.field.component.mjs +1 -1
- package/esm2020/lib/formly/field/value/date/datetime.field.component.mjs +33 -23
- package/esm2020/lib/formly/field/value/date/datetime.field.mjs +3 -3
- package/esm2020/lib/formly/formly.context.mjs +18 -7
- package/esm2020/lib/formly/formly.directive.mjs +5 -2
- package/esm2020/lib/formly/formly.form.component.mjs +51 -17
- package/fesm2015/dereekb-dbx-form.mjs +224 -166
- package/fesm2015/dereekb-dbx-form.mjs.map +1 -1
- package/fesm2020/dereekb-dbx-form.mjs +223 -165
- package/fesm2020/dereekb-dbx-form.mjs.map +1 -1
- package/lib/form/action/form.action.directive.d.ts +12 -10
- package/lib/form/action/transition/form.action.transition.safety.directive.d.ts +3 -3
- package/lib/form/form.d.ts +19 -3
- package/lib/form/io/form.input.directive.d.ts +2 -1
- package/lib/formly/field/component/component.field.component.d.ts +7 -20
- package/lib/formly/field/component/component.field.d.ts +3 -5
- package/lib/formly/field/component/component.field.module.d.ts +1 -1
- package/lib/formly/field/selection/searchable/searchable.field.autocomplete.item.component.d.ts +1 -1
- package/lib/formly/field/texteditor/_texteditor.scss +0 -2
- package/lib/formly/field/value/date/datetime.field.component.d.ts +4 -6
- package/lib/formly/field/value/date/datetime.field.d.ts +2 -2
- package/lib/formly/formly.context.d.ts +8 -5
- package/lib/formly/formly.directive.d.ts +2 -0
- package/lib/formly/formly.form.component.d.ts +13 -3
- package/package.json +7 -6
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import { OnInit, OnDestroy } from '@angular/core';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import {
|
|
3
|
+
import { DbxActionContextStoreSourceInstance } from '@dereekb/dbx-core';
|
|
4
4
|
import { ReadableError } from '@dereekb/util';
|
|
5
|
-
import { LockSet } from '@dereekb/rxjs';
|
|
5
|
+
import { LockSet, IsModifiedFn, IsValidFn } from '@dereekb/rxjs';
|
|
6
6
|
import { DbxMutableForm } from '../../form/form';
|
|
7
7
|
import * as i0 from "@angular/core";
|
|
8
8
|
export interface DbxActionFormTriggerResult {
|
|
9
9
|
value?: any;
|
|
10
10
|
reject?: ReadableError;
|
|
11
11
|
}
|
|
12
|
-
export declare
|
|
13
|
-
export declare type DbxActionFormModifiedFn<T = any> = (value: T) => Observable<boolean>;
|
|
14
|
-
export declare const APP_ACTION_FORM_DISABLED_KEY = "actionForm";
|
|
12
|
+
export declare const APP_ACTION_FORM_DISABLED_KEY = "dbx_action_form";
|
|
15
13
|
/**
|
|
16
14
|
* Used with an action to bind a form to an action as it's value source.
|
|
17
15
|
*
|
|
@@ -21,24 +19,28 @@ export declare const APP_ACTION_FORM_DISABLED_KEY = "actionForm";
|
|
|
21
19
|
*/
|
|
22
20
|
export declare class DbxActionFormDirective<T = any> implements OnInit, OnDestroy {
|
|
23
21
|
readonly form: DbxMutableForm;
|
|
24
|
-
readonly source:
|
|
22
|
+
readonly source: DbxActionContextStoreSourceInstance<object, any>;
|
|
25
23
|
readonly lockSet: LockSet;
|
|
26
24
|
/**
|
|
27
25
|
* Optional validator that checks whether or not the value is
|
|
28
26
|
* ready to send before the context store is marked enabled.
|
|
29
27
|
*/
|
|
30
|
-
|
|
28
|
+
dbxActionFormValidator?: IsValidFn<T>;
|
|
31
29
|
/**
|
|
32
30
|
* Optional function that checks whether or not the value has been modified.
|
|
33
31
|
*/
|
|
34
|
-
|
|
32
|
+
dbxActionFormModified?: IsModifiedFn<T>;
|
|
33
|
+
private _formDisabledWhileWorking;
|
|
35
34
|
private _triggeredSub;
|
|
36
35
|
private _isCompleteSub;
|
|
37
|
-
|
|
36
|
+
private _isWorkingSub;
|
|
37
|
+
constructor(form: DbxMutableForm, source: DbxActionContextStoreSourceInstance<object, any>);
|
|
38
|
+
get dbxActionFormDisabledWhileWorking(): boolean;
|
|
39
|
+
set dbxActionFormDisabledWhileWorking(dbxActionFormDisabledWhileWorking: boolean);
|
|
38
40
|
ngOnInit(): void;
|
|
39
41
|
ngOnDestroy(): void;
|
|
40
42
|
protected preCheckReadyValue(value: T): Observable<boolean>;
|
|
41
43
|
protected readyValue(value: T): Observable<DbxActionFormTriggerResult>;
|
|
42
44
|
static ɵfac: i0.ɵɵFactoryDeclaration<DbxActionFormDirective<any>, [{ host: true; }, null]>;
|
|
43
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<DbxActionFormDirective<any>, "[dbxActionForm]", never, { "
|
|
45
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DbxActionFormDirective<any>, "[dbxActionForm]", never, { "dbxActionFormValidator": "dbxActionFormValidator"; "dbxActionFormModified": "dbxActionFormModified"; "dbxActionFormDisabledWhileWorking": "dbxActionFormDisabledWhileWorking"; }, {}, never>;
|
|
44
46
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ViewContainerRef } from '@angular/core';
|
|
2
2
|
import { MatDialog } from '@angular/material/dialog';
|
|
3
3
|
import { HookResult, Transition, TransitionService } from '@uirouter/core';
|
|
4
|
-
import {
|
|
4
|
+
import { DbxActionContextStoreSourceInstance } from '@dereekb/dbx-core';
|
|
5
5
|
import { DbxActionTransitionSafetyType, DbxActionTransitionSafetyDirective } from '@dereekb/dbx-web';
|
|
6
6
|
import { DbxActionFormDirective } from '../form.action.directive';
|
|
7
7
|
import * as i0 from "@angular/core";
|
|
@@ -11,9 +11,9 @@ import * as i0 from "@angular/core";
|
|
|
11
11
|
* NOTE: Only works with UIRouter
|
|
12
12
|
*/
|
|
13
13
|
export declare class DbxActionFormSafetyDirective<T, O> extends DbxActionTransitionSafetyDirective<T, O> {
|
|
14
|
-
readonly
|
|
14
|
+
readonly dbxActionForm: DbxActionFormDirective<T>;
|
|
15
15
|
inputSafetyType?: DbxActionTransitionSafetyType;
|
|
16
|
-
constructor(
|
|
16
|
+
constructor(dbxActionForm: DbxActionFormDirective<T>, source: DbxActionContextStoreSourceInstance<T, O>, transitionService: TransitionService, viewContainerRef: ViewContainerRef, dialog: MatDialog);
|
|
17
17
|
protected _handleOnBeforeTransition(transition: Transition): HookResult;
|
|
18
18
|
static ɵfac: i0.ɵɵFactoryDeclaration<DbxActionFormSafetyDirective<any, any>, [{ host: true; }, null, null, null, null]>;
|
|
19
19
|
static ɵdir: i0.ɵɵDirectiveDeclaration<DbxActionFormSafetyDirective<any, any>, "[dbxActionFormSafety]", never, { "inputSafetyType": "dbxActionFormSafety"; }, {}, never>;
|
package/lib/form/form.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Provider, Type } from '@angular/core';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { LockSet } from '@dereekb/rxjs';
|
|
4
|
-
import { Maybe } from '@dereekb/util';
|
|
4
|
+
import { BooleanStringKeyArray, Maybe } from '@dereekb/util';
|
|
5
5
|
/**
|
|
6
6
|
* Current state of a DbxForm
|
|
7
7
|
*/
|
|
@@ -10,6 +10,11 @@ export declare enum DbxFormState {
|
|
|
10
10
|
RESET = 0,
|
|
11
11
|
USED = 1
|
|
12
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Unique key for disabling/enabling.
|
|
15
|
+
*/
|
|
16
|
+
export declare type DbxFormDisabledKey = string;
|
|
17
|
+
export declare const DEFAULT_FORM_DISABLED_KEY = "dbx_form_disabled";
|
|
13
18
|
/**
|
|
14
19
|
* DbxForm stream event
|
|
15
20
|
*/
|
|
@@ -20,7 +25,14 @@ export interface DbxFormEvent {
|
|
|
20
25
|
readonly untouched?: boolean;
|
|
21
26
|
readonly lastResetAt?: Date;
|
|
22
27
|
readonly changesCount?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Whether or not the form is disabled.
|
|
30
|
+
*/
|
|
23
31
|
readonly isDisabled?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Current disabled state keys.
|
|
34
|
+
*/
|
|
35
|
+
readonly disabled?: BooleanStringKeyArray;
|
|
24
36
|
}
|
|
25
37
|
/**
|
|
26
38
|
* Form that has an event stream, value, and state items.
|
|
@@ -31,6 +43,10 @@ export declare abstract class DbxForm<T = any> {
|
|
|
31
43
|
* Returns an observable that returns the current state of the form.
|
|
32
44
|
*/
|
|
33
45
|
abstract getValue(): Observable<T>;
|
|
46
|
+
/**
|
|
47
|
+
* Returns an observable that returns the current disabled keys.
|
|
48
|
+
*/
|
|
49
|
+
abstract getDisabled(): Observable<BooleanStringKeyArray>;
|
|
34
50
|
}
|
|
35
51
|
export declare abstract class DbxMutableForm<T = any> extends DbxForm<T> {
|
|
36
52
|
/**
|
|
@@ -48,11 +64,11 @@ export declare abstract class DbxMutableForm<T = any> extends DbxForm<T> {
|
|
|
48
64
|
*/
|
|
49
65
|
abstract resetForm(): void;
|
|
50
66
|
/**
|
|
51
|
-
*
|
|
67
|
+
* Disables the form
|
|
52
68
|
*
|
|
53
69
|
* @param disabled
|
|
54
70
|
*/
|
|
55
|
-
abstract setDisabled(disabled?: boolean): void;
|
|
71
|
+
abstract setDisabled(key?: DbxFormDisabledKey, disabled?: boolean): void;
|
|
56
72
|
/**
|
|
57
73
|
* Force the form to update itself as if it was changed.
|
|
58
74
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import { AbstractSubscriptionDirective } from '@dereekb/dbx-core';
|
|
3
3
|
import { DbxMutableForm } from '../form';
|
|
4
|
+
import { Maybe } from '@dereekb/util';
|
|
4
5
|
import * as i0 from "@angular/core";
|
|
5
6
|
/**
|
|
6
7
|
* Used with a FormComponent to set the value based on the input value.
|
|
@@ -11,7 +12,7 @@ export declare class DbxFormSourceDirective<T extends object = any> extends Abst
|
|
|
11
12
|
/**
|
|
12
13
|
* Sets a LoadingContext that is watched for the loading state.
|
|
13
14
|
*/
|
|
14
|
-
set obs(obs: Observable<T
|
|
15
|
+
set obs(obs: Observable<Maybe<Partial<T>>>);
|
|
15
16
|
private _setObs;
|
|
16
17
|
static ɵfac: i0.ɵɵFactoryDeclaration<DbxFormSourceDirective<any>, [{ host: true; }]>;
|
|
17
18
|
static ɵdir: i0.ɵɵDirectiveDeclaration<DbxFormSourceDirective<any>, "[dbxFormSource]", never, { "obs": "dbxFormSource"; }, {}, never>;
|
|
@@ -1,26 +1,13 @@
|
|
|
1
|
-
import { OnInit, Type } from '@angular/core';
|
|
2
1
|
import { DbxInjectedComponentConfig } from '@dereekb/dbx-core';
|
|
3
2
|
import { FieldType, FormlyFieldConfig } from '@ngx-formly/core';
|
|
4
|
-
import { Maybe } from '@dereekb/util';
|
|
5
3
|
import * as i0 from "@angular/core";
|
|
6
|
-
export interface
|
|
7
|
-
field: FieldType<FormComponentFieldFieldConfig>;
|
|
4
|
+
export interface DbxFormComponentFieldConfig<T> extends DbxInjectedComponentConfig<T> {
|
|
8
5
|
}
|
|
9
|
-
export
|
|
10
|
-
|
|
6
|
+
export interface DbxFormComponentFormlyFieldConfig<T = any> extends FormlyFieldConfig {
|
|
7
|
+
componentField: DbxFormComponentFieldConfig<T>;
|
|
11
8
|
}
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
export declare class FormComponentFieldComponent<T extends FormComponentFieldWrappedComponent = any> extends FieldType<FormComponentFieldFieldConfig<T>> implements OnInit {
|
|
18
|
-
private _config?;
|
|
19
|
-
get config(): Maybe<DbxInjectedComponentConfig>;
|
|
20
|
-
get componentField(): {
|
|
21
|
-
componentClass: Type<T>;
|
|
22
|
-
};
|
|
23
|
-
ngOnInit(): void;
|
|
24
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<FormComponentFieldComponent<any>, never>;
|
|
25
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<FormComponentFieldComponent<any>, "ng-component", never, {}, {}, never, never>;
|
|
9
|
+
export declare class DbxFormComponentFieldComponent<T = any> extends FieldType<DbxFormComponentFormlyFieldConfig<T>> {
|
|
10
|
+
get config(): DbxInjectedComponentConfig<T>;
|
|
11
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DbxFormComponentFieldComponent<any>, never>;
|
|
12
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DbxFormComponentFieldComponent<any>, "ng-component", never, {}, {}, never, never>;
|
|
26
13
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export interface ComponentFieldConfig<T> {
|
|
4
|
-
componentClass: Type<T>;
|
|
1
|
+
import { DbxFormComponentFieldConfig, DbxFormComponentFormlyFieldConfig } from "./component.field.component";
|
|
2
|
+
export interface ComponentFieldConfig<T = any> extends DbxFormComponentFieldConfig<T> {
|
|
5
3
|
}
|
|
6
|
-
export declare function componentField<T
|
|
4
|
+
export declare function componentField<T>(config: ComponentFieldConfig<T>): DbxFormComponentFormlyFieldConfig;
|
|
@@ -5,6 +5,6 @@ import * as i3 from "@dereekb/dbx-core";
|
|
|
5
5
|
import * as i4 from "@ngx-formly/core";
|
|
6
6
|
export declare class DbxFormFormlyComponentFieldModule {
|
|
7
7
|
static ɵfac: i0.ɵɵFactoryDeclaration<DbxFormFormlyComponentFieldModule, never>;
|
|
8
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<DbxFormFormlyComponentFieldModule, [typeof i1.
|
|
8
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<DbxFormFormlyComponentFieldModule, [typeof i1.DbxFormComponentFieldComponent], [typeof i2.CommonModule, typeof i3.DbxInjectedComponentModule, typeof i4.FormlyModule], [typeof i1.DbxFormComponentFieldComponent]>;
|
|
9
9
|
static ɵinj: i0.ɵɵInjectorDeclaration<DbxFormFormlyComponentFieldModule>;
|
|
10
10
|
}
|
package/lib/formly/field/selection/searchable/searchable.field.autocomplete.item.component.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { InjectionToken, OnDestroy } from '@angular/core';
|
|
|
3
3
|
import { ConfiguredSearchableValueFieldDisplayValue } from './searchable';
|
|
4
4
|
import { DbxInjectedComponentConfig } from '@dereekb/dbx-core';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const DBX_SEARCHABLE_FIELD_COMPONENT_DATA_TOKEN: InjectionToken<unknown>;
|
|
7
7
|
export declare class DbxSearchableFieldAutocompleteItemComponent<T> implements OnDestroy {
|
|
8
8
|
private _displayValue;
|
|
9
9
|
readonly displayValue$: Observable<ConfiguredSearchableValueFieldDisplayValue<T, any>>;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LogicalDateStringCode, Maybe, ReadableTimeString } from '@dereekb/util';
|
|
2
2
|
import { DateTimeMinuteConfig } from '@dereekb/date';
|
|
3
3
|
import { ChangeDetectorRef, OnDestroy, OnInit } from '@angular/core';
|
|
4
4
|
import { AbstractControl, FormControl } from '@angular/forms';
|
|
5
5
|
import { FieldType } from '@ngx-formly/material';
|
|
6
6
|
import { FieldTypeConfig, FormlyFieldConfig } from '@ngx-formly/core';
|
|
7
7
|
import { Observable } from 'rxjs';
|
|
8
|
-
import { Maybe, ReadableTimeString } from '@dereekb/util';
|
|
9
8
|
import { MatDatepickerInputEvent } from '@angular/material/datepicker';
|
|
10
9
|
import * as i0 from "@angular/core";
|
|
11
10
|
export declare enum DateTimeFieldTimeMode {
|
|
@@ -57,7 +56,6 @@ export interface DateTimeFormlyFieldConfig extends FormlyFieldConfig {
|
|
|
57
56
|
}
|
|
58
57
|
export declare class DbxDateTimeFieldComponent extends FieldType<DateTimeFormlyFieldConfig & FieldTypeConfig> implements OnInit, OnDestroy {
|
|
59
58
|
private readonly cdRef;
|
|
60
|
-
dateInput: MatInput;
|
|
61
59
|
private _sub;
|
|
62
60
|
private _valueSub;
|
|
63
61
|
private _fullDayInputCtrl?;
|
|
@@ -73,8 +71,8 @@ export declare class DbxDateTimeFieldComponent extends FieldType<DateTimeFormlyF
|
|
|
73
71
|
*/
|
|
74
72
|
readonly displayValue$: Observable<any>;
|
|
75
73
|
readonly timeString$: Observable<ReadableTimeString>;
|
|
74
|
+
readonly dateInputCtrl: FormControl;
|
|
76
75
|
readonly timeInputCtrl: FormControl;
|
|
77
|
-
private _date;
|
|
78
76
|
private _config;
|
|
79
77
|
get dateOnly(): boolean;
|
|
80
78
|
get dateTimeField(): DbxDateTimeFieldConfig;
|
|
@@ -85,7 +83,7 @@ export declare class DbxDateTimeFieldComponent extends FieldType<DateTimeFormlyF
|
|
|
85
83
|
readonly fullDay$: Observable<boolean>;
|
|
86
84
|
readonly showTimeInput$: Observable<boolean>;
|
|
87
85
|
readonly showAddTime$: Observable<boolean>;
|
|
88
|
-
readonly date$: Observable<
|
|
86
|
+
readonly date$: Observable<any>;
|
|
89
87
|
readonly dateValue$: Observable<Date | null | undefined>;
|
|
90
88
|
readonly timeInput$: Observable<ReadableTimeString>;
|
|
91
89
|
readonly config$: Observable<Maybe<DateTimePickerConfiguration>>;
|
|
@@ -94,8 +92,8 @@ export declare class DbxDateTimeFieldComponent extends FieldType<DateTimeFormlyF
|
|
|
94
92
|
constructor(cdRef: ChangeDetectorRef);
|
|
95
93
|
ngOnInit(): void;
|
|
96
94
|
ngOnDestroy(): void;
|
|
97
|
-
dateTextChanged(e: any): void;
|
|
98
95
|
datePicked(event: MatDatepickerInputEvent<Date>): void;
|
|
96
|
+
setLogicalTime(time: LogicalDateStringCode): void;
|
|
99
97
|
setTime(time: ReadableTimeString): void;
|
|
100
98
|
keydownOnInput(event: KeyboardEvent): void;
|
|
101
99
|
focusTime(): void;
|
|
@@ -10,5 +10,5 @@ export declare const TAKE_NEXT_UPCOMING_TIME_CONFIG_OBS: () => Observable<DateTi
|
|
|
10
10
|
/**
|
|
11
11
|
* Same as DateTime field but with the Date input hidden by default.
|
|
12
12
|
*/
|
|
13
|
-
export declare function timeOnlyField(config
|
|
14
|
-
export declare function dateTimeField(config
|
|
13
|
+
export declare function timeOnlyField(config?: Partial<TimeFieldConfig>): FormlyFieldConfig;
|
|
14
|
+
export declare function dateTimeField(config?: Partial<DateTimeFieldConfig>): FormlyFieldConfig;
|
|
@@ -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'
|
|
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
|
}
|
|
@@ -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
|
-
|
|
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
|
|
31
|
-
|
|
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>;
|
package/package.json
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/dbx-form",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/common": "^13.1.0",
|
|
6
6
|
"@angular/core": "^13.1.0",
|
|
7
|
-
"@dereekb/dbx-core": "
|
|
7
|
+
"@dereekb/dbx-core": "2.0.0",
|
|
8
8
|
"@ngrx/component-store": "^13.0.2",
|
|
9
9
|
"@ngrx/data": "^13.0.2",
|
|
10
10
|
"@ngrx/effects": "^13.0.2",
|
|
11
11
|
"@ngrx/entity": "^13.0.2",
|
|
12
12
|
"@ngrx/store": "^13.0.2",
|
|
13
13
|
"rxjs": "^7.5.2",
|
|
14
|
-
"@dereekb/util": "
|
|
14
|
+
"@dereekb/util": "2.0.0",
|
|
15
15
|
"extra-set": "^2.2.11",
|
|
16
|
-
"
|
|
16
|
+
"make-error": "^1.3.0",
|
|
17
|
+
"@dereekb/rxjs": "2.0.0",
|
|
17
18
|
"ms": "^3.0.0-canary.1",
|
|
18
19
|
"@angular/platform-browser": "^13.0.0",
|
|
19
20
|
"date-fns": "^2.28.0",
|
|
20
|
-
"@dereekb/date": "
|
|
21
|
+
"@dereekb/date": "2.0.0",
|
|
21
22
|
"class-transformer": "^0.5.1",
|
|
22
23
|
"class-validator": "^0.13.2",
|
|
23
24
|
"date-fns-tz": "^1.2.2",
|
|
@@ -26,7 +27,7 @@
|
|
|
26
27
|
"@uirouter/core": "^6.0.8",
|
|
27
28
|
"@uirouter/angular": "^9.1.0",
|
|
28
29
|
"@angular/material": "^13.0.0",
|
|
29
|
-
"@dereekb/dbx-web": "
|
|
30
|
+
"@dereekb/dbx-web": "2.0.0",
|
|
30
31
|
"mat-progress-buttons": "git+https://git@github.com/dereekb/mat-progress-buttons.git#60b0374a45644e8756f20b8d761738151ca3df64",
|
|
31
32
|
"@angular/flex-layout": "^13.0.0-beta.38",
|
|
32
33
|
"ng-overlay-container": "^13.0.0",
|