@dereekb/dbx-form 9.16.4 → 9.17.1

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 (29) hide show
  1. package/esm2020/lib/formly/field/selection/index.mjs +2 -1
  2. package/esm2020/lib/formly/field/selection/list/index.mjs +4 -0
  3. package/esm2020/lib/formly/field/selection/list/list.field.component.mjs +90 -0
  4. package/esm2020/lib/formly/field/selection/list/list.field.mjs +15 -0
  5. package/esm2020/lib/formly/field/selection/list/list.field.module.mjs +76 -0
  6. package/esm2020/lib/formly/field/selection/pickable/pickable.field.directive.mjs +3 -3
  7. package/esm2020/lib/formly/field/selection/searchable/searchable.field.directive.mjs +3 -3
  8. package/esm2020/lib/formly/field/selection/selection.module.mjs +5 -4
  9. package/esm2020/lib/formly/field/texteditor/texteditor.field.component.mjs +4 -8
  10. package/esm2020/lib/formly/field/value/array/array.field.component.mjs +34 -3
  11. package/esm2020/lib/formly/field/value/array/array.field.mjs +6 -3
  12. package/fesm2015/dereekb-dbx-form.mjs +247 -65
  13. package/fesm2015/dereekb-dbx-form.mjs.map +1 -1
  14. package/fesm2020/dereekb-dbx-form.mjs +248 -64
  15. package/fesm2020/dereekb-dbx-form.mjs.map +1 -1
  16. package/lib/formly/field/selection/_selection.scss +4 -0
  17. package/lib/formly/field/selection/index.d.ts +1 -0
  18. package/lib/formly/field/selection/list/_list.scss +33 -0
  19. package/lib/formly/field/selection/list/index.d.ts +3 -0
  20. package/lib/formly/field/selection/list/list.field.component.d.ts +53 -0
  21. package/lib/formly/field/selection/list/list.field.d.ts +8 -0
  22. package/lib/formly/field/selection/list/list.field.module.d.ts +18 -0
  23. package/lib/formly/field/selection/pickable/pickable.field.directive.d.ts +1 -1
  24. package/lib/formly/field/selection/searchable/searchable.field.directive.d.ts +1 -1
  25. package/lib/formly/field/selection/selection.module.d.ts +4 -3
  26. package/lib/formly/field/value/array/array.field.component.d.ts +19 -0
  27. package/lib/formly/field/value/array/array.field.d.ts +3 -0
  28. package/mapbox/package.json +4 -4
  29. package/package.json +4 -4
@@ -1,17 +1,21 @@
1
+ @use './list/list';
1
2
  @use './pickable/pickable';
2
3
  @use './searchable/searchable';
3
4
 
4
5
  @mixin all-selection-core() {
6
+ @include list.core();
5
7
  @include pickable.core();
6
8
  @include searchable.core();
7
9
  }
8
10
 
9
11
  @mixin all-selection-typography($typography-config) {
12
+ @include list.typography($typography-config);
10
13
  @include pickable.typography($typography-config);
11
14
  @include searchable.typography($typography-config);
12
15
  }
13
16
 
14
17
  @mixin all-selection-theme($theme-config) {
18
+ @include list.theme($theme-config);
15
19
  @include pickable.theme($theme-config);
16
20
  @include searchable.theme($theme-config);
17
21
  }
@@ -1,3 +1,4 @@
1
+ export * from './list';
1
2
  export * from './pickable';
2
3
  export * from './searchable';
3
4
  export * from './selection';
