@sbcore/ng-absolute-validator 14.0.2 → 14.1.0

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.
Files changed (41) hide show
  1. package/README.md +14 -16
  2. package/esm2020/i18n/ar.mjs +68 -0
  3. package/esm2020/i18n/index.mjs +12 -0
  4. package/esm2020/lib/common.utils.mjs +12 -1
  5. package/esm2020/lib/config-interface.mjs +1 -1
  6. package/esm2020/lib/constant.mjs +2 -2
  7. package/esm2020/lib/directive/error-trigger/error-trigger-on.directive.mjs +1 -1
  8. package/esm2020/lib/interface.mjs +2 -14
  9. package/esm2020/lib/lang.config.mjs +26 -0
  10. package/esm2020/lib/ng-absolute-validator.component.mjs +5 -3
  11. package/esm2020/lib/ng-absolute-validator.module.mjs +10 -22
  12. package/esm2020/lib/ng-absolute-validator.service.mjs +14 -6
  13. package/esm2020/lib/pipe/index.mjs +2 -0
  14. package/esm2020/lib/pipe/replaceWith/replace-with.pipe.mjs +17 -0
  15. package/esm2020/lib/services/http.request.service.mjs +4 -3
  16. package/esm2020/lib/services/messages-builder.service.mjs +30 -33
  17. package/esm2020/lib/services/reactive.validate.mjs +4 -3
  18. package/esm2020/lib/services/utils.service.mjs +4 -3
  19. package/esm2020/lib/services/validate-rule.service.mjs +15 -10
  20. package/esm2020/lib/transator.loader.mjs +35 -24
  21. package/esm2020/public-api.mjs +2 -1
  22. package/fesm2015/sbcore-ng-absolute-validator.mjs +213 -97
  23. package/fesm2015/sbcore-ng-absolute-validator.mjs.map +1 -1
  24. package/fesm2020/sbcore-ng-absolute-validator.mjs +212 -99
  25. package/fesm2020/sbcore-ng-absolute-validator.mjs.map +1 -1
  26. package/i18n/ar.d.ts +68 -0
  27. package/i18n/index.d.ts +11 -0
  28. package/lib/common.utils.d.ts +4 -0
  29. package/lib/config-interface.d.ts +1 -2
  30. package/lib/constant.d.ts +1 -1
  31. package/lib/interface.d.ts +7 -3
  32. package/lib/lang.config.d.ts +1 -0
  33. package/lib/ng-absolute-validator.module.d.ts +6 -9
  34. package/lib/ng-absolute-validator.service.d.ts +8 -3
  35. package/lib/pipe/index.d.ts +1 -0
  36. package/lib/pipe/replaceWith/replace-with.pipe.d.ts +7 -0
  37. package/lib/services/messages-builder.service.d.ts +5 -3
  38. package/lib/services/validate-rule.service.d.ts +4 -2
  39. package/lib/transator.loader.d.ts +5 -3
  40. package/package.json +2 -2
  41. package/public-api.d.ts +1 -0
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, Injectable, Inject, EventEmitter, Component, Optional, Input, Output, ContentChild, Directive, NgModule, APP_INITIALIZER } from '@angular/core';
3
- import { Subject, debounceTime, takeUntil, of, from, distinctUntilChanged, switchMap, first, map as map$1, firstValueFrom } from 'rxjs';
2
+ import { InjectionToken, Injectable, Inject, EventEmitter, Component, Optional, Input, Output, ContentChild, Directive, NgModule, Pipe, APP_INITIALIZER } from '@angular/core';
3
+ import { Subject, takeUntil, debounceTime, of, from, distinctUntilChanged, switchMap, first, map as map$1, firstValueFrom } from 'rxjs';
4
4
  import * as i1$2 from '@angular/forms';
5
5
  import { FormGroupDirective, NgForm, NG_VALIDATORS, NG_ASYNC_VALIDATORS } from '@angular/forms';
6
6
  import * as i1 from '@ngx-translate/core';
@@ -85,11 +85,11 @@ const GlobalConstant = {
85
85
  { min: 76, color: '#5cb85c' }
86
86
  ]
87
87
  };
88
+ const I18N_LANG_PREFIX = 'NG_ABSOLUTE_VALIDATOR';
88
89
  const CUSTOM_OBJECT_NAME = 'ng_abs';
89
90
  const DEFAULT_STRENGTH_COLOR = '#6c757d';
90
91
  const DEFAULT_DATE_FORMAT = 'dd-MM-yyyy';
91
92
  const DEFAULT_LOCALE_LANG = 'en';
92
- const SUPPORTED_LOCALE_LANGS = ['ar', 'bn', 'de', 'en', 'es', 'fr', 'hi', 'ja', 'pt', 'ru', 'zh'];
93
93
  const DEFAULT_TRIGGER_STATE = ['touched', 'dirty'];
94
94
  const EMIT_METHODS = ['credit_card', 'debit_card', 'strength'];
95
95
  const CROSS_FIELD_VALIDATORS = [
@@ -148,17 +148,25 @@ class NgAbsoluteValidatorService {
148
148
  return this.VLIDATOR_CONFIG.delayLoader || 0;
149
149
  }
150
150
  /**
151
- * @description This method state of triger validation
152
- * @returns boolean
153
- **/
151
+ * @description This method state of triger validation
152
+ * @returns boolean
153
+ **/
154
154
  get showErrorOn() {
155
155
  return (this.VLIDATOR_CONFIG.showErrorOn || DEFAULT_TRIGGER_STATE);
156
156
  }
157
+ /**
158
+ * @description Display all validation error instande of latest one
159
+ * @returns boolean
160
+ **/
161
+ get showAllErrors() {
162
+ return this.VLIDATOR_CONFIG.showAllErrors ?? false;
163
+ }
157
164
  }
158
165
  NgAbsoluteValidatorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NgAbsoluteValidatorService, deps: [{ token: LIB_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable });
