@egose/shadcn-theme-ng-tw 0.2.0 → 0.4.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/README.md +1 -1
- package/alert/fesm2022/alert.mjs +1 -1
- package/autocomplete/fesm2022/autocomplete.mjs +1 -1
- package/button/fesm2022/button.mjs +3 -3
- package/checkbox/fesm2022/checkbox.mjs +6 -7
- package/checkbox/types/checkbox.d.ts +1 -1
- package/combobox/fesm2022/combobox.mjs +1 -1
- package/date-picker/README.md +15 -11
- package/date-picker/fesm2022/date-picker.mjs +148 -30
- package/date-picker/types/date-picker.d.ts +102 -9
- package/form-autocomplete/README.md +178 -0
- package/form-autocomplete/fesm2022/form-autocomplete.mjs +243 -0
- package/form-autocomplete/package.json +24 -0
- package/form-autocomplete/types/form-autocomplete.d.ts +81 -0
- package/form-checkbox/README.md +29 -18
- package/form-checkbox/fesm2022/form-checkbox.mjs +62 -22
- package/form-checkbox/types/form-checkbox.d.ts +43 -4
- package/form-combobox/README.md +203 -0
- package/form-combobox/fesm2022/form-combobox.mjs +305 -0
- package/form-combobox/package.json +24 -0
- package/form-combobox/types/form-combobox.d.ts +93 -0
- package/form-date-picker/README.md +49 -22
- package/form-date-picker/fesm2022/form-date-picker.mjs +100 -29
- package/form-date-picker/types/form-date-picker.d.ts +37 -1
- package/form-date-picker-multi/README.md +192 -0
- package/form-date-picker-multi/fesm2022/form-date-picker-multi.mjs +266 -0
- package/form-date-picker-multi/package.json +24 -0
- package/form-date-picker-multi/types/form-date-picker-multi.d.ts +78 -0
- package/form-date-range-picker/README.md +254 -0
- package/form-date-range-picker/fesm2022/form-date-range-picker.mjs +263 -0
- package/form-date-range-picker/package.json +24 -0
- package/form-date-range-picker/types/form-date-range-picker.d.ts +75 -0
- package/form-field/README.md +9 -0
- package/form-field/fesm2022/form-field.mjs +80 -5
- package/form-field/types/form-field.d.ts +50 -2
- package/form-field-simple/fesm2022/form-field-simple.mjs +15 -1
- package/form-field-simple/types/form-field-simple.d.ts +9 -2
- package/form-input-otp/README.md +195 -0
- package/form-input-otp/fesm2022/form-input-otp.mjs +226 -0
- package/form-input-otp/package.json +24 -0
- package/form-input-otp/types/form-input-otp.d.ts +78 -0
- package/form-month-year-picker/README.md +189 -0
- package/form-month-year-picker/fesm2022/form-month-year-picker.mjs +256 -0
- package/form-month-year-picker/package.json +24 -0
- package/form-month-year-picker/types/form-month-year-picker.d.ts +73 -0
- package/form-native-select/README.md +206 -0
- package/form-native-select/fesm2022/form-native-select.mjs +226 -0
- package/form-native-select/package.json +24 -0
- package/form-native-select/types/form-native-select.d.ts +77 -0
- package/form-phone-input/README.md +189 -0
- package/form-phone-input/fesm2022/form-phone-input.mjs +230 -0
- package/form-phone-input/package.json +24 -0
- package/form-phone-input/types/form-phone-input.d.ts +78 -0
- package/form-radio-group/README.md +199 -0
- package/form-radio-group/fesm2022/form-radio-group.mjs +238 -0
- package/form-radio-group/package.json +24 -0
- package/form-radio-group/types/form-radio-group.d.ts +83 -0
- package/form-searchable-multiselect/README.md +28 -17
- package/form-searchable-multiselect/fesm2022/form-searchable-multiselect.mjs +60 -24
- package/form-searchable-multiselect/types/form-searchable-multiselect.d.ts +39 -2
- package/form-select/README.md +30 -19
- package/form-select/fesm2022/form-select.mjs +65 -29
- package/form-select/types/form-select.d.ts +39 -2
- package/form-slider/README.md +183 -0
- package/form-slider/fesm2022/form-slider.mjs +218 -0
- package/form-slider/package.json +24 -0
- package/form-slider/types/form-slider.d.ts +80 -0
- package/form-switch/README.md +174 -0
- package/form-switch/fesm2022/form-switch.mjs +205 -0
- package/form-switch/package.json +24 -0
- package/form-switch/types/form-switch.d.ts +70 -0
- package/form-text-input/README.md +37 -26
- package/form-text-input/fesm2022/form-text-input.mjs +60 -24
- package/form-text-input/types/form-text-input.d.ts +39 -2
- package/form-textarea/README.md +33 -22
- package/form-textarea/fesm2022/form-textarea.mjs +60 -24
- package/form-textarea/types/form-textarea.d.ts +39 -2
- package/form-toggle/README.md +187 -0
- package/form-toggle/fesm2022/form-toggle.mjs +275 -0
- package/form-toggle/package.json +24 -0
- package/form-toggle/types/form-toggle.d.ts +100 -0
- package/form-toggle-group/README.md +177 -0
- package/form-toggle-group/fesm2022/form-toggle-group.mjs +243 -0
- package/form-toggle-group/package.json +24 -0
- package/form-toggle-group/types/form-toggle-group.d.ts +85 -0
- package/input-group/fesm2022/input-group.mjs +20 -10
- package/input-group/types/input-group.d.ts +4 -1
- package/native-select/fesm2022/native-select.mjs +18 -6
- package/native-select/types/native-select.d.ts +7 -2
- package/package.json +57 -1
- package/phone-input/README.md +114 -0
- package/phone-input/fesm2022/phone-input.mjs +191 -0
- package/phone-input/package.json +24 -0
- package/phone-input/types/phone-input.d.ts +67 -0
- package/sheet/fesm2022/sheet.mjs +1 -1
- package/switch/fesm2022/switch.mjs +7 -5
- package/switch/types/switch.d.ts +2 -1
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, inject, input, computed, Component } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/forms';
|
|
4
|
+
import { FormGroupDirective, ReactiveFormsModule, ControlContainer } from '@angular/forms';
|
|
5
|
+
import { injectEgFormErrorMessages, HlmFormIdGenerator, resolveEgFormError, HlmFormField, HlmError, HlmHint } from '@egose/shadcn-theme-ng-tw/form-field';
|
|
6
|
+
import { HlmLabel } from '@egose/shadcn-theme-ng-tw/label';
|
|
7
|
+
import { HlmAutocomplete, HlmAutocompleteContent, HlmAutocompleteEmpty, HlmAutocompleteGroup, HlmAutocompleteInput, HlmAutocompleteItem, HlmAutocompleteList, HlmAutocompleteLabel } from '@egose/shadcn-theme-ng-tw/autocomplete';
|
|
8
|
+
import { hlm } from '@egose/shadcn-theme-ng-tw/utils';
|
|
9
|
+
|
|
10
|
+
const EgFormAutocompleteConfigToken = new InjectionToken('EgFormAutocompleteConfig');
|
|
11
|
+
function provideEgFormAutocompleteConfig(config) {
|
|
12
|
+
return { provide: EgFormAutocompleteConfigToken, useValue: { ...config } };
|
|
13
|
+
}
|
|
14
|
+
function injectEgFormAutocompleteConfig() {
|
|
15
|
+
return inject(EgFormAutocompleteConfigToken, { optional: true }) ?? {};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
class EgFormAutocomplete {
|
|
19
|
+
formGroupDirective = inject(FormGroupDirective);
|
|
20
|
+
_errorMessages = injectEgFormErrorMessages();
|
|
21
|
+
generatedId = inject(HlmFormIdGenerator).generate('eg-form-autocomplete');
|
|
22
|
+
_config = injectEgFormAutocompleteConfig();
|
|
23
|
+
label = input(undefined, /* @ts-ignore */
|
|
24
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
25
|
+
controlId = input(undefined, /* @ts-ignore */
|
|
26
|
+
...(ngDevMode ? [{ debugName: "controlId" }] : /* istanbul ignore next */ []));
|
|
27
|
+
controlName = input('', /* @ts-ignore */
|
|
28
|
+
...(ngDevMode ? [{ debugName: "controlName" }] : /* istanbul ignore next */ []));
|
|
29
|
+
error = input(undefined, /* @ts-ignore */
|
|
30
|
+
...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
|
|
31
|
+
/**
|
|
32
|
+
* Auto-resolve the displayed message from the control's `ValidationErrors`
|
|
33
|
+
* when `error()` is unset. Explicit `error()` always wins. Set to `false`
|
|
34
|
+
* for manual-only messages.
|
|
35
|
+
*/
|
|
36
|
+
autoError = input(true, /* @ts-ignore */
|
|
37
|
+
...(ngDevMode ? [{ debugName: "autoError" }] : /* istanbul ignore next */ []));
|
|
38
|
+
hint = input(undefined, /* @ts-ignore */
|
|
39
|
+
...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
40
|
+
id = input(undefined, /* @ts-ignore */
|
|
41
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
42
|
+
placeholder = input('Type to search…', /* @ts-ignore */
|
|
43
|
+
...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
44
|
+
emptyText = input('No result.', /* @ts-ignore */
|
|
45
|
+
...(ngDevMode ? [{ debugName: "emptyText" }] : /* istanbul ignore next */ []));
|
|
46
|
+
disabled = input(false, /* @ts-ignore */
|
|
47
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
48
|
+
required = input(false, /* @ts-ignore */
|
|
49
|
+
...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
50
|
+
options = input([], /* @ts-ignore */
|
|
51
|
+
...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
52
|
+
effectiveId = computed(() => this.controlId() || this.id() || this.generatedId, /* @ts-ignore */
|
|
53
|
+
...(ngDevMode ? [{ debugName: "effectiveId" }] : /* istanbul ignore next */ []));
|
|
54
|
+
errorId = computed(() => `${this.effectiveId()}-error`, /* @ts-ignore */
|
|
55
|
+
...(ngDevMode ? [{ debugName: "errorId" }] : /* istanbul ignore next */ []));
|
|
56
|
+
hintId = computed(() => `${this.effectiveId()}-hint`, /* @ts-ignore */
|
|
57
|
+
...(ngDevMode ? [{ debugName: "hintId" }] : /* istanbul ignore next */ []));
|
|
58
|
+
/**
|
|
59
|
+
* Displayed message: explicit `error()` wins; otherwise (when `autoError()`)
|
|
60
|
+
* auto-resolved from the control's `ValidationErrors`. Plain method (not a
|
|
61
|
+
* computed): `ValidationErrors` is not a signal, so the control must be read
|
|
62
|
+
* fresh on every change-detection pass.
|
|
63
|
+
*/
|
|
64
|
+
resolvedError() {
|
|
65
|
+
const explicit = this.error();
|
|
66
|
+
if (explicit)
|
|
67
|
+
return explicit;
|
|
68
|
+
if (!this.autoError())
|
|
69
|
+
return undefined;
|
|
70
|
+
const control = this.formGroupDirective.form.get(this.controlName());
|
|
71
|
+
return resolveEgFormError(control?.errors ?? null, this.label(), this._errorMessages);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Whether the error is surfaced: message present + control invalid +
|
|
75
|
+
* touched/dirty/submitted. Gates the visual `<hlm-error>` (and
|
|
76
|
+
* `describedBy()`, where present) so sighted and screen-reader output agree.
|
|
77
|
+
*/
|
|
78
|
+
showError() {
|
|
79
|
+
const control = this.formGroupDirective.form.get(this.controlName());
|
|
80
|
+
return (!!this.resolvedError() &&
|
|
81
|
+
!!control?.invalid &&
|
|
82
|
+
(control.dirty || control.touched || this.formGroupDirective.submitted));
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Combined lock for the brain `linkedSignal`-based disabled state: the raw
|
|
86
|
+
* input write always carries the resolved value, so a same-pass
|
|
87
|
+
* wrapper-toggle + `control.disable()` cannot clobber CVA state.
|
|
88
|
+
*/
|
|
89
|
+
effectiveDisabled() {
|
|
90
|
+
return this.disabled() || !!this.formGroupDirective.form.get(this.controlName())?.disabled;
|
|
91
|
+
}
|
|
92
|
+
// Styling
|
|
93
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
94
|
+
labelClass = input('', /* @ts-ignore */
|
|
95
|
+
...(ngDevMode ? [{ debugName: "labelClass" }] : /* istanbul ignore next */ []));
|
|
96
|
+
controlClass = input('', /* @ts-ignore */
|
|
97
|
+
...(ngDevMode ? [{ debugName: "controlClass" }] : /* istanbul ignore next */ []));
|
|
98
|
+
inputClass = input('', /* @ts-ignore */
|
|
99
|
+
...(ngDevMode ? [{ debugName: "inputClass" }] : /* istanbul ignore next */ []));
|
|
100
|
+
errorClass = input('', /* @ts-ignore */
|
|
101
|
+
...(ngDevMode ? [{ debugName: "errorClass" }] : /* istanbul ignore next */ []));
|
|
102
|
+
hintClass = input('', /* @ts-ignore */
|
|
103
|
+
...(ngDevMode ? [{ debugName: "hintClass" }] : /* istanbul ignore next */ []));
|
|
104
|
+
// Computed classes (library base < global config < per-instance).
|
|
105
|
+
// NOTE: the autocomplete input exposes no aria-describedby, so error/hint
|
|
106
|
+
// ids render without an input-level describedby link.
|
|
107
|
+
$userClass = computed(() => hlm('tw:w-full', this.userClass()), /* @ts-ignore */
|
|
108
|
+
...(ngDevMode ? [{ debugName: "$userClass" }] : /* istanbul ignore next */ []));
|
|
109
|
+
$labelClass = computed(() => hlm('tw:mb-1', this._config.labelClass, this.labelClass()), /* @ts-ignore */
|
|
110
|
+
...(ngDevMode ? [{ debugName: "$labelClass" }] : /* istanbul ignore next */ []));
|
|
111
|
+
$controlClass = computed(() => hlm(this._config.controlClass, this.controlClass()), /* @ts-ignore */
|
|
112
|
+
...(ngDevMode ? [{ debugName: "$controlClass" }] : /* istanbul ignore next */ []));
|
|
113
|
+
$inputClass = computed(() => hlm(this._config.inputClass, this.inputClass()), /* @ts-ignore */
|
|
114
|
+
...(ngDevMode ? [{ debugName: "$inputClass" }] : /* istanbul ignore next */ []));
|
|
115
|
+
$errorClass = computed(() => hlm('tw:mt-0', this._config.errorClass, this.errorClass()), /* @ts-ignore */
|
|
116
|
+
...(ngDevMode ? [{ debugName: "$errorClass" }] : /* istanbul ignore next */ []));
|
|
117
|
+
$hintClass = computed(() => hlm('tw:mt-0', this._config.hintClass, this.hintClass()), /* @ts-ignore */
|
|
118
|
+
...(ngDevMode ? [{ debugName: "$hintClass" }] : /* istanbul ignore next */ []));
|
|
119
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormAutocomplete, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
120
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: EgFormAutocomplete, isStandalone: true, selector: "eg-form-autocomplete", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, controlId: { classPropertyName: "controlId", publicName: "controlId", isSignal: true, isRequired: false, transformFunction: null }, controlName: { classPropertyName: "controlName", publicName: "controlName", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, autoError: { classPropertyName: "autoError", publicName: "autoError", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, emptyText: { classPropertyName: "emptyText", publicName: "emptyText", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, labelClass: { classPropertyName: "labelClass", publicName: "labelClass", isSignal: true, isRequired: false, transformFunction: null }, controlClass: { classPropertyName: "controlClass", publicName: "controlClass", isSignal: true, isRequired: false, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null }, errorClass: { classPropertyName: "errorClass", publicName: "errorClass", isSignal: true, isRequired: false, transformFunction: null }, hintClass: { classPropertyName: "hintClass", publicName: "hintClass", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "$userClass()" } }, providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }], ngImport: i0, template: `
|
|
121
|
+
@let lbl = label();
|
|
122
|
+
@let cnm = controlName();
|
|
123
|
+
@let hnt = hint();
|
|
124
|
+
@let rqrd = required();
|
|
125
|
+
|
|
126
|
+
<hlm-form-field>
|
|
127
|
+
@if (lbl) {
|
|
128
|
+
<label hlmLabel [for]="effectiveId()" [class]="$labelClass()"
|
|
129
|
+
>{{ lbl }}
|
|
130
|
+
@if (rqrd) {
|
|
131
|
+
<span class="tw:text-red-500">*</span>
|
|
132
|
+
}
|
|
133
|
+
</label>
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
<div hlmAutocomplete [formControlName]="cnm" [disabled]="effectiveDisabled()" [class]="$controlClass()">
|
|
137
|
+
<hlm-autocomplete-input [inputId]="effectiveId()" [placeholder]="placeholder()" [class]="$inputClass()" />
|
|
138
|
+
<hlm-autocomplete-content>
|
|
139
|
+
<div hlmAutocompleteList>
|
|
140
|
+
<div hlmAutocompleteGroup>
|
|
141
|
+
@for (option of options(); track option) {
|
|
142
|
+
<hlm-autocomplete-item [value]="option">{{ option }}</hlm-autocomplete-item>
|
|
143
|
+
}
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
146
|
+
<div hlmAutocompleteEmpty>{{ emptyText() }}</div>
|
|
147
|
+
</hlm-autocomplete-content>
|
|
148
|
+
</div>
|
|
149
|
+
|
|
150
|
+
@if (showError()) {
|
|
151
|
+
<hlm-error [id]="errorId()" [class]="$errorClass()">
|
|
152
|
+
{{ resolvedError() }}
|
|
153
|
+
</hlm-error>
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
@if (hnt) {
|
|
157
|
+
<hlm-hint [id]="hintId()" [class]="$hintClass()">
|
|
158
|
+
{{ hnt }}
|
|
159
|
+
</hlm-hint>
|
|
160
|
+
}
|
|
161
|
+
</hlm-form-field>
|
|
162
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: HlmFormField, selector: "hlm-form-field", inputs: ["class"] }, { kind: "directive", type: HlmError, selector: "hlm-error", inputs: ["class"] }, { kind: "directive", type: HlmHint, selector: "hlm-hint", inputs: ["class"] }, { kind: "directive", type: HlmLabel, selector: "[hlmLabel]", inputs: ["class"] }, { kind: "directive", type: HlmAutocomplete, selector: "[hlmAutocomplete],hlm-autocomplete" }, { kind: "directive", type: HlmAutocompleteContent, selector: "[hlmAutocompleteContent],hlm-autocomplete-content" }, { kind: "directive", type: HlmAutocompleteEmpty, selector: "[hlmAutocompleteEmpty],hlm-autocomplete-empty" }, { kind: "directive", type: HlmAutocompleteGroup, selector: "[hlmAutocompleteGroup]" }, { kind: "component", type: HlmAutocompleteInput, selector: "hlm-autocomplete-input", inputs: ["inputId", "placeholder", "showSearch", "showClear", "forceInvalid", "aria-invalid"] }, { kind: "component", type: HlmAutocompleteItem, selector: "hlm-autocomplete-item" }, { kind: "directive", type: HlmAutocompleteList, selector: "[hlmAutocompleteList]" }] });
|
|
163
|
+
}
|
|
164
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormAutocomplete, decorators: [{
|
|
165
|
+
type: Component,
|
|
166
|
+
args: [{
|
|
167
|
+
selector: 'eg-form-autocomplete',
|
|
168
|
+
standalone: true,
|
|
169
|
+
host: {
|
|
170
|
+
'[class]': '$userClass()',
|
|
171
|
+
},
|
|
172
|
+
imports: [
|
|
173
|
+
ReactiveFormsModule,
|
|
174
|
+
HlmFormField,
|
|
175
|
+
HlmError,
|
|
176
|
+
HlmHint,
|
|
177
|
+
HlmLabel,
|
|
178
|
+
HlmAutocomplete,
|
|
179
|
+
HlmAutocompleteContent,
|
|
180
|
+
HlmAutocompleteEmpty,
|
|
181
|
+
HlmAutocompleteGroup,
|
|
182
|
+
HlmAutocompleteInput,
|
|
183
|
+
HlmAutocompleteItem,
|
|
184
|
+
HlmAutocompleteLabel,
|
|
185
|
+
HlmAutocompleteList,
|
|
186
|
+
],
|
|
187
|
+
providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }],
|
|
188
|
+
template: `
|
|
189
|
+
@let lbl = label();
|
|
190
|
+
@let cnm = controlName();
|
|
191
|
+
@let hnt = hint();
|
|
192
|
+
@let rqrd = required();
|
|
193
|
+
|
|
194
|
+
<hlm-form-field>
|
|
195
|
+
@if (lbl) {
|
|
196
|
+
<label hlmLabel [for]="effectiveId()" [class]="$labelClass()"
|
|
197
|
+
>{{ lbl }}
|
|
198
|
+
@if (rqrd) {
|
|
199
|
+
<span class="tw:text-red-500">*</span>
|
|
200
|
+
}
|
|
201
|
+
</label>
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
<div hlmAutocomplete [formControlName]="cnm" [disabled]="effectiveDisabled()" [class]="$controlClass()">
|
|
205
|
+
<hlm-autocomplete-input [inputId]="effectiveId()" [placeholder]="placeholder()" [class]="$inputClass()" />
|
|
206
|
+
<hlm-autocomplete-content>
|
|
207
|
+
<div hlmAutocompleteList>
|
|
208
|
+
<div hlmAutocompleteGroup>
|
|
209
|
+
@for (option of options(); track option) {
|
|
210
|
+
<hlm-autocomplete-item [value]="option">{{ option }}</hlm-autocomplete-item>
|
|
211
|
+
}
|
|
212
|
+
</div>
|
|
213
|
+
</div>
|
|
214
|
+
<div hlmAutocompleteEmpty>{{ emptyText() }}</div>
|
|
215
|
+
</hlm-autocomplete-content>
|
|
216
|
+
</div>
|
|
217
|
+
|
|
218
|
+
@if (showError()) {
|
|
219
|
+
<hlm-error [id]="errorId()" [class]="$errorClass()">
|
|
220
|
+
{{ resolvedError() }}
|
|
221
|
+
</hlm-error>
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
@if (hnt) {
|
|
225
|
+
<hlm-hint [id]="hintId()" [class]="$hintClass()">
|
|
226
|
+
{{ hnt }}
|
|
227
|
+
</hlm-hint>
|
|
228
|
+
}
|
|
229
|
+
</hlm-form-field>
|
|
230
|
+
`,
|
|
231
|
+
}]
|
|
232
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], controlId: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlId", required: false }] }], controlName: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlName", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], autoError: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoError", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], emptyText: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyText", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], labelClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelClass", required: false }] }], controlClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlClass", required: false }] }], inputClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputClass", required: false }] }], errorClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorClass", required: false }] }], hintClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "hintClass", required: false }] }] } });
|
|
233
|
+
|
|
234
|
+
/*
|
|
235
|
+
* Public API Surface of form-autocomplete
|
|
236
|
+
*/
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Generated bundle index. Do not edit.
|
|
240
|
+
*/
|
|
241
|
+
|
|
242
|
+
export { EgFormAutocomplete, injectEgFormAutocompleteConfig, provideEgFormAutocompleteConfig };
|
|
243
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "form-autocomplete",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": "^20.3.0 || ^22.0.0",
|
|
6
|
+
"@angular/core": "^20.3.0 || ^22.0.0"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"tslib": "^2.3.0"
|
|
10
|
+
},
|
|
11
|
+
"sideEffects": false,
|
|
12
|
+
"module": "fesm2022/form-autocomplete.mjs",
|
|
13
|
+
"typings": "types/form-autocomplete.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
"./package.json": {
|
|
16
|
+
"default": "./package.json"
|
|
17
|
+
},
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./types/form-autocomplete.d.ts",
|
|
20
|
+
"default": "./fesm2022/form-autocomplete.mjs"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"type": "module"
|
|
24
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { ValueProvider } from '@angular/core';
|
|
3
|
+
import { ClassValue } from 'clsx';
|
|
4
|
+
|
|
5
|
+
declare class EgFormAutocomplete {
|
|
6
|
+
private readonly formGroupDirective;
|
|
7
|
+
private readonly _errorMessages;
|
|
8
|
+
private readonly generatedId;
|
|
9
|
+
private readonly _config;
|
|
10
|
+
label: _angular_core.InputSignal<string | undefined>;
|
|
11
|
+
controlId: _angular_core.InputSignal<string | undefined>;
|
|
12
|
+
controlName: _angular_core.InputSignal<string>;
|
|
13
|
+
error: _angular_core.InputSignal<string | undefined>;
|
|
14
|
+
/**
|
|
15
|
+
* Auto-resolve the displayed message from the control's `ValidationErrors`
|
|
16
|
+
* when `error()` is unset. Explicit `error()` always wins. Set to `false`
|
|
17
|
+
* for manual-only messages.
|
|
18
|
+
*/
|
|
19
|
+
autoError: _angular_core.InputSignal<boolean>;
|
|
20
|
+
hint: _angular_core.InputSignal<string | undefined>;
|
|
21
|
+
id: _angular_core.InputSignal<string | undefined>;
|
|
22
|
+
placeholder: _angular_core.InputSignal<string>;
|
|
23
|
+
emptyText: _angular_core.InputSignal<string>;
|
|
24
|
+
disabled: _angular_core.InputSignal<boolean>;
|
|
25
|
+
required: _angular_core.InputSignal<boolean>;
|
|
26
|
+
options: _angular_core.InputSignal<string[]>;
|
|
27
|
+
readonly effectiveId: _angular_core.Signal<string>;
|
|
28
|
+
readonly errorId: _angular_core.Signal<string>;
|
|
29
|
+
readonly hintId: _angular_core.Signal<string>;
|
|
30
|
+
/**
|
|
31
|
+
* Displayed message: explicit `error()` wins; otherwise (when `autoError()`)
|
|
32
|
+
* auto-resolved from the control's `ValidationErrors`. Plain method (not a
|
|
33
|
+
* computed): `ValidationErrors` is not a signal, so the control must be read
|
|
34
|
+
* fresh on every change-detection pass.
|
|
35
|
+
*/
|
|
36
|
+
protected resolvedError(): string | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Whether the error is surfaced: message present + control invalid +
|
|
39
|
+
* touched/dirty/submitted. Gates the visual `<hlm-error>` (and
|
|
40
|
+
* `describedBy()`, where present) so sighted and screen-reader output agree.
|
|
41
|
+
*/
|
|
42
|
+
protected showError(): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Combined lock for the brain `linkedSignal`-based disabled state: the raw
|
|
45
|
+
* input write always carries the resolved value, so a same-pass
|
|
46
|
+
* wrapper-toggle + `control.disable()` cannot clobber CVA state.
|
|
47
|
+
*/
|
|
48
|
+
effectiveDisabled(): boolean;
|
|
49
|
+
userClass: _angular_core.InputSignal<ClassValue>;
|
|
50
|
+
labelClass: _angular_core.InputSignal<string>;
|
|
51
|
+
controlClass: _angular_core.InputSignal<string>;
|
|
52
|
+
inputClass: _angular_core.InputSignal<string>;
|
|
53
|
+
errorClass: _angular_core.InputSignal<string>;
|
|
54
|
+
hintClass: _angular_core.InputSignal<string>;
|
|
55
|
+
$userClass: _angular_core.Signal<string>;
|
|
56
|
+
$labelClass: _angular_core.Signal<string>;
|
|
57
|
+
$controlClass: _angular_core.Signal<string>;
|
|
58
|
+
$inputClass: _angular_core.Signal<string>;
|
|
59
|
+
$errorClass: _angular_core.Signal<string>;
|
|
60
|
+
$hintClass: _angular_core.Signal<string>;
|
|
61
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<EgFormAutocomplete, never>;
|
|
62
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<EgFormAutocomplete, "eg-form-autocomplete", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "controlId": { "alias": "controlId"; "required": false; "isSignal": true; }; "controlName": { "alias": "controlName"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "autoError": { "alias": "autoError"; "required": false; "isSignal": true; }; "hint": { "alias": "hint"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "emptyText": { "alias": "emptyText"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "labelClass": { "alias": "labelClass"; "required": false; "isSignal": true; }; "controlClass": { "alias": "controlClass"; "required": false; "isSignal": true; }; "inputClass": { "alias": "inputClass"; "required": false; "isSignal": true; }; "errorClass": { "alias": "errorClass"; "required": false; "isSignal": true; }; "hintClass": { "alias": "hintClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
interface EgFormAutocompleteConfig {
|
|
66
|
+
/**
|
|
67
|
+
* Global class defaults for `eg-form-autocomplete` styling slots.
|
|
68
|
+
* Each is merged under the matching per-instance `*Class` input
|
|
69
|
+
* (library base < global config < per-instance).
|
|
70
|
+
*/
|
|
71
|
+
labelClass?: string;
|
|
72
|
+
controlClass?: string;
|
|
73
|
+
inputClass?: string;
|
|
74
|
+
errorClass?: string;
|
|
75
|
+
hintClass?: string;
|
|
76
|
+
}
|
|
77
|
+
declare function provideEgFormAutocompleteConfig(config: Partial<EgFormAutocompleteConfig>): ValueProvider;
|
|
78
|
+
declare function injectEgFormAutocompleteConfig(): EgFormAutocompleteConfig;
|
|
79
|
+
|
|
80
|
+
export { EgFormAutocomplete, injectEgFormAutocompleteConfig, provideEgFormAutocompleteConfig };
|
|
81
|
+
export type { EgFormAutocompleteConfig };
|
package/form-checkbox/README.md
CHANGED
|
@@ -83,23 +83,24 @@ Selector (from source): `eg-form-checkbox` (standalone component).
|
|
|
83
83
|
|
|
84
84
|
### `EgFormCheckbox` — `eg-form-checkbox`
|
|
85
85
|
|
|
86
|
-
| Input | Type | Default | Description
|
|
87
|
-
| --------------- | --------------------- | ------- |
|
|
88
|
-
| `controlName` | `string` | `''` | `formControlName` key inside the parent `FormGroup`. **Required.**
|
|
89
|
-
| `label` | `string` | `''` | Label text next to the checkbox.
|
|
90
|
-
| `error` | `string \| undefined` | — | Error text shown when the control is invalid + touched/dirty (via `EgFormField` switching).
|
|
91
|
-
| `
|
|
92
|
-
| `
|
|
93
|
-
| `
|
|
94
|
-
| `
|
|
95
|
-
| `
|
|
96
|
-
| `
|
|
97
|
-
| `
|
|
98
|
-
| `
|
|
99
|
-
| `
|
|
100
|
-
| `
|
|
101
|
-
|
|
|
102
|
-
|
|
|
86
|
+
| Input | Type | Default | Description |
|
|
87
|
+
| --------------- | --------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
88
|
+
| `controlName` | `string` | `''` | `formControlName` key inside the parent `FormGroup`. **Required.** |
|
|
89
|
+
| `label` | `string` | `''` | Label text next to the checkbox. |
|
|
90
|
+
| `error` | `string \| undefined` | — | Error text shown when the control is invalid + touched/dirty (via `EgFormField` switching). |
|
|
91
|
+
| `autoError` | `boolean` | `true` | Auto-resolve the message from the control's `ValidationErrors` when `error` is unset. Explicit `error` always wins; `error=""` counts as unset. Global wording via `provideEgFormErrorMessages`. |
|
|
92
|
+
| `hint` | `string \| undefined` | — | Hint text shown when there is no error to display. |
|
|
93
|
+
| `controlId` | `string \| undefined` | — | Explicit control id (first priority for `effectiveId`). |
|
|
94
|
+
| `id` | `string \| undefined` | — | Fallback id (second priority). |
|
|
95
|
+
| `name` | `string \| undefined` | — | Checkbox `name` attribute (defaults to `controlName`). |
|
|
96
|
+
| `checked` | `boolean` | `false` | Initial checked state passed to `hlm-checkbox`. |
|
|
97
|
+
| `required` | `boolean` | `false` | Shows a red `*` and sets checkbox `required`. |
|
|
98
|
+
| `disabled` | `boolean` | `false` | Locks interaction via checkbox `wrapperDisabled` (does not write to the form control). |
|
|
99
|
+
| `class` | `ClassValue` | `''` | Extra host classes. |
|
|
100
|
+
| `checkboxClass` | `string` | `''` | Extra classes for `hlm-checkbox`. |
|
|
101
|
+
| `labelClass` | `string` | `''` | Extra classes for the label. |
|
|
102
|
+
| `errorClass` | `string` | `''` | Extra classes for `hlm-error`. |
|
|
103
|
+
| `hintClass` | `string` | `''` | Extra classes for `hlm-hint`. |
|
|
103
104
|
|
|
104
105
|
| Member | Description |
|
|
105
106
|
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
@@ -303,7 +304,17 @@ export class SubmitCheckComponent {
|
|
|
303
304
|
|
|
304
305
|
## Theming / CSS variables
|
|
305
306
|
|
|
306
|
-
No component-specific CSS variables. Style via `class`, `checkboxClass`, `labelClass`,
|
|
307
|
+
No component-specific CSS variables. Style per-instance via `class`, `checkboxClass`, `labelClass`, `errorClass`, `hintClass` inputs. The row layout (`flex items-center gap-1`) is fixed in the template.
|
|
308
|
+
|
|
309
|
+
Global defaults per styling slot via the wrapper config (precedence: library base < global config < per-instance):
|
|
310
|
+
|
|
311
|
+
```ts
|
|
312
|
+
import { provideEgFormCheckboxConfig } from '@egose/shadcn-theme-ng/form-checkbox';
|
|
313
|
+
|
|
314
|
+
await bootstrapApplication(App, {
|
|
315
|
+
providers: [provideEgFormCheckboxConfig({ checkboxClass: 'tw:size-5', labelClass: 'tw:font-medium' })],
|
|
316
|
+
});
|
|
317
|
+
```
|
|
307
318
|
|
|
308
319
|
## Related subpaths
|
|
309
320
|
|
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, input, computed, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
import { InjectionToken, inject, input, computed, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/forms';
|
|
4
4
|
import { FormGroupDirective, ReactiveFormsModule, ControlContainer } from '@angular/forms';
|
|
5
5
|
import { HlmLabel } from '@egose/shadcn-theme-ng-tw/label';
|
|
6
6
|
import { HlmCheckbox } from '@egose/shadcn-theme-ng-tw/checkbox';
|
|
7
|
-
import { HlmFormIdGenerator, HlmError, HlmHint } from '@egose/shadcn-theme-ng-tw/form-field';
|
|
7
|
+
import { injectEgFormErrorMessages, HlmFormIdGenerator, resolveEgFormError, HlmError, HlmHint } from '@egose/shadcn-theme-ng-tw/form-field';
|
|
8
8
|
import { EgFormField } from '@egose/shadcn-theme-ng-tw/form-field-simple';
|
|
9
9
|
import { hlm } from '@egose/shadcn-theme-ng-tw/utils';
|
|
10
10
|
|
|
11
|
+
const EgFormCheckboxConfigToken = new InjectionToken('EgFormCheckboxConfig');
|
|
12
|
+
function provideEgFormCheckboxConfig(config) {
|
|
13
|
+
return { provide: EgFormCheckboxConfigToken, useValue: { ...config } };
|
|
14
|
+
}
|
|
15
|
+
function injectEgFormCheckboxConfig() {
|
|
16
|
+
return inject(EgFormCheckboxConfigToken, { optional: true }) ?? {};
|
|
17
|
+
}
|
|
18
|
+
|
|
11
19
|
class EgFormCheckbox {
|
|
12
20
|
formGroupDirective = inject(FormGroupDirective);
|
|
21
|
+
_errorMessages = injectEgFormErrorMessages();
|
|
13
22
|
generatedId = inject(HlmFormIdGenerator).generate('eg-form-checkbox');
|
|
23
|
+
_config = injectEgFormCheckboxConfig();
|
|
14
24
|
// Classes
|
|
15
25
|
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
16
26
|
_computedClass = computed(() => hlm('', this.userClass()), /* @ts-ignore */
|
|
@@ -24,6 +34,13 @@ class EgFormCheckbox {
|
|
|
24
34
|
...(ngDevMode ? [{ debugName: "controlName" }] : /* istanbul ignore next */ []));
|
|
25
35
|
error = input(undefined, /* @ts-ignore */
|
|
26
36
|
...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
|
|
37
|
+
/**
|
|
38
|
+
* Auto-resolve the displayed message from the control's `ValidationErrors`
|
|
39
|
+
* when `error()` is unset. Explicit `error()` always wins. Set to `false`
|
|
40
|
+
* for manual-only messages.
|
|
41
|
+
*/
|
|
42
|
+
autoError = input(true, /* @ts-ignore */
|
|
43
|
+
...(ngDevMode ? [{ debugName: "autoError" }] : /* istanbul ignore next */ []));
|
|
27
44
|
hint = input(undefined, /* @ts-ignore */
|
|
28
45
|
...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
29
46
|
id = input(undefined, /* @ts-ignore */
|
|
@@ -42,33 +59,57 @@ class EgFormCheckbox {
|
|
|
42
59
|
...(ngDevMode ? [{ debugName: "errorId" }] : /* istanbul ignore next */ []));
|
|
43
60
|
hintId = computed(() => `${this.effectiveId()}-hint`, /* @ts-ignore */
|
|
44
61
|
...(ngDevMode ? [{ debugName: "hintId" }] : /* istanbul ignore next */ []));
|
|
45
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Displayed message: explicit `error()` wins; otherwise (when `autoError()`)
|
|
64
|
+
* auto-resolved from the control's `ValidationErrors`. Plain method (not a
|
|
65
|
+
* computed): `ValidationErrors` is not a signal, so the control must be read
|
|
66
|
+
* fresh on every change-detection pass.
|
|
67
|
+
*/
|
|
68
|
+
resolvedError() {
|
|
69
|
+
const explicit = this.error();
|
|
70
|
+
if (explicit)
|
|
71
|
+
return explicit;
|
|
72
|
+
if (!this.autoError())
|
|
73
|
+
return undefined;
|
|
46
74
|
const control = this.formGroupDirective.form.get(this.controlName());
|
|
47
|
-
return
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
75
|
+
return resolveEgFormError(control?.errors ?? null, this.label(), this._errorMessages);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Whether the error is surfaced: message present + control invalid +
|
|
79
|
+
* touched/dirty/submitted. Gates the visual `<hlm-error>` (and
|
|
80
|
+
* `describedBy()`, where present) so sighted and screen-reader output agree.
|
|
81
|
+
*/
|
|
82
|
+
showError() {
|
|
83
|
+
const control = this.formGroupDirective.form.get(this.controlName());
|
|
84
|
+
return (!!this.resolvedError() &&
|
|
85
|
+
!!control?.invalid &&
|
|
86
|
+
(control.dirty || control.touched || this.formGroupDirective.submitted));
|
|
87
|
+
}
|
|
88
|
+
describedBy() {
|
|
89
|
+
return this.showError() ? this.errorId() : this.hint() ? this.hintId() : null;
|
|
52
90
|
}
|
|
53
91
|
// Styling
|
|
54
92
|
checkboxClass = input('', /* @ts-ignore */
|
|
55
93
|
...(ngDevMode ? [{ debugName: "checkboxClass" }] : /* istanbul ignore next */ []));
|
|
56
94
|
labelClass = input('', /* @ts-ignore */
|
|
57
95
|
...(ngDevMode ? [{ debugName: "labelClass" }] : /* istanbul ignore next */ []));
|
|
58
|
-
|
|
59
|
-
|
|
96
|
+
errorClass = input('', /* @ts-ignore */
|
|
97
|
+
...(ngDevMode ? [{ debugName: "errorClass" }] : /* istanbul ignore next */ []));
|
|
98
|
+
hintClass = input('', /* @ts-ignore */
|
|
99
|
+
...(ngDevMode ? [{ debugName: "hintClass" }] : /* istanbul ignore next */ []));
|
|
100
|
+
// Computed styling (library base < global config < per-instance)
|
|
101
|
+
$checkboxClass = computed(() => hlm(this._config.checkboxClass, this.checkboxClass()), /* @ts-ignore */
|
|
60
102
|
...(ngDevMode ? [{ debugName: "$checkboxClass" }] : /* istanbul ignore next */ []));
|
|
61
|
-
$labelClass = computed(() => hlm(this.labelClass()), /* @ts-ignore */
|
|
103
|
+
$labelClass = computed(() => hlm(this._config.labelClass, this.labelClass()), /* @ts-ignore */
|
|
62
104
|
...(ngDevMode ? [{ debugName: "$labelClass" }] : /* istanbul ignore next */ []));
|
|
63
|
-
$errorClass =
|
|
105
|
+
$errorClass = computed(() => hlm(this._config.errorClass, this.errorClass()), /* @ts-ignore */
|
|
64
106
|
...(ngDevMode ? [{ debugName: "$errorClass" }] : /* istanbul ignore next */ []));
|
|
65
|
-
$hintClass =
|
|
107
|
+
$hintClass = computed(() => hlm(this._config.hintClass, this.hintClass()), /* @ts-ignore */
|
|
66
108
|
...(ngDevMode ? [{ debugName: "$hintClass" }] : /* istanbul ignore next */ []));
|
|
67
109
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormCheckbox, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
68
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: EgFormCheckbox, isStandalone: true, selector: "eg-form-checkbox", inputs: { userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, controlId: { classPropertyName: "controlId", publicName: "controlId", isSignal: true, isRequired: false, transformFunction: null }, controlName: { classPropertyName: "controlName", publicName: "controlName", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, checkboxClass: { classPropertyName: "checkboxClass", publicName: "checkboxClass", isSignal: true, isRequired: false, transformFunction: null }, labelClass: { classPropertyName: "labelClass", publicName: "labelClass", isSignal: true, isRequired: false, transformFunction: null },
|
|
110
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: EgFormCheckbox, isStandalone: true, selector: "eg-form-checkbox", inputs: { userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, controlId: { classPropertyName: "controlId", publicName: "controlId", isSignal: true, isRequired: false, transformFunction: null }, controlName: { classPropertyName: "controlName", publicName: "controlName", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, autoError: { classPropertyName: "autoError", publicName: "autoError", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, checkboxClass: { classPropertyName: "checkboxClass", publicName: "checkboxClass", isSignal: true, isRequired: false, transformFunction: null }, labelClass: { classPropertyName: "labelClass", publicName: "labelClass", isSignal: true, isRequired: false, transformFunction: null }, errorClass: { classPropertyName: "errorClass", publicName: "errorClass", isSignal: true, isRequired: false, transformFunction: null }, hintClass: { classPropertyName: "hintClass", publicName: "hintClass", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "_computedClass()" } }, providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }], ngImport: i0, template: `
|
|
69
111
|
@let lbl = label();
|
|
70
112
|
@let cnm = controlName();
|
|
71
|
-
@let err = error();
|
|
72
113
|
@let hnt = hint();
|
|
73
114
|
@let rqrd = required();
|
|
74
115
|
|
|
@@ -92,9 +133,9 @@ class EgFormCheckbox {
|
|
|
92
133
|
</label>
|
|
93
134
|
</div>
|
|
94
135
|
|
|
95
|
-
@if (
|
|
136
|
+
@if (showError()) {
|
|
96
137
|
<hlm-error [id]="errorId()" [class]="$errorClass()">
|
|
97
|
-
{{
|
|
138
|
+
{{ resolvedError() }}
|
|
98
139
|
</hlm-error>
|
|
99
140
|
}
|
|
100
141
|
|
|
@@ -120,7 +161,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
120
161
|
template: `
|
|
121
162
|
@let lbl = label();
|
|
122
163
|
@let cnm = controlName();
|
|
123
|
-
@let err = error();
|
|
124
164
|
@let hnt = hint();
|
|
125
165
|
@let rqrd = required();
|
|
126
166
|
|
|
@@ -144,9 +184,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
144
184
|
</label>
|
|
145
185
|
</div>
|
|
146
186
|
|
|
147
|
-
@if (
|
|
187
|
+
@if (showError()) {
|
|
148
188
|
<hlm-error [id]="errorId()" [class]="$errorClass()">
|
|
149
|
-
{{
|
|
189
|
+
{{ resolvedError() }}
|
|
150
190
|
</hlm-error>
|
|
151
191
|
}
|
|
152
192
|
|
|
@@ -158,7 +198,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
158
198
|
</eg-form-field>
|
|
159
199
|
`,
|
|
160
200
|
}]
|
|
161
|
-
}], propDecorators: { userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], controlId: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlId", required: false }] }], controlName: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlName", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], checkboxClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkboxClass", required: false }] }], labelClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelClass", required: false }] }],
|
|
201
|
+
}], propDecorators: { userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], controlId: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlId", required: false }] }], controlName: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlName", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], autoError: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoError", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], checkboxClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkboxClass", required: false }] }], labelClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelClass", required: false }] }], errorClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorClass", required: false }] }], hintClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "hintClass", required: false }] }] } });
|
|
162
202
|
|
|
163
203
|
/*
|
|
164
204
|
* Public API Surface of form-checkbox
|
|
@@ -168,5 +208,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
168
208
|
* Generated bundle index. Do not edit.
|
|
169
209
|
*/
|
|
170
210
|
|
|
171
|
-
export { EgFormCheckbox };
|
|
211
|
+
export { EgFormCheckbox, injectEgFormCheckboxConfig, provideEgFormCheckboxConfig };
|
|
172
212
|
|