@lesterarte/sefin-ui 0.0.17 → 0.0.18
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.
|
@@ -3816,13 +3816,27 @@ class TextareaComponent {
|
|
|
3816
3816
|
class = '';
|
|
3817
3817
|
/** Custom validation function */
|
|
3818
3818
|
customValidator;
|
|
3819
|
+
/** Initial value for the textarea (for non-reactive forms) */
|
|
3820
|
+
set value(val) {
|
|
3821
|
+
this._value = val || '';
|
|
3822
|
+
if (this.textareaRef?.nativeElement) {
|
|
3823
|
+
this.textareaRef.nativeElement.value = this._value;
|
|
3824
|
+
if (this.autoResize) {
|
|
3825
|
+
setTimeout(() => this.adjustHeight(), 0);
|
|
3826
|
+
}
|
|
3827
|
+
}
|
|
3828
|
+
this.validateField();
|
|
3829
|
+
}
|
|
3830
|
+
get value() {
|
|
3831
|
+
return this._value;
|
|
3832
|
+
}
|
|
3819
3833
|
/** Event emitted when the value changes */
|
|
3820
3834
|
valueChange = new EventEmitter();
|
|
3821
3835
|
/** Event emitted when the textarea is focused */
|
|
3822
3836
|
focused = new EventEmitter();
|
|
3823
3837
|
/** Event emitted when the textarea is blurred */
|
|
3824
3838
|
blurred = new EventEmitter();
|
|
3825
|
-
|
|
3839
|
+
_value = '';
|
|
3826
3840
|
isFocused = false;
|
|
3827
3841
|
hasError = false;
|
|
3828
3842
|
internalErrorMessage = '';
|
|
@@ -3837,8 +3851,8 @@ class TextareaComponent {
|
|
|
3837
3851
|
ngAfterViewInit() {
|
|
3838
3852
|
if (this.textareaRef?.nativeElement) {
|
|
3839
3853
|
// Set initial value if provided
|
|
3840
|
-
if (this.
|
|
3841
|
-
this.textareaRef.nativeElement.value = this.
|
|
3854
|
+
if (this._value) {
|
|
3855
|
+
this.textareaRef.nativeElement.value = this._value;
|
|
3842
3856
|
}
|
|
3843
3857
|
// Initialize auto-resize if enabled
|
|
3844
3858
|
if (this.autoResize) {
|
|
@@ -3857,9 +3871,9 @@ class TextareaComponent {
|
|
|
3857
3871
|
}
|
|
3858
3872
|
onInput(event) {
|
|
3859
3873
|
const target = event.target;
|
|
3860
|
-
this.
|
|
3861
|
-
this.onChange(this.
|
|
3862
|
-
this.valueChange.emit(this.
|
|
3874
|
+
this._value = target.value;
|
|
3875
|
+
this.onChange(this._value);
|
|
3876
|
+
this.valueChange.emit(this._value);
|
|
3863
3877
|
this.validateField();
|
|
3864
3878
|
// Auto-resize if enabled
|
|
3865
3879
|
if (this.autoResize) {
|
|
@@ -3903,7 +3917,7 @@ class TextareaComponent {
|
|
|
3903
3917
|
if (this.disabled || this.readonly) {
|
|
3904
3918
|
return;
|
|
3905
3919
|
}
|
|
3906
|
-
const value = this.
|
|
3920
|
+
const value = this._value || '';
|
|
3907
3921
|
// Required validation
|
|
3908
3922
|
if (this.required && !value.trim()) {
|
|
3909
3923
|
this.hasError = true;
|
|
@@ -3957,7 +3971,7 @@ class TextareaComponent {
|
|
|
3957
3971
|
return this.errorMessage || this.internalErrorMessage;
|
|
3958
3972
|
}
|
|
3959
3973
|
get characterCount() {
|
|
3960
|
-
return this.
|
|
3974
|
+
return this._value?.length || 0;
|
|
3961
3975
|
}
|
|
3962
3976
|
get textareaClasses() {
|
|
3963
3977
|
return [
|
|
@@ -3976,9 +3990,9 @@ class TextareaComponent {
|
|
|
3976
3990
|
}
|
|
3977
3991
|
// ControlValueAccessor implementation
|
|
3978
3992
|
writeValue(value) {
|
|
3979
|
-
this.
|
|
3993
|
+
this._value = value || '';
|
|
3980
3994
|
if (this.textareaRef?.nativeElement) {
|
|
3981
|
-
this.textareaRef.nativeElement.value = this.
|
|
3995
|
+
this.textareaRef.nativeElement.value = this._value;
|
|
3982
3996
|
if (this.autoResize) {
|
|
3983
3997
|
setTimeout(() => this.adjustHeight(), 0);
|
|
3984
3998
|
}
|
|
@@ -4046,7 +4060,7 @@ class TextareaComponent {
|
|
|
4046
4060
|
return Object.keys(errors).length > 0 ? errors : null;
|
|
4047
4061
|
}
|
|
4048
4062
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: TextareaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4049
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: TextareaComponent, isStandalone: true, selector: "sefin-textarea", inputs: { variant: "variant", size: "size", placeholder: "placeholder", hint: "hint", errorMessage: "errorMessage", required: "required", disabled: "disabled", readonly: "readonly", maxLength: "maxLength", minLength: "minLength", pattern: "pattern", rows: "rows", cols: "cols", autoResize: "autoResize", minHeight: "minHeight", maxHeight: "maxHeight", showCounter: "showCounter", autocomplete: "autocomplete", name: "name", id: "id", class: "class", customValidator: "customValidator" }, outputs: { valueChange: "valueChange", focused: "focused", blurred: "blurred" }, providers: [
|
|
4063
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: TextareaComponent, isStandalone: true, selector: "sefin-textarea", inputs: { variant: "variant", size: "size", placeholder: "placeholder", hint: "hint", errorMessage: "errorMessage", required: "required", disabled: "disabled", readonly: "readonly", maxLength: "maxLength", minLength: "minLength", pattern: "pattern", rows: "rows", cols: "cols", autoResize: "autoResize", minHeight: "minHeight", maxHeight: "maxHeight", showCounter: "showCounter", autocomplete: "autocomplete", name: "name", id: "id", class: "class", customValidator: "customValidator", value: "value" }, outputs: { valueChange: "valueChange", focused: "focused", blurred: "blurred" }, providers: [
|
|
4050
4064
|
{
|
|
4051
4065
|
provide: NG_VALUE_ACCESSOR,
|
|
4052
4066
|
useExisting: forwardRef(() => TextareaComponent),
|
|
@@ -4120,6 +4134,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
|
|
|
4120
4134
|
type: Input
|
|
4121
4135
|
}], customValidator: [{
|
|
4122
4136
|
type: Input
|
|
4137
|
+
}], value: [{
|
|
4138
|
+
type: Input
|
|
4123
4139
|
}], valueChange: [{
|
|
4124
4140
|
type: Output
|
|
4125
4141
|
}], focused: [{
|