@ngrdt/forms 0.0.86 → 0.0.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/ngrdt-forms.mjs +5 -32
- package/fesm2022/ngrdt-forms.mjs.map +1 -1
- package/index.d.ts +2 -10
- package/package.json +3 -3
package/fesm2022/ngrdt-forms.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, Injector, signal, model, linkedSignal, input, booleanAttribute, computed, effect, untracked, Directive, InjectionToken,
|
|
2
|
+
import { inject, Injector, signal, model, linkedSignal, input, booleanAttribute, computed, effect, untracked, Directive, InjectionToken, forwardRef, numberAttribute, ElementRef, Pipe } from '@angular/core';
|
|
3
3
|
import { takeUntilDestroyed, toSignal, toObservable } from '@angular/core/rxjs-interop';
|
|
4
4
|
import { FormControlName, FormControlDirective, NgModel, NgControl, Validators, NG_VALUE_ACCESSOR, FormControl, FormGroup } from '@angular/forms';
|
|
5
5
|
import { RdtInteractiveElementComponent, RdtComponentOutletDirective, RdtTranslateService } from '@ngrdt/core';
|
|
@@ -236,16 +236,12 @@ const RDT_CHECKBOX_BASE_PROVIDER = new InjectionToken('RdtCheckbox');
|
|
|
236
236
|
|
|
237
237
|
class RdtCheckboxOutletDirective extends RdtFormInputOutletDirective {
|
|
238
238
|
componentClass = inject(RDT_CHECKBOX_BASE_PROVIDER);
|
|
239
|
-
checkedChange = output();
|
|
240
239
|
constructor() {
|
|
241
240
|
super();
|
|
242
241
|
this.initComponentRef();
|
|
243
|
-
this.componentRef?.instance.checkedChange.subscribe((val) => {
|
|
244
|
-
this.checkedChange.emit(val);
|
|
245
|
-
});
|
|
246
242
|
}
|
|
247
243
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: RdtCheckboxOutletDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
248
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.0", type: RdtCheckboxOutletDirective, isStandalone: true, selector: "[rdtCheckboxOutlet]",
|
|
244
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.0", type: RdtCheckboxOutletDirective, isStandalone: true, selector: "[rdtCheckboxOutlet]", providers: [
|
|
249
245
|
{
|
|
250
246
|
provide: NG_VALUE_ACCESSOR,
|
|
251
247
|
useExisting: forwardRef(() => RdtCheckboxOutletDirective),
|
|
@@ -279,29 +275,6 @@ class RdtCheckboxComponent extends RdtBaseFormInputComponent {
|
|
|
279
275
|
});
|
|
280
276
|
falseValue = linkedSignal(() => this.falseValueInput());
|
|
281
277
|
indeterminate = input(false, { transform: booleanAttribute });
|
|
282
|
-
value = input();
|
|
283
|
-
checked = input(false);
|
|
284
|
-
checkedChange = output();
|
|
285
|
-
checkedState = signal(this.checked());
|
|
286
|
-
constructor() {
|
|
287
|
-
super();
|
|
288
|
-
}
|
|
289
|
-
//Needed because of our custom boolean types
|
|
290
|
-
writeValue(value) {
|
|
291
|
-
const external = value;
|
|
292
|
-
const newInternal = this.toInternalValue(external);
|
|
293
|
-
if (newInternal !== this.checkedState()) {
|
|
294
|
-
this.checkedState.set(newInternal ?? false);
|
|
295
|
-
this.externalValue.set(value);
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
handleValueChange(newInternal) {
|
|
299
|
-
this.checkedState.set(newInternal);
|
|
300
|
-
const external = this.toExternalValue(newInternal);
|
|
301
|
-
this.onChange(external);
|
|
302
|
-
this.onTouch();
|
|
303
|
-
this.checkedChange.emit(newInternal);
|
|
304
|
-
}
|
|
305
278
|
toExternalValue(internalValue) {
|
|
306
279
|
switch (internalValue) {
|
|
307
280
|
case true:
|
|
@@ -325,12 +298,12 @@ class RdtCheckboxComponent extends RdtBaseFormInputComponent {
|
|
|
325
298
|
isEmpty(value) {
|
|
326
299
|
return value === null;
|
|
327
300
|
}
|
|
328
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: RdtCheckboxComponent, deps:
|
|
329
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.0.0", type: RdtCheckboxComponent, isStandalone: true, inputs: { trueValueInput: { classPropertyName: "trueValueInput", publicName: "trueValue", isSignal: true, isRequired: false, transformFunction: null }, falseValueInput: { classPropertyName: "falseValueInput", publicName: "falseValue", isSignal: true, isRequired: false, transformFunction: null }, indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null }
|
|
301
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: RdtCheckboxComponent, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
302
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.0.0", type: RdtCheckboxComponent, isStandalone: true, inputs: { trueValueInput: { classPropertyName: "trueValueInput", publicName: "trueValue", isSignal: true, isRequired: false, transformFunction: null }, falseValueInput: { classPropertyName: "falseValueInput", publicName: "falseValue", isSignal: true, isRequired: false, transformFunction: null }, indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0 });
|
|
330
303
|
}
|
|
331
304
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: RdtCheckboxComponent, decorators: [{
|
|
332
305
|
type: Directive
|
|
333
|
-
}]
|
|
306
|
+
}] });
|
|
334
307
|
|
|
335
308
|
const RDT_FORM_CONTROL_DATE_FORMAT = new InjectionToken('RDT_FORM_CONTROL_DATE_FORMAT', { providedIn: 'root', factory: () => 'yyyy-MM-dd' });
|
|
336
309
|
const RDT_FORM_CONTROL_DATETIME_FORMAT = new InjectionToken('RDT_FORM_CONTROL_DATETIME_FORMAT', { providedIn: 'root', factory: () => "yyyy-MM-dd'T'HH:mm:ss" });
|