@rxap/form-system 16.0.0-dev.1 → 16.0.0-dev.3

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 (44) hide show
  1. package/CHANGELOG.md +294 -0
  2. package/README.md +7 -22
  3. package/esm2022/index.mjs +1 -3
  4. package/esm2022/lib/control-data-source.mjs +7 -8
  5. package/esm2022/lib/control-with-data-source.mjs +1 -1
  6. package/esm2022/lib/decorators/metadata-keys.mjs +1 -1
  7. package/esm2022/lib/decorators/use-component.mjs +2 -2
  8. package/esm2022/lib/decorators/use-data-source.mjs +6 -3
  9. package/esm2022/lib/decorators/use-form-component.mjs +2 -2
  10. package/esm2022/lib/directives/control-hide-show.directive.mjs +13 -26
  11. package/esm2022/lib/directives/input-select-options.directive.mjs +32 -34
  12. package/esm2022/lib/error.mjs +1 -1
  13. package/esm2022/lib/form-system-control.directive.mjs +13 -13
  14. package/esm2022/lib/mixins/extract-control-from-parent.mixin.mjs +5 -3
  15. package/esm2022/lib/mixins/extract-control.mixin.mjs +5 -3
  16. package/esm2022/lib/mixins/extract-data-sources.mixin.mjs +2 -2
  17. package/esm2022/lib/mixins/extract-form-definition.mixin.mjs +1 -1
  18. package/esm2022/lib/mixins/extract-options-data-source.mixin.mjs +6 -7
  19. package/esm2022/lib/validators/is-equal-to.mjs +19 -27
  20. package/esm2022/lib/validators/is-selectable-value.directive.mjs +21 -29
  21. package/esm2022/rxap-form-system.mjs +1 -1
  22. package/fesm2022/rxap-form-system.mjs +221 -267
  23. package/fesm2022/rxap-form-system.mjs.map +1 -1
  24. package/index.d.ts +0 -2
  25. package/lib/directives/control-hide-show.directive.d.ts +2 -7
  26. package/lib/directives/input-select-options.directive.d.ts +6 -11
  27. package/lib/form-system-control.directive.d.ts +2 -2
  28. package/lib/mixins/extract-control.mixin.d.ts +2 -2
  29. package/lib/mixins/extract-form-definition.mixin.d.ts +1 -1
  30. package/lib/mixins/extract-options-data-source.mixin.d.ts +2 -3
  31. package/lib/validators/is-equal-to.d.ts +1 -6
  32. package/lib/validators/is-selectable-value.directive.d.ts +1 -6
  33. package/package.json +58 -52
  34. package/LICENSE +0 -21
  35. package/collection.json +0 -10
  36. package/esm2022/lib/directives/form-directives.module.mjs +0 -22
  37. package/esm2022/lib/form-system.module.mjs +0 -18
  38. package/lib/directives/form-directives.module.d.ts +0 -8
  39. package/lib/form-system.module.d.ts +0 -7
  40. package/migration.json +0 -4
  41. package/src/schematics/ng-add/index.d.ts +0 -2
  42. package/src/schematics/ng-add/index.js +0 -8
  43. package/src/schematics/ng-add/index.js.map +0 -1
  44. package/src/schematics/ng-add/schema.json +0 -7
@@ -1,19 +1,19 @@
1
+ import { RxapError, equals, Required } from '@rxap/utilities';
2
+ import * as i1$1 from '@rxap/data-source';
3
+ import { BaseDataSource, RXAP_DATA_SOURCE_METADATA, PipeDataSource, DataSourceLoader } from '@rxap/data-source';
1
4
  import * as i0 from '@angular/core';
2
- import { ComponentFactoryResolver, ViewContainerRef, INJECTOR, ComponentRef, Injector, Directive, Inject, Input, NgModule, InjectionToken, isDevMode, Injectable, Optional, Renderer2, ElementRef, Self, TemplateRef, ChangeDetectorRef, forwardRef } from '@angular/core';
3
- import { __decorate, __metadata } from 'tslib';
4
- import { RxapError, Required, equals } from '@rxap/utilities';
5
- import * as i1 from '@angular/forms';
6
- import { ControlContainer, NgControl, NG_VALIDATORS } from '@angular/forms';
5
+ import { InjectionToken, isDevMode, Injectable, Inject, Optional, ComponentFactoryResolver, ViewContainerRef, INJECTOR, ComponentRef, Injector, Directive, Input, Renderer2, ElementRef, Self, TemplateRef, ChangeDetectorRef, forwardRef } from '@angular/core';
6
+ import { startWith, distinctUntilChanged, shareReplay, map, tap, catchError, throttleTime, switchMap } from 'rxjs/operators';
7
+ import { getMetadata, setMetadataMapMap, setMetadataMap, setMetadata } from '@rxap/reflect-metadata';
7
8
  import { RxapFormControl, RxapFormGroup, RxapFormArray } from '@rxap/forms';
