@acorex/cdk 20.1.25 → 20.1.26
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/common/index.d.ts
CHANGED
|
@@ -297,7 +297,7 @@ declare class MXInteractiveComponent extends MXBaseComponent {
|
|
|
297
297
|
*/
|
|
298
298
|
protected onTouchedCallback: () => void;
|
|
299
299
|
/**
|
|
300
|
-
* Registers a callback function
|
|
300
|
+
* Registers a touched callback function (ControlValueAccessor method).
|
|
301
301
|
*
|
|
302
302
|
* @param fn - The callback function to register.
|
|
303
303
|
*/
|
|
@@ -413,15 +413,54 @@ declare class MXValueComponent<T = any> extends MXInteractiveComponent implement
|
|
|
413
413
|
validationRulesChange: EventEmitter<AXFormValidationRule[]>;
|
|
414
414
|
private validationRules;
|
|
415
415
|
get isRequired(): boolean;
|
|
416
|
+
/**
|
|
417
|
+
* Adds a validation rule.
|
|
418
|
+
*
|
|
419
|
+
* @param rule - The validation rule to add.
|
|
420
|
+
*/
|
|
416
421
|
addValidationRule(rule: AXFormValidationRule): void;
|
|
422
|
+
/**
|
|
423
|
+
* Removes a validation rule.
|
|
424
|
+
*
|
|
425
|
+
* @param ruleToRemove - The validation rule to remove.
|
|
426
|
+
*/
|
|
417
427
|
removeValidationRule(ruleToRemove: AXFormValidationRule): void;
|
|
428
|
+
/**
|
|
429
|
+
* Validates the component.
|
|
430
|
+
*
|
|
431
|
+
* @returns Promise<AXValidationSummary> - Validation result.
|
|
432
|
+
*/
|
|
418
433
|
validate(): Promise<AXValidationSummary>;
|
|
419
434
|
protected setState(state: AXComponentState, ...args: any[]): void;
|
|
420
435
|
protected onChangeCallback: (value: T) => void;
|
|
436
|
+
/**
|
|
437
|
+
* Registers a change callback function (ControlValueAccessor method).
|
|
438
|
+
*
|
|
439
|
+
* @param fn - The callback function to register.
|
|
440
|
+
*/
|
|
421
441
|
registerOnChange(fn: (value: T) => void): void;
|
|
442
|
+
/**
|
|
443
|
+
* Writes a value to the component (ControlValueAccessor method).
|
|
444
|
+
*
|
|
445
|
+
* @param value - The value to write.
|
|
446
|
+
*/
|
|
422
447
|
writeValue(value: T): void;
|
|
448
|
+
/**
|
|
449
|
+
* Commits a value with optional user interaction flag.
|
|
450
|
+
*
|
|
451
|
+
* @param value - The value to commit.
|
|
452
|
+
* @param u - Optional flag indicating if this is a user interaction.
|
|
453
|
+
*/
|
|
423
454
|
commitValue(value: T, u?: boolean): void;
|
|
455
|
+
/**
|
|
456
|
+
* Resets the component value.
|
|
457
|
+
*
|
|
458
|
+
* @param e - Optional flag indicating if this is a user interaction.
|
|
459
|
+
*/
|
|
424
460
|
reset(e?: boolean): void;
|
|
461
|
+
/**
|
|
462
|
+
* Resets validation errors.
|
|
463
|
+
*/
|
|
425
464
|
resetErrors(): void;
|
|
426
465
|
static ɵfac: i0.ɵɵFactoryDeclaration<MXValueComponent<any>, never>;
|
|
427
466
|
static ɵprov: i0.ɵɵInjectableDeclaration<MXValueComponent<any>>;
|
|
@@ -439,7 +439,7 @@ class MXInteractiveComponent extends MXBaseComponent {
|
|
|
439
439
|
// }
|
|
440
440
|
}
|
|
441
441
|
/**
|
|
442
|
-
* Registers a callback function
|
|
442
|
+
* Registers a touched callback function (ControlValueAccessor method).
|
|
443
443
|
*
|
|
444
444
|
* @param fn - The callback function to register.
|
|
445
445
|
*/
|
|
@@ -667,10 +667,20 @@ class MXValueComponent extends MXInteractiveComponent {
|
|
|
667
667
|
get isRequired() {
|
|
668
668
|
return this.validationRules?.some((c) => c.rule == 'required');
|
|
669
669
|
}
|
|
670
|
+
/**
|
|
671
|
+
* Adds a validation rule.
|
|
672
|
+
*
|
|
673
|
+
* @param rule - The validation rule to add.
|
|
674
|
+
*/
|
|
670
675
|
addValidationRule(rule) {
|
|
671
676
|
this.validationRules.push(rule);
|
|
672
677
|
this.validationRulesChange.emit(this.validationRules);
|
|
673
678
|
}
|
|
679
|
+
/**
|
|
680
|
+
* Removes a validation rule.
|
|
681
|
+
*
|
|
682
|
+
* @param ruleToRemove - The validation rule to remove.
|
|
683
|
+
*/
|
|
674
684
|
removeValidationRule(ruleToRemove) {
|
|
675
685
|
this.validationRules = this.validationRules.filter((r) => {
|
|
676
686
|
if (r.rule !== ruleToRemove.rule) {
|
|
@@ -684,6 +694,11 @@ class MXValueComponent extends MXInteractiveComponent {
|
|
|
684
694
|
this.validationRulesChange.emit(this.validationRules);
|
|
685
695
|
this.setState('clear');
|
|
686
696
|
}
|
|
697
|
+
/**
|
|
698
|
+
* Validates the component.
|
|
699
|
+
*
|
|
700
|
+
* @returns Promise<AXValidationSummary> - Validation result.
|
|
701
|
+
*/
|
|
687
702
|
async validate() {
|
|
688
703
|
const container_classes = ['ax-editor-container', 'ax-checkbox', 'ax-radio'];
|
|
689
704
|
const container = container_classes.some((c) => this.getHostElement().classList.contains(c))
|
|
@@ -752,12 +767,28 @@ class MXValueComponent extends MXInteractiveComponent {
|
|
|
752
767
|
this.cdr.markForCheck();
|
|
753
768
|
}
|
|
754
769
|
}
|
|
770
|
+
/**
|
|
771
|
+
* Registers a change callback function (ControlValueAccessor method).
|
|
772
|
+
*
|
|
773
|
+
* @param fn - The callback function to register.
|
|
774
|
+
*/
|
|
755
775
|
registerOnChange(fn) {
|
|
756
776
|
this.onChangeCallback = fn;
|
|
757
777
|
}
|
|
778
|
+
/**
|
|
779
|
+
* Writes a value to the component (ControlValueAccessor method).
|
|
780
|
+
*
|
|
781
|
+
* @param value - The value to write.
|
|
782
|
+
*/
|
|
758
783
|
writeValue(value) {
|
|
759
784
|
this.value = value;
|
|
760
785
|
}
|
|
786
|
+
/**
|
|
787
|
+
* Commits a value with optional user interaction flag.
|
|
788
|
+
*
|
|
789
|
+
* @param value - The value to commit.
|
|
790
|
+
* @param u - Optional flag indicating if this is a user interaction.
|
|
791
|
+
*/
|
|
761
792
|
commitValue(value, u = false) {
|
|
762
793
|
if (u) {
|
|
763
794
|
this.markAsTouched();
|
|
@@ -766,9 +797,17 @@ class MXValueComponent extends MXInteractiveComponent {
|
|
|
766
797
|
}
|
|
767
798
|
this.writeValue(value);
|
|
768
799
|
}
|
|
800
|
+
/**
|
|
801
|
+
* Resets the component value.
|
|
802
|
+
*
|
|
803
|
+
* @param e - Optional flag indicating if this is a user interaction.
|
|
804
|
+
*/
|
|
769
805
|
reset(e = false) {
|
|
770
806
|
this.commitValue(null, e);
|
|
771
807
|
}
|
|
808
|
+
/**
|
|
809
|
+
* Resets validation errors.
|
|
810
|
+
*/
|
|
772
811
|
resetErrors() {
|
|
773
812
|
this.setState('clear');
|
|
774
813
|
}
|