@rxap/material-form-system 12.0.10-next.0 → 12.1.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/esm2015/index.js CHANGED
@@ -7,4 +7,6 @@ export * from './lib/compare-with.directive';
7
7
  export * from './lib/form-field-hide-show.directive';
8
8
  export * from './lib/form-controls/form-controls.component.module';
9
9
  export * from './lib/form-controls/form-controls.component';
10
+ export * from './lib/chip-input-adapter.directive';
11
+ export * from './lib/chip-list-iterator.directive';
10
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/material/form-system/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,mCAAmC,CAAC;AAClD,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AAErD,cAAc,oDAAoD,CAAC;AACnE,cAAc,6CAA6C,CAAC","sourcesContent":["export * from './lib/control-error.directive';\nexport * from './lib/control-errors.directive';\nexport * from './lib/input-clear-button.directive';\nexport * from './lib/material-form-system.module';\nexport * from './lib/required.directive';\nexport * from './lib/compare-with.directive';\nexport * from './lib/form-field-hide-show.directive';\n\nexport * from './lib/form-controls/form-controls.component.module';\nexport * from './lib/form-controls/form-controls.component';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/material/form-system/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,mCAAmC,CAAC;AAClD,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AAErD,cAAc,oDAAoD,CAAC;AACnE,cAAc,6CAA6C,CAAC;AAC5D,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC","sourcesContent":["export * from './lib/control-error.directive';\nexport * from './lib/control-errors.directive';\nexport * from './lib/input-clear-button.directive';\nexport * from './lib/material-form-system.module';\nexport * from './lib/required.directive';\nexport * from './lib/compare-with.directive';\nexport * from './lib/form-field-hide-show.directive';\n\nexport * from './lib/form-controls/form-controls.component.module';\nexport * from './lib/form-controls/form-controls.component';\nexport * from './lib/chip-input-adapter.directive';\nexport * from './lib/chip-list-iterator.directive';\n"]}
@@ -0,0 +1,52 @@
1
+ import { COMMA, ENTER } from '@angular/cdk/keycodes';
2
+ import { Directive, NgModule } from '@angular/core';
3
+ import { NgControl } from '@angular/forms';
4
+ import { MatChipInput } from '@angular/material/chips';
5
+ import { unique } from '@rxap/utilities';
6
+ import { filter, tap } from 'rxjs/operators';
7
+ import * as i0 from "@angular/core";
8
+ import * as i1 from "@angular/material/chips";
9
+ import * as i2 from "@angular/forms";
10
+ export class ChipInputAdapterDirective {
11
+ constructor(matChipInput, ngControl) {
12
+ this.matChipInput = matChipInput;
13
+ this.ngControl = ngControl;
14
+ this.matChipInput.separatorKeyCodes = [ENTER, COMMA];
15
+ this.matChipInput.addOnBlur = true;
16
+ }
17
+ ngOnDestroy() {
18
+ var _a;
19
+ (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
20
+ }
21
+ ngOnInit() {
22
+ this._subscription = this.matChipInput.chipEnd
23
+ .pipe(filter((add) => { var _a; return !!((_a = add.value) === null || _a === void 0 ? void 0 : _a.trim()); }), tap((add) => {
24
+ var _a, _b;
25
+ const value = (_a = this.ngControl.value) !== null && _a !== void 0 ? _a : [];
26
+ (_b = this.ngControl.control) === null || _b === void 0 ? void 0 : _b.setValue([...value, add.value].filter(unique()));
27
+ this.matChipInput.clear();
28
+ }))
29
+ .subscribe();
30
+ }
31
+ }
32
+ ChipInputAdapterDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: ChipInputAdapterDirective, deps: [{ token: i1.MatChipInput }, { token: i2.NgControl }], target: i0.ɵɵFactoryTarget.Directive });
33
+ ChipInputAdapterDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: ChipInputAdapterDirective, selector: "[matChipInputFor][rxapChipInputAdapter]", ngImport: i0 });
34
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: ChipInputAdapterDirective, decorators: [{
35
+ type: Directive,
36
+ args: [{
37
+ selector: '[matChipInputFor][rxapChipInputAdapter]'
38
+ }]
39
+ }], ctorParameters: function () { return [{ type: i1.MatChipInput }, { type: i2.NgControl }]; } });
40
+ export class ChipInputAdapterDirectiveModule {
41
+ }
42
+ ChipInputAdapterDirectiveModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: ChipInputAdapterDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
43
+ ChipInputAdapterDirectiveModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: ChipInputAdapterDirectiveModule, declarations: [ChipInputAdapterDirective], exports: [ChipInputAdapterDirective] });
44
+ ChipInputAdapterDirectiveModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: ChipInputAdapterDirectiveModule });
45
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: ChipInputAdapterDirectiveModule, decorators: [{
46
+ type: NgModule,
47
+ args: [{
48
+ exports: [ChipInputAdapterDirective],
49
+ declarations: [ChipInputAdapterDirective]
50
+ }]
51
+ }] });
52
+ //# sourceMappingURL=chip-input-adapter.directive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chip-input-adapter.directive.js","sourceRoot":"","sources":["../../../../../../libs/material/form-system/src/lib/chip-input-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,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;QAC5B,CAAC,CAAC,CACH;aACA,SAAS,EAAE,CAAC;IACjB,CAAC;;sHA5BU,yBAAyB;0GAAzB,yBAAyB;2FAAzB,yBAAyB;kBAHrC,SAAS;mBAAC;oBACT,QAAQ,EAAE,yCAAyC;iBACpD;;AAoCD,MAAM,OAAO,+BAA+B;;4HAA/B,+BAA+B;6HAA/B,+BAA+B,iBAnC/B,yBAAyB,aAAzB,yBAAyB;6HAmCzB,+BAA+B;2FAA/B,+BAA+B;kBAJ3C,QAAQ;mBAAC;oBACR,OAAO,EAAE,CAAE,yBAAyB,CAAE;oBACtC,YAAY,EAAE,CAAE,yBAAyB,CAAE;iBAC5C","sourcesContent":["import {\n COMMA,\n ENTER\n} from '@angular/cdk/keycodes';\nimport {\n Directive,\n NgModule,\n OnDestroy,\n OnInit\n} from '@angular/core';\nimport { NgControl } from '@angular/forms';\nimport { MatChipInput } from '@angular/material/chips';\nimport { unique } from '@rxap/utilities';\nimport { Subscription } from 'rxjs';\nimport {\n filter,\n tap\n} from 'rxjs/operators';\n\n@Directive({\n selector: '[matChipInputFor][rxapChipInputAdapter]'\n})\nexport class ChipInputAdapterDirective implements OnDestroy, OnInit {\n private _subscription?: Subscription;\n\n constructor(\n private readonly matChipInput: MatChipInput,\n private readonly ngControl: NgControl\n ) {\n this.matChipInput.separatorKeyCodes = [ ENTER, COMMA ] as const;\n this.matChipInput.addOnBlur = true;\n }\n\n public ngOnDestroy() {\n this._subscription?.unsubscribe();\n }\n\n public ngOnInit() {\n this._subscription = this.matChipInput.chipEnd\n .pipe(\n filter((add) => !!add.value?.trim()),\n tap((add) => {\n const value = this.ngControl.value ?? [];\n this.ngControl.control?.setValue(\n [ ...value, add.value ].filter(unique())\n );\n this.matChipInput.clear();\n })\n )\n .subscribe();\n }\n}\n\n@NgModule({\n exports: [ ChipInputAdapterDirective ],\n declarations: [ ChipInputAdapterDirective ]\n})\nexport class ChipInputAdapterDirectiveModule {\n}\n"]}
@@ -0,0 +1,108 @@
1
+ import { Directive, IterableDiffers, NgModule, TemplateRef, ViewContainerRef } from '@angular/core';
2
+ import { NgControl } from '@angular/forms';
3
+ import { log } from '@rxap/utilities/rxjs';
4
+ import { filter, startWith, tap } from 'rxjs/operators';
5
+ import * as i0 from "@angular/core";
6
+ import * as i1 from "@angular/forms";
7
+ function getTypeName(type) {
8
+ return type['name'] || typeof type;
9
+ }
10
+ class RecordViewTuple {
11
+ constructor(record, view) {
12
+ this.record = record;
13
+ this.view = view;
14
+ }
15
+ }
16
+ export class ChipListIteratorDirective {
17
+ constructor(template, viewContainerRef, ngControl, differs) {
18
+ this.template = template;
19
+ this.viewContainerRef = viewContainerRef;
20
+ this.ngControl = ngControl;
21
+ this.differs = differs;
22
+ this._dirty = true;
23
+ this._differ = null;
24
+ }
25
+ ngOnInit() {
26
+ var _a;
27
+ this._subscription = (_a = this.ngControl.valueChanges) === null || _a === void 0 ? void 0 : _a.pipe(startWith(this.ngControl.value), log('test'), filter((value) => Array.isArray(value)), tap((items) => {
28
+ this._dirty = false;
29
+ // React on ngForOf changes only once all inputs have been initialized
30
+ const value = items;
31
+ if (!this._differ && value) {
32
+ try {
33
+ this._differ = this.differs.find(value).create((_, item) => item);
34
+ }
35
+ catch (_a) {
36
+ throw new Error(`Cannot find a differ supporting object '${value}' of type '${getTypeName(value)}'. NgFor only supports binding to Iterables such as Arrays.`);
37
+ }
38
+ }
39
+ if (this._differ) {
40
+ const changes = this._differ.diff(items);
41
+ if (changes) {
42
+ this.applyChanges(changes);
43
+ }
44
+ }
45
+ })).subscribe();
46
+ }
47
+ ngOnDestroy() {
48
+ var _a;
49
+ (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
50
+ }
51
+ applyChanges(changes) {
52
+ const insertTuples = [];
53
+ changes.forEachOperation((item, adjustedPreviousIndex, currentIndex) => {
54
+ if (item.previousIndex == null) {
55
+ // NgForOf is never "null" or "undefined" here because the differ detected
56
+ // that a new item needs to be inserted from the iterable. This implies that
57
+ // there is an iterable value for "_ngForOf".
58
+ const view = this.viewContainerRef.createEmbeddedView(this.template, { $implicit: item.item, onRemoved: this.onRemoved.bind(this) }, currentIndex === null ? undefined : currentIndex);
59
+ const tuple = new RecordViewTuple(item, view);
60
+ insertTuples.push(tuple);
61
+ }
62
+ else if (currentIndex == null) {
63
+ this.viewContainerRef.remove(adjustedPreviousIndex === null ? undefined : adjustedPreviousIndex);
64
+ }
65
+ else if (adjustedPreviousIndex !== null) {
66
+ const view = this.viewContainerRef.get(adjustedPreviousIndex);
67
+ this.viewContainerRef.move(view, currentIndex);
68
+ const tuple = new RecordViewTuple(item, view);
69
+ insertTuples.push(tuple);
70
+ }
71
+ });
72
+ for (let i = 0; i < insertTuples.length; i++) {
73
+ this.perViewChange(insertTuples[i].view, insertTuples[i].record);
74
+ }
75
+ changes.forEachIdentityChange((record) => {
76
+ const viewRef = (this.viewContainerRef.get(record.currentIndex));
77
+ viewRef.context.$implicit = record.item;
78
+ });
79
+ }
80
+ onRemoved($event) {
81
+ var _a, _b;
82
+ (_a = this.ngControl.control) === null || _a === void 0 ? void 0 : _a.setValue(((_b = this.ngControl.value) !== null && _b !== void 0 ? _b : []).filter((item) => item !== $event.chip.value));
83
+ }
84
+ perViewChange(view, record) {
85
+ view.context.$implicit = record.item;
86
+ }
87
+ }
88
+ ChipListIteratorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: ChipListIteratorDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: i1.NgControl }, { token: i0.IterableDiffers }], target: i0.ɵɵFactoryTarget.Directive });
89
+ ChipListIteratorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: ChipListIteratorDirective, selector: "[rxapChipListIterator]", ngImport: i0 });
90
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: ChipListIteratorDirective, decorators: [{
91
+ type: Directive,
92
+ args: [{
93
+ selector: '[rxapChipListIterator]'
94
+ }]
95
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }, { type: i1.NgControl }, { type: i0.IterableDiffers }]; } });
96
+ export class ChipListIteratorDirectiveModule {
97
+ }
98
+ ChipListIteratorDirectiveModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: ChipListIteratorDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
99
+ ChipListIteratorDirectiveModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: ChipListIteratorDirectiveModule, declarations: [ChipListIteratorDirective], exports: [ChipListIteratorDirective] });
100
+ ChipListIteratorDirectiveModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: ChipListIteratorDirectiveModule });
101
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: ChipListIteratorDirectiveModule, decorators: [{
102
+ type: NgModule,
103
+ args: [{
104
+ exports: [ChipListIteratorDirective],
105
+ declarations: [ChipListIteratorDirective]
106
+ }]
107
+ }] });
108
+ //# sourceMappingURL=chip-list-iterator.directive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chip-list-iterator.directive.js","sourceRoot":"","sources":["../../../../../../libs/material/form-system/src/lib/chip-list-iterator.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAKT,eAAe,EACf,QAAQ,EAGR,WAAW,EACX,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAE3C,OAAO,EACL,MAAM,EACN,SAAS,EACT,GAAG,EACJ,MAAM,gBAAgB,C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HA9GU,yBAAyB;0GAAzB,yBAAyB;2FAAzB,yBAAyB;kBAHrC,SAAS;mBAAC;oBACT,QAAQ,EAAE,wBAAwB;iBACnC;;AAsHD,MAAM,OAAO,+BAA+B;;4HAA/B,+BAA+B;6HAA/B,+BAA+B,iBArH/B,yBAAyB,aAAzB,yBAAyB;6HAqHzB,+BAA+B;2FAA/B,+BAA+B;kBAJ3C,QAAQ;mBAAC;oBACR,OAAO,EAAE,CAAE,yBAAyB,CAAE;oBACtC,YAAY,EAAE,CAAE,yBAAyB,CAAE;iBAC5C","sourcesContent":["import {\n Directive,\n EmbeddedViewRef,\n IterableChangeRecord,\n IterableChanges,\n IterableDiffer,\n IterableDiffers,\n NgModule,\n OnDestroy,\n OnInit,\n TemplateRef,\n ViewContainerRef\n} from '@angular/core';\nimport { NgControl } from '@angular/forms';\nimport { MatChipEvent } from '@angular/material/chips/chip';\nimport { log } from '@rxap/utilities/rxjs';\nimport { Subscription } from 'rxjs';\nimport {\n filter,\n startWith,\n tap\n} from 'rxjs/operators';\n\nfunction getTypeName(type: any): string {\n return type['name'] || typeof type;\n}\n\nexport interface ChipListTemplateContext {\n $implicit: string;\n onRemoved: (event: MatChipEvent) => void;\n}\n\nclass RecordViewTuple {\n constructor(\n public record: any,\n public view: EmbeddedViewRef<ChipListTemplateContext>\n ) {\n }\n}\n\n@Directive({\n selector: '[rxapChipListIterator]'\n})\nexport class ChipListIteratorDirective implements OnInit, OnDestroy {\n private _subscription?: Subscription;\n\n private _dirty = true;\n private _differ: IterableDiffer<string> | null = null;\n\n constructor(\n private readonly template: TemplateRef<ChipListTemplateContext>,\n private readonly viewContainerRef: ViewContainerRef,\n private readonly ngControl: NgControl,\n private readonly differs: IterableDiffers\n ) {\n }\n\n public ngOnInit() {\n this._subscription = this.ngControl.valueChanges\n ?.pipe(\n startWith(this.ngControl.value),\n log('test'),\n filter((value) => Array.isArray(value)),\n tap((items) => {\n this._dirty = false;\n // React on ngForOf changes only once all inputs have been initialized\n const value = items;\n if (!this._differ && value) {\n try {\n this._differ = this.differs.find(value).create((_, item) => item);\n } catch {\n throw new Error(\n `Cannot find a differ supporting object '${value}' of type '${getTypeName(\n value\n )}'. NgFor only supports binding to Iterables such as Arrays.`\n );\n }\n }\n if (this._differ) {\n const changes = this._differ.diff(items);\n if (changes) {\n this.applyChanges(changes);\n }\n }\n })\n )\n .subscribe();\n }\n\n public ngOnDestroy() {\n this._subscription?.unsubscribe();\n }\n\n protected applyChanges(changes: IterableChanges<string>) {\n const insertTuples: RecordViewTuple[] = [];\n changes.forEachOperation(\n (\n item: IterableChangeRecord<any>,\n adjustedPreviousIndex: number | null,\n currentIndex: number | null\n ) => {\n if (item.previousIndex == null) {\n // NgForOf is never \"null\" or \"undefined\" here because the differ detected\n // that a new item needs to be inserted from the iterable. This implies that\n // there is an iterable value for \"_ngForOf\".\n const view = this.viewContainerRef.createEmbeddedView(\n this.template,\n { $implicit: item.item, onRemoved: this.onRemoved.bind(this) },\n currentIndex === null ? undefined : currentIndex\n );\n const tuple = new RecordViewTuple(item, view);\n insertTuples.push(tuple);\n } else if (currentIndex == null) {\n this.viewContainerRef.remove(\n adjustedPreviousIndex === null ? undefined : adjustedPreviousIndex\n );\n } else if (adjustedPreviousIndex !== null) {\n const view = this.viewContainerRef.get(adjustedPreviousIndex)!;\n this.viewContainerRef.move(view, currentIndex);\n const tuple = new RecordViewTuple(\n item,\n <EmbeddedViewRef<ChipListTemplateContext>>view\n );\n insertTuples.push(tuple);\n }\n }\n );\n\n for (let i = 0; i < insertTuples.length; i++) {\n this.perViewChange(insertTuples[i].view, insertTuples[i].record);\n }\n\n changes.forEachIdentityChange((record: any) => {\n const viewRef = <EmbeddedViewRef<ChipListTemplateContext>>(\n this.viewContainerRef.get(record.currentIndex)\n );\n viewRef.context.$implicit = record.item;\n });\n }\n\n private onRemoved($event: MatChipEvent) {\n this.ngControl.control?.setValue(\n (this.ngControl.value ?? []).filter(\n (item: any) => item !== $event.chip.value\n )\n );\n }\n\n private perViewChange(\n view: EmbeddedViewRef<ChipListTemplateContext>,\n record: IterableChangeRecord<any>\n ) {\n view.context.$implicit = record.item;\n }\n}\n\n@NgModule({\n exports: [ ChipListIteratorDirective ],\n declarations: [ ChipListIteratorDirective ]\n})\nexport class ChipListIteratorDirectiveModule {\n}\n"]}
@@ -1,7 +1,6 @@
1
- import { __decorate, __metadata } from "tslib";
2
- import { Directive, NgModule, Input, isDevMode, Inject, } from '@angular/core';
1
+ import { Directive, NgModule, Input, isDevMode, Inject } from '@angular/core';
3
2
  import { MatSelect } from '@angular/material/select';