8
- import * as i1$1 from '@rxap/data-source';
9
- import { PipeDataSource, DataSourceLoader, BaseDataSource, RXAP_DATA_SOURCE_METADATA } from '@rxap/data-source';
9
+ import { __decorate, __metadata } from 'tslib';
10
10
  import { Mixin } from '@rxap/mixin';
11
- import { getMetadata, setMetadataMapMap, setMetadataMap, setMetadata } from '@rxap/utilities/reflect-metadata';
12
- import { map, startWith, distinctUntilChanged, shareReplay, tap, catchError, throttleTime, switchMap } from 'rxjs/operators';
11
+ import * as i1 from '@angular/forms';
12
+ import { NgControl, ControlContainer, NG_VALIDATORS } from '@angular/forms';
13
13
  import { Subscription, of, EMPTY } from 'rxjs';
14
- import * as i3 from '@angular/material/legacy-form-field';
15
- import { MAT_LEGACY_FORM_FIELD } from '@angular/material/legacy-form-field';
16
- import '@angular/material/legacy-autocomplete';
14
+ import * as i3 from '@angular/material/form-field';
15
+ import { MAT_FORM_FIELD } from '@angular/material/form-field';
16
+ import '@angular/material/autocomplete';
17
17
 
18
18
  class RxapFormSystemError extends RxapError {
19
19
  constructor(message, code, className) {
@@ -21,6 +21,41 @@ class RxapFormSystemError extends RxapError {
21
21
  }
22
22
  }
23
23
 
24
+ const RXAP_FORM_CONTROL_SOURCE = new InjectionToken('rxap/forms/data-source');
25
+ class ControlDataSource extends BaseDataSource {
26
+ constructor(control, metadata = null) {
27
+ super(metadata);
28
+ this.control = control;
29
+ }
30
+ init() {
31
+ if (this._initialised) {
32
+ return;
33
+ }
34
+ super.init();
35
+ if (isDevMode()) {
36
+ console.log(this.control);
37
+ }
38
+ this._data$ = this.control.valueChanges.pipe(startWith(this.control.value), distinctUntilChanged((a, b) => equals(a, b)), shareReplay(1));
39
+ }
40
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ControlDataSource, deps: [{ token: RXAP_FORM_CONTROL_SOURCE }, { token: RXAP_DATA_SOURCE_METADATA, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
41
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ControlDataSource }); }
42
+ }
43
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ControlDataSource, decorators: [{
44
+ type: Injectable
45
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
46
+ type: Inject,
47
+ args: [RXAP_FORM_CONTROL_SOURCE]
48
+ }] }, { type: undefined, decorators: [{
49
+ type: Optional
50
+ }, {
51
+ type: Inject,
52
+ args: [RXAP_DATA_SOURCE_METADATA]
53
+ }] }]; } });
54
+ function controlDataSource(control) {
55
+ // TODO : remove as any (wait for @rxap/forms update)
56
+ return new ControlDataSource(control, { id: control.controlId });
57
+ }
58
+
24
59
  var FormSystemMetadataKeys;