159
- NgAbsoluteValidatorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NgAbsoluteValidatorService });
166
+ NgAbsoluteValidatorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NgAbsoluteValidatorService, providedIn: 'root' });
160
167
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NgAbsoluteValidatorService, decorators: [{
161
- type: Injectable
168
+ type: Injectable,
169
+ args: [{ providedIn: 'root' }]
162
170
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
163
171
  type: Inject,
164
172
  args: [LIB_CONFIG]
@@ -195,6 +203,8 @@ class NgAbsoluteValidatorComponent {
195
203
  this.isStrengthBarOn = this.avs.strengthBar;
196
204
  this.strength_color = this.avs.strengthColor;
197
205
  this.doCheckAndValidate();
206
+ this.translate.onLangChange.pipe(takeUntil(this.destroy$))
207
+ .subscribe(() => this.emitedData(this.formInstance));
198
208
  }
199
209
  get errorContext() {
200
210
  return {
@@ -311,10 +321,10 @@ class NgAbsoluteValidatorComponent {
311
321
  }
312
322
  }
313
323
  NgAbsoluteValidatorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NgAbsoluteValidatorComponent, deps: [{ token: NgAbsoluteValidatorService }, { token: i1.TranslateService }, { token: FormGroupDirective, optional: true }, { token: NgForm, optional: true }], target: i0.ɵɵFactoryTarget.Component });
314
- NgAbsoluteValidatorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: NgAbsoluteValidatorComponent, selector: "ng-absolute-validator", inputs: { formInstance: "formInstance", loader: "loader", message: "message", defaultError: "defaultError", showErrorOn: "showErrorOn" }, outputs: { onValid: "onValid", onValidate: "onValidate" }, queries: [{ propertyName: "absError", first: true, predicate: ["absError"], descendants: true }, { propertyName: "absProgress", first: true, predicate: ["absProgress"], descendants: true }, { propertyName: "absLoader", first: true, predicate: ["absLoader"], descendants: true }], ngImport: i0, template: "<ng-container *ngIf=\"formInstance.pending && isLoaderOn\">\r\n <div class=\"av-loading-panel\">\r\n <ng-template [ngTemplateOutlet]=\"absLoader ?? absFbLoader\"></ng-template>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"(formInstance.control?.ng_abs?.strength || formInstance?.ng_abs?.strength ) && isStrengthBarOn && indicatorScore > 0\">\r\n <div class=\"av-progress\">\r\n <ng-template [ngTemplateOutlet]=\"absProgress ?? absFbProgress\" [ngTemplateOutletContext]=\"progressContext\"></ng-template>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"isDisplay && defaultError && errorMessage.length > 0\">\r\n <div class=\"av-error-panel\">\r\n <ng-template [ngTemplateOutlet]=\"absError ?? absFbError\"[ngTemplateOutletContext]=\"errorContext\"></ng-template>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-template #absFbLoader>\r\n <div class=\"av-loading\" >\r\n <div><div></div></div>\r\n <div><div></div></div>\r\n <div><div></div></div>\r\n <div><div></div></div>\r\n <div><div></div></div>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #absFbProgress>\r\n <div\r\n\t\tclass=\"av-progress-bar\"\r\n\t\trole=\"progressbar\"\r\n\t\taria-valuenow=\"40\"\r\n\t\taria-valuemin=\"0\"\r\n\t\taria-valuemax=\"100\"\r\n\t\t[style.background-color]=\"indicatorColor\"\r\n\t\t[style.width.%]=\"indicatorScore\">\r\n\t</div>\r\n</ng-template>\r\n\r\n<ng-template #absFbError>\r\n <ul class=\"av-errors-list\">\r\n <ng-container *ngFor=\"let error of errorMessage\">\r\n <li [innerText]=\"error\"></li>\r\n </ng-container>\r\n </ul>\r\n</ng-template>\r\n", styles: [".av-progress{display:flex}.av-progress-bar{margin-top:5px;float:left;width:0%;height:3px;font-size:12px;line-height:20px;color:#fff;text-align:center;background-color:#337ab7;box-shadow:inset 0 -1px #00000026;transition:width .6s ease}.av-progress-bar.active,.av-progress.active .av-progress-bar{animation:av-progress-bar-stripes 2s linear infinite}.av-progress-bar-striped,.av-progress-striped .av-progress-bar{background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-size:40px 40px}.av-progress-bar-success{background-color:#5cb85c}.av-progress-bar-info{background-color:#5bc0de}.av-progress-bar-warning{background-color:#f0ad4e}.av-progress-bar-danger{background-color:#d9534f}.av-errors-list{margin:2px 0 3px;padding:0;list-style-type:none;font-size:.9em;color:#dc3545;line-height:1.6em;opacity:1;transition:all .3s ease-in;-o-transition:all .3s ease-in;-moz-transition:all .3s ease-in;-webkit-transition:all .3s ease-in}@keyframes av-loading{0%{left:32px;transform:scale(0)}25%{left:32px;transform:scale(1)}50%{left:100px}75%{left:168px;transform:scale(1)}to{left:168px;transform:scale(0)}}.av-loading{position:relative;width:100%;height:100%}.av-loading>div{position:absolute;transform:translate(-50%,-50%);width:40px;height:40px}.av-loading div>div{width:40px;height:40px;border-radius:50%;background:#f00;position:absolute;top:100px;left:32px;animation:av-loading .8s cubic-bezier(0,.5,.5,1) infinite forwards}.av-loading div:nth-child(1) div{animation:av-loading-2 .8s cubic-bezier(0,.5,.5,1) infinite forwards;background:#dce4eb}.av-loading div:nth-child(2) div{animation-delay:-.4s;background:#bbcedd}.av-loading div:nth-child(3) div{animation-delay:-.2s;background:#85a2b6}.av-loading div:nth-child(4) div{animation-delay:0s;background:#fdfdfd}.av-loading div:nth-child(5) div{animation:av-loading-3 .8s cubic-bezier(0,.5,.5,1) infinite forwards;background:#dce4eb}.av-loading{width:32px!important;height:32px!important;transform:translate(-16px,-16px) scale(.16) translate(16px,16px)}\n"], dependencies: [{ kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
324
+ NgAbsoluteValidatorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: NgAbsoluteValidatorComponent, selector: "ng-absolute-validator", inputs: { formInstance: "formInstance", loader: "loader", message: "message", defaultError: "defaultError", showErrorOn: "showErrorOn" }, outputs: { onValid: "onValid", onValidate: "onValidate" }, queries: [{ propertyName: "absError", first: true, predicate: ["absError"], descendants: true }, { propertyName: "absProgress", first: true, predicate: ["absProgress"], descendants: true }, { propertyName: "absLoader", first: true, predicate: ["absLoader"], descendants: true }], ngImport: i0, template: "<ng-container *ngIf=\"formInstance.pending && isLoaderOn\">\r\n <div class=\"av-loading-panel\">\r\n <ng-template [ngTemplateOutlet]=\"absLoader ?? absFbLoader\"></ng-template>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"(formInstance.control?.ng_abs?.strength || formInstance?.ng_abs?.strength ) && isStrengthBarOn && indicatorScore > 0\">\r\n <div class=\"av-progress\">\r\n <ng-template [ngTemplateOutlet]=\"absProgress ?? absFbProgress\" [ngTemplateOutletContext]=\"progressContext\"></ng-template>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"isDisplay && defaultError && errorMessage.length > 0\">\r\n <div class=\"av-error-panel\">\r\n <ng-template [ngTemplateOutlet]=\"absError ?? absFbError\"[ngTemplateOutletContext]=\"errorContext\"></ng-template>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-template #absFbLoader>\r\n <div class=\"av-loading\" >\r\n <div><div></div></div>\r\n <div><div></div></div>\r\n <div><div></div></div>\r\n <div><div></div></div>\r\n <div><div></div></div>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #absFbProgress>\r\n <div\r\n\t\tclass=\"av-progress-bar\"\r\n\t\trole=\"progressbar\"\r\n\t\taria-valuenow=\"40\"\r\n\t\taria-valuemin=\"0\"\r\n\t\taria-valuemax=\"100\"\r\n\t\t[style.background-color]=\"indicatorColor\"\r\n\t\t[style.width.%]=\"indicatorScore\">\r\n\t</div>\r\n</ng-template>\r\n\r\n<ng-template #absFbError>\r\n <ul class=\"av-errors-list\">\r\n <ng-container *ngFor=\"let error of errorMessage\">\r\n <li [innerText]=\"error.message\"></li>\r\n </ng-container>\r\n </ul>\r\n</ng-template>\r\n", styles: [".av-progress{display:flex}.av-progress-bar{margin-top:5px;float:left;width:0%;height:3px;font-size:12px;line-height:20px;color:#fff;text-align:center;background-color:#337ab7;box-shadow:inset 0 -1px #00000026;transition:width .6s ease}.av-progress-bar.active,.av-progress.active .av-progress-bar{animation:av-progress-bar-stripes 2s linear infinite}.av-progress-bar-striped,.av-progress-striped .av-progress-bar{background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-size:40px 40px}.av-progress-bar-success{background-color:#5cb85c}.av-progress-bar-info{background-color:#5bc0de}.av-progress-bar-warning{background-color:#f0ad4e}.av-progress-bar-danger{background-color:#d9534f}.av-errors-list{margin:2px 0 3px;padding:0;list-style-type:none;font-size:.9em;color:#dc3545;line-height:1.6em;opacity:1;transition:all .3s ease-in;-o-transition:all .3s ease-in;-moz-transition:all .3s ease-in;-webkit-transition:all .3s ease-in}@keyframes av-loading{0%{left:32px;transform:scale(0)}25%{left:32px;transform:scale(1)}50%{left:100px}75%{left:168px;transform:scale(1)}to{left:168px;transform:scale(0)}}.av-loading{position:relative;width:100%;height:100%}.av-loading>div{position:absolute;transform:translate(-50%,-50%);width:40px;height:40px}.av-loading div>div{width:40px;height:40px;border-radius:50%;background:#f00;position:absolute;top:100px;left:32px;animation:av-loading .8s cubic-bezier(0,.5,.5,1) infinite forwards}.av-loading div:nth-child(1) div{animation:av-loading-2 .8s cubic-bezier(0,.5,.5,1) infinite forwards;background:#dce4eb}.av-loading div:nth-child(2) div{animation-delay:-.4s;background:#bbcedd}.av-loading div:nth-child(3) div{animation-delay:-.2s;background:#85a2b6}.av-loading div:nth-child(4) div{animation-delay:0s;background:#fdfdfd}.av-loading div:nth-child(5) div{animation:av-loading-3 .8s cubic-bezier(0,.5,.5,1) infinite forwards;background:#dce4eb}.av-loading{width:32px!important;height:32px!important;transform:translate(-16px,-16px) scale(.16) translate(16px,16px)}\n"], dependencies: [{ kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
315
325
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NgAbsoluteValidatorComponent, decorators: [{
316
326
  type: Component,
317
- args: [{ selector: 'ng-absolute-validator', template: "<ng-container *ngIf=\"formInstance.pending && isLoaderOn\">\r\n <div class=\"av-loading-panel\">\r\n <ng-template [ngTemplateOutlet]=\"absLoader ?? absFbLoader\"></ng-template>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"(formInstance.control?.ng_abs?.strength || formInstance?.ng_abs?.strength ) && isStrengthBarOn && indicatorScore > 0\">\r\n <div class=\"av-progress\">\r\n <ng-template [ngTemplateOutlet]=\"absProgress ?? absFbProgress\" [ngTemplateOutletContext]=\"progressContext\"></ng-template>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"isDisplay && defaultError && errorMessage.length > 0\">\r\n <div class=\"av-error-panel\">\r\n <ng-template [ngTemplateOutlet]=\"absError ?? absFbError\"[ngTemplateOutletContext]=\"errorContext\"></ng-template>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-template #absFbLoader>\r\n <div class=\"av-loading\" >\r\n <div><div></div></div>\r\n <div><div></div></div>\r\n <div><div></div></div>\r\n <div><div></div></div>\r\n <div><div></div></div>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #absFbProgress>\r\n <div\r\n\t\tclass=\"av-progress-bar\"\r\n\t\trole=\"progressbar\"\r\n\t\taria-valuenow=\"40\"\r\n\t\taria-valuemin=\"0\"\r\n\t\taria-valuemax=\"100\"\r\n\t\t[style.background-color]=\"indicatorColor\"\r\n\t\t[style.width.%]=\"indicatorScore\">\r\n\t</div>\r\n</ng-template>\r\n\r\n<ng-template #absFbError>\r\n <ul class=\"av-errors-list\">\r\n <ng-container *ngFor=\"let error of errorMessage\">\r\n <li [innerText]=\"error\"></li>\r\n </ng-container>\r\n </ul>\r\n</ng-template>\r\n", styles: [".av-progress{display:flex}.av-progress-bar{margin-top:5px;float:left;width:0%;height:3px;font-size:12px;line-height:20px;color:#fff;text-align:center;background-color:#337ab7;box-shadow:inset 0 -1px #00000026;transition:width .6s ease}.av-progress-bar.active,.av-progress.active .av-progress-bar{animation:av-progress-bar-stripes 2s linear infinite}.av-progress-bar-striped,.av-progress-striped .av-progress-bar{background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-size:40px 40px}.av-progress-bar-success{background-color:#5cb85c}.av-progress-bar-info{background-color:#5bc0de}.av-progress-bar-warning{background-color:#f0ad4e}.av-progress-bar-danger{background-color:#d9534f}.av-errors-list{margin:2px 0 3px;padding:0;list-style-type:none;font-size:.9em;color:#dc3545;line-height:1.6em;opacity:1;transition:all .3s ease-in;-o-transition:all .3s ease-in;-moz-transition:all .3s ease-in;-webkit-transition:all .3s ease-in}@keyframes av-loading{0%{left:32px;transform:scale(0)}25%{left:32px;transform:scale(1)}50%{left:100px}75%{left:168px;transform:scale(1)}to{left:168px;transform:scale(0)}}.av-loading{position:relative;width:100%;height:100%}.av-loading>div{position:absolute;transform:translate(-50%,-50%);width:40px;height:40px}.av-loading div>div{width:40px;height:40px;border-radius:50%;background:#f00;position:absolute;top:100px;left:32px;animation:av-loading .8s cubic-bezier(0,.5,.5,1) infinite forwards}.av-loading div:nth-child(1) div{animation:av-loading-2 .8s cubic-bezier(0,.5,.5,1) infinite forwards;background:#dce4eb}.av-loading div:nth-child(2) div{animation-delay:-.4s;background:#bbcedd}.av-loading div:nth-child(3) div{animation-delay:-.2s;background:#85a2b6}.av-loading div:nth-child(4) div{animation-delay:0s;background:#fdfdfd}.av-loading div:nth-child(5) div{animation:av-loading-3 .8s cubic-bezier(0,.5,.5,1) infinite forwards;background:#dce4eb}.av-loading{width:32px!important;height:32px!important;transform:translate(-16px,-16px) scale(.16) translate(16px,16px)}\n"] }]
327
+ args: [{ selector: 'ng-absolute-validator', template: "<ng-container *ngIf=\"formInstance.pending && isLoaderOn\">\r\n <div class=\"av-loading-panel\">\r\n <ng-template [ngTemplateOutlet]=\"absLoader ?? absFbLoader\"></ng-template>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"(formInstance.control?.ng_abs?.strength || formInstance?.ng_abs?.strength ) && isStrengthBarOn && indicatorScore > 0\">\r\n <div class=\"av-progress\">\r\n <ng-template [ngTemplateOutlet]=\"absProgress ?? absFbProgress\" [ngTemplateOutletContext]=\"progressContext\"></ng-template>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"isDisplay && defaultError && errorMessage.length > 0\">\r\n <div class=\"av-error-panel\">\r\n <ng-template [ngTemplateOutlet]=\"absError ?? absFbError\"[ngTemplateOutletContext]=\"errorContext\"></ng-template>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-template #absFbLoader>\r\n <div class=\"av-loading\" >\r\n <div><div></div></div>\r\n <div><div></div></div>\r\n <div><div></div></div>\r\n <div><div></div></div>\r\n <div><div></div></div>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #absFbProgress>\r\n <div\r\n\t\tclass=\"av-progress-bar\"\r\n\t\trole=\"progressbar\"\r\n\t\taria-valuenow=\"40\"\r\n\t\taria-valuemin=\"0\"\r\n\t\taria-valuemax=\"100\"\r\n\t\t[style.background-color]=\"indicatorColor\"\r\n\t\t[style.width.%]=\"indicatorScore\">\r\n\t</div>\r\n</ng-template>\r\n\r\n<ng-template #absFbError>\r\n <ul class=\"av-errors-list\">\r\n <ng-container *ngFor=\"let error of errorMessage\">\r\n <li [innerText]=\"error.message\"></li>\r\n </ng-container>\r\n </ul>\r\n</ng-template>\r\n", styles: [".av-progress{display:flex}.av-progress-bar{margin-top:5px;float:left;width:0%;height:3px;font-size:12px;line-height:20px;color:#fff;text-align:center;background-color:#337ab7;box-shadow:inset 0 -1px #00000026;transition:width .6s ease}.av-progress-bar.active,.av-progress.active .av-progress-bar{animation:av-progress-bar-stripes 2s linear infinite}.av-progress-bar-striped,.av-progress-striped .av-progress-bar{background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-size:40px 40px}.av-progress-bar-success{background-color:#5cb85c}.av-progress-bar-info{background-color:#5bc0de}.av-progress-bar-warning{background-color:#f0ad4e}.av-progress-bar-danger{background-color:#d9534f}.av-errors-list{margin:2px 0 3px;padding:0;list-style-type:none;font-size:.9em;color:#dc3545;line-height:1.6em;opacity:1;transition:all .3s ease-in;-o-transition:all .3s ease-in;-moz-transition:all .3s ease-in;-webkit-transition:all .3s ease-in}@keyframes av-loading{0%{left:32px;transform:scale(0)}25%{left:32px;transform:scale(1)}50%{left:100px}75%{left:168px;transform:scale(1)}to{left:168px;transform:scale(0)}}.av-loading{position:relative;width:100%;height:100%}.av-loading>div{position:absolute;transform:translate(-50%,-50%);width:40px;height:40px}.av-loading div>div{width:40px;height:40px;border-radius:50%;background:#f00;position:absolute;top:100px;left:32px;animation:av-loading .8s cubic-bezier(0,.5,.5,1) infinite forwards}.av-loading div:nth-child(1) div{animation:av-loading-2 .8s cubic-bezier(0,.5,.5,1) infinite forwards;background:#dce4eb}.av-loading div:nth-child(2) div{animation-delay:-.4s;background:#bbcedd}.av-loading div:nth-child(3) div{animation-delay:-.2s;background:#85a2b6}.av-loading div:nth-child(4) div{animation-delay:0s;background:#fdfdfd}.av-loading div:nth-child(5) div{animation:av-loading-3 .8s cubic-bezier(0,.5,.5,1) infinite forwards;background:#dce4eb}.av-loading{width:32px!important;height:32px!important;transform:translate(-16px,-16px) scale(.16) translate(16px,16px)}\n"] }]
318
328
  }], ctorParameters: function () { return [{ type: NgAbsoluteValidatorService }, { type: i1.TranslateService }, { type: undefined, decorators: [{
319
329
  type: Optional
320
330
  }, {
@@ -397,48 +407,55 @@ function toCharClass(chars) {
397
407
  }
398
408
  function cloneDeep(data) {
399
409
  return JSON.parse(JSON.stringify(data));
410
+ }
411
+ function formatMessage(template, data) {
412
+ const { attr, args } = data;
413
+ return template.replace(/:attribute|:arg(\d+)(:)?/g, (match, index, multi) => {
414
+ if (index === undefined)
415
+ return attr; // matched ":attribute"
416
+ const i = Number(index);
417
+ if (i >= args.length)
418
+ return match; // no such arg, leave placeholder as-is
419
+ return multi ? args.slice(i).join(',') : args[i];
420
+ });
400
421
  }
401
422
 
402
423
  class MessageBuilderService {
403
- constructor(ts) {
404
- this.ts = ts;
424
+ constructor(translate) {
425
+ this.translate = translate;
405
426
  }
406
427
  call(langAttr, attribute, ...args) {
407
- let message = '';
408
- let [lastElement] = args.slice(-1);
409
- let template = this.ts.instant(langAttr) || '';
410
- let hasCustomTemplate = typeof lastElement === 'object' && Object.keys(lastElement).length > 0;
411
- if (hasCustomTemplate && lastElement[langAttr] && lastElement[langAttr][this.ts.currentLang]) {
412
- template = lastElement[langAttr][this.ts.currentLang];
428
+ const [lastElement] = args.slice(-1);
429
+ const inputArgs = args.filter((arg) => typeof arg !== 'object');
430
+ const i18nKey = `${I18N_LANG_PREFIX}.${langAttr}`;
431
+ const translate = this.translate;
432
+ if (typeof lastElement === 'object' && Object.keys(lastElement).length > 0) {
433
+ this.injectToTranslation(langAttr, lastElement);
434
+ this.translate.onLangChange.subscribe(() => this.injectToTranslation(langAttr, lastElement));
413
435
  }
414
- if (hasCustomTemplate && lastElement[this.ts.currentLang]) {
415
- template = lastElement[this.ts.currentLang];
416
- }
417
- if (attribute && template) {
418
- message = template.replace(':attribute', attribute);
419
- }
420
- if (args.length === 0) {
421
- return message;
422
- }
423
- args.forEach((v, index) => {
424
- let replaceWithOne = `:arg${index}`;
425
- let replaceWithMulti = `:arg${index}:`;
426
- if (message.includes(replaceWithMulti)) {
427
- args = args.splice(index);
428
- let argString = toArray(args) ? toArray(args).join(',') : args;
429
- message = message.replace(replaceWithMulti, argString);
430
- }
431
- if (message.includes(replaceWithOne)) {
432
- message = message.replace(replaceWithOne, v);
436
+ return {
437
+ args: inputArgs,
438
+ attr: attribute,
439
+ i18nKey: i18nKey,
440
+ get lang() {
441
+ return translate.currentLang;
442
+ },
443
+ get message() {
444
+ return formatMessage(translate.instant(i18nKey), { attr: attribute, args: inputArgs });
433
445
  }
434
- });
435
- return message;
446
+ };
447
+ }
448
+ injectToTranslation(langAttr, translation = {}) {
449
+ for (let lang of Object.keys(translation)) {
450
+ this.translate.setTranslation(lang, { [I18N_LANG_PREFIX]: { [langAttr]: translation[lang] } }, true);
451
+ }
436
452
  }
437
453
  }
438
454
  MessageBuilderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: MessageBuilderService, deps: [{ token: i1.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable });
439
- MessageBuilderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: MessageBuilderService });
455
+ MessageBuilderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: MessageBuilderService, providedIn: 'root' });
440
456
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: MessageBuilderService, decorators: [{
441
- type: Injectable
457
+ type: Injectable,
458
+ args: [{ providedIn: 'root' }]
442
459
  }], ctorParameters: function () { return [{ type: i1.TranslateService }]; } });
443
460
 
444
461
  class HttpRequestService {
@@ -453,9 +470,10 @@ class HttpRequestService {
453
470
  }
454
471
  }
455
472
  HttpRequestService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: HttpRequestService, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
456
- HttpRequestService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: HttpRequestService });
473
+ HttpRequestService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: HttpRequestService, providedIn: 'root' });
457
474
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: HttpRequestService, decorators: [{
458
- type: Injectable
475
+ type: Injectable,
476
+ args: [{ providedIn: 'root' }]
459
477
  }], ctorParameters: function () { return [{ type: i1$1.HttpClient }]; } });
460
478
 
461
479
  class UtilService {
@@ -920,19 +938,21 @@ class UtilService {
920
938
  }
921
939
  }
922
940
  UtilService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: UtilService, deps: [{ token: HttpRequestService }, { token: NgAbsoluteValidatorService }], target: i0.ɵɵFactoryTarget.Injectable });
