rd-outer-component 0.0.72 → 0.0.74
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/esm2020/lib/modules/custom-input/custom-input.component.mjs +7 -7
- package/esm2020/lib/modules/custom-input-amount/custom-input-amount.component.mjs +5 -5
- package/esm2020/lib/modules/custom-select/custom-select.component.mjs +2 -2
- package/esm2020/lib/modules/custom-textarea/custom-textarea.component.mjs +16 -8
- package/esm2020/lib/utils/form-vaild-lang.mjs +7 -7
- package/fesm2015/rd-outer-component.mjs +31 -24
- package/fesm2015/rd-outer-component.mjs.map +1 -1
- package/fesm2020/rd-outer-component.mjs +31 -24
- package/fesm2020/rd-outer-component.mjs.map +1 -1
- package/lib/modules/custom-textarea/custom-textarea.component.d.ts +2 -1
- package/package.json +1 -1
|
@@ -246,13 +246,13 @@ function numberToBig(value, precision = 6, mode = 'cut') {
|
|
|
246
246
|
|
|
247
247
|
const translations = {
|
|
248
248
|
en: {
|
|
249
|
-
pleaseEnter: 'Please enter',
|
|
250
|
-
lengthCannotBeLess: 'Length cannot be less than the minimum length',
|
|
251
|
-
lengthCannotExceed: 'Length cannot exceed the maximum length',
|
|
249
|
+
pleaseEnter: 'Please enter ',
|
|
250
|
+
lengthCannotBeLess: ' Length cannot be less than the minimum length ',
|
|
251
|
+
lengthCannotExceed: ' Length cannot exceed the maximum length ',
|
|
252
252
|
validationFailed: 'Validation failed',
|
|
253
|
-
cannotBeLessThan: 'cannot be less than the minimum value',
|
|
254
|
-
cannotExceed: 'cannot exceed the maximum value',
|
|
255
|
-
maxDecimalPlaces: 'The maximum number of decimal places is',
|
|
253
|
+
cannotBeLessThan: ' cannot be less than the minimum value ',
|
|
254
|
+
cannotExceed: ' cannot exceed the maximum value ',
|
|
255
|
+
maxDecimalPlaces: 'The maximum number of decimal places is ',
|
|
256
256
|
clearFilter: 'Clear filter',
|
|
257
257
|
},
|
|
258
258
|
zh: {
|
|
@@ -279,22 +279,22 @@ class CustomInputComponent {
|
|
|
279
279
|
switch (firstError) {
|
|
280
280
|
case 'required':
|
|
281
281
|
return (msg ||
|
|
282
|
-
`${getTranslation(this.lang, 'pleaseEnter')}
|
|
282
|
+
`${getTranslation(this.lang, 'pleaseEnter')}${this.label.toLowerCase()}`);
|
|
283
283
|
case 'min':
|
|
284
284
|
return (msg ||
|
|
285
|
-
`${this.label}
|
|
285
|
+
`${this.label}${getTranslation(this.lang, 'cannotBeLessThan')}${formatBigNumber(this.min)}`);
|
|
286
286
|
case 'max':
|
|
287
287
|
return (msg ||
|
|
288
|
-
`${this.label} ${getTranslation(this.lang, 'cannotExceed')}
|
|
288
|
+
`${this.label} ${getTranslation(this.lang, 'cannotExceed')}${formatBigNumber(this.max)}`);
|
|
289
289
|
case 'precision':
|
|
290
290
|
return (msg ||
|
|
291
|
-
`${getTranslation(this.lang, 'maxDecimalPlaces')}
|
|
291
|
+
`${getTranslation(this.lang, 'maxDecimalPlaces')}${this.maskNumber}`);
|
|
292
292
|
case 'minLength':
|
|
293
293
|
return (msg ||
|
|
294
|
-
`${getTranslation(this.lang, 'lengthCannotBeLess')}
|
|
294
|
+
`${getTranslation(this.lang, 'lengthCannotBeLess')}${this.minLength}`);
|
|
295
295
|
case 'maxLength':
|
|
296
296
|
return (msg ||
|
|
297
|
-
`${getTranslation(this.lang, 'lengthCannotExceed')}
|
|
297
|
+
`${getTranslation(this.lang, 'lengthCannotExceed')}${this.maxLength}`);
|
|
298
298
|
case 'custom':
|
|
299
299
|
return (this.control?.errors['custom'] ||
|
|
300
300
|
getTranslation(this.lang, 'validationFailed'));
|
|
@@ -532,16 +532,20 @@ class CustomTextareaComponent {
|
|
|
532
532
|
const msg = this.errorMessages[firstError];
|
|
533
533
|
switch (firstError) {
|
|
534
534
|
case 'required':
|
|
535
|
-
return msg ||
|
|
535
|
+
return (msg ||
|
|
536
|
+
`${getTranslation(this.lang, 'pleaseEnter')}${this.label.toLowerCase()}`);
|
|
536
537
|
case 'minLength':
|
|
537
538
|
return (msg ||
|
|
538
|
-
|
|
539
|
+
`${getTranslation(this.lang, 'lengthCannotBeLess')}${this.minLength}`);
|
|
539
540
|
case 'maxLength':
|
|
540
|
-
return (msg ||
|
|
541
|
+
return (msg ||
|
|
542
|
+
`${getTranslation(this.lang, 'lengthCannotExceed')}${this.maxLength}`);
|
|
541
543
|
case 'custom':
|
|
542
|
-
return this.control?.errors['custom'] ||
|
|
544
|
+
return (this.control?.errors['custom'] ||
|
|
545
|
+
getTranslation(this.lang, 'validationFailed'));
|
|
543
546
|
default:
|
|
544
|
-
return this.errorMessages[firstError] ||
|
|
547
|
+
return (this.errorMessages[firstError] ||
|
|
548
|
+
getTranslation(this.lang, 'validationFailed'));
|
|
545
549
|
}
|
|
546
550
|
}
|
|
547
551
|
get showError() {
|
|
@@ -549,6 +553,7 @@ class CustomTextareaComponent {
|
|
|
549
553
|
}
|
|
550
554
|
constructor(cdr) {
|
|
551
555
|
this.cdr = cdr;
|
|
556
|
+
this.lang = 'en';
|
|
552
557
|
this.label = '';
|
|
553
558
|
this.name = '';
|
|
554
559
|
this.disabled = false;
|
|
@@ -640,7 +645,7 @@ class CustomTextareaComponent {
|
|
|
640
645
|
}
|
|
641
646
|
}
|
|
642
647
|
CustomTextareaComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CustomTextareaComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
643
|
-
CustomTextareaComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: CustomTextareaComponent, selector: "app-rd-textarea", inputs: { label: "label", name: "name", disabled: "disabled", required: "required", minLength: "minLength", maxLength: "maxLength", pattern: "pattern", customValidator: "customValidator", nzAutosize: "nzAutosize", errorMessages: "errorMessages" }, outputs: { valueChange: "valueChange", focus: "focus", blur: "blur" }, providers: [
|
|
648
|
+
CustomTextareaComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: CustomTextareaComponent, selector: "app-rd-textarea", inputs: { lang: "lang", label: "label", name: "name", disabled: "disabled", required: "required", minLength: "minLength", maxLength: "maxLength", pattern: "pattern", customValidator: "customValidator", nzAutosize: "nzAutosize", errorMessages: "errorMessages" }, outputs: { valueChange: "valueChange", focus: "focus", blur: "blur" }, providers: [
|
|
644
649
|
{
|
|
645
650
|
provide: NG_VALUE_ACCESSOR,
|
|
646
651
|
useExisting: forwardRef(() => CustomTextareaComponent),
|
|
@@ -666,7 +671,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
666
671
|
multi: true,
|
|
667
672
|
},
|
|
668
673
|
], template: "<div>\n <div\n class=\"rd-form-item rd-form-textarea\"\n [ngClass]=\"{ disabled: disabled, error: showError }\"\n >\n <textarea\n nz-input\n nzBorderless\n [name]=\"name\"\n [(ngModel)]=\"value\"\n [disabled]=\"disabled\"\n (ngModelChange)=\"handleValueChange($event)\"\n (blur)=\"onBlur()\"\n [nzAutosize]=\"nzAutosize\"\n placeholder=\" \"\n class=\"rd-form-item-input\"\n ></textarea>\n <div class=\"rd-form-item-label\">{{ label }}</div>\n </div>\n <div *ngIf=\"showError\" class=\"rd-form-item-error\">\n <img *ngIf=\"currentErrorMessage\" src=\"/assets/img/icon/icon-error.svg\" />\n {{ currentErrorMessage }}\n </div>\n</div>\n", styles: [":host .rd-form-textarea{height:auto;min-height:64px}:host .rd-form-textarea .rd-form-item-input{position:static;line-height:1.5;min-height:58px}:host .rd-form-textarea .rd-form-item-input:focus,:host .rd-form-textarea .rd-form-item-input:not(:placeholder-shown){padding-top:28px}\n", ".rd-form-item{position:relative;border-radius:4px;padding:2px 0;border:1px solid #e5e7eb;background-color:#fff;width:100%;height:64px}.rd-form-item .rd-form-item-select-icon{position:absolute;right:12px;top:50%;transform:translateY(-50%);width:16px;height:16px;pointer-events:none}.rd-form-item-label{position:absolute;left:16px;top:50%;transform:translateY(-50%);color:#6b7280;transition:all .3s ease;pointer-events:none;z-index:1;font-size:14px;font-weight:600;line-height:1}.rd-form-item-input{color:#030712;font-size:14px;width:100%;font-weight:500;padding:22px 16px 12px;height:52px}.rd-form-item-input:focus,.rd-form-item-input:not(:placeholder-shown){top:10px}.rd-form-item .rd-form-item-input:focus~.rd-form-item-label,.rd-form-item .rd-form-item-input:not(:placeholder-shown)~.rd-form-item-label{top:18px;font-size:12px}.rd-form-item-select{width:100%}.rd-form-item-select ::ng-deep .ant-select-selection-item{color:#030712;font-size:14px;font-weight:500}.rd-form-item.rd-selected .rd-form-item-label{top:16px;font-size:12px}.rd-form-item.rd-selected .rd-form-item-select{top:10px}.rd-form-item.rd-disabled{background-color:#f3f4f6;border-color:#d1d5db}.rd-form-item.rd-disabled .rd-form-item-label,.rd-form-item.rd-disabled .rd-form-item-input{color:#9ca3af}.rd-form-item.rd-disabled ::ng-deep .ant-select-selection-item{color:#9ca3af}.rd-form-item.rd-error{border-color:#e51c36}.rd-form-item-error{color:#d2152e;font-size:12px;font-weight:500;display:flex;align-items:center;gap:4px;margin-top:4px}.rd-form-item-error img{width:16px}.rd-form-number-item{position:relative;border-radius:4px;padding:12px 16px;background-color:#fff;border:1px solid #e5e7eb;width:100%}.rd-form-number-item .rd-item-label{color:#6b7280;font-size:12px;font-weight:600}.rd-form-number-item .rd-item-content{display:flex;align-items:center;font-size:32px;font-weight:600;line-height:48px;color:#9ca3af}.rd-form-number-item .rd-item-content-value{flex:1;font-size:32px;font-weight:600;line-height:48px;color:#030712;border:none;padding:4px 0}.rd-form-number-item .rd-item-content-value:focus,.rd-form-number-item .rd-item-content-value:active,.rd-form-number-item .rd-item-content-value:hover{outline:none;box-shadow:none}.rd-form-number-item .rd-item-content-value ::ng-deep .ant-input-number-handler-wrap{display:none}.rd-form-number-item .rd-item-content-value ::ng-deep .ant-input-number-input{font-size:32px;font-weight:600;line-height:48px}.rd-form-number-item .rd-item-content-value ::ng-deep .ant-input-number-input::placeholder{color:#9ca3af}.rd-form-number-item .rd-item-content-symbol{flex-shrink:0}.rd-form-number-item ::ng-deep .rd-item-warning{font-weight:500;font-size:12px;color:#6b7280;margin-top:4px;padding:0 12px}.rd-form-number-item.rd-disabled{background-color:#f3f4f6;border-color:#d1d5db}.rd-form-number-item.rd-disabled .rd-item-label,.rd-form-number-item.rd-disabled .rd-item-content-value{color:#9ca3af}.rd-form-number-item.rd-error{border-color:#e51c36}\n"] }]
|
|
669
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: {
|
|
674
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { lang: [{
|
|
675
|
+
type: Input
|
|
676
|
+
}], label: [{
|
|
670
677
|
type: Input
|
|
671
678
|
}], name: [{
|
|
672
679
|
type: Input
|
|
@@ -742,16 +749,16 @@ class CustomInputAmountComponent {
|
|
|
742
749
|
switch (firstError) {
|
|
743
750
|
case 'required':
|
|
744
751
|
return (msg ||
|
|
745
|
-
`${getTranslation(this.lang, 'pleaseEnter')}
|
|
752
|
+
`${getTranslation(this.lang, 'pleaseEnter')}${this.label.toLowerCase()}`);
|
|
746
753
|
case 'min':
|
|
747
754
|
return (msg ||
|
|
748
|
-
`${this.label}
|
|
755
|
+
`${this.label}${getTranslation(this.lang, 'cannotBeLessThan')}${formatBigNumber(this.min)}`);
|
|
749
756
|
case 'max':
|
|
750
757
|
return (msg ||
|
|
751
|
-
`${this.label} ${getTranslation(this.lang, 'cannotExceed')}
|
|
758
|
+
`${this.label} ${getTranslation(this.lang, 'cannotExceed')}${formatBigNumber(this.max)}`);
|
|
752
759
|
case 'precision':
|
|
753
760
|
return (msg ||
|
|
754
|
-
`${getTranslation(this.lang, 'maxDecimalPlaces')}
|
|
761
|
+
`${getTranslation(this.lang, 'maxDecimalPlaces')}${this.nzPrecision}`);
|
|
755
762
|
case 'custom':
|
|
756
763
|
return (this.control?.errors['custom'] ||
|
|
757
764
|
getTranslation(this.lang, 'validationFailed'));
|
|
@@ -1068,7 +1075,7 @@ class CustomSelectComponent {
|
|
|
1068
1075
|
switch (firstError) {
|
|
1069
1076
|
case 'required':
|
|
1070
1077
|
return (msg ||
|
|
1071
|
-
`${getTranslation(this.lang, 'pleaseEnter')}
|
|
1078
|
+
`${getTranslation(this.lang, 'pleaseEnter')}${this.label.toLowerCase()}`);
|
|
1072
1079
|
case 'custom':
|
|
1073
1080
|
return (this.control?.errors['custom'] ||
|
|
1074
1081
|
getTranslation(this.lang, 'validationFailed'));
|