25
60
  (function (FormSystemMetadataKeys) {
26
61
  FormSystemMetadataKeys["COMPONENTS"] = "rxap/form-system/components";
@@ -42,6 +77,115 @@ class ExtractDataSourcesMixin {
42
77
  }
43
78
  }
44
79
 
80
+ class ExtractControlFromParentMixin {
81
+ extractControlFromParent(parent, controlPath) {
82
+ if (!controlPath) {
83
+ throw new RxapFormSystemError('The control path is empty', '');
84
+ }
85
+ if (!parent.control) {
86
+ throw new RxapFormSystemError('The control property of ControlContainer is not defined', '');
87
+ }
88
+ const control = parent.control.get(controlPath);
89
+ if (!control) {
90
+ throw new RxapFormSystemError('Could not find the control instance', '');
91
+ }
92
+ if (!(control instanceof RxapFormControl) &&
93
+ !(control instanceof RxapFormGroup) &&
94
+ !(control instanceof RxapFormArray)) {
95
+ throw new RxapFormSystemError('The extracted control is not a RxapFormControl', '');
96
+ }
97
+ return control;
98
+ }
99
+ }
100
+
101
+ class ExtractFormDefinitionMixin {
102
+ // TODO : change to AbstractControl from @rxap/forms
103
+ extractFormDefinition(control) {
104
+ const formDefinition = control.rxapFormDefinition;
105
+ if (!formDefinition) {
106
+ throw new RxapFormSystemError('Could not find the form definition instance', '');
107
+ }
108
+ return formDefinition;
109
+ }
110
+ }
111
+
112
+ function UseDataSource(dataSource, name, settings) {
113
+ return function (target, propertyKey) {
114
+ const value = {
115
+ dataSource,
116
+ settings,
117
+ };
118
+ setMetadataMapMap(propertyKey, name, value, FormSystemMetadataKeys.DATA_SOURCES, target);
119
+ };
120
+ }
121
+
122
+ class ExtractControlMixin {
123
+ extractControl(ngControl = this.ngControl ??
124
+ this.matFormField?._control?.ngControl ??
125
+ null) {
126
+ if (!ngControl) {
127
+ throw new Error('The ngControl is not defined!');
128
+ }
129
+ if (!(ngControl instanceof NgControl)) {
130
+ throw new Error('The AbstractControlDirective is not a NgControl!');
131
+ }
132
+ this.ngControl = ngControl;
133
+ const control = this.ngControl.control;
134
+ if (!(control instanceof RxapFormControl)) {
135
+ throw new Error('Control is not a RxapFormControl!');
136
+ }
137
+ return this.control = control;
138
+ }
139
+ }
140
+
141
+ const DATA_SOURCE_NAME = 'options';
142
+ function ComposeOptionsTransformers(...fnc) {
143
+ return base => fnc.reduce((source, transform) => transform(source), base);
144
+ }
145
+ function UseOptionsDataSource(dataSource, settings) {
146
+ return function (target, propertyKey) {
147
+ UseDataSource(dataSource, DATA_SOURCE_NAME, settings)(target, propertyKey);
148
+ };
149
+ }
150
+ let ExtractOptionsDataSourceMixin = class ExtractOptionsDataSourceMixin {
151
+ extractOptionsDatasource(control) {
152
+ control ??= this.extractControl();
153
+ if (!(control instanceof RxapFormControl)) {
154
+ throw new Error('Ensure to use a RxapFromControl');
155
+ }
156
+ const formDefinition = this.extractFormDefinition(control);
157
+ const useDataSourceValueMap = this.extractDataSources(formDefinition, control.controlId);
158
+ if (!useDataSourceValueMap.has('options')) {
159
+ throw new Error(`The data source with the name 'options' is not defined`);
160
+ }
161
+ const useDataSourceValue = this.useDataSourceValue = useDataSourceValueMap.get('options');
162
+ this.settings = this.useDataSourceValue.settings ?? {};
163
+ let dataSource;
164
+ try {
165
+ dataSource = this.dataSourceLoader.load(useDataSourceValue.dataSource, this.metadata, this.injector);
166
+ }
167
+ catch (e) {
168
+ if (e.name && e.name === 'NullInjectorError') {
169
+ if (isDevMode()) {
170
+ console.error('Cloud not inject the options data source', this.useDataSourceValue);
171
+ }
172
+ throw new Error('Cloud not inject the options data source:\n' + e.message);
173
+ }
174
+ throw e;
175
+ }
176
+ if (this.settings?.transformer) {
177
+ dataSource = new PipeDataSource(dataSource, map(this.settings.transformer), tap(options => useDataSourceValue.lastValue = options));
178
+ }
179
+ else {
180
+ dataSource = new PipeDataSource(dataSource, tap(options => useDataSourceValue.lastValue = options));
181
+ }
182
+ return this.dataSource = dataSource;
183
+ }
184
+ };
185
+ ExtractOptionsDataSourceMixin = __decorate([
186
+ Mixin(ExtractControlMixin, ExtractFormDefinitionMixin, ExtractDataSourcesMixin)
187
+ ], ExtractOptionsDataSourceMixin);
188
+
45
189
  let FormSystemControlDirective = class FormSystemControlDirective {
46
190
  constructor(parent, cfr, viewContainerRef, dataSourceLoader, injector) {
47
191
  this.parent = parent;
@@ -137,8 +281,8 @@ let FormSystemControlDirective = class FormSystemControlDirective {
137
281
  }
138
282
  return map.get(this.controlId);
139
283
  }
140
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: FormSystemControlDirective, deps: [{ token: ControlContainer }, { token: ComponentFactoryResolver }, { token: ViewContainerRef }, { token: DataSourceLoader }, { token: INJECTOR }], target: i0.ɵɵFactoryTarget.Directive }); }
141
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.2", type: FormSystemControlDirective, selector: "[rxapFormSystemControl]", inputs: { controlId: "controlId" }, ngImport: i0 }); }
284
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormSystemControlDirective, deps: [{ token: ControlContainer }, { token: ComponentFactoryResolver }, { token: ViewContainerRef }, { token: DataSourceLoader }, { token: INJECTOR }], target: i0.ɵɵFactoryTarget.Directive }); }
285
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.4", type: FormSystemControlDirective, isStandalone: true, selector: "[rxapFormSystemControl]", inputs: { controlId: "controlId" }, ngImport: i0 }); }
142
286
  };
143
287
  __decorate([
144
288
  Required,
@@ -160,10 +304,11 @@ FormSystemControlDirective = __decorate([
160
304
  DataSourceLoader,
161
305
  Injector])
162
306
  ], FormSystemControlDirective);