923
- UtilService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: UtilService });
941
+ UtilService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: UtilService, providedIn: 'root' });
924
942
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: UtilService, decorators: [{
925
- type: Injectable
943
+ type: Injectable,
944
+ args: [{ providedIn: 'root' }]
926
945
  }], ctorParameters: function () { return [{ type: HttpRequestService }, { type: NgAbsoluteValidatorService }]; } });
927
946
 
928
947
  class ValidateRuleService {
929
- constructor(mb, utl) {
948
+ constructor(mb, abs, utl) {
930
949
  this.mb = mb;
950
+ this.abs = abs;
931
951
  this.utl = utl;
932
952
  this.subMessageMethod = ['max', 'min'];
933
953
  this.wiredRulesMap = new WeakMap();
934
954
  }
935
- gererateRuleAndValidate(fieldName, control, rule, custom_message) {
955
+ gererateRuleAndValidate(fieldName, control, rule, customMessage) {
936
956
  let messages = {};
937
957
  let generateRules = toArray(rule, '|');
938
958
  let activeRules = generateRules.map(v => v.includes(':') ? v.split(':')[0] : v);
@@ -974,8 +994,10 @@ class ValidateRuleService {
974
994
  }
975
995
  this.utl.setValidationRules(control, activeRules, emitData);
976
996
  if (!isValid) {
977
- messages[messageKey] = this.mb.call(messageKey, fieldName, ...mulArg, custom_message);
978
- break;
997
+ messages[messageKey] = this.mb.call(messageKey, fieldName, ...mulArg, customMessage);
998
+ if (!this.abs.showAllErrors) {
999
+ break;
1000
+ }
979
1001
  }
980
1002
  }
981
1003
  if (Object.keys(messages).length > 0) {
@@ -1015,11 +1037,12 @@ class ValidateRuleService {
1015
1037
  }
1016
1038
  }
1017
1039
  }
1018
- ValidateRuleService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ValidateRuleService, deps: [{ token: MessageBuilderService }, { token: UtilService }], target: i0.ɵɵFactoryTarget.Injectable });
1019
- ValidateRuleService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ValidateRuleService });
1040
+ ValidateRuleService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ValidateRuleService, deps: [{ token: MessageBuilderService }, { token: NgAbsoluteValidatorService }, { token: UtilService }], target: i0.ɵɵFactoryTarget.Injectable });
1041
+ ValidateRuleService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ValidateRuleService, providedIn: 'root' });
1020
1042
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ValidateRuleService, decorators: [{
1021
- type: Injectable
1022
- }], ctorParameters: function () { return [{ type: MessageBuilderService }, { type: UtilService }]; } });
1043
+ type: Injectable,
1044
+ args: [{ providedIn: 'root' }]
1045
+ }], ctorParameters: function () { return [{ type: MessageBuilderService }, { type: NgAbsoluteValidatorService }, { type: UtilService }]; } });
1023
1046
 