4
- import { Required, getFromObject } from '@rxap/utilities';
3
+ import { getFromObject, equals } from '@rxap/utilities';
5
4
  import * as i0 from "@angular/core";
6
5
  import * as i1 from "@angular/material/select";
7
6
  export class CompareWithDirective {
@@ -12,32 +11,33 @@ export class CompareWithDirective {
12
11
  this.matSelect.compareWith = this.compareWith.bind(this);
13
12
  }
14
13
  compareWith(o1, o2) {
15
- if (typeof o1 !== 'object' || typeof o2 !== 'object') {
16
- if (isDevMode()) {
17
- console.warn('At least one of the select options value is not an object');
14
+ if (this.objectPath) {
15
+ if (typeof o1 !== 'object' || typeof o2 !== 'object') {
16
+ if (isDevMode()) {
17
+ console.warn('At least one of the select options value is not an object');
18
+ }
19
+ return false;
18
20
  }
19
- return false;
20
- }
21
- if (o1 === null || o1 === undefined || o2 === null || o2 === undefined) {
22
- if (isDevMode()) {
23
- console.warn('At least one of the select options value is undefined or null');
21
+ if (o1 === null || o1 === undefined || o2 === null || o2 === undefined) {
22
+ if (isDevMode()) {
23
+ console.warn('At least one of the select options value is undefined or null');
24
+ }
25
+ return false;
26
+ }
27
+ const o1Value = getFromObject(o1, this.objectPath);
28
+ const o2Value = getFromObject(o2, this.objectPath);
29
+ if (o1Value === undefined || o2Value === undefined) {
30
+ return false;
24
31
  }
25
- return false;
32
+ return o1Value === o2Value;
26
33
  }
27
- const o1Value = getFromObject(o1, this.objectPath);
28
- const o2Value = getFromObject(o2, this.objectPath);
29
- if (o1Value === undefined || o2Value === undefined) {
30
- return false;
34
+ else {
35
+ return equals(o1, o2);
31
36
  }
32
- return o1Value === o2Value;
33
37
  }
34
38
  }
35
39
  CompareWithDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: CompareWithDirective, deps: [{ token: MatSelect }], target: i0.ɵɵFactoryTarget.Directive });
36
40
  CompareWithDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: CompareWithDirective, selector: "mat-select[rxapCompareWith]", inputs: { objectPath: ["rxapCompareWith", "objectPath"] }, ngImport: i0 });