163
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: FormSystemControlDirective, decorators: [{
307
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormSystemControlDirective, decorators: [{
164
308
  type: Directive,
165
309
  args: [{
166
- selector: '[rxapFormSystemControl]'
310
+ selector: '[rxapFormSystemControl]',
311
+ standalone: true,
167
312
  }]
168
313
  }], ctorParameters: function () { return [{ type: i1.ControlContainer, decorators: [{
169
314
  type: Inject,
@@ -184,157 +329,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
184
329
  type: Input
185
330
  }], control: [], componentRef: [] } });
186
331
 
187
- class FormSystemModule {
188
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: FormSystemModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
189
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.2", ngImport: i0, type: FormSystemModule, declarations: [FormSystemControlDirective], exports: [FormSystemControlDirective] }); }
190
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: FormSystemModule }); }
191
- }
192
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: FormSystemModule, decorators: [{
193
- type: NgModule,
194
- args: [{
195
- declarations: [FormSystemControlDirective],
196
- exports: [FormSystemControlDirective],
197
- imports: []
198
- }]
199
- }] });
200
-
201
- const RXAP_FORM_CONTROL_SOURCE = new InjectionToken('rxap/forms/data-source');
202
- class ControlDataSource extends BaseDataSource {
203
- constructor(control, metadata = null) {
204
- super(metadata);
205
- this.control = control;
206
- }
207
- init() {
208
- if (this._initialised) {
209
- return;
210
- }
211
- super.init();
212
- if (isDevMode()) {
213
- console.log(this.control);
214
- }
215
- this._data$ = this.control.valueChanges.pipe(startWith(this.control.value), distinctUntilChanged((a, b) => equals(a, b)), shareReplay(1));
216
- }
217
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ControlDataSource, deps: [{ token: RXAP_FORM_CONTROL_SOURCE }, { token: RXAP_DATA_SOURCE_METADATA, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
218
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ControlDataSource }); }
219
- }
220
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ControlDataSource, decorators: [{
221
- type: Injectable
222
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
223
- type: Inject,
224
- args: [RXAP_FORM_CONTROL_SOURCE]
225
- }] }, { type: undefined, decorators: [{
226
- type: Optional
227
- }, {
228
- type: Inject,
229
- args: [RXAP_DATA_SOURCE_METADATA]
230
- }] }]; } });
231
- function controlDataSource(control) {
232
- // TODO : remove as any (wait for @rxap/forms update)
233
- return new ControlDataSource(control, { id: control.controlId });
234
- }
235
-
236
- class ExtractControlFromParentMixin {
237
- extractControlFromParent(parent, controlPath) {
238
- if (!controlPath) {
239
- throw new RxapFormSystemError('The control path is empty', '');
240
- }
241
- if (!parent.control) {
242
- throw new RxapFormSystemError('The control property of ControlContainer is not defined', '');
243
- }
244
- const control = parent.control.get(controlPath);
245
- if (!control) {
246
- throw new RxapFormSystemError('Could not find the control instance', '');
247
- }
248
- if (!(control instanceof RxapFormControl) && !(control instanceof RxapFormGroup) && !(control instanceof RxapFormArray)) {
249
- throw new RxapFormSystemError('The extracted control is not a RxapFormControl', '');
250
- }
251
- return control;
252
- }
253
- }
254
-
255
- class ExtractFormDefinitionMixin {
256
- // TODO : change to AbstractControl from @rxap/forms
257
- extractFormDefinition(control) {
258
- const formDefinition = control.rxapFormDefinition;
259
- if (!formDefinition) {
260
- throw new RxapFormSystemError('Could not find the form definition instance', '');
261
- }
262
- return formDefinition;
263
- }
264
- }
265
-
266
- function UseDataSource(dataSource, name, settings) {
267
- return function (target, propertyKey) {
268
- const value = { dataSource, settings };
269
- setMetadataMapMap(propertyKey, name, value, FormSystemMetadataKeys.DATA_SOURCES, target);
270
- };
271
- }
272
-
273
- class ExtractControlMixin {
274
- extractControl(ngControl = this.ngControl ?? this.matFormField?._control?.ngControl ?? null) {
275
- if (!ngControl) {
276
- throw new Error('The ngControl is not defined!');
277
- }
278
- if (!(ngControl instanceof NgControl)) {
279
- throw new Error('The AbstractControlDirective is not a NgControl!');
280
- }
281
- this.ngControl = ngControl;
282
- const control = this.ngControl.control;
283
- if (!(control instanceof RxapFormControl)) {
284
- throw new Error('Control is not a RxapFormControl!');
285
- }
286
- return this.control = control;
287
- }
288
- }
289
-
290
- const DATA_SOURCE_NAME = 'options';
291
- function ComposeOptionsTransformers(...fnc) {
292
- return base => fnc.reduce((source, transform) => transform(source), base);
293
- }
294
- function UseOptionsDataSource(dataSource, settings) {
295
- return function (target, propertyKey) {
296
- UseDataSource(dataSource, DATA_SOURCE_NAME, settings)(target, propertyKey);
297
- };
298
- }
299
- let ExtractOptionsDataSourceMixin = class ExtractOptionsDataSourceMixin {
300
- extractOptionsDatasource(control) {
301
- control ??= this.extractControl();
302
- if (!(control instanceof RxapFormControl)) {
303
- throw new Error('Ensure to use a RxapFromControl');
304
- }
305
- const formDefinition = this.extractFormDefinition(control);
306
- const useDataSourceValueMap = this.extractDataSources(formDefinition, control.controlId);
307
- if (!useDataSourceValueMap.has('options')) {
308
- throw new Error(`The data source with the name 'options' is not defined`);
309
- }
310
- const useDataSourceValue = this.useDataSourceValue = useDataSourceValueMap.get('options');
311
- this.settings = this.useDataSourceValue.settings ?? {};
312
- let dataSource;
313
- try {
314
- dataSource = this.dataSourceLoader.load(useDataSourceValue.dataSource, this.metadata, this.injector);
315
- }
316
- catch (e) {
317
- if (e.name && e.name === 'NullInjectorError') {
318
- if (isDevMode()) {
319
- console.error('Cloud not inject the options data source', this.useDataSourceValue);
320
- }
321
- throw new Error('Cloud not inject the options data source:\n' + e.message);
322
- }
323
- throw e;
324
- }
325
- if (this.settings?.transformer) {
326
- dataSource = new PipeDataSource(dataSource, map(this.settings.transformer), tap(options => useDataSourceValue.lastValue = options));
327
- }
328
- else {
329
- dataSource = new PipeDataSource(dataSource, tap(options => useDataSourceValue.lastValue = options));
330
- }
331
- return this.dataSource = dataSource;
332
- }
333
- };
334
- ExtractOptionsDataSourceMixin = __decorate([
335
- Mixin(ExtractControlMixin, ExtractFormDefinitionMixin, ExtractDataSourcesMixin)
336
- ], ExtractOptionsDataSourceMixin);
337
-
338
332
  function UseComponent(component, setProperties = {}) {
339
333
  return function (target, propertyKey) {
340
334
  setMetadataMap(propertyKey, component, FormSystemMetadataKeys.COMPONENTS, target);
@@ -475,18 +469,19 @@ let ControlHideShowDirective = class ControlHideShowDirective {
475
469
  reset() {
476
470
  this.renderer.removeStyle(this.elementRef.nativeElement, 'display');
477
471
  }
478
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ControlHideShowDirective, deps: [{ token: Renderer2 }, { token: ElementRef }, { token: ControlContainer, optional: true }, { token: NgControl, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Directive }); }
479
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.2", type: ControlHideShowDirective, selector: "[rxapControlHideShow]", inputs: { controlId: ["rxapControlHideShow", "controlId"] }, ngImport: i0 }); }
472
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ControlHideShowDirective, deps: [{ token: Renderer2 }, { token: ElementRef }, { token: ControlContainer, optional: true }, { token: NgControl, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Directive }); }
473
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.4", type: ControlHideShowDirective, isStandalone: true, selector: "[rxapControlHideShow]", inputs: { controlId: ["rxapControlHideShow", "controlId"] }, ngImport: i0 }); }
480
474
  };