@@ -0,0 +1,33 @@
1
+ @use '../../../../style/theming';
2
+
3
+ // MARK: Variables
4
+ $dbx-list-item-field-content-max-height: 300px;
5
+
6
+ // MARK: Mixin
7
+ @mixin core() {
8
+ .dbx-list-item-field-content {
9
+ max-height: $dbx-list-item-field-content-max-height;
10
+ overflow: auto;
11
+ }
12
+ }
13
+
14
+ @mixin color($theme-config) {
15
+ }
16
+
17
+ @mixin typography($typography-config) {
18
+ }
19
+
20
+ @mixin theme($theme-config) {
21
+ @include theming.private-check-duplicate-theme-styles($theme-config, 'dbx-form-field-selection-list') {
22
+ $color: theming.get-color-config($theme-config);
23
+ $typography: theming.get-typography-config($theme-config);
24
+
25
+ @if $color !=null {
26
+ @include color($theme-config);
27
+ }
28
+
29
+ @if $typography !=null {
30
+ @include typography($typography);
31
+ }
32
+ }
33
+ }
@@ -0,0 +1,3 @@
1
+ export * from './list.field';
2
+ export * from './list.field.component';
3
+ export * from './list.field.module';
@@ -0,0 +1,53 @@
1
+ import { OnDestroy, OnInit, Type } from '@angular/core';
2
+ import { AbstractControl } from '@angular/forms';
3
+ import { DbxInjectionComponentConfig } from '@dereekb/dbx-core';
4
+ import { AbstractDbxSelectionListWrapperDirective, ListSelectionState, DbxValueListItemDecisionFunction } from '@dereekb/dbx-web';
5
+ import { ListLoadingState } from '@dereekb/rxjs';
6
+ import { Maybe, PrimativeKey, ReadKeyFunction } from '@dereekb/util';
7
+ import { FormlyFieldProps, FieldType, FieldTypeConfig } from '@ngx-formly/core';
8
+ import { Observable } from 'rxjs';
9
+ import * as i0 from "@angular/core";
10
+ export interface DbxItemListFieldProps<T = unknown, C extends AbstractDbxSelectionListWrapperDirective<T> = AbstractDbxSelectionListWrapperDirective<T>, K extends PrimativeKey = PrimativeKey> extends Pick<FormlyFieldProps, 'label' | 'description'> {
11
+ /**
12
+ * list to load/initialize
13
+ */
14
+ readonly listComponentClass: Observable<Type<C>>;
15
+ /**
16
+ * Read key function to read the identifier from the input
17
+ */
18
+ readonly readKey: ReadKeyFunction<T, K>;
19
+ /**
20
+ * Observable that provides the items to select.
21
+ */
22
+ readonly state$: Observable<ListLoadingState<T>>;
23
+ /**
24
+ * Function that signals to load more items.
25
+ */
26
+ readonly loadMore?: () => void;
27
+ }
28
+ /**
29
+ * Used for picking items by identifier from a DbxList component.
30
+ */
31
+ export declare class DbxItemListFieldComponent<T = unknown, C extends AbstractDbxSelectionListWrapperDirective<T> = AbstractDbxSelectionListWrapperDirective<T>, K extends PrimativeKey = PrimativeKey> extends FieldType<FieldTypeConfig<DbxItemListFieldProps<T, C, K>>> implements OnInit, OnDestroy {
32
+ private _selectionEventSub;
33
+ private _loadMoreSub;
34
+ private _formControlObs;
35
+ readonly formControl$: Observable<AbstractControl<any, any>>;
36
+ readonly _formControlValue$: Observable<Maybe<K[]>>;
37
+ readonly values$: Observable<K[]>;
38
+ private _listComponentClassObs;
39
+ readonly listComponentClass$: Observable<Type<C>>;
40
+ readonly config$: Observable<DbxInjectionComponentConfig<C>>;
41
+ readonly isSelectedModifierFunction$: Observable<DbxValueListItemDecisionFunction<T>>;
42
+ get label(): string | undefined;
43
+ get description(): string | undefined;
44
+ get listComponentClass(): Observable<Type<C>>;
45
+ get readKey(): ReadKeyFunction<T, K>;
46
+ get loadMore(): (() => void) | undefined;
47
+ ngOnInit(): void;
48
+ ngOnDestroy(): void;
49
+ updateForSelection(list: ListSelectionState<T>): void;
50
+ setValues(values: Maybe<K[]>): void;
51
+ static ɵfac: i0.ɵɵFactoryDeclaration<DbxItemListFieldComponent<any, any, any>, never>;
52
+ static ɵcmp: i0.ɵɵComponentDeclaration<DbxItemListFieldComponent<any, any, any>, "ng-component", never, {}, {}, never, never, false>;
53
+ }
@@ -0,0 +1,8 @@
1
+ import { FormlyFieldConfig } from '@ngx-formly/core';
2
+ import { LabeledFieldConfig } from '../../field';
3
+ import { DbxItemListFieldProps } from './list.field.component';
4
+ import { AbstractDbxSelectionListWrapperDirective } from '@dereekb/dbx-web';
5
+ import { PrimativeKey } from '@dereekb/util';
6
+ export interface DbxListFieldConfig<T = unknown, C extends AbstractDbxSelectionListWrapperDirective<T> = AbstractDbxSelectionListWrapperDirective<T>, K extends PrimativeKey = PrimativeKey> extends LabeledFieldConfig, DbxItemListFieldProps<T, C, K> {
7
+ }
8
+ export declare function dbxListField<T = unknown, C extends AbstractDbxSelectionListWrapperDirective<T> = AbstractDbxSelectionListWrapperDirective<T>, K extends PrimativeKey = PrimativeKey>(config: DbxListFieldConfig<T, C, K>): FormlyFieldConfig;
@@ -0,0 +1,18 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./list.field.component";
3
+ import * as i2 from "@angular/common";
4
+ import * as i3 from "@dereekb/dbx-web";
5
+ import * as i4 from "@angular/forms";
6
+ import * as i5 from "@angular/material/divider";
7
+ import * as i6 from "@angular/material/button";
8
+ import * as i7 from "@angular/material/input";
9
+ import * as i8 from "@angular/material/form-field";
10
+ import * as i9 from "@angular/material/autocomplete";
11
+ import * as i10 from "@angular/material/icon";
12
+ import * as i11 from "@dereekb/dbx-core";
13
+ import * as i12 from "@ngx-formly/core";
14
+ export declare class DbxFormFormlyDbxListFieldModule {
15
+ static ɵfac: i0.ɵɵFactoryDeclaration<DbxFormFormlyDbxListFieldModule, never>;
16
+ static ɵmod: i0.ɵɵNgModuleDeclaration<DbxFormFormlyDbxListFieldModule, [typeof i1.DbxItemListFieldComponent], [typeof i2.CommonModule, typeof i3.DbxTextModule, typeof i3.DbxLoadingModule, typeof i3.DbxButtonModule, typeof i4.FormsModule, typeof i5.MatDividerModule, typeof i6.MatButtonModule, typeof i7.MatInputModule, typeof i8.MatFormFieldModule, typeof i4.ReactiveFormsModule, typeof i9.MatAutocompleteModule, typeof i10.MatIconModule, typeof i11.DbxInjectionComponentModule, typeof i3.DbxListLayoutModule, typeof i12.FormlyModule], [typeof i1.DbxItemListFieldComponent]>;
17
+ static ɵinj: i0.ɵɵInjectorDeclaration<DbxFormFormlyDbxListFieldModule>;
18
+ }
@@ -97,7 +97,7 @@ export declare class AbstractDbxPickableItemFieldDirective<T, M = unknown, H ext
97
97
  readonly filterInputValue$: Observable<Maybe<string>>;