37
- __decorate([
38
- Required,
39
- __metadata("design:type", String)
40
- ], CompareWithDirective.prototype, "objectPath", void 0);
41
41
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: CompareWithDirective, decorators: [{
42
42
  type: Directive,
43
43
  args: [{
@@ -1 +1 @@
1
- {"version":3,"file":"compare-with.directive.js","sourceRoot":"","sources":["../../../../../../libs/material/form-system/src/lib/compare-with.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,SAAS,EACT,QAAQ,EACR,KAAK,EAEL,SAAS,EACT,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;;;AAK1D,MAAM,OAAO,oBAAoB;IAK/B,YAEmB,SAAoB;QAApB,cAAS,GAAT,SAAS,CAAW;IACpC,CAAC;IAEG,QAAQ;QACb,IAAI,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3D,CAAC;IAEO,WAAW,CAAC,EAAO,EAAE,EAAO;QAClC,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;YACpD,IAAI,SAAS,EAAE,EAAE;gBACf,OAAO,CAAC,IAAI,CACV,2DAA2D,CAC5D,CAAC;aACH;YACD,OAAO,KAAK,CAAC;SACd;QACD,IAAI,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,SAAS,IAAI,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,SAAS,EAAE;YACtE,IAAI,SAAS,EAAE,EAAE;gBACf,OAAO,CAAC,IAAI,CACV,+DAA+D,CAChE,CAAC;aACH;YACD,OAAO,KAAK,CAAC;SACd;QACD,MAAM,OAAO,GAAG,aAAa,CAAC,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACnD,MAAM,OAAO,GAAG,aAAa,CAAC,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACnD,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,SAAS,EAAE;YAClD,OAAO,KAAK,CAAC;SACd;QACD,OAAO,OAAO,KAAK,OAAO,CAAC;IAC7B,CAAC;;iHArCU,oBAAoB,kBAMrB,SAAS;qGANR,oBAAoB;AAG/B;IADC,QAAQ;;wDACkB;2FAHhB,oBAAoB;kBAHhC,SAAS;mBAAC;oBACT,QAAQ,EAAE,6BAA6B;iBACxC;;0BAOI,MAAM;2BAAC,SAAS;4CAHZ,UAAU;sBAFhB,KAAK;uBAAC,iBAAiB;;AA2C1B,MAAM,OAAO,0BAA0B;;uHAA1B,0BAA0B;wHAA1B,0BAA0B,iBA5C1B,oBAAoB,aAApB,oBAAoB;wHA4CpB,0BAA0B;2FAA1B,0BAA0B;kBAJtC,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAC,oBAAoB,CAAC;oBACpC,OAAO,EAAE,CAAC,oBAAoB,CAAC;iBAChC","sourcesContent":["import {\n Directive,\n NgModule,\n Input,\n OnInit,\n isDevMode,\n Inject,\n} from '@angular/core';\nimport { MatSelect } from '@angular/material/select';\nimport { Required, getFromObject } from '@rxap/utilities';\n\n@Directive({\n selector: 'mat-select[rxapCompareWith]',\n})\nexport class CompareWithDirective implements OnInit {\n @Input('rxapCompareWith')\n @Required\n public objectPath!: string;\n\n constructor(\n @Inject(MatSelect)\n private readonly matSelect: MatSelect\n ) {}\n\n public ngOnInit() {\n this.matSelect.compareWith = this.compareWith.bind(this);\n }\n\n private compareWith(o1: any, o2: any): boolean {\n if (typeof o1 !== 'object' || typeof o2 !== 'object') {\n if (isDevMode()) {\n console.warn(\n 'At least one of the select options value is not an object'\n );\n }\n return false;\n }\n if (o1 === null || o1 === undefined || o2 === null || o2 === undefined) {\n if (isDevMode()) {\n console.warn(\n 'At least one of the select options value is undefined or null'\n );\n }\n return false;\n }\n const o1Value = getFromObject(o1, this.objectPath);\n const o2Value = getFromObject(o2, this.objectPath);\n if (o1Value === undefined || o2Value === undefined) {\n return false;\n }\n return o1Value === o2Value;\n }\n}\n\n@NgModule({\n declarations: [CompareWithDirective],\n exports: [CompareWithDirective],\n})\nexport class CompareWithDirectiveModule {}\n"]}
1
+ {"version":3,"file":"compare-with.directive.js","sourceRoot":"","sources":["../../../../../../libs/material/form-system/src/lib/compare-with.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,QAAQ,EACR,KAAK,EAEL,SAAS,EACT,MAAM,EACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EACL,aAAa,EACb,MAAM,EACP,MAAM,iBAAiB,CAAC;;;AAKzB,MAAM,OAAO,oBAAoB;IAI/B,YAEmB,SAAoB;QAApB,cAAS,GAAT,SAAS,CAAW;IACpC,CAAC;IAEG,QAAQ;QACb,IAAI,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3D,CAAC;IAEO,WAAW,CAAC,EAAO,EAAE,EAAO;QAClC,IAAI,IAAI,CAAC,UAAU,EAAE;YACnB,IAAI,OAAO,EAAE,KAAK,QAAQ,I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'@angular/core';\nimport { MatSelect } from '@angular/material/select';\nimport {\n getFromObject,\n equals\n} from '@rxap/utilities';\n\n@Directive({\n selector: 'mat-select[rxapCompareWith]',\n})\nexport class CompareWithDirective implements OnInit {\n @Input('rxapCompareWith')\n public objectPath!: string;\n\n constructor(\n @Inject(MatSelect)\n private readonly matSelect: MatSelect\n ) {}\n\n public ngOnInit() {\n this.matSelect.compareWith = this.compareWith.bind(this);\n }\n\n private compareWith(o1: any, o2: any): boolean {\n if (this.objectPath) {\n if (typeof o1 !== 'object' || typeof o2 !== 'object') {\n if (isDevMode()) {\n console.warn(\n 'At least one of the select options value is not an object'\n );\n }\n return false;\n }\n if (o1 === null || o1 === undefined || o2 === null || o2 === undefined) {\n if (isDevMode()) {\n console.warn(\n 'At least one of the select options value is undefined or null'\n );\n }\n return false;\n }\n const o1Value = getFromObject(o1, this.objectPath);\n const o2Value = getFromObject(o2, this.objectPath);\n if (o1Value === undefined || o2Value === undefined) {\n return false;\n }\n return o1Value === o2Value;\n } else {\n return equals(o1, o2);\n }\n }\n}\n\n@NgModule({\n declarations: [CompareWithDirective],\n exports: [CompareWithDirective],\n})\nexport class CompareWithDirectiveModule {}\n"]}
@@ -5,8 +5,8 @@ import * as i1 from '@angular/material/form-field';
5
5
  import { MAT_FORM_FIELD, MatFormField } from '@angular/material/form-field';
6
6
  import * as i6 from '@rxap/forms';
7
7
  import { controlErrorChanges$, RxapFormControl, FormDirective, RxapFormsModule } from '@rxap/forms';
8
- import { tap, startWith, catchError, take } from 'rxjs/operators';
9
- import { Required, getFromObject, coerceBoolean, clone } from '@rxap/utilities';
8
+ import { tap, startWith, catchError, take, filter } from 'rxjs/operators';
9
+ import { Required, getFromObject, equals, coerceBoolean, clone, unique } from '@rxap/utilities';
10
10
  import { Subscription, of } from 'rxjs';
11
11
  import { RXAP_FORM_SYSTEM_HIDE_SHOW_OPTIONS, RXAP_FORM_SYSTEM_HIDE_METADATA, RXAP_FORM_SYSTEM_SHOW_METADATA, ExtractFormDefinitionMixin } from '@rxap/form-system';
12
12
  import { Mixin } from '@rxap/mixin';
@@ -27,6 +27,10 @@ import * as i4 from '@angular/flex-layout/extended';
27
27
  import * as i5 from '@angular/common';
28
28
  import { CommonModule } from '@angular/common';
29
29
  import { FlexLayoutModule } from '@angular/flex-layout';
30
+ import { ENTER, COMMA } from '@angular/cdk/keycodes';
31
+ import * as i2$1 from '@angular/forms';
32
+ import * as i1$3 from '@angular/material/chips';
33
+ import { log } from '@rxap/utilities/rxjs';
30
34
 
31
35
  class ControlErrorDirective {
32
36
  constructor(formField, template, viewContainerRef, cdr) {
@@ -468,32 +472,33 @@ class CompareWithDirective {
468
472
  this.matSelect.compareWith = this.compareWith.bind(this);
469
473
  }
470
474
  compareWith(o1, o2) {
471
- if (typeof o1 !== 'object' || typeof o2 !== 'object') {
472
- if (isDevMode()) {
473
- console.warn('At least one of the select options value is not an object');
475
+ if (this.objectPath) {
476
+ if (typeof o1 !== 'object' || typeof o2 !== 'object') {
477
+ if (isDevMode()) {
478
+ console.warn('At least one of the select options value is not an object');
479
+ }
480
+ return false;
474
481
  }
475
- return false;
476
- }
477
- if (o1 === null || o1 === undefined || o2 === null || o2 === undefined) {
478
- if (isDevMode()) {
479
- console.warn('At least one of the select options value is undefined or null');
482
+ if (o1 === null || o1 === undefined || o2 === null || o2 === undefined) {
483
+ if (isDevMode()) {
484
+ console.warn('At least one of the select options value is undefined or null');
485
+ }
486
+ return false;
487
+ }
488
+ const o1Value = getFromObject(o1, this.objectPath);
489
+ const o2Value = getFromObject(o2, this.objectPath);
490
+ if (o1Value === undefined || o2Value === undefined) {
491
+ return false;
480
492
  }
481
- return false;
493
+ return o1Value === o2Value;
482
494
  }
483
- const o1Value = getFromObject(o1, this.objectPath);
484
- const o2Value = getFromObject(o2, this.objectPath);
485
- if (o1Value === undefined || o2Value === undefined) {
486
- return false;
495
+ else {
496
+ return equals(o1, o2);
487
497
  }
488
- return o1Value === o2Value;
489
498
  }
490
499
  }
491
500
  CompareWithDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: CompareWithDirective, deps: [{ token: MatSelect }], target: i0.ɵɵFactoryTarget.Directive });
492
501
  CompareWithDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: CompareWithDirective, selector: "mat-select[rxapCompareWith]", inputs: { objectPath: ["rxapCompareWith", "objectPath"] }, ngImport: i0 });
493
- __decorate([
494
- Required,
495
- __metadata("design:type", String)
496
- ], CompareWithDirective.prototype, "objectPath", void 0);
497
502
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: CompareWithDirective, decorators: [{
498
503
  type: Directive,
499
504
  args: [{
@@ -665,9 +670,154 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImpor
665
670
  }]
666
671
  }] });
667
672
 
673
+ class ChipInputAdapterDirective {
674
+ constructor(matChipInput, ngControl) {
675
+ this.matChipInput = matChipInput;
676
+ this.ngControl = ngControl;
677
+ this.matChipInput.separatorKeyCodes = [ENTER, COMMA];
678
+ this.matChipInput.addOnBlur = true;
679
+ }
680
+ ngOnDestroy() {
681
+ var _a;
682
+ (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
683
+ }
684
+ ngOnInit() {
685
+ this._subscription = this.matChipInput.chipEnd
686
+ .pipe(filter((add) => { var _a; return !!((_a = add.value) === null || _a === void 0 ? void 0 : _a.trim()); }), tap((add) => {
687
+ var _a, _b;
688
+ const value = (_a = this.ngControl.value) !== null && _a !== void 0 ? _a : [];
689
+ (_b = this.ngControl.control) === null || _b === void 0 ? void 0 : _b.setValue([...value, add.value].filter(unique()));
690
+ this.matChipInput.clear();
691
+ }))
692
+ .subscribe();
693
+ }
694
+ }
695
+ ChipInputAdapterDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: ChipInputAdapterDirective, deps: [{ token: i1$3.MatChipInput }, { token: i2$1.NgControl }], target: i0.ɵɵFactoryTarget.Directive });
696
+ ChipInputAdapterDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: ChipInputAdapterDirective, selector: "[matChipInputFor][rxapChipInputAdapter]", ngImport: i0 });
697
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: ChipInputAdapterDirective, decorators: [{
698
+ type: Directive,
699
+ args: [{
700
+ selector: '[matChipInputFor][rxapChipInputAdapter]'
701
+ }]
702
+ }], ctorParameters: function () { return [{ type: i1$3.MatChipInput }, { type: i2$1.NgControl }]; } });
703
+ class ChipInputAdapterDirectiveModule {
704
+ }
705
+ ChipInputAdapterDirectiveModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: ChipInputAdapterDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
706
+ ChipInputAdapterDirectiveModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: ChipInputAdapterDirectiveModule, declarations: [ChipInputAdapterDirective], exports: [ChipInputAdapterDirective] });
707
+ ChipInputAdapterDirectiveModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: ChipInputAdapterDirectiveModule });
708
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: ChipInputAdapterDirectiveModule, decorators: [{
709
+ type: NgModule,
710
+ args: [{
711
+ exports: [ChipInputAdapterDirective],
712
+ declarations: [ChipInputAdapterDirective]
713
+ }]
714
+ }] });
715
+
716
+ function getTypeName(type) {
717
+ return type['name'] || typeof type;
718
+ }
719
+ class RecordViewTuple {
720
+ constructor(record, view) {
721
+ this.record = record;
722
+ this.view = view;
723
+ }
724
+ }
725
+ class ChipListIteratorDirective {
726
+ constructor(template, viewContainerRef, ngControl, differs) {
727
+ this.template = template;
728
+ this.viewContainerRef = viewContainerRef;
729
+ this.ngControl = ngControl;
730
+ this.differs = differs;
731
+ this._dirty = true;
732
+ this._differ = null;
733
+ }
734
+ ngOnInit() {
735
+ var _a;
736
+ this._subscription = (_a = this.ngControl.valueChanges) === null || _a === void 0 ? void 0 : _a.pipe(startWith(this.ngControl.value), log('test'), filter((value) => Array.isArray(value)), tap((items) => {
737
+ this._dirty = false;
738
+ // React on ngForOf changes only once all inputs have been initialized
739
+ const value = items;
740
+ if (!this._differ && value) {
741
+ try {
742
+ this._differ = this.differs.find(value).create((_, item) => item);
743
+ }
744
+ catch (_a) {
745
+ throw new Error(`Cannot find a differ supporting object '${value}' of type '${getTypeName(value)}'. NgFor only supports binding to Iterables such as Arrays.`);
746
+ }
747
+ }
748
+ if (this._differ) {
749
+ const changes = this._differ.diff(items);
750
+ if (changes) {
751
+ this.applyChanges(changes);
752
+ }
753
+ }
754
+ })).subscribe();
755
+ }
756
+ ngOnDestroy() {
757
+ var _a;
758
+ (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
759
+ }
760
+ applyChanges(changes) {
761
+ const insertTuples = [];
762
+ changes.forEachOperation((item, adjustedPreviousIndex, currentIndex) => {
763
+ if (item.previousIndex == null) {
764
+ // NgForOf is never "null" or "undefined" here because the differ detected
765
+ // that a new item needs to be inserted from the iterable. This implies that
766
+ // there is an iterable value for "_ngForOf".
767
+ const view = this.viewContainerRef.createEmbeddedView(this.template, { $implicit: item.item, onRemoved: this.onRemoved.bind(this) }, currentIndex === null ? undefined : currentIndex);
768
+ const tuple = new RecordViewTuple(item, view);
769
+ insertTuples.push(tuple);
770
+ }
771
+ else if (currentIndex == null) {
772
+ this.viewContainerRef.remove(adjustedPreviousIndex === null ? undefined : adjustedPreviousIndex);
773
+ }
774
+ else if (adjustedPreviousIndex !== null) {
775
+ const view = this.viewContainerRef.get(adjustedPreviousIndex);
776
+ this.viewContainerRef.move(view, currentIndex);
777
+ const tuple = new RecordViewTuple(item, view);
778
+ insertTuples.push(tuple);
779
+ }
780
+ });
781
+ for (let i = 0; i < insertTuples.length; i++) {
782
+ this.perViewChange(insertTuples[i].view, insertTuples[i].record);
783
+ }
784
+ changes.forEachIdentityChange((record) => {
785
+ const viewRef = (this.viewContainerRef.get(record.currentIndex));
786
+ viewRef.context.$implicit = record.item;
787
+ });
788
+ }
789
+ onRemoved($event) {
790
+ var _a, _b;
791
+ (_a = this.ngControl.control) === null || _a === void 0 ? void 0 : _a.setValue(((_b = this.ngControl.value) !== null && _b !== void 0 ? _b : []).filter((item) => item !== $event.chip.value));
792
+ }
793
+ perViewChange(view, record) {
794
+ view.context.$implicit = record.item;
795
+ }
796
+ }
797
+ ChipListIteratorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: ChipListIteratorDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: i2$1.NgControl }, { token: i0.IterableDiffers }], target: i0.ɵɵFactoryTarget.Directive });
798
+ ChipListIteratorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: ChipListIteratorDirective, selector: "[rxapChipListIterator]", ngImport: i0 });
799
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: ChipListIteratorDirective, decorators: [{
800
+ type: Directive,
801
+ args: [{
802
+ selector: '[rxapChipListIterator]'
803
+ }]
804
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }, { type: i2$1.NgControl }, { type: i0.IterableDiffers }]; } });
805
+ class ChipListIteratorDirectiveModule {
806
+ }
807
+ ChipListIteratorDirectiveModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: ChipListIteratorDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
808
+ ChipListIteratorDirectiveModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: ChipListIteratorDirectiveModule, declarations: [ChipListIteratorDirective], exports: [ChipListIteratorDirective] });
809
+ ChipListIteratorDirectiveModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: ChipListIteratorDirectiveModule });
810
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: ChipListIteratorDirectiveModule, decorators: [{
811
+ type: NgModule,
812
+ args: [{
813
+ exports: [ChipListIteratorDirective],
814
+ declarations: [ChipListIteratorDirective]
815
+ }]
816
+ }] });
817
+
668
818
  /**
669
819
  * Generated bundle index. Do not edit.
670
820
  */
671
821
 
672
- export { CompareWithDirective, CompareWithDirectiveModule, ControlErrorDirective, ControlErrorDirectiveModule, ControlErrorsDirective, ControlErrorsDirectiveModule, ExtractHideShowMixin, FormControlsComponent, FormControlsComponentModule, FormFieldHideShowDirective, FormFieldHideShowDirectiveModule, InputClearButtonDirective, InputClearButtonDirectiveModule, MaterialFormSystemModule, RequiredDirective, RequiredDirectiveModule };
822
+ export { ChipInputAdapterDirective, ChipInputAdapterDirectiveModule, ChipListIteratorDirective, ChipListIteratorDirectiveModule, CompareWithDirective, CompareWithDirectiveModule, ControlErrorDirective, ControlErrorDirectiveModule, ControlErrorsDirective, ControlErrorsDirectiveModule, ExtractHideShowMixin, FormControlsComponent, FormControlsComponentModule, FormFieldHideShowDirective, FormFieldHideShowDirectiveModule, InputClearButtonDirective, InputClearButtonDirectiveModule, MaterialFormSystemModule, RequiredDirective, RequiredDirectiveModule };
673
823
  //# sourceMappingURL=rxap-material-form-system.js.map