481
475
  ControlHideShowDirective = __decorate([
482
476
  Mixin(ExtractControlFromParentMixin, ExtractFormDefinitionMixin),
483
477
  __metadata("design:paramtypes", [Renderer2,
484
478
  ElementRef, Object, Object])
485
479
  ], ControlHideShowDirective);
486
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ControlHideShowDirective, decorators: [{
480
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ControlHideShowDirective, decorators: [{
487
481
  type: Directive,
488
482
  args: [{
489
- selector: '[rxapControlHideShow]'
483
+ selector: '[rxapControlHideShow]',
484
+ standalone: true,
490
485
  }]
491
486
  }], ctorParameters: function () { return [{ type: i0.Renderer2, decorators: [{
492
487
  type: Inject,
@@ -510,18 +505,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
510
505
  type: Input,
511
506
  args: ['rxapControlHideShow']
512
507
  }] } });
513
- class ControlHideShowDirectiveModule {
514
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ControlHideShowDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
515
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.2", ngImport: i0, type: ControlHideShowDirectiveModule, declarations: [ControlHideShowDirective], exports: [ControlHideShowDirective] }); }
516
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ControlHideShowDirectiveModule }); }
517
- }
518
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ControlHideShowDirectiveModule, decorators: [{
519
- type: NgModule,
520
- args: [{
521
- declarations: [ControlHideShowDirective],
522
- exports: [ControlHideShowDirective]
523
- }]
524
- }] });
525
508
 
