@xui/form-field 2.0.0-alpha.4 → 2.0.0-alpha.6
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Component, contentChild, contentChildren, computed, effect, NgModule } from '@angular/core';
|
|
3
|
-
import {
|
|
3
|
+
import { XFormFieldControl } from '@xui/core/form-field';
|
|
4
4
|
|
|
5
5
|
class XuiErrorComponent {
|
|
6
6
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: XuiErrorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -18,18 +18,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImpor
|
|
|
18
18
|
}] });
|
|
19
19
|
|
|
20
20
|
class XuiFormFieldComponent {
|
|
21
|
-
control = contentChild(
|
|
21
|
+
control = contentChild(XFormFieldControl);
|
|
22
22
|
errorChildren = contentChildren(XuiErrorComponent);
|
|
23
23
|
hasDisplayedMessage = computed(() => this.errorChildren() && this.errorChildren().length > 0 && this.control()?.errorState() ? 'error' : 'hint');
|
|
24
24
|
constructor() {
|
|
25
25
|
effect(() => {
|
|
26
26
|
if (!this.control()) {
|
|
27
|
-
throw new Error('xui-form-field must contain an
|
|
27
|
+
throw new Error('xui-form-field must contain an XFormFieldControl.');
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: XuiFormFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
32
|
-
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.3", type: XuiFormFieldComponent, isStandalone: true, selector: "xui-form-field", host: { classAttribute: "block space-y-2" }, queries: [{ propertyName: "control", first: true, predicate:
|
|
32
|
+
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.3", type: XuiFormFieldComponent, isStandalone: true, selector: "xui-form-field", host: { classAttribute: "block space-y-2" }, queries: [{ propertyName: "control", first: true, predicate: XFormFieldControl, descendants: true, isSignal: true }, { propertyName: "errorChildren", predicate: XuiErrorComponent, isSignal: true }], ngImport: i0, template: `
|
|
33
33
|
<ng-content></ng-content>
|
|
34
34
|
|
|
35
35
|
@switch (hasDisplayedMessage()) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xui-form-field.mjs","sources":["../../../../../../libs/ui/form-field/xui/src/lib/error.component.ts","../../../../../../libs/ui/form-field/xui/src/lib/form-field.component.ts","../../../../../../libs/ui/form-field/xui/src/lib/hint.component.ts","../../../../../../libs/ui/form-field/xui/src/index.ts","../../../../../../libs/ui/form-field/xui/src/xui-form-field.ts"],"sourcesContent":["import { Component } from '@angular/core';\n\n@Component({\n selector: 'xui-error',\n template: '<ng-content />',\n host: {\n class: 'block text-error text-sm font-medium'\n }\n})\nexport class XuiErrorComponent {}\n","import { Component, computed, contentChild, contentChildren, effect } from '@angular/core';\nimport {
|
|
1
|
+
{"version":3,"file":"xui-form-field.mjs","sources":["../../../../../../libs/ui/form-field/xui/src/lib/error.component.ts","../../../../../../libs/ui/form-field/xui/src/lib/form-field.component.ts","../../../../../../libs/ui/form-field/xui/src/lib/hint.component.ts","../../../../../../libs/ui/form-field/xui/src/index.ts","../../../../../../libs/ui/form-field/xui/src/xui-form-field.ts"],"sourcesContent":["import { Component } from '@angular/core';\n\n@Component({\n selector: 'xui-error',\n template: '<ng-content />',\n host: {\n class: 'block text-error text-sm font-medium'\n }\n})\nexport class XuiErrorComponent {}\n","import { Component, computed, contentChild, contentChildren, effect } from '@angular/core';\nimport { XFormFieldControl } from '@xui/core/form-field';\nimport { XuiErrorComponent } from './error.component';\n\n@Component({\n selector: 'xui-form-field',\n imports: [],\n template: `\n <ng-content></ng-content>\n\n @switch (hasDisplayedMessage()) {\n @case ('error') {\n <ng-content select=\"xui-error\"></ng-content>\n }\n @default {\n <ng-content select=\"xui-hint\"></ng-content>\n }\n }\n `,\n host: {\n class: 'block space-y-2'\n }\n})\nexport class XuiFormFieldComponent {\n readonly control = contentChild(XFormFieldControl);\n readonly errorChildren = contentChildren(XuiErrorComponent);\n\n protected readonly hasDisplayedMessage = computed<'error' | 'hint'>(() =>\n this.errorChildren() && this.errorChildren().length > 0 && this.control()?.errorState() ? 'error' : 'hint'\n );\n\n constructor() {\n effect(() => {\n if (!this.control()) {\n throw new Error('xui-form-field must contain an XFormFieldControl.');\n }\n });\n }\n}\n","import { Component } from '@angular/core';\n\n@Component({\n selector: 'xui-hint',\n template: '<ng-content />',\n host: {\n class: 'block text-sm text-foreground/50'\n }\n})\nexport class XuiHintComponent {}\n","import { NgModule } from '@angular/core';\nimport { XuiErrorComponent } from './lib/error.component';\nimport { XuiFormFieldComponent } from './lib/form-field.component';\nimport { XuiHintComponent } from './lib/hint.component';\nexport * from './lib/error.component';\nexport * from './lib/form-field.component';\nexport * from './lib/hint.component';\n\nexport const XuiFormFieldImports = [XuiFormFieldComponent, XuiErrorComponent, XuiHintComponent] as const;\n\n@NgModule({\n imports: [...XuiFormFieldImports],\n exports: [...XuiFormFieldImports]\n})\nexport class XuiFormFieldModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MASa,iBAAiB,CAAA;0HAAjB,iBAAiB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAjB,uBAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,iBAAiB,uIALlB,gBAAgB,EAAA,QA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ANK,qBAAqB,EAAE,iBAAiB,EAAE,gBAAgB,CAAA,EAAA,OAAA,EAAA,CAA1D,qBAAqB,EAAE,iBAAiB,EAAE,gBAAgB,CAAA,EAAA,CAAA;2HAMjF,kBAAkB,EAAA,CAAA;;2FAAlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAJ9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,CAAC,GAAG,mBAAmB,CAAC;AACjC,oBAAA,OAAO,EAAE,CAAC,GAAG,mBAAmB;AACjC,iBAAA;;;ACbD;;AAEG;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { XFormFieldControl } from '@xui/core/form-field';
|
|
2
2
|
import { XuiErrorComponent } from './error.component';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
export declare class XuiFormFieldComponent {
|
|
5
|
-
readonly control: import("@angular/core").Signal<
|
|
5
|
+
readonly control: import("@angular/core").Signal<XFormFieldControl | undefined>;
|
|
6
6
|
readonly errorChildren: import("@angular/core").Signal<readonly XuiErrorComponent[]>;
|
|
7
7
|
protected readonly hasDisplayedMessage: import("@angular/core").Signal<"error" | "hint">;
|
|
8
8
|
constructor();
|