98
98
  readonly filterInputValueString$: Observable<Maybe<string>>;
99
99
  readonly loadResultsDisplayValuesState$: Observable<LoadingState<PickableValueFieldDisplayValueWithHash<T, M, H>[]>>;
100
- readonly _formControlValue: Observable<T | T[]>;
100
+ readonly _formControlValue$: Observable<T | T[]>;
101
101
  readonly loadResultsDisplayValues$: Observable<PickableValueFieldDisplayValueWithHash<T, M, H>[]>;
102
102
  /**
103
103
  * Current values in the form control.
@@ -88,7 +88,7 @@ export declare abstract class AbstractDbxSearchableValueFieldDirective<T, M = un
88
88
  readonly singleValueSyncSubscription: SubscriptionObject;
89
89
  readonly searchContext: LoadingStateContextInstance<unknown, LoadingState<ConfiguredSearchableValueFieldDisplayValue<T, M>[]>>;
90
90
  readonly searchResults$: Observable<ConfiguredSearchableValueFieldDisplayValue<T, M>[]>;
91
- readonly _formControlValue: Observable<T | T[]>;
91
+ readonly _formControlValue$: Observable<T | T[]>;
92
92
  readonly values$: Observable<T[]>;
93
93
  readonly displayValuesState$: Observable<LoadingState<ConfiguredSearchableValueFieldDisplayValue<T, M>[]>>;
94
94
  readonly displayValues$: Observable<ConfiguredSearchableValueFieldDisplayValue<T, M>[]>;
@@ -1,9 +1,10 @@
1
1
  import * as i0 from "@angular/core";
2
2
  import * as i1 from "@angular/common";
3
- import * as i2 from "./pickable/pickable.field.module";
4
- import * as i3 from "./searchable/searchable.field.module";
3
+ import * as i2 from "./list/list.field.module";
4
+ import * as i3 from "./pickable/pickable.field.module";
5
+ import * as i4 from "./searchable/searchable.field.module";
5
6
  export declare class DbxFormFormlySelectionModule {
6
7
  static ɵfac: i0.ɵɵFactoryDeclaration<DbxFormFormlySelectionModule, never>;
7
- static ɵmod: i0.ɵɵNgModuleDeclaration<DbxFormFormlySelectionModule, never, [typeof i1.CommonModule], [typeof i2.DbxFormFormlyPickableFieldModule, typeof i3.DbxFormFormlySearchableFieldModule]>;
8
+ static ɵmod: i0.ɵɵNgModuleDeclaration<DbxFormFormlySelectionModule, never, [typeof i1.CommonModule], [typeof i2.DbxFormFormlyDbxListFieldModule, typeof i3.DbxFormFormlyPickableFieldModule, typeof i4.DbxFormFormlySearchableFieldModule]>;
8
9
  static ɵinj: i0.ɵɵInjectorDeclaration<DbxFormFormlySelectionModule>;
9
10
  }
@@ -1,4 +1,5 @@
1
1
  import { CdkDragDrop } from '@angular/cdk/drag-drop';
2
+ import { TrackByFunction } from '@angular/core';
2
3
  import { DecisionFunction, FactoryWithRequiredInput, IndexRef, Maybe } from '@dereekb/util';
3
4
  import { FieldArrayTypeConfig, FieldArrayType, FormlyFieldConfig, FormlyFieldProps } from '@ngx-formly/core';
4
5
  import * as i0 from "@angular/core";
@@ -14,6 +15,10 @@ export interface DbxFormRepeatArrayConfig<T = unknown> extends Pick<FormlyFieldP
14
15
  * Text for the add button.
15
16
  */