526
509
  let InputSelectOptionsDirective = class InputSelectOptionsDirective {
527
510
  constructor(template, dataSourceLoader, viewContainerRef, injector, cdr,
@@ -570,7 +553,8 @@ let InputSelectOptionsDirective = class InputSelectOptionsDirective {
570
553
  if (!value) {
571
554
  return '';
572
555
  }
573
- return this.options?.find((option) => option.value === value)?.display ?? (isDevMode() ? 'to display error' : '');
556
+ return this.options?.find((option) => option.value === value)?.display ??
557
+ (isDevMode() ? 'to display error' : '');
574
558
  }
575
559
  ngOnDestroy() {
576
560
  this.subscription?.unsubscribe();
@@ -586,8 +570,13 @@ let InputSelectOptionsDirective = class InputSelectOptionsDirective {
586
570
  }
587
571
  else {
588
572
  return Object.entries(options)
589
- .filter(([value, display]) => typeof display === 'string' && display.toLowerCase().includes(controlValue))
590
- .map(([value, display]) => ({ value, display }));
573
+ .filter(([value, display]) => typeof display ===
574
+ 'string' &&
575
+ display.toLowerCase().includes(controlValue))
576
+ .map(([value, display]) => ({
577
+ value,
578
+ display,
579
+ }));
591
580
  }
592
581
  }
593
582
  return options;
@@ -608,7 +597,12 @@ let InputSelectOptionsDirective = class InputSelectOptionsDirective {
608
597
  if (options) {
609
598
  if (!Array.isArray(options)) {
610
599
  for (const [value, display] of Object.entries(options)) {
611
- this.viewContainerRef.createEmbeddedView(this.template, { $implicit: { value, display } });
600
+ this.viewContainerRef.createEmbeddedView(this.template, {
601
+ $implicit: {
602
+ value,
603
+ display,
604
+ },
605
+ });
612
606
  }
613
607
  }
614
608
  else {
@@ -624,8 +618,8 @@ let InputSelectOptionsDirective = class InputSelectOptionsDirective {
624
618
  }
625
619
  this.cdr.detectChanges();
626
620
  }
627
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: InputSelectOptionsDirective, deps: [{ token: TemplateRef }, { token: DataSourceLoader }, { token: ViewContainerRef }, { token: INJECTOR }, { token: ChangeDetectorRef }, { token: NgControl, optional: true }, { token: MAT_LEGACY_FORM_FIELD, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
628
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.2", type: InputSelectOptionsDirective, selector: "[rxapInputSelectOptions]", inputs: { viewer: ["rxapInputSelectOptionsViewer", "viewer"], metadata: ["rxapInputSelectOptionsMetadata", "metadata"], matAutocomplete: ["rxapInputSelectOptionsMatAutocomplete", "matAutocomplete"] }, ngImport: i0 }); }
621
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: InputSelectOptionsDirective, deps: [{ token: TemplateRef }, { token: DataSourceLoader }, { token: ViewContainerRef }, { token: INJECTOR }, { token: ChangeDetectorRef }, { token: NgControl, optional: true }, { token: MAT_FORM_FIELD, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
622
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.4", type: InputSelectOptionsDirective, isStandalone: true, selector: "[rxapInputSelectOptions]", inputs: { viewer: ["rxapInputSelectOptionsViewer", "viewer"], metadata: ["rxapInputSelectOptionsMetadata", "metadata"], matAutocomplete: ["rxapInputSelectOptionsMatAutocomplete", "matAutocomplete"] }, ngImport: i0 }); }
629
623
  };
630
624
  __decorate([
631
625
  Required,
@@ -643,10 +637,11 @@ InputSelectOptionsDirective = __decorate([
643
637
  Injector,
644
638
  ChangeDetectorRef, Object, Object])
645
639
  ], InputSelectOptionsDirective);
646
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: InputSelectOptionsDirective, decorators: [{
640
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: InputSelectOptionsDirective, decorators: [{
647
641
  type: Directive,
648
642
  args: [{
649
- selector: '[rxapInputSelectOptions]'
643
+ selector: '[rxapInputSelectOptions]',
644
+ standalone: true,
650
645
  }]
651
646
  }], ctorParameters: function () { return [{ type: i0.TemplateRef, decorators: [{
652
647
  type: Inject,
@@ -668,11 +663,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
668
663
  }, {
669
664
  type: Inject,
670
665
  args: [NgControl]
671
- }] }, { type: i3.MatLegacyFormField, decorators: [{
666
+ }] }, { type: i3.MatFormField, decorators: [{
672
667
  type: Optional
673
668
  }, {
674
669
  type: Inject,
675
- args: [MAT_LEGACY_FORM_FIELD]
670
+ args: [MAT_FORM_FIELD]
676
671
  }] }]; }, propDecorators: { viewer: [{
677
672
  type: Input,
678
673
  args: ['rxapInputSelectOptionsViewer']
@@ -683,35 +678,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
683
678
  type: Input,
684
679
  args: ['rxapInputSelectOptionsMatAutocomplete']
685
680
  }], control: [], dataSource: [] } });
686
- class InputSelectOptionsDirectiveModule {
687
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: InputSelectOptionsDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
688
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.2", ngImport: i0, type: InputSelectOptionsDirectiveModule, declarations: [InputSelectOptionsDirective], exports: [InputSelectOptionsDirective] }); }
689
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: InputSelectOptionsDirectiveModule }); }
690
- }
691
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: InputSelectOptionsDirectiveModule, decorators: [{
692
- type: NgModule,
693
- args: [{
694
- declarations: [InputSelectOptionsDirective],
695
- exports: [InputSelectOptionsDirective]
696
- }]
697
- }] });
698
-
699
- class FormSystemDirectivesModule {
700
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: FormSystemDirectivesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
701
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.2", ngImport: i0, type: FormSystemDirectivesModule, exports: [InputSelectOptionsDirectiveModule,
702
- ControlHideShowDirectiveModule] }); }
703
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: FormSystemDirectivesModule, imports: [InputSelectOptionsDirectiveModule,
704
- ControlHideShowDirectiveModule] }); }
705
- }
706
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: FormSystemDirectivesModule, decorators: [{
707
- type: NgModule,
708
- args: [{
709
- exports: [
710
- InputSelectOptionsDirectiveModule,
711
- ControlHideShowDirectiveModule
712
- ]
713
- }]
714
- }] });
715
681
 
