@rxap/form-system 16.0.0-dev.1 → 16.0.0-dev.11
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/CHANGELOG.md +344 -0
- package/LICENSE +621 -21
- package/LICENSE.md +621 -0
- package/README.md +7 -22
- package/esm2022/index.mjs +4 -2
- package/esm2022/lib/control-data-source.mjs +7 -8
- package/esm2022/lib/control-with-data-source.mjs +1 -1
- package/esm2022/lib/decorators/metadata-keys.mjs +1 -1
- package/esm2022/lib/decorators/use-component.mjs +2 -2
- package/esm2022/lib/decorators/use-data-source.mjs +6 -3
- package/esm2022/lib/decorators/use-form-component.mjs +2 -2
- package/esm2022/lib/directives/control-hide-show.directive.mjs +13 -26
- package/esm2022/lib/directives/form-directives.module.mjs +17 -14
- package/esm2022/lib/directives/input-select-options.directive.mjs +33 -44
- package/esm2022/lib/directives/options-from-remote-method.directive.mjs +131 -0
- package/esm2022/lib/error.mjs +1 -1
- package/esm2022/lib/form-context-from-activated-route.factory.mjs +4 -0
- package/esm2022/lib/form-system-control.directive.mjs +15 -27
- package/esm2022/lib/mixins/extract-control-from-parent.mixin.mjs +5 -3
- package/esm2022/lib/mixins/extract-control.mixin.mjs +5 -3
- package/esm2022/lib/mixins/extract-data-sources.mixin.mjs +2 -2
- package/esm2022/lib/mixins/extract-form-definition.mixin.mjs +1 -1
- package/esm2022/lib/mixins/extract-options-data-source.mixin.mjs +9 -10
- package/esm2022/lib/submit-context-form-adapter.factory.mjs +32 -0
- package/esm2022/lib/validators/is-equal-to.mjs +23 -35
- package/esm2022/lib/validators/is-selectable-value.directive.mjs +21 -29
- package/esm2022/rxap-form-system.mjs +1 -1
- package/fesm2022/rxap-form-system.mjs +394 -287
- package/fesm2022/rxap-form-system.mjs.map +1 -1
- package/index.d.ts +3 -1
- package/lib/directives/control-hide-show.directive.d.ts +2 -7
- package/lib/directives/form-directives.module.d.ts +1 -1
- package/lib/directives/input-select-options.directive.d.ts +6 -11
- package/lib/directives/options-from-remote-method.directive.d.ts +38 -0
- package/lib/form-context-from-activated-route.factory.d.ts +2 -0
- package/lib/form-system-control.directive.d.ts +2 -2
- package/lib/mixins/extract-control.mixin.d.ts +2 -2
- package/lib/mixins/extract-form-definition.mixin.d.ts +1 -1
- package/lib/mixins/extract-options-data-source.mixin.d.ts +6 -7
- package/lib/submit-context-form-adapter.factory.d.ts +13 -0
- package/lib/validators/is-equal-to.d.ts +1 -6
- package/lib/validators/is-selectable-value.directive.d.ts +1 -6
- package/package.json +74 -53
- package/theme.css +1 -0
- package/collection.json +0 -10
- package/esm2022/lib/form-system.module.mjs +0 -18
- package/lib/form-system.module.d.ts +0 -7
- package/migration.json +0 -4
- package/src/schematics/ng-add/index.d.ts +0 -2
- package/src/schematics/ng-add/index.js +0 -8
- package/src/schematics/ng-add/index.js.map +0 -1
- package/src/schematics/ng-add/schema.json +0 -7
|
@@ -1,19 +1,21 @@
|
|
|
1
|
+
import { RxapError, equals } 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 {
|
|
5
|
+
import { InjectionToken, isDevMode, Injectable, Inject, Optional, TemplateRef, ViewContainerRef, INJECTOR, ChangeDetectorRef, Injector, Directive, Input, ComponentFactoryResolver, Renderer2, ElementRef, Self, NgModule, forwardRef } from '@angular/core';
|
|
6
|
+
import { startWith, distinctUntilChanged, shareReplay, map, tap, catchError, throttleTime, switchMap } from 'rxjs/operators';
|
|
7
|
+
import { RXAP_FORM_CONTEXT, RxapFormControl, RxapFormGroup, RxapFormArray } from '@rxap/forms';
|
|
8
|
+
import * as i2 from '@rxap/remote-method';
|
|
9
|
+
import { ProxyRemoteMethod, RemoteMethodLoader } from '@rxap/remote-method';
|
|
3
10
|
import { __decorate, __metadata } from 'tslib';
|
|
4
|
-
import { RxapError, Required, equals } from '@rxap/utilities';
|
|
5
11
|
import * as i1 from '@angular/forms';
|
|
6
|
-
import {
|
|
7
|
-
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';
|
|
12
|
+
import { NgControl, ControlContainer, NG_VALIDATORS } from '@angular/forms';
|
|
10
13
|
import { Mixin } from '@rxap/mixin';
|
|
11
|
-
import {
|
|
12
|
-
import { map, startWith, distinctUntilChanged, shareReplay, tap, catchError, throttleTime, switchMap } from 'rxjs/operators';
|
|
14
|
+
import { setMetadataMapMap, getMetadata, setMetadataMap, setMetadata } from '@rxap/reflect-metadata';
|
|
13
15
|
import { Subscription, of, EMPTY } from 'rxjs';
|
|
14
|
-
import * as i3 from '@angular/material/
|
|
15
|
-
import {
|
|
16
|
-
import '@angular/material/
|
|
16
|
+
import * as i3 from '@angular/material/form-field';
|
|
17
|
+
import { MAT_FORM_FIELD } from '@angular/material/form-field';
|
|
18
|
+
import '@angular/material/autocomplete';
|
|
17
19
|
|
|
18
20
|
class RxapFormSystemError extends RxapError {
|
|
19
21
|
constructor(message, code, className) {
|
|
@@ -21,6 +23,203 @@ class RxapFormSystemError extends RxapError {
|
|
|
21
23
|
}
|
|
22
24
|
}
|
|
23
25
|
|
|
26
|
+
const RXAP_FORM_CONTROL_SOURCE = new InjectionToken('rxap/forms/data-source');
|
|
27
|
+
class ControlDataSource extends BaseDataSource {
|
|
28
|
+
constructor(control, metadata = null) {
|
|
29
|
+
super(metadata);
|
|
30
|
+
this.control = control;
|
|
31
|
+
}
|
|
32
|
+
init() {
|
|
33
|
+
if (this._initialised) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
super.init();
|
|
37
|
+
if (isDevMode()) {
|
|
38
|
+
console.log(this.control);
|
|
39
|
+
}
|
|
40
|
+
this._data$ = this.control.valueChanges.pipe(startWith(this.control.value), distinctUntilChanged((a, b) => equals(a, b)), shareReplay(1));
|
|
41
|
+
}
|
|
42
|
+
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 }); }
|
|
43
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ControlDataSource }); }
|
|
44
|
+
}
|
|
45
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ControlDataSource, decorators: [{
|
|
46
|
+
type: Injectable
|
|
47
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
48
|
+
type: Inject,
|
|
49
|
+
args: [RXAP_FORM_CONTROL_SOURCE]
|
|
50
|
+
}] }, { type: undefined, decorators: [{
|
|
51
|
+
type: Optional
|
|
52
|
+
}, {
|
|
53
|
+
type: Inject,
|
|
54
|
+
args: [RXAP_DATA_SOURCE_METADATA]
|
|
55
|
+
}] }]; } });
|
|
56
|
+
function controlDataSource(control) {
|
|
57
|
+
// TODO : remove as any (wait for @rxap/forms update)
|
|
58
|
+
return new ControlDataSource(control, { id: control.controlId });
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function FormContextFromActivatedRouteFactory(route) {
|
|
62
|
+
return route.snapshot.params;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const SUBMIT_CONTEXT_FORM_ADAPTER_METHOD = new InjectionToken('submit-context-form-adapter-method');
|
|
66
|
+
class SubmitContextFormAdapter extends ProxyRemoteMethod {
|
|
67
|
+
constructor(remoteMethod, context) {
|
|
68
|
+
super(remoteMethod);
|
|
69
|
+
this.context = context;
|
|
70
|
+
}
|
|
71
|
+
transformParameters(value) {
|
|
72
|
+
return {
|
|
73
|
+
parameters: this.context ?? {},
|
|
74
|
+
requestBody: value,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: SubmitContextFormAdapter, deps: [{ token: SUBMIT_CONTEXT_FORM_ADAPTER_METHOD }, { token: RXAP_FORM_CONTEXT }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
78
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: SubmitContextFormAdapter }); }
|
|
79
|
+
}
|
|
80
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: SubmitContextFormAdapter, decorators: [{
|
|
81
|
+
type: Injectable
|
|
82
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
83
|
+
type: Inject,
|
|
84
|
+
args: [SUBMIT_CONTEXT_FORM_ADAPTER_METHOD]
|
|
85
|
+
}] }, { type: undefined, decorators: [{
|
|
86
|
+
type: Inject,
|
|
87
|
+
args: [RXAP_FORM_CONTEXT]
|
|
88
|
+
}] }]; } });
|
|
89
|
+
function SubmitContextFormAdapterFactory(remoteMethod, context) {
|
|
90
|
+
return new SubmitContextFormAdapter(remoteMethod, context);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
class ExtractFormDefinitionMixin {
|
|
94
|
+
// TODO : change to AbstractControl from @rxap/forms
|
|
95
|
+
extractFormDefinition(control) {
|
|
96
|
+
const formDefinition = control.rxapFormDefinition;
|
|
97
|
+
if (!formDefinition) {
|
|
98
|
+
throw new RxapFormSystemError('Could not find the form definition instance', '');
|
|
99
|
+
}
|
|
100
|
+
return formDefinition;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const REMOTE_METHOD_NAME = 'options';
|
|
105
|
+
const RXAP_USE_REMOTE_METHOD = 'rxap/form-system/remote-method/use';
|
|
106
|
+
function UseRemoteMethod(remoteMethod, name) {
|
|
107
|
+
return function (target, propertyKey) {
|
|
108
|
+
setMetadataMapMap(propertyKey, name, remoteMethod, RXAP_USE_REMOTE_METHOD, target);
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function UseOptionsRemoteMethod(dataSource) {
|
|
112
|
+
return function (target, propertyKey) {
|
|
113
|
+
UseRemoteMethod(dataSource, REMOTE_METHOD_NAME)(target, propertyKey);
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
class ExtractRemoteMethodsMixin {
|
|
117
|
+
extractRemoteMethods(formDefinition, controlId) {
|
|
118
|
+
const map = getMetadata(RXAP_USE_REMOTE_METHOD, Object.getPrototypeOf(formDefinition));
|
|
119
|
+
if (!map) {
|
|
120
|
+
throw new RxapFormSystemError('Could not extract the use remote method map from the form definition instance', '');
|
|
121
|
+
}
|
|
122
|
+
if (!map.has(controlId)) {
|
|
123
|
+
throw new RxapFormSystemError('A use remote method definition does not exists in the form definition metadata', '');
|
|
124
|
+
}
|
|
125
|
+
return map.get(controlId);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
let OptionsFromRemoteMethodDirective = class OptionsFromRemoteMethodDirective {
|
|
129
|
+
constructor(ngControl, template, remoteMethodLoader, viewContainerRef, injector, cdr) {
|
|
130
|
+
this.ngControl = ngControl;
|
|
131
|
+
this.template = template;
|
|
132
|
+
this.remoteMethodLoader = remoteMethodLoader;
|
|
133
|
+
this.viewContainerRef = viewContainerRef;
|
|
134
|
+
this.injector = injector;
|
|
135
|
+
this.cdr = cdr;
|
|
136
|
+
this.withoutParameters = false;
|
|
137
|
+
}
|
|
138
|
+
ngOnChanges(changes) {
|
|
139
|
+
const parametersChanges = changes['parameters'];
|
|
140
|
+
if (parametersChanges) {
|
|
141
|
+
if (!this.remoteMethodToken) {
|
|
142
|
+
this.remoteMethodToken = this.extractRemoteMethodToken();
|
|
143
|
+
}
|
|
144
|
+
this.renderTemplate(parametersChanges.currentValue);
|
|
145
|
+
}
|
|
146
|
+
if (changes['withoutParameters']?.currentValue) {
|
|
147
|
+
if (!this.remoteMethodToken) {
|
|
148
|
+
this.remoteMethodToken = this.extractRemoteMethodToken();
|
|
149
|
+
}
|
|
150
|
+
this.renderTemplate();
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
extractRemoteMethodToken() {
|
|
154
|
+
const control = this.ngControl.control;
|
|
155
|
+
if (!(control instanceof RxapFormControl)) {
|
|
156
|
+
throw new Error('Control is not a RxapFormControl!');
|
|
157
|
+
}
|
|
158
|
+
const formDefinition = this.extractFormDefinition(control);
|
|
159
|
+
const remoteMethodsTokens = this.extractRemoteMethods(formDefinition, control.controlId);
|
|
160
|
+
if (!remoteMethodsTokens.has(REMOTE_METHOD_NAME)) {
|
|
161
|
+
throw new Error(`The remote method with the name 'options' is not defined`);
|
|
162
|
+
}
|
|
163
|
+
return remoteMethodsTokens.get(REMOTE_METHOD_NAME);
|
|
164
|
+
}
|
|
165
|
+
async renderTemplate(parameters) {
|
|
166
|
+
const options = await this.remoteMethodLoader.call$(this.remoteMethodToken, parameters, undefined, this.injector);
|
|
167
|
+
this.viewContainerRef.clear();
|
|
168
|
+
for (const option of options) {
|
|
169
|
+
this.viewContainerRef.createEmbeddedView(this.template, { $implicit: option });
|
|
170
|
+
}
|
|
171
|
+
if (this.resetOnChange !== undefined) {
|
|
172
|
+
this.ngControl.reset(this.resetOnChange);
|
|
173
|
+
}
|
|
174
|
+
this.cdr.detectChanges();
|
|
175
|
+
}
|
|
176
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: OptionsFromRemoteMethodDirective, deps: [{ token: NgControl }, { token: TemplateRef }, { token: RemoteMethodLoader }, { token: ViewContainerRef }, { token: INJECTOR }, { token: ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
177
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.4", type: OptionsFromRemoteMethodDirective, isStandalone: true, selector: "[rxapOptionsFromRemoteMethod]", inputs: { parameters: ["rxapOptionsFromRemoteMethodParameters", "parameters"], resetOnChange: ["rxapOptionsFromRemoteMethodResetOnChange", "resetOnChange"], withoutParameters: ["rxapOptionsFromRemoteMethodWithoutParameters", "withoutParameters"] }, usesOnChanges: true, ngImport: i0 }); }
|
|
178
|
+
};
|
|
179
|
+
OptionsFromRemoteMethodDirective = __decorate([
|
|
180
|
+
Mixin(ExtractFormDefinitionMixin, ExtractRemoteMethodsMixin),
|
|
181
|
+
__metadata("design:paramtypes", [NgControl,
|
|
182
|
+
TemplateRef,
|
|
183
|
+
RemoteMethodLoader,
|
|
184
|
+
ViewContainerRef,
|
|
185
|
+
Injector,
|
|
186
|
+
ChangeDetectorRef])
|
|
187
|
+
], OptionsFromRemoteMethodDirective);
|
|
188
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: OptionsFromRemoteMethodDirective, decorators: [{
|
|
189
|
+
type: Directive,
|
|
190
|
+
args: [{
|
|
191
|
+
selector: '[rxapOptionsFromRemoteMethod]',
|
|
192
|
+
standalone: true,
|
|
193
|
+
}]
|
|
194
|
+
}], ctorParameters: function () { return [{ type: i1.NgControl, decorators: [{
|
|
195
|
+
type: Inject,
|
|
196
|
+
args: [NgControl]
|
|
197
|
+
}] }, { type: i0.TemplateRef, decorators: [{
|
|
198
|
+
type: Inject,
|
|
199
|
+
args: [TemplateRef]
|
|
200
|
+
}] }, { type: i2.RemoteMethodLoader, decorators: [{
|
|
201
|
+
type: Inject,
|
|
202
|
+
args: [RemoteMethodLoader]
|
|
203
|
+
}] }, { type: i0.ViewContainerRef, decorators: [{
|
|
204
|
+
type: Inject,
|
|
205
|
+
args: [ViewContainerRef]
|
|
206
|
+
}] }, { type: i0.Injector, decorators: [{
|
|
207
|
+
type: Inject,
|
|
208
|
+
args: [INJECTOR]
|
|
209
|
+
}] }, { type: i0.ChangeDetectorRef, decorators: [{
|
|
210
|
+
type: Inject,
|
|
211
|
+
args: [ChangeDetectorRef]
|
|
212
|
+
}] }]; }, propDecorators: { parameters: [{
|
|
213
|
+
type: Input,
|
|
214
|
+
args: ['rxapOptionsFromRemoteMethodParameters']
|
|
215
|
+
}], resetOnChange: [{
|
|
216
|
+
type: Input,
|
|
217
|
+
args: ['rxapOptionsFromRemoteMethodResetOnChange']
|
|
218
|
+
}], withoutParameters: [{
|
|
219
|
+
type: Input,
|
|
220
|
+
args: ['rxapOptionsFromRemoteMethodWithoutParameters']
|
|
221
|
+
}] } });
|
|
222
|
+
|
|
24
223
|
var FormSystemMetadataKeys;
|
|
25
224
|
(function (FormSystemMetadataKeys) {
|
|
26
225
|
FormSystemMetadataKeys["COMPONENTS"] = "rxap/form-system/components";
|
|
@@ -42,6 +241,104 @@ class ExtractDataSourcesMixin {
|
|
|
42
241
|
}
|
|
43
242
|
}
|
|
44
243
|
|
|
244
|
+
class ExtractControlFromParentMixin {
|
|
245
|
+
extractControlFromParent(parent, controlPath) {
|
|
246
|
+
if (!controlPath) {
|
|
247
|
+
throw new RxapFormSystemError('The control path is empty', '');
|
|
248
|
+
}
|
|
249
|
+
if (!parent.control) {
|
|
250
|
+
throw new RxapFormSystemError('The control property of ControlContainer is not defined', '');
|
|
251
|
+
}
|
|
252
|
+
const control = parent.control.get(controlPath);
|
|
253
|
+
if (!control) {
|
|
254
|
+
throw new RxapFormSystemError('Could not find the control instance', '');
|
|
255
|
+
}
|
|
256
|
+
if (!(control instanceof RxapFormControl) &&
|
|
257
|
+
!(control instanceof RxapFormGroup) &&
|
|
258
|
+
!(control instanceof RxapFormArray)) {
|
|
259
|
+
throw new RxapFormSystemError('The extracted control is not a RxapFormControl', '');
|
|
260
|
+
}
|
|
261
|
+
return control;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
function UseDataSource(dataSource, name, settings) {
|
|
266
|
+
return function (target, propertyKey) {
|
|
267
|
+
const value = {
|
|
268
|
+
dataSource,
|
|
269
|
+
settings,
|
|
270
|
+
};
|
|
271
|
+
setMetadataMapMap(propertyKey, name, value, FormSystemMetadataKeys.DATA_SOURCES, target);
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
class ExtractControlMixin {
|
|
276
|
+
extractControl(ngControl = this.ngControl ??
|
|
277
|
+
this.matFormField?._control?.ngControl ??
|
|
278
|
+
null) {
|
|
279
|
+
if (!ngControl) {
|
|
280
|
+
throw new Error('The ngControl is not defined!');
|
|
281
|
+
}
|
|
282
|
+
if (!(ngControl instanceof NgControl)) {
|
|
283
|
+
throw new Error('The AbstractControlDirective is not a NgControl!');
|
|
284
|
+
}
|
|
285
|
+
this.ngControl = ngControl;
|
|
286
|
+
const control = this.ngControl.control;
|
|
287
|
+
if (!(control instanceof RxapFormControl)) {
|
|
288
|
+
throw new Error('Control is not a RxapFormControl!');
|
|
289
|
+
}
|
|
290
|
+
return this.control = control;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
const DATA_SOURCE_NAME = 'options';
|
|
295
|
+
function ComposeOptionsTransformers(...fnc) {
|
|
296
|
+
return base => fnc.reduce((source, transform) => transform(source), base);
|
|
297
|
+
}
|
|
298
|
+
function UseOptionsDataSource(dataSource, settings) {
|
|
299
|
+
return function (target, propertyKey) {
|
|
300
|
+
UseDataSource(dataSource, DATA_SOURCE_NAME, settings)(target, propertyKey);
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
let ExtractOptionsDataSourceMixin = class ExtractOptionsDataSourceMixin {
|
|
304
|
+
extractOptionsDatasource(control) {
|
|
305
|
+
control ??= this.extractControl();
|
|
306
|
+
if (!(control instanceof RxapFormControl)) {
|
|
307
|
+
throw new Error('Ensure to use a RxapFromControl');
|
|
308
|
+
}
|
|
309
|
+
const formDefinition = this.extractFormDefinition(control);
|
|
310
|
+
const useDataSourceValueMap = this.extractDataSources(formDefinition, control.controlId);
|
|
311
|
+
if (!useDataSourceValueMap.has('options')) {
|
|
312
|
+
throw new Error(`The data source with the name 'options' is not defined`);
|
|
313
|
+
}
|
|
314
|
+
const useDataSourceValue = this.useDataSourceValue = useDataSourceValueMap.get('options');
|
|
315
|
+
this.settings = this.useDataSourceValue.settings ?? {};
|
|
316
|
+
let dataSource;
|
|
317
|
+
try {
|
|
318
|
+
dataSource = this.dataSourceLoader.load(useDataSourceValue.dataSource, this.metadata, this.injector);
|
|
319
|
+
}
|
|
320
|
+
catch (e) {
|
|
321
|
+
if (e.name && e.name === 'NullInjectorError') {
|
|
322
|
+
if (isDevMode()) {
|
|
323
|
+
console.error('Cloud not inject the options data source', this.useDataSourceValue);
|
|
324
|
+
}
|
|
325
|
+
throw new Error('Cloud not inject the options data source:\n' + e.message);
|
|
326
|
+
}
|
|
327
|
+
throw e;
|
|
328
|
+
}
|
|
329
|
+
if (this.settings?.transformer) {
|
|
330
|
+
dataSource = new PipeDataSource(dataSource, map(this.settings.transformer), tap(options => useDataSourceValue.lastValue = options));
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
333
|
+
dataSource = new PipeDataSource(dataSource, tap(options => useDataSourceValue.lastValue = options));
|
|
334
|
+
}
|
|
335
|
+
return this.dataSource = dataSource;
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
ExtractOptionsDataSourceMixin = __decorate([
|
|
339
|
+
Mixin(ExtractControlMixin, ExtractFormDefinitionMixin, ExtractDataSourcesMixin)
|
|
340
|
+
], ExtractOptionsDataSourceMixin);
|
|
341
|
+
|
|
45
342
|
let FormSystemControlDirective = class FormSystemControlDirective {
|
|
46
343
|
constructor(parent, cfr, viewContainerRef, dataSourceLoader, injector) {
|
|
47
344
|
this.parent = parent;
|
|
@@ -137,21 +434,9 @@ let FormSystemControlDirective = class FormSystemControlDirective {
|
|
|
137
434
|
}
|
|
138
435
|
return map.get(this.controlId);
|
|
139
436
|
}
|
|
140
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
141
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.
|
|
437
|
+
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 }); }
|
|
438
|
+
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
439
|
};
|
|
143
|
-
__decorate([
|
|
144
|
-
Required,
|
|
145
|
-
__metadata("design:type", String)
|
|
146
|
-
], FormSystemControlDirective.prototype, "controlId", void 0);
|
|
147
|
-
__decorate([
|
|
148
|
-
Required,
|
|
149
|
-
__metadata("design:type", RxapFormControl)
|
|
150
|
-
], FormSystemControlDirective.prototype, "control", void 0);
|
|
151
|
-
__decorate([
|
|
152
|
-
Required,
|
|
153
|
-
__metadata("design:type", ComponentRef)
|
|
154
|
-
], FormSystemControlDirective.prototype, "componentRef", void 0);
|
|
155
440
|
FormSystemControlDirective = __decorate([
|
|
156
441
|
Mixin(ExtractDataSourcesMixin),
|
|
157
442
|
__metadata("design:paramtypes", [ControlContainer,
|
|
@@ -160,10 +445,11 @@ FormSystemControlDirective = __decorate([
|
|
|
160
445
|
DataSourceLoader,
|
|
161
446
|
Injector])
|
|
162
447
|
], FormSystemControlDirective);
|
|
163
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
448
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormSystemControlDirective, decorators: [{
|
|
164
449
|
type: Directive,
|
|
165
450
|
args: [{
|
|
166
|
-
selector: '[rxapFormSystemControl]'
|
|
451
|
+
selector: '[rxapFormSystemControl]',
|
|
452
|
+
standalone: true,
|
|
167
453
|
}]
|
|
168
454
|
}], ctorParameters: function () { return [{ type: i1.ControlContainer, decorators: [{
|
|
169
455
|
type: Inject,
|
|
@@ -181,159 +467,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
181
467
|
type: Inject,
|
|
182
468
|
args: [INJECTOR]
|
|
183
469
|
}] }]; }, propDecorators: { controlId: [{
|
|
184
|
-
type: Input
|
|
185
|
-
|
|
186
|
-
|
|
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);
|
|
470
|
+
type: Input,
|
|
471
|
+
args: [{ required: true }]
|
|
472
|
+
}] } });
|
|
337
473
|
|
|
338
474
|
function UseComponent(component, setProperties = {}) {
|
|
339
475
|
return function (target, propertyKey) {
|
|
@@ -475,18 +611,19 @@ let ControlHideShowDirective = class ControlHideShowDirective {
|
|
|
475
611
|
reset() {
|
|
476
612
|
this.renderer.removeStyle(this.elementRef.nativeElement, 'display');
|
|
477
613
|
}
|
|
478
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
479
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.
|
|
614
|
+
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 }); }
|
|
615
|
+
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
616
|
};
|
|
481
617
|
ControlHideShowDirective = __decorate([
|
|
482
618
|
Mixin(ExtractControlFromParentMixin, ExtractFormDefinitionMixin),
|
|
483
619
|
__metadata("design:paramtypes", [Renderer2,
|
|
484
620
|
ElementRef, Object, Object])
|
|
485
621
|
], ControlHideShowDirective);
|
|
486
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
622
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ControlHideShowDirective, decorators: [{
|
|
487
623
|
type: Directive,
|
|
488
624
|
args: [{
|
|
489
|
-
selector: '[rxapControlHideShow]'
|
|
625
|
+
selector: '[rxapControlHideShow]',
|
|
626
|
+
standalone: true,
|
|
490
627
|
}]
|
|
491
628
|
}], ctorParameters: function () { return [{ type: i0.Renderer2, decorators: [{
|
|
492
629
|
type: Inject,
|
|
@@ -510,18 +647,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
510
647
|
type: Input,
|
|
511
648
|
args: ['rxapControlHideShow']
|
|
512
649
|
}] } });
|
|
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
650
|
|
|
526
651
|
let InputSelectOptionsDirective = class InputSelectOptionsDirective {
|
|
527
652
|
constructor(template, dataSourceLoader, viewContainerRef, injector, cdr,
|
|
@@ -570,7 +695,8 @@ let InputSelectOptionsDirective = class InputSelectOptionsDirective {
|
|
|
570
695
|
if (!value) {
|
|
571
696
|
return '';
|
|
572
697
|
}
|
|
573
|
-
return this.options?.find((option) => option.value === value)?.display ??
|
|
698
|
+
return this.options?.find((option) => option.value === value)?.display ??
|
|
699
|
+
(isDevMode() ? 'to display error' : '');
|
|
574
700
|
}
|
|
575
701
|
ngOnDestroy() {
|
|
576
702
|
this.subscription?.unsubscribe();
|
|
@@ -586,8 +712,13 @@ let InputSelectOptionsDirective = class InputSelectOptionsDirective {
|
|
|
586
712
|
}
|
|
587
713
|
else {
|
|
588
714
|
return Object.entries(options)
|
|
589
|
-
.filter(([value, display]) => typeof display ===
|
|
590
|
-
|
|
715
|
+
.filter(([value, display]) => typeof display ===
|
|
716
|
+
'string' &&
|
|
717
|
+
display.toLowerCase().includes(controlValue))
|
|
718
|
+
.map(([value, display]) => ({
|
|
719
|
+
value,
|
|
720
|
+
display,
|
|
721
|
+
}));
|
|
591
722
|
}
|
|
592
723
|
}
|
|
593
724
|
return options;
|
|
@@ -608,7 +739,12 @@ let InputSelectOptionsDirective = class InputSelectOptionsDirective {
|
|
|
608
739
|
if (options) {
|
|
609
740
|
if (!Array.isArray(options)) {
|
|
610
741
|
for (const [value, display] of Object.entries(options)) {
|
|
611
|
-
this.viewContainerRef.createEmbeddedView(this.template, {
|
|
742
|
+
this.viewContainerRef.createEmbeddedView(this.template, {
|
|
743
|
+
$implicit: {
|
|
744
|
+
value,
|
|
745
|
+
display,
|
|
746
|
+
},
|
|
747
|
+
});
|
|
612
748
|
}
|
|
613
749
|
}
|
|
614
750
|
else {
|
|
@@ -624,17 +760,9 @@ let InputSelectOptionsDirective = class InputSelectOptionsDirective {
|
|
|
624
760
|
}
|
|
625
761
|
this.cdr.detectChanges();
|
|
626
762
|
}
|
|
627
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
628
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.
|
|
763
|
+
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 }); }
|
|
764
|
+
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
765
|
};
|
|
630
|
-
__decorate([
|
|
631
|
-
Required,
|
|
632
|
-
__metadata("design:type", RxapFormControl)
|
|
633
|
-
], InputSelectOptionsDirective.prototype, "control", void 0);
|
|
634
|
-
__decorate([
|
|
635
|
-
Required,
|
|
636
|
-
__metadata("design:type", BaseDataSource)
|
|
637
|
-
], InputSelectOptionsDirective.prototype, "dataSource", void 0);
|
|
638
766
|
InputSelectOptionsDirective = __decorate([
|
|
639
767
|
Mixin(ExtractOptionsDataSourceMixin),
|
|
640
768
|
__metadata("design:paramtypes", [TemplateRef,
|
|
@@ -643,10 +771,11 @@ InputSelectOptionsDirective = __decorate([
|
|
|
643
771
|
Injector,
|
|
644
772
|
ChangeDetectorRef, Object, Object])
|
|
645
773
|
], InputSelectOptionsDirective);
|
|
646
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
774
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: InputSelectOptionsDirective, decorators: [{
|
|
647
775
|
type: Directive,
|
|
648
776
|
args: [{
|
|
649
|
-
selector: '[rxapInputSelectOptions]'
|
|
777
|
+
selector: '[rxapInputSelectOptions]',
|
|
778
|
+
standalone: true,
|
|
650
779
|
}]
|
|
651
780
|
}], ctorParameters: function () { return [{ type: i0.TemplateRef, decorators: [{
|
|
652
781
|
type: Inject,
|
|
@@ -668,11 +797,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
668
797
|
}, {
|
|
669
798
|
type: Inject,
|
|
670
799
|
args: [NgControl]
|
|
671
|
-
}] }, { type: i3.
|
|
800
|
+
}] }, { type: i3.MatFormField, decorators: [{
|
|
672
801
|
type: Optional
|
|
673
802
|
}, {
|
|
674
803
|
type: Inject,
|
|
675
|
-
args: [
|
|
804
|
+
args: [MAT_FORM_FIELD]
|
|
676
805
|
}] }]; }, propDecorators: { viewer: [{
|
|
677
806
|
type: Input,
|
|
678
807
|
args: ['rxapInputSelectOptionsViewer']
|
|
@@ -682,34 +811,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
682
811
|
}], matAutocomplete: [{
|
|
683
812
|
type: Input,
|
|
684
813
|
args: ['rxapInputSelectOptionsMatAutocomplete']
|
|
685
|
-
}]
|
|
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
|
-
}] });
|
|
814
|
+
}] } });
|
|
698
815
|
|
|
699
816
|
class FormSystemDirectivesModule {
|
|
700
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
701
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
817
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormSystemDirectivesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
818
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.4", ngImport: i0, type: FormSystemDirectivesModule, imports: [InputSelectOptionsDirective,
|
|
819
|
+
ControlHideShowDirective], exports: [InputSelectOptionsDirective,
|
|
820
|
+
ControlHideShowDirective] }); }
|
|
821
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormSystemDirectivesModule }); }
|
|
705
822
|
}
|
|
706
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
823
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormSystemDirectivesModule, decorators: [{
|
|
707
824
|
type: NgModule,
|
|
708
825
|
args: [{
|
|
709
826
|
exports: [
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
]
|
|
827
|
+
InputSelectOptionsDirective,
|
|
828
|
+
ControlHideShowDirective,
|
|
829
|
+
],
|
|
830
|
+
imports: [
|
|
831
|
+
InputSelectOptionsDirective,
|
|
832
|
+
ControlHideShowDirective,
|
|
833
|
+
],
|
|
713
834
|
}]
|
|
714
835
|
}] });
|
|
715
836
|
|
|
@@ -724,7 +845,12 @@ class IsEqualToDirective {
|
|
|
724
845
|
if (this._equalTo === null || this._equalTo === control.value) {
|
|
725
846
|
return null;
|
|
726
847
|
}
|
|
727
|
-
return {
|
|
848
|
+
return {
|
|
849
|
+
isEqualTo: {
|
|
850
|
+
value: this._equalTo,
|
|
851
|
+
actualValue: control.value,
|
|
852
|
+
},
|
|
853
|
+
};
|
|
728
854
|
}
|
|
729
855
|
/**
|
|
730
856
|
* @description
|
|
@@ -735,21 +861,16 @@ class IsEqualToDirective {
|
|
|
735
861
|
registerOnValidatorChange(fn) {
|
|
736
862
|
this._onChange = fn;
|
|
737
863
|
}
|
|
738
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
739
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.
|
|
864
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: IsEqualToDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
865
|
+
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
866
|
{
|
|
741
867
|
provide: NG_VALIDATORS,
|
|
742
868
|
multi: true,
|
|
743
|
-
useExisting: forwardRef(() => IsEqualToDirective)
|
|
744
|
-
}
|
|
869
|
+
useExisting: forwardRef(() => IsEqualToDirective),
|
|
870
|
+
},
|
|
745
871
|
], ngImport: i0 }); }
|
|
746
872
|
}
|
|
747
|
-
|
|
748
|
-
Required,
|
|
749
|
-
__metadata("design:type", Object),
|
|
750
|
-
__metadata("design:paramtypes", [Object])
|
|
751
|
-
], IsEqualToDirective.prototype, "equalTo", null);
|
|
752
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: IsEqualToDirective, decorators: [{
|
|
873
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: IsEqualToDirective, decorators: [{
|
|
753
874
|
type: Directive,
|
|
754
875
|
args: [{
|
|
755
876
|
selector: '[rxapIsEqualTo]',
|
|
@@ -757,29 +878,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
757
878
|
{
|
|
758
879
|
provide: NG_VALIDATORS,
|
|
759
880
|
multi: true,
|
|
760
|
-
useExisting: forwardRef(() => IsEqualToDirective)
|
|
761
|
-
}
|
|
762
|
-
]
|
|
881
|
+
useExisting: forwardRef(() => IsEqualToDirective),
|
|
882
|
+
},
|
|
883
|
+
],
|
|
884
|
+
standalone: true,
|
|
763
885
|
}]
|
|
764
886
|
}], propDecorators: { equalTo: [{
|
|
765
887
|
type: Input,
|
|
766
|
-
args: [
|
|
888
|
+
args: [{
|
|
889
|
+
required: true,
|
|
890
|
+
alias: 'rxapIsEqualTo',
|
|
891
|
+
}]
|
|
767
892
|
}] } });
|
|
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
893
|
|
|
781
894
|
var IsSelectableValueDirective_1;
|
|
782
|
-
let IsSelectableValueDirective =
|
|
895
|
+
let IsSelectableValueDirective = class IsSelectableValueDirective {
|
|
896
|
+
static { IsSelectableValueDirective_1 = this; }
|
|
783
897
|
constructor(dataSourceLoader, injector) {
|
|
784
898
|
this.dataSourceLoader = dataSourceLoader;
|
|
785
899
|
this.injector = injector;
|
|
@@ -795,13 +909,17 @@ let IsSelectableValueDirective = IsSelectableValueDirective_1 = class IsSelectab
|
|
|
795
909
|
options = data;
|
|
796
910
|
}
|
|
797
911
|
else {
|
|
798
|
-
options = Object.entries(data)
|
|
912
|
+
options = Object.entries(data)
|
|
913
|
+
.map(([value, display]) => ({
|
|
914
|
+
value,
|
|
915
|
+
display,
|
|
916
|
+
}));
|
|
799
917
|
}
|
|
800
918
|
if (!options.some(option => option.value === control.value)) {
|
|
801
919
|
return {
|
|
802
920
|
isSelectableValue: {
|
|
803
921
|
expected: 'Value should be from the list of provided options',
|
|
804
|
-
}
|
|
922
|
+
},
|
|
805
923
|
};
|
|
806
924
|
}
|
|
807
925
|
}
|
|
@@ -811,13 +929,13 @@ let IsSelectableValueDirective = IsSelectableValueDirective_1 = class IsSelectab
|
|
|
811
929
|
}
|
|
812
930
|
return null;
|
|
813
931
|
}
|
|
814
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
815
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.
|
|
932
|
+
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 }); }
|
|
933
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.4", type: IsSelectableValueDirective, isStandalone: true, selector: "[rxapIsSelectableValue]", inputs: { viewer: "viewer" }, providers: [
|
|
816
934
|
{
|
|
817
935
|
provide: NG_VALIDATORS,
|
|
818
936
|
multi: true,
|
|
819
|
-
useExisting: forwardRef(() => IsSelectableValueDirective_1)
|
|
820
|
-
}
|
|
937
|
+
useExisting: forwardRef(() => IsSelectableValueDirective_1),
|
|
938
|
+
},
|
|
821
939
|
], ngImport: i0 }); }
|
|
822
940
|
};
|
|
823
941
|
IsSelectableValueDirective = IsSelectableValueDirective_1 = __decorate([
|
|
@@ -825,7 +943,7 @@ IsSelectableValueDirective = IsSelectableValueDirective_1 = __decorate([
|
|
|
825
943
|
__metadata("design:paramtypes", [DataSourceLoader,
|
|
826
944
|
Injector])
|
|
827
945
|
], IsSelectableValueDirective);
|
|
828
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
946
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: IsSelectableValueDirective, decorators: [{
|
|
829
947
|
type: Directive,
|
|
830
948
|
args: [{
|
|
831
949
|
selector: '[rxapIsSelectableValue]',
|
|
@@ -833,9 +951,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
833
951
|
{
|
|
834
952
|
provide: NG_VALIDATORS,
|
|
835
953
|
multi: true,
|
|
836
|
-
useExisting: forwardRef(() => IsSelectableValueDirective)
|
|
837
|
-
}
|
|
838
|
-
]
|
|
954
|
+
useExisting: forwardRef(() => IsSelectableValueDirective),
|
|
955
|
+
},
|
|
956
|
+
],
|
|
957
|
+
standalone: true,
|
|
839
958
|
}]
|
|
840
959
|
}], ctorParameters: function () { return [{ type: i1$1.DataSourceLoader, decorators: [{
|
|
841
960
|
type: Inject,
|
|
@@ -846,18 +965,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
846
965
|
}] }]; }, propDecorators: { viewer: [{
|
|
847
966
|
type: Input
|
|
848
967
|
}] } });
|
|
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
968
|
|
|
862
969
|
// endregion
|
|
863
970
|
|
|
@@ -865,5 +972,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
865
972
|
* Generated bundle index. Do not edit.
|
|
866
973
|
*/
|
|
867
974
|
|
|
868
|
-
export { ComposeOptionsTransformers, ControlDataSource, ControlHideShowDirective,
|
|
975
|
+
export { ComposeOptionsTransformers, ControlDataSource, ControlHideShowDirective, DATA_SOURCE_NAME, ExtractControlFromParentMixin, ExtractControlMixin, ExtractDataSourcesMixin, ExtractFormDefinitionMixin, ExtractOptionsDataSourceMixin, ExtractRemoteMethodsMixin, FormContextFromActivatedRouteFactory, FormSystemControlDirective, FormSystemDirectivesModule, FormSystemMetadataKeys, InputSelectOptionsDirective, IsEqualToDirective, IsSelectableValueDirective, OptionsFromRemoteMethodDirective, REMOTE_METHOD_NAME, RXAP_FORM_CONTROL_SOURCE, RXAP_FORM_SYSTEM_HIDE_METADATA, RXAP_FORM_SYSTEM_HIDE_SHOW_OPTIONS, RXAP_FORM_SYSTEM_SHOW_METADATA, RXAP_USE_REMOTE_METHOD, RxapFormSystemError, SUBMIT_CONTEXT_FORM_ADAPTER_METHOD, SubmitContextFormAdapter, SubmitContextFormAdapterFactory, UseComponent, UseDataSource, UseFormComponent, UseHideFunction, UseOptionsDataSource, UseOptionsRemoteMethod, UseRemoteMethod, UseShowFunction, controlDataSource };
|
|
869
976
|
//# sourceMappingURL=rxap-form-system.mjs.map
|