16
17
  addText?: string;
18
+ /**
19
+ * Text for the duplicate button.
20
+ */
21
+ duplicateText?: string;
17
22
  /**
18
23
  * Text for the remove button.
19
24
  */
@@ -30,26 +35,39 @@ export interface DbxFormRepeatArrayConfig<T = unknown> extends Pick<FormlyFieldP
30
35
  * True by default.
31
36
  */
32
37
  allowAdd?: boolean;
38
+ /**
39
+ * Whether or not to allow duplicateing items. Can optionally pass a decision function that decides whether or not a specific item can be removed.
40
+ */
41
+ allowDuplicate?: boolean | DecisionFunction<DbxFormRepeatArrayPair<T>>;
33
42
  /**
34
43
  * Whether or not to allow removing items. Can optionally pass a decision function that decides whether or not a specific item can be removed.
35
44
  */
36
45
  allowRemove?: boolean | DecisionFunction<DbxFormRepeatArrayPair<T>>;
46
+ /**
47
+ * Adds the duplicate to the end of the values
48
+ */
49
+ addDuplicateToEnd?: boolean;
37
50
  }
38
51
  export declare class DbxFormRepeatArrayTypeComponent<T = unknown> extends FieldArrayType<FieldArrayTypeConfig<DbxFormRepeatArrayConfig>> {
39
52
  private _labelForField;
40
53
  private _allowRemove;
54
+ private _allowDuplicate;
41
55
  get repeatArrayField(): DbxFormRepeatArrayConfig;
42
56
  get label(): string;
43
57
  get description(): Maybe<string>;
58
+ get duplicateText(): string;
44
59
  get addText(): string;
45
60
  get removeText(): string;
46
61
  get max(): Maybe<number>;
47
62
  get count(): number;
48
63
  get disableRearrange(): boolean;
49
64
  get allowAdd(): boolean;
65
+ get addDuplicateToEnd(): boolean;
50
66
  allowRemove(i: number): boolean;
67
+ allowDuplicate(i: number): boolean;
51
68
  get addItemDisabled(): boolean;
52
69
  get canAddItem(): boolean;
70
+ readonly trackByFunction: TrackByFunction<FormlyFieldConfig>;
53
71
  /**
54
72
  * Moves the target index up one value.
55
73
  *
@@ -57,6 +75,7 @@ export declare class DbxFormRepeatArrayTypeComponent<T = unknown> extends FieldA
57
75
  */
58
76
  moveUp(index: number): void;
59
77
  moveDown(index: number): void;
78
+ duplicate(index: number): void;
60
79
  swapIndexes(currentIndex: number, targetIndex: number): void;
61
80
  drop(event: CdkDragDrop<unknown>): void;
62
81
  labelForItem(fieldConfig: FormlyFieldConfig, i: number): string;
@@ -18,9 +18,12 @@ export declare function repeatArrayField<T = unknown>(config: RepeatArrayFieldCo
18
18
  labelForField: string | import("@dereekb/util").FactoryWithRequiredInput<string, import("./array.field.component").DbxFormRepeatArrayFieldConfigPair<T>> | undefined;
19
19
  addText: string | undefined;
20
20
  removeText: string | undefined;
21
+ duplicateText: string | undefined;
21
22
  disableRearrange: boolean | undefined;
22
23
  allowAdd: boolean | undefined;
23
24
  allowRemove: boolean | import("@dereekb/util").DecisionFunction<import("./array.field.component").DbxFormRepeatArrayPair<T>> | undefined;
25
+ allowDuplicate: boolean | import("@dereekb/util").DecisionFunction<import("./array.field.component").DbxFormRepeatArrayPair<T>> | undefined;
26
+ addDuplicateToEnd: boolean | undefined;
24
27
  };
25
28
  expressions: {
26
29
  [property: string]: string | import("rxjs").Observable<any> | ((field: FormlyFieldConfig<import("@ngx-formly/core").FormlyFieldProps & {
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@dereekb/dbx-form/mapbox",
3
- "version": "9.16.4",
3
+ "version": "9.17.1",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^14.1.0",
6
6
  "@angular/core": "^14.1.0",
7
7
  "@angular/forms": "^14.0.0",
8
- "@dereekb/dbx-web": "9.16.4",
8
+ "@dereekb/dbx-web": "9.17.1",
9
9
  "@ngx-formly/core": "6.0.0-rc.2",
10
10
  "@ngx-formly/material": "6.0.0-rc.2",
11
11
  "@ng-web-apis/geolocation": "^2.0.0",
12
12
  "mapbox-gl": "^2.9.2",
13
- "@dereekb/dbx-web/mapbox": "9.16.4",
14
- "@dereekb/dbx-form": "9.16.4"
13
+ "@dereekb/dbx-web/mapbox": "9.17.1",
14
+ "@dereekb/dbx-form": "9.17.1"
15
15
  },
16
16
  "dependencies": {
17
17
  "tslib": "^2.3.0"
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@dereekb/dbx-form",
3
- "version": "9.16.4",
3
+ "version": "9.17.1",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^14.0.0",
6
6
  "@angular/core": "^14.0.0",
7
7
  "lodash.clonedeep": "^4.5.0",
8
- "@dereekb/dbx-core": "9.16.4",
8
+ "@dereekb/dbx-core": "9.17.1",
9
9
  "@angular/material": "^14.0.0",
10
- "@dereekb/dbx-web": "9.16.4",
10
+ "@dereekb/dbx-web": "9.17.1",
11
11
  "@angular/forms": "^14.0.0",
12
12
  "@ngx-formly/core": "6.0.0-rc.2",
13
13
  "@ngx-formly/material": "6.0.0-rc.2",
14
14
  "change-case": "^4.1.2",
15
15
  "ngx-editor": "^15.0.0",
16
16
  "ngx-mat-intl-tel-input": "^5.0.0",
17
- "@dereekb/model": "9.16.4"
17
+ "@dereekb/model": "9.17.1"
18
18
  },
19
19
  "dependencies": {
20
20
  "tslib": "^2.3.0"