1024
1047
  class Rule {
1025
1048
  constructor(ruleValidate, el) {
@@ -3569,9 +3592,10 @@ class ReactiveValidator {
3569
3592
  }
3570
3593
  }
3571
3594
  ReactiveValidator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ReactiveValidator, deps: [{ token: ValidateRuleService }, { token: UtilService }, { token: MessageBuilderService }], target: i0.ɵɵFactoryTarget.Injectable });
3572
- ReactiveValidator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ReactiveValidator });
3595
+ ReactiveValidator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ReactiveValidator, providedIn: 'root' });
3573
3596
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ReactiveValidator, decorators: [{
3574
- type: Injectable
3597
+ type: Injectable,
3598
+ args: [{ providedIn: 'root' }]
3575
3599
  }], ctorParameters: function () { return [{ type: ValidateRuleService }, { type: UtilService }, { type: MessageBuilderService }]; } });
3576
3600
 
3577
3601
  class NativeElementDirective {
@@ -3604,6 +3628,74 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
3604
3628
  args: ['formControlName']
3605
3629
  }] } });
3606
3630
 
3631
+ var ar = {
3632
+ above: 'يجب أن يكون :attribute أعلى من :arg0.',
3633
+ accepted: 'يجب قبول :attribute.',
3634
+ after: 'يجب أن يكون :attribute تاريخًا بعد :arg0.',
3635
+ alpha: 'يجب أن يحتوي :attribute على أحرف فقط.',
3636
+ alpha_dash: 'يجب أن يحتوي :attribute على أحرف وأرقام وشرطات وشرطات سفلية فقط.',
3637
+ alpha_numeric: 'يجب أن يحتوي :attribute على أحرف وأرقام فقط.',
3638
+ array: 'يجب أن يكون :attribute مصفوفة.',
3639
+ before: 'يجب أن يكون :attribute تاريخًا قبل :arg0.',
3640
+ boolean: 'يجب أن يكون حقل :attribute صحيحًا أو خاطئًا (true أو false).',
3641
+ confirmed: 'تأكيد :attribute غير مطابق.',
3642
+ credit_card: 'يجب أن يكون :attribute رقم بطاقة ائتمان صالحًا.',
3643
+ cvv: 'يجب أن يكون :attribute رقم CVV صالحًا.',
3644
+ date: ':attribute ليس تاريخًا صالحًا.',
3645
+ date_format: ':attribute لا يطابق الصيغة :arg0.',
3646
+ debit_card: 'يجب أن يكون :attribute رقم بطاقة خصم صالحًا.',
3647
+ different: 'يجب أن يكون :attribute و :arg0 مختلفين.',
3648
+ dimension: 'أبعاد صورة :attribute غير صالحة.',
3649
+ email: 'يجب أن يكون :attribute عنوان بريد إلكتروني صالحًا.',
3650
+ ends_with: 'يجب أن ينتهي :attribute بأحد القيم التالية: :arg0',
3651
+ equals: 'يجب أن يساوي :attribute القيمة :arg0',
3652
+ exists: ':attribute المحدد غير صالح.',
3653
+ image: 'يجب أن يكون :attribute صورة صالحة.',
3654
+ in: 'يجب أن يكون :attribute المحدد ضمن :arg0.',
3655
+ includes: 'يجب أن يحتوي :attribute على :arg0.',
3656
+ integer: 'يجب أن يكون :attribute عددًا صحيحًا.',
3657
+ ip: 'يجب أن يكون :attribute عنوان IP صالحًا.',
3658
+ ipv4: 'يجب أن يكون :attribute عنوان IPv4 صالحًا.',
3659
+ ipv6: 'يجب أن يكون :attribute عنوان IPv6 صالحًا.',
3660
+ json: 'يجب أن يكون :attribute نص JSON صالحًا.',
3661
+ max: {
3662
+ array: 'لا يجوز أن يحتوي :attribute على أكثر من :arg0 عنصرًا.',
3663
+ numeric: 'يجب ألا يكون :attribute أكبر من :arg0.',
3664
+ string: 'يجب ألا يتجاوز :attribute :arg0 حرفًا.'
3665
+ },
3666
+ min: {
3667
+ array: 'يجب أن يحتوي :attribute على :arg0 عناصر على الأقل.',
3668
+ numeric: 'يجب أن يكون :attribute :arg0 على الأقل.',
3669
+ string: 'يجب أن يحتوي :attribute على :arg0 أحرف على الأقل.'
3670
+ },
3671
+ mimes: 'يجب أن يكون :attribute ملفًا من نوع :arg0.',
3672
+ not_equals: 'يجب ألا يساوي :attribute القيمة :arg0',
3673
+ not_in: 'يجب ألا يكون :attribute المحدد ضمن :arg0.',
3674
+ not_regex: 'صيغة :attribute غير صالحة.',
3675
+ number: 'يجب أن يكون :attribute رقمًا.',
3676
+ phone_no: 'يجب أن يكون :attribute رقم هاتف صالحًا.',
3677
+ range: 'يجب أن يكون :attribute بين :arg0 و :arg1.',
3678
+ between: 'يجب أن يكون :attribute بين :arg0 و :arg1، دون تضمين الحدين.',
3679
+ regex: 'صيغة :attribute غير صالحة.',
3680
+ required: 'حقل :attribute مطلوب.',
3681
+ required_if: 'حقل :attribute مطلوب عندما يكون :arg0 هو :arg1.',
3682
+ required_unless: 'حقل :attribute مطلوب ما لم يكن :arg0 ضمن :arg1.',
3683
+ required_with: 'حقل :attribute مطلوب عند وجود أي من :arg0.',
3684
+ required_with_all: 'حقل :attribute مطلوب عند وجود :arg0.',
3685
+ required_without: 'حقل :attribute مطلوب عند عدم وجود :arg0.',
3686
+ required_without_all: 'حقل :attribute مطلوب عند عدم وجود أي من :arg0.',
3687
+ same: 'يجب أن يتطابق :attribute و :arg0.',
3688
+ size: 'يجب ألا يتجاوز :attribute :arg0 كيلوبايت.',
3689
+ starts_with: 'يجب أن يبدأ :attribute بأحد القيم التالية: :arg0',
3690
+ string: 'يجب أن يكون :attribute نصًا (string).',
3691
+ strength: ':attribute ليس قويًا بما فيه الكفاية.',
3692
+ under: 'يجب أن يكون :attribute أقل من :arg0.',
3693
+ url: 'صيغة :attribute غير صالحة.',
3694
+ uuid: 'يجب أن يكون :attribute UUID صالحًا.',
3695
+ unique: ':attribute مُستخدم بالفعل.',
3696
+ video: 'يجب أن يكون :attribute فيديو صالحًا.',
3697
+ };
3698
+
3607
3699
  var en = {
3608
3700
  "above": "The :attribute should be above :arg0.",
3609
3701
  "accepted": "The :attribute must be accepted.",
@@ -4284,26 +4376,59 @@ var ru = {
4284
4376
  video: 'Поле :attribute должно быть действительным видео.',
4285
4377
  };
4286
4378
 
4287
- const BUILT_IN_TRANSLATIONS = { en, de, es, fr, hi, bn, pt, ja, zh, ru };
4379
+ const BUILT_IN_TRANSLATIONS = {
4380
+ ar: { [I18N_LANG_PREFIX]: ar },
4381
+ en: { [I18N_LANG_PREFIX]: en },
4382
+ de: { [I18N_LANG_PREFIX]: de },
4383
+ es: { [I18N_LANG_PREFIX]: es },
4384
+ fr: { [I18N_LANG_PREFIX]: fr },
4385
+ hi: { [I18N_LANG_PREFIX]: hi },
4386
+ bn: { [I18N_LANG_PREFIX]: bn },
4387
+ pt: { [I18N_LANG_PREFIX]: pt },
4388
+ ja: { [I18N_LANG_PREFIX]: ja },
4389
+ zh: { [I18N_LANG_PREFIX]: zh },
4390
+ ru: { [I18N_LANG_PREFIX]: ru }
4391
+ };
4392
+
4393
+ function TranslateLoaderFactory(config) {
4394
+ return new InlineTranslateLoader(config?.translations);
4395
+ }
4396
+ function appInitializerFactory(translate, config, activeLoader) {
4397
+ return () => {
4398
+ const languages = Object.keys(BUILT_IN_TRANSLATIONS);
4399
+ const browserLang = translate.getBrowserLang();
4400
+ const langToUse = browserLang && languages.includes(browserLang)
4401
+ ? browserLang
4402
+ : (config?.defaultLanguage || DEFAULT_LOCALE_LANG);
4403
+ const consumerHasOwnLoader = !(activeLoader instanceof InlineTranslateLoader);
4404
+ if (consumerHasOwnLoader) {
4405
+ const loader = new InlineTranslateLoader(config?.translations);
4406
+ const translations = loader.translations;
4407
+ translate.onLangChange.subscribe(event => {
4408
+ if (translations[event.lang]) {
4409
+ translate.setTranslation(event.lang, translations[event.lang], true);
4410
+ }
4411
+ });
4412
+ }
4413
+ return firstValueFrom(translate.use(langToUse));
4414
+ };
4415
+ }
4288
4416
  class InlineTranslateLoader {
4289
- constructor(mergeTranslations = {}, replaceTranslations = {}) {
4290
- this.mergeTranslations = mergeTranslations;
4417
+ constructor(replaceTranslations = {}) {
4291
4418
  this.replaceTranslations = replaceTranslations;
4292
4419
  this.translations = {};
4293
4420
  this.init();
4294
4421
  }
4295
4422
  init() {
4296
4423
  this.translations = { ...BUILT_IN_TRANSLATIONS };
4297
- // Full replace happens first — wipes out all existing keys for that lang
4298
4424
  for (const lang of Object.keys(this.replaceTranslations)) {
4299
- this.translations[lang] = { ...this.replaceTranslations[lang] };
4300
- }
4301
- // Merge happens second — adds new languages, or patches individual keys
4302
- for (const lang of Object.keys(this.mergeTranslations)) {
4303
- this.translations[lang] = {
4304
- ...(this.translations[lang] || {}),
4305
- ...this.mergeTranslations[lang]
4306
- };
4425
+ if (this.translations[lang]) {
4426
+ const translation = Object.assign(this.translations[lang][I18N_LANG_PREFIX], this.replaceTranslations[lang]);
4427
+ this.translations[lang] = { [I18N_LANG_PREFIX]: translation };
4428
+ }
4429
+ else {
4430
+ this.translations[lang] = { [I18N_LANG_PREFIX]: this.replaceTranslations[lang] };
4431
+ }
4307
4432
  }
4308
4433
  }
4309
4434
  getTranslation(lang) {
@@ -4311,20 +4436,20 @@ class InlineTranslateLoader {
4311
4436
  }
4312
4437
  }
4313
4438
 
4314
- function TranslateLoaderFactory(config) {
4315
- return new InlineTranslateLoader(config?.translations, config?.replaceTranslations);
4316
- }
4317
- function appInitializerFactory(translate, config) {
4318
- return () => {
4319
- const builtIn = SUPPORTED_LOCALE_LANGS;
4320
- const supported = config?.supportedLanguages?.length ? config.supportedLanguages : builtIn;
4321
- const browserLang = translate.getBrowserLang();
4322
- const langToUse = browserLang && supported.includes(browserLang)
4323
- ? browserLang
4324
- : (config?.defaultLanguage || DEFAULT_LOCALE_LANG);
4325
- return firstValueFrom(translate.use(langToUse));
4326
- };
4439
+ class ReplaceWithPipe {
4440
+ transform(value, data) {
4441
+ return formatMessage(value, { attr: data.attr, args: data.args });
4442
+ }
4327
4443
  }
4444
+ ReplaceWithPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ReplaceWithPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
4445
+ ReplaceWithPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: ReplaceWithPipe, name: "replaceWith" });
4446
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ReplaceWithPipe, decorators: [{
4447
+ type: Pipe,
4448
+ args: [{
4449
+ name: 'replaceWith'
4450
+ }]
4451
+ }] });
4452
+
4328
4453
  class NgAbsoluteValidatorModule {
4329
4454
  static forRoot(config = {}) {
4330
4455
  return {
@@ -4340,7 +4465,8 @@ class NgAbsoluteValidatorModule {
4340
4465
  NgAbsoluteValidatorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NgAbsoluteValidatorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4341
4466
  NgAbsoluteValidatorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: NgAbsoluteValidatorModule, declarations: [NgAbsoluteValidatorComponent,
4342
4467
  NativeElementDirective,
4343
- ErrorTriggerOn], imports: [CommonModule,
4468
+ ErrorTriggerOn,
4469
+ ReplaceWithPipe], imports: [CommonModule,
4344
4470
  RuleModule,
4345
4471
  HttpClientModule, i1.TranslateModule], exports: [RuleModule,
4346
4472
  NgAbsoluteValidatorComponent,
@@ -4357,7 +4483,7 @@ NgAbsoluteValidatorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0
4357
4483
  {
4358
4484
  provide: APP_INITIALIZER,
4359
4485
  useFactory: appInitializerFactory,
4360
- deps: [TranslateService, LIB_CONFIG],
4486
+ deps: [TranslateService, LIB_CONFIG, TranslateLoader],
4361
4487
  multi: true
4362
4488
  }
4363
4489
  ], imports: [CommonModule,
@@ -4378,7 +4504,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
4378
4504
  declarations: [
4379
4505
  NgAbsoluteValidatorComponent,
4380
4506
  NativeElementDirective,
4381
- ErrorTriggerOn
4507
+ ErrorTriggerOn,
4508
+ ReplaceWithPipe
4382
4509
  ],
4383
4510
  imports: [
4384
4511
  CommonModule,
@@ -4404,7 +4531,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
4404
4531
  {
4405
4532
  provide: APP_INITIALIZER,
4406
4533
  useFactory: appInitializerFactory,
4407
- deps: [TranslateService, LIB_CONFIG],
4534
+ deps: [TranslateService, LIB_CONFIG, TranslateLoader],
4408
4535
  multi: true
4409
4536
  }
4410
4537
  ],
@@ -4417,20 +4544,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
4417
4544
  }]
4418
4545
  }] });