716
682
  class IsEqualToDirective {
717
683
  set equalTo(value) {
@@ -724,7 +690,12 @@ class IsEqualToDirective {
724
690
  if (this._equalTo === null || this._equalTo === control.value) {
725
691
  return null;
726
692
  }
727
- return { isEqualTo: { value: this._equalTo, actualValue: control.value } };
693
+ return {
694
+ isEqualTo: {
695
+ value: this._equalTo,
696
+ actualValue: control.value,
697
+ },
698
+ };
728
699
  }
729
700
  /**
730
701
  * @description
@@ -735,13 +706,13 @@ class IsEqualToDirective {
735
706
  registerOnValidatorChange(fn) {
736
707
  this._onChange = fn;
737
708
  }
738
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: IsEqualToDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
739
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.2", type: IsEqualToDirective, selector: "[rxapIsEqualTo]", inputs: { equalTo: ["rxapIsEqualTo", "equalTo"] }, providers: [
709
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: IsEqualToDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
710
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.4", type: IsEqualToDirective, isStandalone: true, selector: "[rxapIsEqualTo]", inputs: { equalTo: ["rxapIsEqualTo", "equalTo"] }, providers: [
740
711
  {
741
712
  provide: NG_VALIDATORS,
742
713
  multi: true,
743
- useExisting: forwardRef(() => IsEqualToDirective)
744
- }
714
+ useExisting: forwardRef(() => IsEqualToDirective),
715
+ },
745
716
  ], ngImport: i0 }); }
746
717
  }
747
718
  __decorate([
@@ -749,7 +720,7 @@ __decorate([
749
720
  __metadata("design:type", Object),
750
721
  __metadata("design:paramtypes", [Object])
751
722
  ], IsEqualToDirective.prototype, "equalTo", null);
752
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: IsEqualToDirective, decorators: [{
723
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: IsEqualToDirective, decorators: [{
753
724
  type: Directive,
754
725
  args: [{
755
726
  selector: '[rxapIsEqualTo]',
@@ -757,29 +728,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
757
728
  {
758
729
  provide: NG_VALIDATORS,
759
730
  multi: true,
760
- useExisting: forwardRef(() => IsEqualToDirective)
761
- }
762
- ]
731
+ useExisting: forwardRef(() => IsEqualToDirective),
732
+ },
733
+ ],
734
+ standalone: true,
763
735
  }]
764
736
  }], propDecorators: { equalTo: [{
765
737
  type: Input,
766
738
  args: ['rxapIsEqualTo']
767
739
  }] } });
768
- class IsEqualToDirectiveModule {
769
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: IsEqualToDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
770
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.2", ngImport: i0, type: IsEqualToDirectiveModule, declarations: [IsEqualToDirective], exports: [IsEqualToDirective] }); }
771
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: IsEqualToDirectiveModule }); }
772
- }
773
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: IsEqualToDirectiveModule, decorators: [{
774
- type: NgModule,
775
- args: [{
776
- declarations: [IsEqualToDirective],
777
- exports: [IsEqualToDirective]
778
- }]
779
- }] });
780
740
 
781
741
  var IsSelectableValueDirective_1;
782
- let IsSelectableValueDirective = IsSelectableValueDirective_1 = class IsSelectableValueDirective {
742
+ let IsSelectableValueDirective = class IsSelectableValueDirective {
743
+ static { IsSelectableValueDirective_1 = this; }
783
744
  constructor(dataSourceLoader, injector) {
784
745
  this.dataSourceLoader = dataSourceLoader;
785
746
  this.injector = injector;
@@ -795,13 +756,17 @@ let IsSelectableValueDirective = IsSelectableValueDirective_1 = class IsSelectab
795
756
  options = data;
796
757
  }
797
758
  else {
798
- options = Object.entries(data).map(([value, display]) => ({ value, display }));
759
+ options = Object.entries(data)
760
+ .map(([value, display]) => ({
761
+ value,
762
+ display,
763
+ }));
799
764
  }
800
765
  if (!options.some(option => option.value === control.value)) {
801
766
  return {
802
767
  isSelectableValue: {
803
768
  expected: 'Value should be from the list of provided options',
804
- }
769
+ },
805
770
  };
806
771
  }
807
772
  }
@@ -811,13 +776,13 @@ let IsSelectableValueDirective = IsSelectableValueDirective_1 = class IsSelectab
811
776
  }
812
777
  return null;
813
778
  }
814
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: IsSelectableValueDirective, deps: [{ token: DataSourceLoader }, { token: INJECTOR }], target: i0.ɵɵFactoryTarget.Directive }); }
815
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.2", type: IsSelectableValueDirective, selector: "[rxapIsSelectableValue]", inputs: { viewer: "viewer" }, providers: [
779
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: IsSelectableValueDirective, deps: [{ token: DataSourceLoader }, { token: INJECTOR }], target: i0.ɵɵFactoryTarget.Directive }); }
780
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.4", type: IsSelectableValueDirective, isStandalone: true, selector: "[rxapIsSelectableValue]", inputs: { viewer: "viewer" }, providers: [
816
781
  {
817
782
  provide: NG_VALIDATORS,
818
783
  multi: true,
819
- useExisting: forwardRef(() => IsSelectableValueDirective_1)
820
- }
784
+ useExisting: forwardRef(() => IsSelectableValueDirective_1),
785
+ },
821
786
  ], ngImport: i0 }); }
822
787
  };
823
788
  IsSelectableValueDirective = IsSelectableValueDirective_1 = __decorate([
@@ -825,7 +790,7 @@ IsSelectableValueDirective = IsSelectableValueDirective_1 = __decorate([
825
790
  __metadata("design:paramtypes", [DataSourceLoader,
826
791
  Injector])
827
792
  ], IsSelectableValueDirective);
828
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: IsSelectableValueDirective, decorators: [{
793
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: IsSelectableValueDirective, decorators: [{
829
794
  type: Directive,
830
795
  args: [{
831
796
  selector: '[rxapIsSelectableValue]',
@@ -833,9 +798,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
833
798
  {
834
799
  provide: NG_VALIDATORS,
835
800
  multi: true,
836
- useExisting: forwardRef(() => IsSelectableValueDirective)
837
- }
838
- ]
801
+ useExisting: forwardRef(() => IsSelectableValueDirective),
802
+ },
803
+ ],
804
+ standalone: true,
839
805
  }]
840
806
  }], ctorParameters: function () { return [{ type: i1$1.DataSourceLoader, decorators: [{
841
807
  type: Inject,
@@ -846,18 +812,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
846
812
  }] }]; }, propDecorators: { viewer: [{
847
813
  type: Input
848
814
  }] } });
849
- class IsSelectableValueDirectiveModule {
850
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: IsSelectableValueDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
851
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.2", ngImport: i0, type: IsSelectableValueDirectiveModule, declarations: [IsSelectableValueDirective], exports: [IsSelectableValueDirective] }); }
852
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: IsSelectableValueDirectiveModule }); }
853
- }
854
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: IsSelectableValueDirectiveModule, decorators: [{
855
- type: NgModule,
856
- args: [{
857
- declarations: [IsSelectableValueDirective],
858
- exports: [IsSelectableValueDirective]
859
- }]
860
- }] });
861
815
 
862
816
  // endregion
863
817
 
@@ -865,5 +819,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
865
819
  * Generated bundle index. Do not edit.
866
820
  */
867
821
 
868
- export { ComposeOptionsTransformers, ControlDataSource, ControlHideShowDirective, ControlHideShowDirectiveModule, DATA_SOURCE_NAME, ExtractControlFromParentMixin, ExtractControlMixin, ExtractDataSourcesMixin, ExtractFormDefinitionMixin, ExtractOptionsDataSourceMixin, FormSystemControlDirective, FormSystemDirectivesModule, FormSystemMetadataKeys, FormSystemModule, InputSelectOptionsDirective, InputSelectOptionsDirectiveModule, IsEqualToDirective, IsEqualToDirectiveModule, IsSelectableValueDirective, IsSelectableValueDirectiveModule, RXAP_FORM_CONTROL_SOURCE, RXAP_FORM_SYSTEM_HIDE_METADATA, RXAP_FORM_SYSTEM_HIDE_SHOW_OPTIONS, RXAP_FORM_SYSTEM_SHOW_METADATA, RxapFormSystemError, UseComponent, UseDataSource, UseFormComponent, UseHideFunction, UseOptionsDataSource, UseShowFunction, controlDataSource };
822
+ export { ComposeOptionsTransformers, ControlDataSource, ControlHideShowDirective, DATA_SOURCE_NAME, ExtractControlFromParentMixin, ExtractControlMixin, ExtractDataSourcesMixin, ExtractFormDefinitionMixin, ExtractOptionsDataSourceMixin, FormSystemControlDirective, FormSystemMetadataKeys, InputSelectOptionsDirective, IsEqualToDirective, IsSelectableValueDirective, RXAP_FORM_CONTROL_SOURCE, RXAP_FORM_SYSTEM_HIDE_METADATA, RXAP_FORM_SYSTEM_HIDE_SHOW_OPTIONS, RXAP_FORM_SYSTEM_SHOW_METADATA, RxapFormSystemError, UseComponent, UseDataSource, UseFormComponent, UseHideFunction, UseOptionsDataSource, UseShowFunction, controlDataSource };
869
823
  //# sourceMappingURL=rxap-form-system.mjs.map