xt-components 0.4.8 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/xt-components.mjs +92 -79
- package/fesm2022/xt-components.mjs.map +1 -1
- package/index.d.ts +512 -3
- package/package.json +13 -13
- package/globals.d.ts +0 -10
- package/lib/angular/message-handler.d.ts +0 -7
- package/lib/angular/xt-resolver.service.d.ts +0 -40
- package/lib/angular/xt-tokens.d.ts +0 -7
- package/lib/output/xt-base-input.d.ts +0 -5
- package/lib/output/xt-base-output.d.ts +0 -5
- package/lib/plugin/xt-plugin-info.d.ts +0 -19
- package/lib/registry/xt-plugin-registry.d.ts +0 -34
- package/lib/render/xt-render-sub.component.d.ts +0 -28
- package/lib/render/xt-render.component.d.ts +0 -36
- package/lib/resolver/xt-registry-resolver.d.ts +0 -11
- package/lib/resolver/xt-resolver.d.ts +0 -5
- package/lib/store/store-support.d.ts +0 -60
- package/lib/test/store-test-helper.d.ts +0 -36
- package/lib/test/xt-test-helper-components.d.ts +0 -72
- package/lib/test/xt-unit-test-helper.d.ts +0 -2
- package/lib/type/type-helper.d.ts +0 -5
- package/lib/xt-component.d.ts +0 -22
- package/lib/xt-composite/xt-composite.component.d.ts +0 -21
- package/lib/xt-context.d.ts +0 -86
- package/lib/xt-resolved-component.d.ts +0 -8
- package/lib/xt-simple/xt-simple.component.d.ts +0 -44
- package/public-api.d.ts +0 -19
|
@@ -23,7 +23,7 @@ class XtBaseContext {
|
|
|
23
23
|
else {
|
|
24
24
|
throw new Error("Cannot display a value that does not exist. Are you sure you're not using Reactive Form with this context? " + this.toString());
|
|
25
25
|
}
|
|
26
|
-
});
|
|
26
|
+
}, ...(ngDevMode ? [{ debugName: "displayValue" }] : []));
|
|
27
27
|
this.displayMode = displayMode;
|
|
28
28
|
this.parentFormGroup = parentGroup;
|
|
29
29
|
this.parentContext = parentContext;
|
|
@@ -35,7 +35,7 @@ class XtBaseContext {
|
|
|
35
35
|
if (this.nonFormValue == null) {
|
|
36
36
|
if ((this.childContexts != null) && (this.childContexts.size > 0))
|
|
37
37
|
throw new Error('An XtContext with no values cannot have children ', { cause: this });
|
|
38
|
-
this.nonFormValue = signal(newValue);
|
|
38
|
+
this.nonFormValue = signal(newValue, ...(ngDevMode ? [{ debugName: "nonFormValue" }] : []));
|
|
39
39
|
}
|
|
40
40
|
else {
|
|
41
41
|
this.nonFormValue.set(newValue);
|
|
@@ -234,8 +234,8 @@ class XtPluginRegistry {
|
|
|
234
234
|
this.pluginRegistry = new Map();
|
|
235
235
|
this.componentRegistry = new Map();
|
|
236
236
|
this.componentByTypeCache = new Map();
|
|
237
|
-
this.listComponents = signal(new Array());
|
|
238
|
-
this.listPlugins = signal(new Array());
|
|
237
|
+
this.listComponents = signal(new Array(), ...(ngDevMode ? [{ debugName: "listComponents" }] : []));
|
|
238
|
+
this.listPlugins = signal(new Array(), ...(ngDevMode ? [{ debugName: "listPlugins" }] : []));
|
|
239
239
|
}
|
|
240
240
|
/**
|
|
241
241
|
* The component can manage any standard javascript primitives types. That's usually the default whenever we don't know any particular type
|
|
@@ -411,10 +411,10 @@ class XtResolverService {
|
|
|
411
411
|
this.baseTypeResolver = inject(XT_TYPE_RESOLVER_TOKEN, { optional: true });
|
|
412
412
|
this.listComponents = computed(() => {
|
|
413
413
|
return this.pluginRegistry.listComponents();
|
|
414
|
-
});
|
|
414
|
+
}, ...(ngDevMode ? [{ debugName: "listComponents" }] : []));
|
|
415
415
|
this.listPlugins = computed(() => {
|
|
416
416
|
return this.pluginRegistry.listPlugins();
|
|
417
|
-
});
|
|
417
|
+
}, ...(ngDevMode ? [{ debugName: "listPlugins" }] : []));
|
|
418
418
|
if (this.baseTypeResolver == null) {
|
|
419
419
|
this.typeResolver = xtTypeManager();
|
|
420
420
|
}
|
|
@@ -503,10 +503,10 @@ class XtResolverService {
|
|
|
503
503
|
return module;
|
|
504
504
|
});
|
|
505
505
|
}
|
|
506
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
507
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
506
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: XtResolverService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
507
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: XtResolverService, providedIn: 'root' }); }
|
|
508
508
|
}
|
|
509
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
509
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: XtResolverService, decorators: [{
|
|
510
510
|
type: Injectable,
|
|
511
511
|
args: [{
|
|
512
512
|
providedIn: 'root'
|
|
@@ -524,16 +524,16 @@ class XtBaseOutput {
|
|
|
524
524
|
class XtRenderComponent {
|
|
525
525
|
constructor() {
|
|
526
526
|
this.resolverService = inject(XtResolverService);
|
|
527
|
-
this.componentType = input();
|
|
528
|
-
this.displayMode = input.required();
|
|
529
|
-
this.valueType = input();
|
|
527
|
+
this.componentType = input(...(ngDevMode ? [undefined, { debugName: "componentType" }] : []));
|
|
528
|
+
this.displayMode = input.required(...(ngDevMode ? [{ debugName: "displayMode" }] : []));
|
|
529
|
+
this.valueType = input(...(ngDevMode ? [undefined, { debugName: "valueType" }] : []));
|
|
530
530
|
// Either we set the value directly
|
|
531
|
-
this.value = model();
|
|
531
|
+
this.value = model(...(ngDevMode ? [undefined, { debugName: "value" }] : []));
|
|
532
532
|
// Or we are inside a Form
|
|
533
|
-
this.formGroup = input();
|
|
534
|
-
this.subName = input();
|
|
533
|
+
this.formGroup = input(...(ngDevMode ? [undefined, { debugName: "formGroup" }] : []));
|
|
534
|
+
this.subName = input(...(ngDevMode ? [undefined, { debugName: "subName" }] : []));
|
|
535
535
|
this.outputsObject = new XtBaseOutput();
|
|
536
|
-
this.inputs = input();
|
|
536
|
+
this.inputs = input(...(ngDevMode ? [undefined, { debugName: "inputs" }] : []));
|
|
537
537
|
this.outputs = output();
|
|
538
538
|
this.outlet = viewChild.required(NgComponentOutlet);
|
|
539
539
|
this.context = computed(() => {
|
|
@@ -551,7 +551,7 @@ class XtRenderComponent {
|
|
|
551
551
|
}
|
|
552
552
|
}
|
|
553
553
|
return ret;
|
|
554
|
-
});
|
|
554
|
+
}, ...(ngDevMode ? [{ debugName: "context" }] : []));
|
|
555
555
|
this.type = computed(() => {
|
|
556
556
|
//console.debug("Calculating type in XtRenderSubComponent");
|
|
557
557
|
let type = this.componentType();
|
|
@@ -565,7 +565,7 @@ class XtRenderComponent {
|
|
|
565
565
|
type = compFound.componentClass;
|
|
566
566
|
}
|
|
567
567
|
return type ?? null;
|
|
568
|
-
});
|
|
568
|
+
}, ...(ngDevMode ? [{ debugName: "type" }] : []));
|
|
569
569
|
}
|
|
570
570
|
/**
|
|
571
571
|
* Transfers the input and outputs from the host to the rendered component
|
|
@@ -589,10 +589,10 @@ class XtRenderComponent {
|
|
|
589
589
|
}
|
|
590
590
|
}
|
|
591
591
|
}
|
|
592
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
593
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "
|
|
592
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: XtRenderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
593
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.2.3", type: XtRenderComponent, isStandalone: true, selector: "xt-render", inputs: { componentType: { classPropertyName: "componentType", publicName: "componentType", isSignal: true, isRequired: false, transformFunction: null }, displayMode: { classPropertyName: "displayMode", publicName: "displayMode", isSignal: true, isRequired: true, transformFunction: null }, valueType: { classPropertyName: "valueType", publicName: "valueType", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, formGroup: { classPropertyName: "formGroup", publicName: "formGroup", isSignal: true, isRequired: false, transformFunction: null }, subName: { classPropertyName: "subName", publicName: "subName", isSignal: true, isRequired: false, transformFunction: null }, inputs: { classPropertyName: "inputs", publicName: "inputs", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", outputs: "outputs" }, viewQueries: [{ propertyName: "outlet", first: true, predicate: NgComponentOutlet, descendants: true, isSignal: true }], ngImport: i0, template: "<ng-container *ngComponentOutlet=\"type(); inputs: {context:context ()}\" />\n", styles: [""], dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"], exportAs: ["ngComponentOutlet"] }, { kind: "ngmodule", type: ReactiveFormsModule }] }); }
|
|
594
594
|
}
|
|
595
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
595
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: XtRenderComponent, decorators: [{
|
|
596
596
|
type: Component,
|
|
597
597
|
args: [{ selector: 'xt-render', standalone: true, imports: [
|
|
598
598
|
NgComponentOutlet,
|
|
@@ -606,10 +606,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
|
|
|
606
606
|
*/
|
|
607
607
|
class XtRenderSubComponent {
|
|
608
608
|
constructor() {
|
|
609
|
-
this.context = input.required();
|
|
610
|
-
this.componentType = input();
|
|
609
|
+
this.context = input.required(...(ngDevMode ? [{ debugName: "context" }] : []));
|
|
610
|
+
this.componentType = input(...(ngDevMode ? [undefined, { debugName: "componentType" }] : []));
|
|
611
611
|
this.outputsObject = new XtBaseOutput();
|
|
612
|
-
this.inputs = input();
|
|
612
|
+
this.inputs = input(...(ngDevMode ? [undefined, { debugName: "inputs" }] : []));
|
|
613
613
|
this.outputs = output();
|
|
614
614
|
this.outlet = viewChild.required(NgComponentOutlet);
|
|
615
615
|
this.resolverService = inject(XtResolverService);
|
|
@@ -626,7 +626,7 @@ class XtRenderSubComponent {
|
|
|
626
626
|
type = compFound.componentClass;
|
|
627
627
|
}
|
|
628
628
|
return type ?? null;
|
|
629
|
-
});
|
|
629
|
+
}, ...(ngDevMode ? [{ debugName: "type" }] : []));
|
|
630
630
|
}
|
|
631
631
|
/**
|
|
632
632
|
* Transfers the input and outputs from the host to the rendered component
|
|
@@ -650,10 +650,10 @@ class XtRenderSubComponent {
|
|
|
650
650
|
}
|
|
651
651
|
}
|
|
652
652
|
}
|
|
653
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
654
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "
|
|
653
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: XtRenderSubComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
654
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.2.3", type: XtRenderSubComponent, isStandalone: true, selector: "xt-render-sub", inputs: { context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: true, transformFunction: null }, componentType: { classPropertyName: "componentType", publicName: "componentType", isSignal: true, isRequired: false, transformFunction: null }, inputs: { classPropertyName: "inputs", publicName: "inputs", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { outputs: "outputs" }, viewQueries: [{ propertyName: "outlet", first: true, predicate: NgComponentOutlet, descendants: true, isSignal: true }], ngImport: i0, template: "{{componentType()}}\n<ng-container *ngComponentOutlet=\"type(); inputs: {context:context ()}\" />\n", styles: [""], dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"], exportAs: ["ngComponentOutlet"] }, { kind: "ngmodule", type: ReactiveFormsModule }] }); }
|
|
655
655
|
}
|
|
656
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
656
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: XtRenderSubComponent, decorators: [{
|
|
657
657
|
type: Component,
|
|
658
658
|
args: [{ selector: 'xt-render-sub', standalone: true, imports: [
|
|
659
659
|
NgComponentOutlet,
|
|
@@ -670,37 +670,37 @@ class XtBaseInput {
|
|
|
670
670
|
*/
|
|
671
671
|
class XtSimpleComponent {
|
|
672
672
|
constructor() {
|
|
673
|
-
this.context = input.required();
|
|
673
|
+
this.context = input.required(...(ngDevMode ? [{ debugName: "context" }] : []));
|
|
674
674
|
this.outputsObject = new XtBaseOutput();
|
|
675
675
|
this.inputsObject = new XtBaseInput();
|
|
676
676
|
this.outputs = output();
|
|
677
677
|
this.isInForm = computed(() => {
|
|
678
678
|
return this.context()?.isInForm() ?? false;
|
|
679
|
-
});
|
|
679
|
+
}, ...(ngDevMode ? [{ debugName: "isInForm" }] : []));
|
|
680
680
|
this.formControlNameIfAny = computed(() => {
|
|
681
681
|
return this.context()?.subName;
|
|
682
|
-
});
|
|
682
|
+
}, ...(ngDevMode ? [{ debugName: "formControlNameIfAny" }] : []));
|
|
683
683
|
this.formGroupIfAny = computed(() => {
|
|
684
684
|
return this.context()?.formGroup();
|
|
685
|
-
});
|
|
685
|
+
}, ...(ngDevMode ? [{ debugName: "formGroupIfAny" }] : []));
|
|
686
686
|
this.formGroup = computed(() => {
|
|
687
687
|
const ret = this.context()?.formGroup();
|
|
688
688
|
if (ret == null)
|
|
689
689
|
throw new Error('No form groups in this component of type ' + this.componentDescriptor());
|
|
690
690
|
return ret;
|
|
691
|
-
});
|
|
691
|
+
}, ...(ngDevMode ? [{ debugName: "formGroup" }] : []));
|
|
692
692
|
/**
|
|
693
693
|
* Returns the component form name, which is for now the subName
|
|
694
694
|
*/
|
|
695
695
|
this.componentNameInForm = computed(() => {
|
|
696
696
|
return this.safelyGetSubName();
|
|
697
|
-
});
|
|
697
|
+
}, ...(ngDevMode ? [{ debugName: "componentNameInForm" }] : []));
|
|
698
698
|
this.safelyGetSubName = computed(() => {
|
|
699
699
|
const ret = this.context()?.subName;
|
|
700
700
|
if (ret == null)
|
|
701
701
|
throw new Error('This component has no name in the form ' + this.componentDescriptor());
|
|
702
702
|
return ret;
|
|
703
|
-
});
|
|
703
|
+
}, ...(ngDevMode ? [{ debugName: "safelyGetSubName" }] : []));
|
|
704
704
|
/**
|
|
705
705
|
* Returns the form control name and create a form control behind the scene
|
|
706
706
|
*/
|
|
@@ -708,20 +708,20 @@ class XtSimpleComponent {
|
|
|
708
708
|
const ret = this.safelyGetSubName();
|
|
709
709
|
//this.manageFormControl<any>(ret); // Don't create anything at this point. It's a computed value.
|
|
710
710
|
return ret;
|
|
711
|
-
});
|
|
711
|
+
}, ...(ngDevMode ? [{ debugName: "formControlName" }] : []));
|
|
712
712
|
this.formControl = computed(() => {
|
|
713
713
|
const subName = this.safelyGetSubName();
|
|
714
714
|
const formControl = this.manageFormControl(subName, false);
|
|
715
715
|
if (formControl == null)
|
|
716
716
|
throw new Error("Calling formControl for subName " + subName + " when none exist.");
|
|
717
717
|
return formControl;
|
|
718
|
-
});
|
|
718
|
+
}, ...(ngDevMode ? [{ debugName: "formControl" }] : []));
|
|
719
719
|
this.getValue = computed(() => {
|
|
720
720
|
return this.context().value();
|
|
721
|
-
});
|
|
721
|
+
}, ...(ngDevMode ? [{ debugName: "getValue" }] : []));
|
|
722
722
|
this.displayValue = computed(() => {
|
|
723
723
|
return this.context().displayValue();
|
|
724
|
-
});
|
|
724
|
+
}, ...(ngDevMode ? [{ debugName: "displayValue" }] : []));
|
|
725
725
|
}
|
|
726
726
|
ngOnInit() {
|
|
727
727
|
this.setupInputOutput();
|
|
@@ -756,10 +756,10 @@ class XtSimpleComponent {
|
|
|
756
756
|
setupInputOutput() {
|
|
757
757
|
// Nothing to do here
|
|
758
758
|
}
|
|
759
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
760
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
759
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: XtSimpleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
760
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.2.3", type: XtSimpleComponent, isStandalone: true, selector: "ng-component", inputs: { context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { outputs: "outputs" }, ngImport: i0, template: '', isInline: true }); }
|
|
761
761
|
}
|
|
762
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
762
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: XtSimpleComponent, decorators: [{
|
|
763
763
|
type: Component,
|
|
764
764
|
args: [{
|
|
765
765
|
standalone: true,
|
|
@@ -788,7 +788,7 @@ class XtCompositeComponent extends XtSimpleComponent {
|
|
|
788
788
|
ret = context.localFormGroup;
|
|
789
789
|
}
|
|
790
790
|
return ret;
|
|
791
|
-
});
|
|
791
|
+
}, ...(ngDevMode ? [{ debugName: "formGroupIfAny" }] : []));
|
|
792
792
|
/**
|
|
793
793
|
* We need to create a new form group to manage the sub elements.
|
|
794
794
|
*/
|
|
@@ -797,7 +797,7 @@ class XtCompositeComponent extends XtSimpleComponent {
|
|
|
797
797
|
if (ret == null)
|
|
798
798
|
throw new Error('No form groups in this component of type ' + this.componentDescriptor());
|
|
799
799
|
return ret;
|
|
800
|
-
});
|
|
800
|
+
}, ...(ngDevMode ? [{ debugName: "formGroup" }] : []));
|
|
801
801
|
}
|
|
802
802
|
/**
|
|
803
803
|
* Helper function to calculate the sub context
|
|
@@ -808,10 +808,10 @@ class XtCompositeComponent extends XtSimpleComponent {
|
|
|
808
808
|
this.formGroupIfAny(); // Ensure the context is properly initialized
|
|
809
809
|
return this.context().subContext(subName, subType, this.resolverService.typeResolver);
|
|
810
810
|
}
|
|
811
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
812
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
811
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: XtCompositeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
812
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.2.3", type: XtCompositeComponent, isStandalone: true, selector: "ng-component", usesInheritance: true, ngImport: i0, template: '', isInline: true, styles: [""] }); }
|
|
813
813
|
}
|
|
814
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
814
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: XtCompositeComponent, decorators: [{
|
|
815
815
|
type: Component,
|
|
816
816
|
args: [{ standalone: true, imports: [], template: '' }]
|
|
817
817
|
}] });
|
|
@@ -823,10 +823,10 @@ class MessageHandler {
|
|
|
823
823
|
warningOccurred(warningMsg) {
|
|
824
824
|
console.warn(warningMsg);
|
|
825
825
|
}
|
|
826
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
827
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
826
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: MessageHandler, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
827
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: MessageHandler, providedIn: 'root' }); }
|
|
828
828
|
}
|
|
829
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
829
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: MessageHandler, decorators: [{
|
|
830
830
|
type: Injectable,
|
|
831
831
|
args: [{
|
|
832
832
|
providedIn: 'root'
|
|
@@ -847,6 +847,19 @@ class StoreSupport {
|
|
|
847
847
|
}
|
|
848
848
|
}
|
|
849
849
|
|
|
850
|
+
function attachToFormGroup(formGroup, controlName, value, valueType, resolver) {
|
|
851
|
+
// If it's a single value, just create the control
|
|
852
|
+
if (((value != null) && (isPrimitive(value))
|
|
853
|
+
|| (resolver?.isPrimitiveType(valueType)))) {
|
|
854
|
+
const simpleControl = new FormControl(value);
|
|
855
|
+
formGroup.addControl(controlName, simpleControl);
|
|
856
|
+
}
|
|
857
|
+
else {
|
|
858
|
+
const complexGroup = new FormGroup({});
|
|
859
|
+
updateFormGroupWithValue(complexGroup, value, valueType, resolver);
|
|
860
|
+
formGroup.addControl(controlName, complexGroup);
|
|
861
|
+
}
|
|
862
|
+
}
|
|
850
863
|
function updateFormGroupWithValue(formGroup, value, valueType, resolver) {
|
|
851
864
|
const toDelete = new Set(Object.keys(formGroup.controls));
|
|
852
865
|
// We merge the properties of the value if any, with the properties of the model
|
|
@@ -860,7 +873,7 @@ function updateFormGroupWithValue(formGroup, value, valueType, resolver) {
|
|
|
860
873
|
for (const valueKey of keySet) {
|
|
861
874
|
const subValue = (value != null) ? value[valueKey] : null;
|
|
862
875
|
const subType = resolver?.findTypeName(valueType, valueKey, subValue) ?? undefined;
|
|
863
|
-
const primitive = (subType != null) ? resolver?.isPrimitiveType(subType) : isPrimitive(subValue);
|
|
876
|
+
const primitive = (subType != null) ? resolver?.isPrimitiveType(subType, subValue) : isPrimitive(subValue);
|
|
864
877
|
if (toDelete.delete(valueKey)) {
|
|
865
878
|
// Already a control
|
|
866
879
|
const oldControl = formGroup.get(valueKey);
|
|
@@ -914,14 +927,14 @@ class XtUnitTestHelper {
|
|
|
914
927
|
*/
|
|
915
928
|
class HostTestSimpleComponent {
|
|
916
929
|
constructor() {
|
|
917
|
-
this.type = input.required();
|
|
918
|
-
this.displayMode = input('FULL_VIEW');
|
|
919
|
-
this.value = input(undefined);
|
|
930
|
+
this.type = input.required(...(ngDevMode ? [{ debugName: "type" }] : []));
|
|
931
|
+
this.displayMode = input('FULL_VIEW', ...(ngDevMode ? [{ debugName: "displayMode" }] : []));
|
|
932
|
+
this.value = input(undefined, ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
920
933
|
}
|
|
921
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
922
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
934
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: HostTestSimpleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
935
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.2.3", type: HostTestSimpleComponent, isStandalone: true, selector: "test-host", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: true, transformFunction: null }, displayMode: { classPropertyName: "displayMode", publicName: "displayMode", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: '<h1>Test Simple Component</h1> <xt-render [componentType]="type()" [displayMode]="displayMode()" [value]="value()" ></xt-render> ', isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: XtRenderComponent, selector: "xt-render", inputs: ["componentType", "displayMode", "valueType", "value", "formGroup", "subName", "inputs"], outputs: ["valueChange", "outputs"] }] }); }
|
|
923
936
|
}
|
|
924
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
937
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: HostTestSimpleComponent, decorators: [{
|
|
925
938
|
type: Component,
|
|
926
939
|
args: [{
|
|
927
940
|
selector: 'test-host',
|
|
@@ -938,12 +951,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
|
|
|
938
951
|
class HostTestFormComponent {
|
|
939
952
|
constructor() {
|
|
940
953
|
this.builder = inject(FormBuilder);
|
|
941
|
-
this.type = input.required();
|
|
942
|
-
this.controlName = input.required();
|
|
954
|
+
this.type = input.required(...(ngDevMode ? [{ debugName: "type" }] : []));
|
|
955
|
+
this.controlName = input.required(...(ngDevMode ? [{ debugName: "controlName" }] : []));
|
|
943
956
|
// You can send the description to be used in a FormBuilder to create the formgroup;
|
|
944
|
-
this.formDescription = input({});
|
|
957
|
+
this.formDescription = input({}, ...(ngDevMode ? [{ debugName: "formDescription" }] : []));
|
|
945
958
|
// Or set the FormGroup directly
|
|
946
|
-
this.formGroup = input();
|
|
959
|
+
this.formGroup = input(...(ngDevMode ? [undefined, { debugName: "formGroup" }] : []));
|
|
947
960
|
this.createdFormGroup = null;
|
|
948
961
|
}
|
|
949
962
|
computedFormGroup() {
|
|
@@ -967,10 +980,10 @@ class HostTestFormComponent {
|
|
|
967
980
|
else
|
|
968
981
|
throw new Error("FormGroup not yet created. Did you set formGroup or formDescription property ?");
|
|
969
982
|
}
|
|
970
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
971
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
983
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: HostTestFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
984
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.2.3", type: HostTestFormComponent, isStandalone: true, selector: "test-form-host", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: true, transformFunction: null }, controlName: { classPropertyName: "controlName", publicName: "controlName", isSignal: true, isRequired: true, transformFunction: null }, formDescription: { classPropertyName: "formDescription", publicName: "formDescription", isSignal: true, isRequired: false, transformFunction: null }, formGroup: { classPropertyName: "formGroup", publicName: "formGroup", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: '<h1>Test Form Component</h1> <form [formGroup]="computedFormGroup()"> <xt-render [componentType]="type()" displayMode="FULL_EDITABLE" [subName]="controlName()" [formGroup]="computedFormGroup()"></xt-render></form>', isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: XtRenderComponent, selector: "xt-render", inputs: ["componentType", "displayMode", "valueType", "value", "formGroup", "subName", "inputs"], outputs: ["valueChange", "outputs"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }] }); }
|
|
972
985
|
}
|
|
973
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
986
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: HostTestFormComponent, decorators: [{
|
|
974
987
|
type: Component,
|
|
975
988
|
args: [{
|
|
976
989
|
selector: 'test-form-host',
|
|
@@ -985,20 +998,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
|
|
|
985
998
|
*/
|
|
986
999
|
class HostTestTypedComponent {
|
|
987
1000
|
constructor() {
|
|
988
|
-
this.displayMode = input('FULL_VIEW');
|
|
989
|
-
this.value = input();
|
|
990
|
-
this.valueType = input();
|
|
1001
|
+
this.displayMode = input('FULL_VIEW', ...(ngDevMode ? [{ debugName: "displayMode" }] : []));
|
|
1002
|
+
this.value = input(...(ngDevMode ? [undefined, { debugName: "value" }] : []));
|
|
1003
|
+
this.valueType = input(...(ngDevMode ? [undefined, { debugName: "valueType" }] : []));
|
|
991
1004
|
this.context = computed(() => {
|
|
992
1005
|
const ret = new XtBaseContext(this.displayMode());
|
|
993
1006
|
ret.valueType = this.valueType();
|
|
994
1007
|
ret.setDisplayValue(this.value());
|
|
995
1008
|
return ret;
|
|
996
|
-
});
|
|
1009
|
+
}, ...(ngDevMode ? [{ debugName: "context" }] : []));
|
|
997
1010
|
}
|
|
998
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
999
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
1011
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: HostTestTypedComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1012
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.2.3", type: HostTestTypedComponent, isStandalone: true, selector: "test-typed-host", inputs: { displayMode: { classPropertyName: "displayMode", publicName: "displayMode", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, valueType: { classPropertyName: "valueType", publicName: "valueType", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: '<h1>Test Typed Component</h1> <xt-render-sub [context]="context()" ></xt-render-sub> ', isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: XtRenderSubComponent, selector: "xt-render-sub", inputs: ["context", "componentType", "inputs"], outputs: ["outputs"] }] }); }
|
|
1000
1013
|
}
|
|
1001
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1014
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: HostTestTypedComponent, decorators: [{
|
|
1002
1015
|
type: Component,
|
|
1003
1016
|
args: [{
|
|
1004
1017
|
selector: 'test-typed-host',
|
|
@@ -1016,12 +1029,12 @@ class HostTestTypedFormComponent {
|
|
|
1016
1029
|
constructor() {
|
|
1017
1030
|
this.builder = inject(FormBuilder);
|
|
1018
1031
|
this.resolver = inject(XtResolverService);
|
|
1019
|
-
this.valueType = input();
|
|
1020
|
-
this.controlName = input();
|
|
1032
|
+
this.valueType = input(...(ngDevMode ? [undefined, { debugName: "valueType" }] : []));
|
|
1033
|
+
this.controlName = input(...(ngDevMode ? [undefined, { debugName: "controlName" }] : []));
|
|
1021
1034
|
// You can send the description to be used in a FormBuilder to create the formgroup;
|
|
1022
|
-
this.formDescription = input(null);
|
|
1035
|
+
this.formDescription = input(null, ...(ngDevMode ? [{ debugName: "formDescription" }] : []));
|
|
1023
1036
|
// Or set the FormGroup directly
|
|
1024
|
-
this.formGroup = input();
|
|
1037
|
+
this.formGroup = input(...(ngDevMode ? [undefined, { debugName: "formGroup" }] : []));
|
|
1025
1038
|
this.parentFormGroup = this.builder.group({});
|
|
1026
1039
|
this.createdFormGroup = null;
|
|
1027
1040
|
}
|
|
@@ -1068,10 +1081,10 @@ class HostTestTypedFormComponent {
|
|
|
1068
1081
|
retrieveValue(controlName) {
|
|
1069
1082
|
return this.computeFormGroup().value[controlName];
|
|
1070
1083
|
}
|
|
1071
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1072
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
1084
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: HostTestTypedFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1085
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.2.3", type: HostTestTypedFormComponent, isStandalone: true, selector: "test-typed-form-host", inputs: { valueType: { classPropertyName: "valueType", publicName: "valueType", isSignal: true, isRequired: false, transformFunction: null }, controlName: { classPropertyName: "controlName", publicName: "controlName", isSignal: true, isRequired: false, transformFunction: null }, formDescription: { classPropertyName: "formDescription", publicName: "formDescription", isSignal: true, isRequired: false, transformFunction: null }, formGroup: { classPropertyName: "formGroup", publicName: "formGroup", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: '<h1>Test Typed Form Component</h1> <form [formGroup]="parentFormGroup"> <xt-render-sub [context]="subContext()"></xt-render-sub></form>', isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: XtRenderSubComponent, selector: "xt-render-sub", inputs: ["context", "componentType", "inputs"], outputs: ["outputs"] }] }); }
|
|
1073
1086
|
}
|
|
1074
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1087
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: HostTestTypedFormComponent, decorators: [{
|
|
1075
1088
|
type: Component,
|
|
1076
1089
|
args: [{
|
|
1077
1090
|
selector: 'test-typed-form-host',
|
|
@@ -1203,5 +1216,5 @@ class TestDocumentInfo {
|
|
|
1203
1216
|
* Generated bundle index. Do not edit.
|
|
1204
1217
|
*/
|
|
1205
1218
|
|
|
1206
|
-
export { HostTestFormComponent, HostTestSimpleComponent, HostTestTypedComponent, HostTestTypedFormComponent, MessageHandler, StoreSupport, StoreTestHelper, TestDocumentInfo, TestStoreManager, TestStoreProvider, XT_REGISTRY_TOKEN, XT_RESOLVER_TOKEN, XT_TYPE_RESOLVER_TOKEN, XtBaseContext, XtCompositeComponent, XtPluginRegistry, XtRenderComponent, XtRenderSubComponent, XtResolvedComponent, XtResolverService, XtSimpleComponent, XtUnitTestHelper, initXtPluginRegistry, updateFormGroupWithValue, xtPluginRegistry };
|
|
1219
|
+
export { HostTestFormComponent, HostTestSimpleComponent, HostTestTypedComponent, HostTestTypedFormComponent, MessageHandler, StoreSupport, StoreTestHelper, TestDocumentInfo, TestStoreManager, TestStoreProvider, XT_REGISTRY_TOKEN, XT_RESOLVER_TOKEN, XT_TYPE_RESOLVER_TOKEN, XtBaseContext, XtCompositeComponent, XtPluginRegistry, XtRenderComponent, XtRenderSubComponent, XtResolvedComponent, XtResolverService, XtSimpleComponent, XtUnitTestHelper, attachToFormGroup, initXtPluginRegistry, updateFormGroupWithValue, xtPluginRegistry };
|
|
1207
1220
|
//# sourceMappingURL=xt-components.mjs.map
|