4419
4546
 
4420
- const LOCALE_LANG_LABELS = {
4421
- en: 'English',
4422
- es: 'Español',
4423
- fr: 'Français',
4424
- de: 'Deutsch',
4425
- hi: 'हिन्दी',
4426
- bn: 'বাংলা',
4427
- pt: 'Português',
4428
- ar: 'العربية',
4429
- ja: '日本語',
4430
- zh: '中文',
4431
- ru: 'Русский',
4432
- };
4433
-
4434
4547
  /*
4435
4548
  * Public API Surface of ng-absolute-validator
4436
4549
  */
@@ -4439,5 +4552,5 @@ const LOCALE_LANG_LABELS = {
4439
4552
  * Generated bundle index. Do not edit.
4440
4553
  */
4441
4554
 
4442
- export { Above, Accepted, After, Alpha, AlphaDash, AlphaNumeric, Array$1 as Array, Before, Between, Boolean$1 as Boolean, Confirmed, CreditCard, Cvv, Date$1 as Date, DateFormat, DebitCard, Different, Dimension, Email, EndsWith, Equals, ErrorTriggerOn, Exists, Image$1 as Image, In, Includes, Integer, Ip, Ipv4, Ipv6, Json, LOCALE_LANG_LABELS, Max, Mimes, Min, NativeElementDirective, NgAbsoluteValidatorComponent, NgAbsoluteValidatorModule, NgAbsoluteValidatorService, NotEquals, NotIn, NotRegex, Number$1 as Number, PhoneNo, Range, ReactiveValidator, Regex, Required, RequiredIf, RequiredUnless, RequiredWith, RequiredWithAll, RequiredWithout, RequiredWithoutAll, Rule, RuleModule, Same, Size, StartsWith, Strength, String, TranslateLoaderFactory, Under, Unique, Url, Uuid, Video, appInitializerFactory };
4555
+ export { Above, Accepted, After, Alpha, AlphaDash, AlphaNumeric, Array$1 as Array, Before, Between, Boolean$1 as Boolean, Confirmed, CreditCard, Cvv, Date$1 as Date, DateFormat, DebitCard, Different, Dimension, Email, EndsWith, Equals, ErrorTriggerOn, Exists, Image$1 as Image, In, Includes, Integer, Ip, Ipv4, Ipv6, Json, Max, Mimes, Min, NativeElementDirective, NgAbsoluteValidatorComponent, NgAbsoluteValidatorModule, NgAbsoluteValidatorService, NotEquals, NotIn, NotRegex, Number$1 as Number, PhoneNo, Range, ReactiveValidator, Regex, Required, RequiredIf, RequiredUnless, RequiredWith, RequiredWithAll, RequiredWithout, RequiredWithoutAll, Rule, RuleModule, Same, Size, StartsWith, Strength, String, Under, Unique, Url, Uuid, Video };
4443
4556
  //# sourceMappingURL=sbcore-ng-absolute-validator.mjs.map