@wirekyt/angular 0.0.3 → 0.0.5
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/dist/fesm2022/wirekyt-angular-accordion.mjs +359 -0
- package/dist/fesm2022/wirekyt-angular-accordion.mjs.map +1 -0
- package/dist/fesm2022/wirekyt-angular-angle-slider.mjs +383 -0
- package/dist/fesm2022/wirekyt-angular-angle-slider.mjs.map +1 -0
- package/dist/fesm2022/wirekyt-angular-collapsible.mjs +16 -16
- package/dist/fesm2022/wirekyt-angular-collapsible.mjs.map +1 -1
- package/dist/fesm2022/wirekyt-angular-field.mjs +647 -0
- package/dist/fesm2022/wirekyt-angular-field.mjs.map +1 -0
- package/dist/fesm2022/wirekyt-angular-fieldset.mjs +317 -0
- package/dist/fesm2022/wirekyt-angular-fieldset.mjs.map +1 -0
- package/dist/fesm2022/wirekyt-angular.mjs +2 -1
- package/dist/fesm2022/wirekyt-angular.mjs.map +1 -1
- package/dist/package.json +18 -2
- package/dist/types/wirekyt-angular-accordion.d.ts +139 -0
- package/dist/types/wirekyt-angular-accordion.d.ts.map +1 -0
- package/dist/types/wirekyt-angular-angle-slider.d.ts +130 -0
- package/dist/types/wirekyt-angular-angle-slider.d.ts.map +1 -0
- package/dist/types/wirekyt-angular-collapsible.d.ts +5 -5
- package/dist/types/wirekyt-angular-collapsible.d.ts.map +1 -1
- package/dist/types/wirekyt-angular-field.d.ts +205 -0
- package/dist/types/wirekyt-angular-field.d.ts.map +1 -0
- package/dist/types/wirekyt-angular-fieldset.d.ts +106 -0
- package/dist/types/wirekyt-angular-fieldset.d.ts.map +1 -0
- package/package.json +19 -3
|
@@ -0,0 +1,647 @@
|
|
|
1
|
+
import { createAnatomy } from '@wirekyt/dom/anatomy';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { InjectionToken, inject, computed, signal, input, booleanAttribute, DestroyRef, Renderer2, ElementRef, forwardRef, Directive, PLATFORM_ID, effect, untracked } from '@angular/core';
|
|
4
|
+
import { createId, bindProps } from '@wirekyt/angular';
|
|
5
|
+
import { injectFieldsetContextOptional } from '@wirekyt/angular/fieldset';
|
|
6
|
+
import { isPlatformBrowser } from '@angular/common';
|
|
7
|
+
import { autoresizeTextarea } from '@wirekyt/dom/auto-resize';
|
|
8
|
+
|
|
9
|
+
const fieldAnatomy = createAnatomy("field").parts("root", "errorText", "helperText", "input", "label", "select", "textarea", "requiredIndicator");
|
|
10
|
+
const fieldParts = fieldAnatomy.build();
|
|
11
|
+
|
|
12
|
+
const FIELD_CONTEXT = new InjectionToken("WIREKYT.FIELD_CONTEXT");
|
|
13
|
+
function injectFieldContext() {
|
|
14
|
+
return inject(FIELD_CONTEXT);
|
|
15
|
+
}
|
|
16
|
+
function injectFieldContextOptional() {
|
|
17
|
+
return inject(FIELD_CONTEXT, { optional: true });
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const dataAttr = (value) => (value ? "" : undefined);
|
|
21
|
+
const ariaAttr = (value) => (value ? "true" : undefined);
|
|
22
|
+
function useField(options) {
|
|
23
|
+
const fallbackId = createId();
|
|
24
|
+
const fieldsetContext = injectFieldsetContextOptional();
|
|
25
|
+
const propsSignal = computed(() => options.context(), /* @ts-ignore */
|
|
26
|
+
...(ngDevMode ? [{ debugName: "propsSignal" }] : /* istanbul ignore next */ []));
|
|
27
|
+
const id = computed(() => propsSignal().id ?? fallbackId, /* @ts-ignore */
|
|
28
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
29
|
+
const ids = computed(() => {
|
|
30
|
+
const provided = propsSignal().ids;
|
|
31
|
+
const baseId = id();
|
|
32
|
+
return {
|
|
33
|
+
root: provided?.root ?? `field:${baseId}`,
|
|
34
|
+
control: provided?.control ?? baseId,
|
|
35
|
+
label: provided?.label ?? `field:${baseId}:label`,
|
|
36
|
+
errorText: provided?.errorText ?? `field:${baseId}:error-text`,
|
|
37
|
+
helperText: provided?.helperText ?? `field:${baseId}:helper-text`,
|
|
38
|
+
};
|
|
39
|
+
}, /* @ts-ignore */
|
|
40
|
+
...(ngDevMode ? [{ debugName: "ids" }] : /* istanbul ignore next */ []));
|
|
41
|
+
const disabled = computed(() => {
|
|
42
|
+
if (propsSignal().disabled)
|
|
43
|
+
return true;
|
|
44
|
+
return fieldsetContext ? fieldsetContext.disabled() : false;
|
|
45
|
+
}, /* @ts-ignore */
|
|
46
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
47
|
+
const invalid = computed(() => {
|
|
48
|
+
if (propsSignal().invalid)
|
|
49
|
+
return true;
|
|
50
|
+
return fieldsetContext ? fieldsetContext.invalid() : false;
|
|
51
|
+
}, /* @ts-ignore */
|
|
52
|
+
...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
|
|
53
|
+
const readOnly = computed(() => Boolean(propsSignal().readOnly), /* @ts-ignore */
|
|
54
|
+
...(ngDevMode ? [{ debugName: "readOnly" }] : /* istanbul ignore next */ []));
|
|
55
|
+
const required = computed(() => Boolean(propsSignal().required), /* @ts-ignore */
|
|
56
|
+
...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
57
|
+
const errorTextCount = signal(0, /* @ts-ignore */
|
|
58
|
+
...(ngDevMode ? [{ debugName: "errorTextCount" }] : /* istanbul ignore next */ []));
|
|
59
|
+
const helperTextCount = signal(0, /* @ts-ignore */
|
|
60
|
+
...(ngDevMode ? [{ debugName: "helperTextCount" }] : /* istanbul ignore next */ []));
|
|
61
|
+
const explicitHasErrorText = signal(false, /* @ts-ignore */
|
|
62
|
+
...(ngDevMode ? [{ debugName: "explicitHasErrorText" }] : /* istanbul ignore next */ []));
|
|
63
|
+
const explicitHasHelperText = signal(false, /* @ts-ignore */
|
|
64
|
+
...(ngDevMode ? [{ debugName: "explicitHasHelperText" }] : /* istanbul ignore next */ []));
|
|
65
|
+
const hasErrorTextSignal = computed(() => explicitHasErrorText() || errorTextCount() > 0, /* @ts-ignore */
|
|
66
|
+
...(ngDevMode ? [{ debugName: "hasErrorTextSignal" }] : /* istanbul ignore next */ []));
|
|
67
|
+
const hasHelperTextSignal = computed(() => explicitHasHelperText() || helperTextCount() > 0, /* @ts-ignore */
|
|
68
|
+
...(ngDevMode ? [{ debugName: "hasHelperTextSignal" }] : /* istanbul ignore next */ []));
|
|
69
|
+
const ariaDescribedby = computed(() => {
|
|
70
|
+
return hasHelperTextSignal() ? ids().helperText : undefined;
|
|
71
|
+
}, /* @ts-ignore */
|
|
72
|
+
...(ngDevMode ? [{ debugName: "ariaDescribedby" }] : /* istanbul ignore next */ []));
|
|
73
|
+
const ariaErrormessage = computed(() => {
|
|
74
|
+
return hasErrorTextSignal() && invalid() ? ids().errorText : undefined;
|
|
75
|
+
}, /* @ts-ignore */
|
|
76
|
+
...(ngDevMode ? [{ debugName: "ariaErrormessage" }] : /* istanbul ignore next */ []));
|
|
77
|
+
const targetControlId = computed(() => {
|
|
78
|
+
const t = propsSignal().target;
|
|
79
|
+
return t ? `field:${id()}:item:${t}` : undefined;
|
|
80
|
+
}, /* @ts-ignore */
|
|
81
|
+
...(ngDevMode ? [{ debugName: "targetControlId" }] : /* istanbul ignore next */ []));
|
|
82
|
+
const getRootProps = () => ({
|
|
83
|
+
...fieldParts.root.attrs,
|
|
84
|
+
id: ids().root,
|
|
85
|
+
role: "group",
|
|
86
|
+
"data-disabled": dataAttr(disabled()),
|
|
87
|
+
"data-invalid": dataAttr(invalid()),
|
|
88
|
+
"data-readonly": dataAttr(readOnly()),
|
|
89
|
+
});
|
|
90
|
+
const getLabelProps = () => ({
|
|
91
|
+
...fieldParts.label.attrs,
|
|
92
|
+
id: ids().label,
|
|
93
|
+
"data-disabled": dataAttr(disabled()),
|
|
94
|
+
"data-invalid": dataAttr(invalid()),
|
|
95
|
+
"data-readonly": dataAttr(readOnly()),
|
|
96
|
+
"data-required": dataAttr(required()),
|
|
97
|
+
htmlFor: targetControlId() ?? ids().control,
|
|
98
|
+
});
|
|
99
|
+
const getControlProps = () => ({
|
|
100
|
+
"aria-describedby": ariaDescribedby(),
|
|
101
|
+
"aria-errormessage": ariaErrormessage(),
|
|
102
|
+
"aria-invalid": ariaAttr(invalid()),
|
|
103
|
+
"data-invalid": dataAttr(invalid()),
|
|
104
|
+
"data-required": dataAttr(required()),
|
|
105
|
+
"data-readonly": dataAttr(readOnly()),
|
|
106
|
+
id: ids().control,
|
|
107
|
+
required: required() || undefined,
|
|
108
|
+
disabled: disabled() || undefined,
|
|
109
|
+
readOnly: readOnly() || undefined,
|
|
110
|
+
});
|
|
111
|
+
const getInputProps = () => ({
|
|
112
|
+
...getControlProps(),
|
|
113
|
+
...fieldParts.input.attrs,
|
|
114
|
+
});
|
|
115
|
+
const getTextareaProps = () => ({
|
|
116
|
+
...getControlProps(),
|
|
117
|
+
...fieldParts.textarea.attrs,
|
|
118
|
+
});
|
|
119
|
+
const getSelectProps = () => ({
|
|
120
|
+
...getControlProps(),
|
|
121
|
+
...fieldParts.select.attrs,
|
|
122
|
+
});
|
|
123
|
+
const getHelperTextProps = () => ({
|
|
124
|
+
...fieldParts.helperText.attrs,
|
|
125
|
+
id: ids().helperText,
|
|
126
|
+
"data-disabled": dataAttr(disabled()),
|
|
127
|
+
});
|
|
128
|
+
const getErrorTextProps = () => ({
|
|
129
|
+
...fieldParts.errorText.attrs,
|
|
130
|
+
id: ids().errorText,
|
|
131
|
+
"aria-live": "polite",
|
|
132
|
+
hidden: !invalid() || undefined,
|
|
133
|
+
});
|
|
134
|
+
const getRequiredIndicatorProps = () => ({
|
|
135
|
+
...fieldParts.requiredIndicator.attrs,
|
|
136
|
+
"aria-hidden": "true",
|
|
137
|
+
hidden: !required() || undefined,
|
|
138
|
+
});
|
|
139
|
+
return {
|
|
140
|
+
get ids() {
|
|
141
|
+
return ids();
|
|
142
|
+
},
|
|
143
|
+
disabled,
|
|
144
|
+
invalid,
|
|
145
|
+
readOnly,
|
|
146
|
+
required,
|
|
147
|
+
hasErrorText: hasErrorTextSignal,
|
|
148
|
+
hasHelperText: hasHelperTextSignal,
|
|
149
|
+
ariaDescribedby,
|
|
150
|
+
setHasErrorText: (value) => explicitHasErrorText.set(value),
|
|
151
|
+
setHasHelperText: (value) => explicitHasHelperText.set(value),
|
|
152
|
+
registerErrorText: () => {
|
|
153
|
+
errorTextCount.update((count) => count + 1);
|
|
154
|
+
return () => errorTextCount.update((count) => Math.max(0, count - 1));
|
|
155
|
+
},
|
|
156
|
+
registerHelperText: () => {
|
|
157
|
+
helperTextCount.update((count) => count + 1);
|
|
158
|
+
return () => helperTextCount.update((count) => Math.max(0, count - 1));
|
|
159
|
+
},
|
|
160
|
+
getRootProps,
|
|
161
|
+
getControlProps,
|
|
162
|
+
getLabelProps,
|
|
163
|
+
getInputProps,
|
|
164
|
+
getTextareaProps,
|
|
165
|
+
getSelectProps,
|
|
166
|
+
getHelperTextProps,
|
|
167
|
+
getErrorTextProps,
|
|
168
|
+
getRequiredIndicatorProps,
|
|
169
|
+
getItemControlId: (value) => `field:${id()}:item:${value}`,
|
|
170
|
+
getItemLabelId: (value) => `field:${id()}:item:${value}:label`,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
class FieldRoot {
|
|
175
|
+
id = input(undefined, /* @ts-ignore */
|
|
176
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
177
|
+
elementIds = input(undefined, { ...(ngDevMode ? { debugName: "elementIds" } : /* istanbul ignore next */ {}), alias: "ids" });
|
|
178
|
+
required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
179
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
180
|
+
invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
181
|
+
readOnly = input(false, { ...(ngDevMode ? { debugName: "readOnly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
182
|
+
target = input(undefined, /* @ts-ignore */
|
|
183
|
+
...(ngDevMode ? [{ debugName: "target" }] : /* istanbul ignore next */ []));
|
|
184
|
+
field = useField({
|
|
185
|
+
context: () => ({
|
|
186
|
+
id: this.id(),
|
|
187
|
+
ids: this.elementIds(),
|
|
188
|
+
required: this.required(),
|
|
189
|
+
disabled: this.disabled(),
|
|
190
|
+
invalid: this.invalid(),
|
|
191
|
+
readOnly: this.readOnly(),
|
|
192
|
+
target: this.target(),
|
|
193
|
+
}),
|
|
194
|
+
});
|
|
195
|
+
get ids() {
|
|
196
|
+
return this.field.ids;
|
|
197
|
+
}
|
|
198
|
+
get hasErrorText() {
|
|
199
|
+
return this.field.hasErrorText;
|
|
200
|
+
}
|
|
201
|
+
get hasHelperText() {
|
|
202
|
+
return this.field.hasHelperText;
|
|
203
|
+
}
|
|
204
|
+
get ariaDescribedby() {
|
|
205
|
+
return this.field.ariaDescribedby;
|
|
206
|
+
}
|
|
207
|
+
setHasErrorText(value) {
|
|
208
|
+
this.field.setHasErrorText(value);
|
|
209
|
+
}
|
|
210
|
+
setHasHelperText(value) {
|
|
211
|
+
this.field.setHasHelperText(value);
|
|
212
|
+
}
|
|
213
|
+
registerErrorText() {
|
|
214
|
+
return this.field.registerErrorText();
|
|
215
|
+
}
|
|
216
|
+
registerHelperText() {
|
|
217
|
+
return this.field.registerHelperText();
|
|
218
|
+
}
|
|
219
|
+
getRootProps() {
|
|
220
|
+
return this.field.getRootProps();
|
|
221
|
+
}
|
|
222
|
+
getControlProps() {
|
|
223
|
+
return this.field.getControlProps();
|
|
224
|
+
}
|
|
225
|
+
getLabelProps() {
|
|
226
|
+
return this.field.getLabelProps();
|
|
227
|
+
}
|
|
228
|
+
getInputProps() {
|
|
229
|
+
return this.field.getInputProps();
|
|
230
|
+
}
|
|
231
|
+
getTextareaProps() {
|
|
232
|
+
return this.field.getTextareaProps();
|
|
233
|
+
}
|
|
234
|
+
getSelectProps() {
|
|
235
|
+
return this.field.getSelectProps();
|
|
236
|
+
}
|
|
237
|
+
getHelperTextProps() {
|
|
238
|
+
return this.field.getHelperTextProps();
|
|
239
|
+
}
|
|
240
|
+
getErrorTextProps() {
|
|
241
|
+
return this.field.getErrorTextProps();
|
|
242
|
+
}
|
|
243
|
+
getRequiredIndicatorProps() {
|
|
244
|
+
return this.field.getRequiredIndicatorProps();
|
|
245
|
+
}
|
|
246
|
+
getItemControlId(value) {
|
|
247
|
+
return this.field.getItemControlId(value);
|
|
248
|
+
}
|
|
249
|
+
getItemLabelId(value) {
|
|
250
|
+
return this.field.getItemLabelId(value);
|
|
251
|
+
}
|
|
252
|
+
constructor() {
|
|
253
|
+
bindProps({
|
|
254
|
+
elementRef: inject(ElementRef),
|
|
255
|
+
renderer: inject(Renderer2),
|
|
256
|
+
destroyRef: inject(DestroyRef),
|
|
257
|
+
props: () => this.field.getRootProps(),
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: FieldRoot, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
261
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.0", type: FieldRoot, isStandalone: true, selector: "[fieldRoot]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, elementIds: { classPropertyName: "elementIds", publicName: "ids", 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 }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, readOnly: { classPropertyName: "readOnly", publicName: "readOnly", isSignal: true, isRequired: false, transformFunction: null }, target: { classPropertyName: "target", publicName: "target", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: FIELD_CONTEXT, useExisting: forwardRef(() => FieldRoot) }], exportAs: ["fieldRoot"], ngImport: i0 });
|
|
262
|
+
}
|
|
263
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: FieldRoot, decorators: [{
|
|
264
|
+
type: Directive,
|
|
265
|
+
args: [{
|
|
266
|
+
selector: "[fieldRoot]",
|
|
267
|
+
standalone: true,
|
|
268
|
+
exportAs: "fieldRoot",
|
|
269
|
+
providers: [{ provide: FIELD_CONTEXT, useExisting: forwardRef(() => FieldRoot) }],
|
|
270
|
+
}]
|
|
271
|
+
}], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], elementIds: [{ type: i0.Input, args: [{ isSignal: true, alias: "ids", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], readOnly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readOnly", required: false }] }], target: [{ type: i0.Input, args: [{ isSignal: true, alias: "target", required: false }] }] } });
|
|
272
|
+
|
|
273
|
+
class FieldRootProvider {
|
|
274
|
+
value = input.required(/* @ts-ignore */
|
|
275
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
276
|
+
disabled = computed(() => this.value().disabled(), /* @ts-ignore */
|
|
277
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
278
|
+
invalid = computed(() => this.value().invalid(), /* @ts-ignore */
|
|
279
|
+
...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
|
|
280
|
+
readOnly = computed(() => this.value().readOnly(), /* @ts-ignore */
|
|
281
|
+
...(ngDevMode ? [{ debugName: "readOnly" }] : /* istanbul ignore next */ []));
|
|
282
|
+
required = computed(() => this.value().required(), /* @ts-ignore */
|
|
283
|
+
...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
284
|
+
hasErrorText = computed(() => this.value().hasErrorText(), /* @ts-ignore */
|
|
285
|
+
...(ngDevMode ? [{ debugName: "hasErrorText" }] : /* istanbul ignore next */ []));
|
|
286
|
+
hasHelperText = computed(() => this.value().hasHelperText(), /* @ts-ignore */
|
|
287
|
+
...(ngDevMode ? [{ debugName: "hasHelperText" }] : /* istanbul ignore next */ []));
|
|
288
|
+
ariaDescribedby = computed(() => this.value().ariaDescribedby(), /* @ts-ignore */
|
|
289
|
+
...(ngDevMode ? [{ debugName: "ariaDescribedby" }] : /* istanbul ignore next */ []));
|
|
290
|
+
get ids() {
|
|
291
|
+
return this.value().ids;
|
|
292
|
+
}
|
|
293
|
+
setHasErrorText(value) {
|
|
294
|
+
this.value().setHasErrorText(value);
|
|
295
|
+
}
|
|
296
|
+
setHasHelperText(value) {
|
|
297
|
+
this.value().setHasHelperText(value);
|
|
298
|
+
}
|
|
299
|
+
registerErrorText() {
|
|
300
|
+
return this.value().registerErrorText();
|
|
301
|
+
}
|
|
302
|
+
registerHelperText() {
|
|
303
|
+
return this.value().registerHelperText();
|
|
304
|
+
}
|
|
305
|
+
getRootProps() {
|
|
306
|
+
return this.value().getRootProps();
|
|
307
|
+
}
|
|
308
|
+
getControlProps() {
|
|
309
|
+
return this.value().getControlProps();
|
|
310
|
+
}
|
|
311
|
+
getLabelProps() {
|
|
312
|
+
return this.value().getLabelProps();
|
|
313
|
+
}
|
|
314
|
+
getInputProps() {
|
|
315
|
+
return this.value().getInputProps();
|
|
316
|
+
}
|
|
317
|
+
getTextareaProps() {
|
|
318
|
+
return this.value().getTextareaProps();
|
|
319
|
+
}
|
|
320
|
+
getSelectProps() {
|
|
321
|
+
return this.value().getSelectProps();
|
|
322
|
+
}
|
|
323
|
+
getHelperTextProps() {
|
|
324
|
+
return this.value().getHelperTextProps();
|
|
325
|
+
}
|
|
326
|
+
getErrorTextProps() {
|
|
327
|
+
return this.value().getErrorTextProps();
|
|
328
|
+
}
|
|
329
|
+
getRequiredIndicatorProps() {
|
|
330
|
+
return this.value().getRequiredIndicatorProps();
|
|
331
|
+
}
|
|
332
|
+
getItemControlId(value) {
|
|
333
|
+
return this.value().getItemControlId(value);
|
|
334
|
+
}
|
|
335
|
+
getItemLabelId(value) {
|
|
336
|
+
return this.value().getItemLabelId(value);
|
|
337
|
+
}
|
|
338
|
+
constructor() {
|
|
339
|
+
bindProps({
|
|
340
|
+
elementRef: inject(ElementRef),
|
|
341
|
+
renderer: inject(Renderer2),
|
|
342
|
+
destroyRef: inject(DestroyRef),
|
|
343
|
+
props: () => this.value().getRootProps(),
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: FieldRootProvider, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
347
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.0", type: FieldRootProvider, isStandalone: true, selector: "[fieldRootProvider]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null } }, providers: [{ provide: FIELD_CONTEXT, useExisting: forwardRef(() => FieldRootProvider) }], exportAs: ["fieldRootProvider"], ngImport: i0 });
|
|
348
|
+
}
|
|
349
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: FieldRootProvider, decorators: [{
|
|
350
|
+
type: Directive,
|
|
351
|
+
args: [{
|
|
352
|
+
selector: "[fieldRootProvider]",
|
|
353
|
+
standalone: true,
|
|
354
|
+
exportAs: "fieldRootProvider",
|
|
355
|
+
providers: [{ provide: FIELD_CONTEXT, useExisting: forwardRef(() => FieldRootProvider) }],
|
|
356
|
+
}]
|
|
357
|
+
}], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }] } });
|
|
358
|
+
|
|
359
|
+
class FieldLabel {
|
|
360
|
+
constructor() {
|
|
361
|
+
const context = injectFieldContext();
|
|
362
|
+
bindProps({
|
|
363
|
+
elementRef: inject(ElementRef),
|
|
364
|
+
renderer: inject(Renderer2),
|
|
365
|
+
destroyRef: inject(DestroyRef),
|
|
366
|
+
props: () => context.getLabelProps(),
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: FieldLabel, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
370
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.0", type: FieldLabel, isStandalone: true, selector: "[fieldLabel]", exportAs: ["fieldLabel"], ngImport: i0 });
|
|
371
|
+
}
|
|
372
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: FieldLabel, decorators: [{
|
|
373
|
+
type: Directive,
|
|
374
|
+
args: [{
|
|
375
|
+
selector: "[fieldLabel]",
|
|
376
|
+
standalone: true,
|
|
377
|
+
exportAs: "fieldLabel",
|
|
378
|
+
}]
|
|
379
|
+
}], ctorParameters: () => [] });
|
|
380
|
+
|
|
381
|
+
class FieldInput {
|
|
382
|
+
constructor() {
|
|
383
|
+
const context = injectFieldContext();
|
|
384
|
+
bindProps({
|
|
385
|
+
elementRef: inject(ElementRef),
|
|
386
|
+
renderer: inject(Renderer2),
|
|
387
|
+
destroyRef: inject(DestroyRef),
|
|
388
|
+
props: () => context.getInputProps(),
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: FieldInput, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
392
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.0", type: FieldInput, isStandalone: true, selector: "[fieldInput]", exportAs: ["fieldInput"], ngImport: i0 });
|
|
393
|
+
}
|
|
394
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: FieldInput, decorators: [{
|
|
395
|
+
type: Directive,
|
|
396
|
+
args: [{
|
|
397
|
+
selector: "[fieldInput]",
|
|
398
|
+
standalone: true,
|
|
399
|
+
exportAs: "fieldInput",
|
|
400
|
+
}]
|
|
401
|
+
}], ctorParameters: () => [] });
|
|
402
|
+
|
|
403
|
+
class FieldTextarea {
|
|
404
|
+
autoresize = input(false, { ...(ngDevMode ? { debugName: "autoresize" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
405
|
+
constructor() {
|
|
406
|
+
const context = injectFieldContext();
|
|
407
|
+
const elementRef = inject(ElementRef);
|
|
408
|
+
const destroyRef = inject(DestroyRef);
|
|
409
|
+
const isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
|
|
410
|
+
bindProps({
|
|
411
|
+
elementRef,
|
|
412
|
+
renderer: inject(Renderer2),
|
|
413
|
+
destroyRef,
|
|
414
|
+
props: () => ({
|
|
415
|
+
...context.getTextareaProps(),
|
|
416
|
+
style: this.autoresize() ? { resize: "none" } : undefined,
|
|
417
|
+
}),
|
|
418
|
+
});
|
|
419
|
+
if (!isBrowser)
|
|
420
|
+
return;
|
|
421
|
+
effect((onCleanup) => {
|
|
422
|
+
if (!this.autoresize())
|
|
423
|
+
return;
|
|
424
|
+
const cleanup = autoresizeTextarea(elementRef.nativeElement);
|
|
425
|
+
onCleanup(() => {
|
|
426
|
+
cleanup?.();
|
|
427
|
+
});
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: FieldTextarea, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
431
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.0", type: FieldTextarea, isStandalone: true, selector: "[fieldTextarea]", inputs: { autoresize: { classPropertyName: "autoresize", publicName: "autoresize", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["fieldTextarea"], ngImport: i0 });
|
|
432
|
+
}
|
|
433
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: FieldTextarea, decorators: [{
|
|
434
|
+
type: Directive,
|
|
435
|
+
args: [{
|
|
436
|
+
selector: "[fieldTextarea]",
|
|
437
|
+
standalone: true,
|
|
438
|
+
exportAs: "fieldTextarea",
|
|
439
|
+
}]
|
|
440
|
+
}], ctorParameters: () => [], propDecorators: { autoresize: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoresize", required: false }] }] } });
|
|
441
|
+
|
|
442
|
+
class FieldSelect {
|
|
443
|
+
constructor() {
|
|
444
|
+
const context = injectFieldContext();
|
|
445
|
+
bindProps({
|
|
446
|
+
elementRef: inject(ElementRef),
|
|
447
|
+
renderer: inject(Renderer2),
|
|
448
|
+
destroyRef: inject(DestroyRef),
|
|
449
|
+
props: () => context.getSelectProps(),
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: FieldSelect, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
453
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.0", type: FieldSelect, isStandalone: true, selector: "[fieldSelect]", exportAs: ["fieldSelect"], ngImport: i0 });
|
|
454
|
+
}
|
|
455
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: FieldSelect, decorators: [{
|
|
456
|
+
type: Directive,
|
|
457
|
+
args: [{
|
|
458
|
+
selector: "[fieldSelect]",
|
|
459
|
+
standalone: true,
|
|
460
|
+
exportAs: "fieldSelect",
|
|
461
|
+
}]
|
|
462
|
+
}], ctorParameters: () => [] });
|
|
463
|
+
|
|
464
|
+
class FieldHelperText {
|
|
465
|
+
constructor() {
|
|
466
|
+
const context = injectFieldContext();
|
|
467
|
+
effect((onCleanup) => {
|
|
468
|
+
const unregister = untracked(() => context.registerHelperText());
|
|
469
|
+
onCleanup(unregister);
|
|
470
|
+
});
|
|
471
|
+
bindProps({
|
|
472
|
+
elementRef: inject(ElementRef),
|
|
473
|
+
renderer: inject(Renderer2),
|
|
474
|
+
destroyRef: inject(DestroyRef),
|
|
475
|
+
props: () => context.getHelperTextProps(),
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: FieldHelperText, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
479
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.0", type: FieldHelperText, isStandalone: true, selector: "[fieldHelperText]", exportAs: ["fieldHelperText"], ngImport: i0 });
|
|
480
|
+
}
|
|
481
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: FieldHelperText, decorators: [{
|
|
482
|
+
type: Directive,
|
|
483
|
+
args: [{
|
|
484
|
+
selector: "[fieldHelperText]",
|
|
485
|
+
standalone: true,
|
|
486
|
+
exportAs: "fieldHelperText",
|
|
487
|
+
}]
|
|
488
|
+
}], ctorParameters: () => [] });
|
|
489
|
+
|
|
490
|
+
class FieldErrorText {
|
|
491
|
+
constructor() {
|
|
492
|
+
const context = injectFieldContext();
|
|
493
|
+
effect((onCleanup) => {
|
|
494
|
+
const unregister = untracked(() => context.registerErrorText());
|
|
495
|
+
onCleanup(unregister);
|
|
496
|
+
});
|
|
497
|
+
bindProps({
|
|
498
|
+
elementRef: inject(ElementRef),
|
|
499
|
+
renderer: inject(Renderer2),
|
|
500
|
+
destroyRef: inject(DestroyRef),
|
|
501
|
+
props: () => context.getErrorTextProps(),
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: FieldErrorText, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
505
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.0", type: FieldErrorText, isStandalone: true, selector: "[fieldErrorText]", exportAs: ["fieldErrorText"], ngImport: i0 });
|
|
506
|
+
}
|
|
507
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: FieldErrorText, decorators: [{
|
|
508
|
+
type: Directive,
|
|
509
|
+
args: [{
|
|
510
|
+
selector: "[fieldErrorText]",
|
|
511
|
+
standalone: true,
|
|
512
|
+
exportAs: "fieldErrorText",
|
|
513
|
+
}]
|
|
514
|
+
}], ctorParameters: () => [] });
|
|
515
|
+
|
|
516
|
+
class FieldRequiredIndicator {
|
|
517
|
+
constructor() {
|
|
518
|
+
const context = injectFieldContext();
|
|
519
|
+
bindProps({
|
|
520
|
+
elementRef: inject(ElementRef),
|
|
521
|
+
renderer: inject(Renderer2),
|
|
522
|
+
destroyRef: inject(DestroyRef),
|
|
523
|
+
props: () => context.getRequiredIndicatorProps(),
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: FieldRequiredIndicator, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
527
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.0", type: FieldRequiredIndicator, isStandalone: true, selector: "[fieldRequiredIndicator]", exportAs: ["fieldRequiredIndicator"], ngImport: i0 });
|
|
528
|
+
}
|
|
529
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: FieldRequiredIndicator, decorators: [{
|
|
530
|
+
type: Directive,
|
|
531
|
+
args: [{
|
|
532
|
+
selector: "[fieldRequiredIndicator]",
|
|
533
|
+
standalone: true,
|
|
534
|
+
exportAs: "fieldRequiredIndicator",
|
|
535
|
+
}]
|
|
536
|
+
}], ctorParameters: () => [] });
|
|
537
|
+
|
|
538
|
+
class FieldItem {
|
|
539
|
+
value = input.required(/* @ts-ignore */
|
|
540
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
541
|
+
parent = inject(FIELD_CONTEXT, { skipSelf: true });
|
|
542
|
+
disabled = computed(() => this.parent.disabled(), /* @ts-ignore */
|
|
543
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
544
|
+
invalid = computed(() => this.parent.invalid(), /* @ts-ignore */
|
|
545
|
+
...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
|
|
546
|
+
readOnly = computed(() => this.parent.readOnly(), /* @ts-ignore */
|
|
547
|
+
...(ngDevMode ? [{ debugName: "readOnly" }] : /* istanbul ignore next */ []));
|
|
548
|
+
required = computed(() => this.parent.required(), /* @ts-ignore */
|
|
549
|
+
...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
550
|
+
hasErrorText = computed(() => this.parent.hasErrorText(), /* @ts-ignore */
|
|
551
|
+
...(ngDevMode ? [{ debugName: "hasErrorText" }] : /* istanbul ignore next */ []));
|
|
552
|
+
hasHelperText = computed(() => this.parent.hasHelperText(), /* @ts-ignore */
|
|
553
|
+
...(ngDevMode ? [{ debugName: "hasHelperText" }] : /* istanbul ignore next */ []));
|
|
554
|
+
ariaDescribedby = computed(() => this.parent.ariaDescribedby(), /* @ts-ignore */
|
|
555
|
+
...(ngDevMode ? [{ debugName: "ariaDescribedby" }] : /* istanbul ignore next */ []));
|
|
556
|
+
controlIdSignal = computed(() => this.parent.getItemControlId(this.value()), /* @ts-ignore */
|
|
557
|
+
...(ngDevMode ? [{ debugName: "controlIdSignal" }] : /* istanbul ignore next */ []));
|
|
558
|
+
labelIdSignal = computed(() => this.parent.getItemLabelId(this.value()), /* @ts-ignore */
|
|
559
|
+
...(ngDevMode ? [{ debugName: "labelIdSignal" }] : /* istanbul ignore next */ []));
|
|
560
|
+
get ids() {
|
|
561
|
+
const parentIds = this.parent.ids;
|
|
562
|
+
return {
|
|
563
|
+
...parentIds,
|
|
564
|
+
control: this.controlIdSignal(),
|
|
565
|
+
label: this.labelIdSignal(),
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
setHasErrorText(value) {
|
|
569
|
+
this.parent.setHasErrorText(value);
|
|
570
|
+
}
|
|
571
|
+
setHasHelperText(value) {
|
|
572
|
+
this.parent.setHasHelperText(value);
|
|
573
|
+
}
|
|
574
|
+
registerErrorText() {
|
|
575
|
+
return this.parent.registerErrorText();
|
|
576
|
+
}
|
|
577
|
+
registerHelperText() {
|
|
578
|
+
return this.parent.registerHelperText();
|
|
579
|
+
}
|
|
580
|
+
getRootProps() {
|
|
581
|
+
return this.parent.getRootProps();
|
|
582
|
+
}
|
|
583
|
+
getControlProps() {
|
|
584
|
+
return {
|
|
585
|
+
...this.parent.getControlProps(),
|
|
586
|
+
id: this.controlIdSignal(),
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
getLabelProps() {
|
|
590
|
+
return {
|
|
591
|
+
...this.parent.getLabelProps(),
|
|
592
|
+
id: this.labelIdSignal(),
|
|
593
|
+
htmlFor: this.controlIdSignal(),
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
getInputProps() {
|
|
597
|
+
return {
|
|
598
|
+
...this.getControlProps(),
|
|
599
|
+
...fieldParts.input.attrs,
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
getTextareaProps() {
|
|
603
|
+
return {
|
|
604
|
+
...this.getControlProps(),
|
|
605
|
+
...fieldParts.textarea.attrs,
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
getSelectProps() {
|
|
609
|
+
return {
|
|
610
|
+
...this.getControlProps(),
|
|
611
|
+
...fieldParts.select.attrs,
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
getHelperTextProps() {
|
|
615
|
+
return this.parent.getHelperTextProps();
|
|
616
|
+
}
|
|
617
|
+
getErrorTextProps() {
|
|
618
|
+
return this.parent.getErrorTextProps();
|
|
619
|
+
}
|
|
620
|
+
getRequiredIndicatorProps() {
|
|
621
|
+
return this.parent.getRequiredIndicatorProps();
|
|
622
|
+
}
|
|
623
|
+
getItemControlId(value) {
|
|
624
|
+
return this.parent.getItemControlId(value);
|
|
625
|
+
}
|
|
626
|
+
getItemLabelId(value) {
|
|
627
|
+
return this.parent.getItemLabelId(value);
|
|
628
|
+
}
|
|
629
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: FieldItem, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
630
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.0", type: FieldItem, isStandalone: true, selector: "[fieldItem]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null } }, providers: [{ provide: FIELD_CONTEXT, useExisting: forwardRef(() => FieldItem) }], exportAs: ["fieldItem"], ngImport: i0 });
|
|
631
|
+
}
|
|
632
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: FieldItem, decorators: [{
|
|
633
|
+
type: Directive,
|
|
634
|
+
args: [{
|
|
635
|
+
selector: "[fieldItem]",
|
|
636
|
+
standalone: true,
|
|
637
|
+
exportAs: "fieldItem",
|
|
638
|
+
providers: [{ provide: FIELD_CONTEXT, useExisting: forwardRef(() => FieldItem) }],
|
|
639
|
+
}]
|
|
640
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }] } });
|
|
641
|
+
|
|
642
|
+
/**
|
|
643
|
+
* Generated bundle index. Do not edit.
|
|
644
|
+
*/
|
|
645
|
+
|
|
646
|
+
export { FIELD_CONTEXT, FieldErrorText, FieldHelperText, FieldInput, FieldItem, FieldLabel, FieldRequiredIndicator, FieldRoot, FieldRootProvider, FieldSelect, FieldTextarea, fieldAnatomy, injectFieldContext, injectFieldContextOptional, useField };
|
|
647
|
+
//# sourceMappingURL=wirekyt-angular-field.mjs.map
|