@sbcore/ng-absolute-validator 14.0.1 → 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 +243 -257
  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,26 @@ 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
+ var _a;
163
+ return (_a = this.VLIDATOR_CONFIG.showAllErrors) !== null && _a !== void 0 ? _a : false;
164
+ }
157
165
  }
158
166
  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 });
167
+ NgAbsoluteValidatorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NgAbsoluteValidatorService, providedIn: 'root' });
160
168
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NgAbsoluteValidatorService, decorators: [{
161
- type: Injectable
169
+ type: Injectable,
170
+ args: [{ providedIn: 'root' }]
162
171
  }], ctorParameters: function () {
163
172
  return [{ type: undefined, decorators: [{
164
173
  type: Inject,
@@ -197,6 +206,8 @@ class NgAbsoluteValidatorComponent {
197
206
  this.isStrengthBarOn = this.avs.strengthBar;
198
207
  this.strength_color = this.avs.strengthColor;
199
208
  this.doCheckAndValidate();
209
+ this.translate.onLangChange.pipe(takeUntil(this.destroy$))
210
+ .subscribe(() => this.emitedData(this.formInstance));
200
211
  }
201
212
  get errorContext() {
202
213
  return {
@@ -315,10 +326,10 @@ class NgAbsoluteValidatorComponent {
315
326
  }
316
327
  }
317
328
  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 });
318
- 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"] }] });
329
+ 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"] }] });
319
330
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NgAbsoluteValidatorComponent, decorators: [{
320
331
  type: Component,
321
- 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"] }]
332
+ 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"] }]
322
333
  }], ctorParameters: function () {
323
334
  return [{ type: NgAbsoluteValidatorService }, { type: i1.TranslateService }, { type: undefined, decorators: [{
324
335
  type: Optional
@@ -403,48 +414,55 @@ function toCharClass(chars) {
403
414
  }
404
415
  function cloneDeep(data) {
405
416
  return JSON.parse(JSON.stringify(data));
417
+ }
418
+ function formatMessage(template, data) {
419
+ const { attr, args } = data;
420
+ return template.replace(/:attribute|:arg(\d+)(:)?/g, (match, index, multi) => {
421
+ if (index === undefined)
422
+ return attr; // matched ":attribute"
423
+ const i = Number(index);
424
+ if (i >= args.length)
425
+ return match; // no such arg, leave placeholder as-is
426
+ return multi ? args.slice(i).join(',') : args[i];
427
+ });
406
428
  }
407
429
 
408
430
  class MessageBuilderService {
409
- constructor(ts) {
410
- this.ts = ts;
431
+ constructor(translate) {
432
+ this.translate = translate;
411
433
  }
412
434
  call(langAttr, attribute, ...args) {
413
- let message = '';
414
- let [lastElement] = args.slice(-1);
415
- let template = this.ts.instant(langAttr) || '';
416
- let hasCustomTemplate = typeof lastElement === 'object' && Object.keys(lastElement).length > 0;
417
- if (hasCustomTemplate && lastElement[langAttr] && lastElement[langAttr][this.ts.currentLang]) {
418
- template = lastElement[langAttr][this.ts.currentLang];
419
- }
420
- if (hasCustomTemplate && lastElement[this.ts.currentLang]) {
421
- template = lastElement[this.ts.currentLang];
422
- }
423
- if (attribute && template) {
424
- message = template.replace(':attribute', attribute);
425
- }
426
- if (args.length === 0) {
427
- return message;
435
+ const [lastElement] = args.slice(-1);
436
+ const inputArgs = args.filter((arg) => typeof arg !== 'object');
437
+ const i18nKey = `${I18N_LANG_PREFIX}.${langAttr}`;
438
+ const translate = this.translate;
439
+ if (typeof lastElement === 'object' && Object.keys(lastElement).length > 0) {
440
+ this.injectToTranslation(langAttr, lastElement);
441
+ this.translate.onLangChange.subscribe(() => this.injectToTranslation(langAttr, lastElement));
428
442
  }
429
- args.forEach((v, index) => {
430
- let replaceWithOne = `:arg${index}`;
431
- let replaceWithMulti = `:arg${index}:`;
432
- if (message.includes(replaceWithMulti)) {
433
- args = args.splice(index);
434
- let argString = toArray(args) ? toArray(args).join(',') : args;
435
- message = message.replace(replaceWithMulti, argString);
436
- }
437
- if (message.includes(replaceWithOne)) {
438
- message = message.replace(replaceWithOne, v);
443
+ return {
444
+ args: inputArgs,
445
+ attr: attribute,
446
+ i18nKey: i18nKey,
447
+ get lang() {
448
+ return translate.currentLang;
449
+ },
450
+ get message() {
451
+ return formatMessage(translate.instant(i18nKey), { attr: attribute, args: inputArgs });
439
452
  }
440
- });
441
- return message;
453
+ };
454
+ }
455
+ injectToTranslation(langAttr, translation = {}) {
456
+ for (let lang of Object.keys(translation)) {
457
+ this.translate.setTranslation(lang, { [I18N_LANG_PREFIX]: { [langAttr]: translation[lang] } }, true);
458
+ }
442
459
  }
443
460
  }
444
461
  MessageBuilderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: MessageBuilderService, deps: [{ token: i1.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable });
445
- MessageBuilderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: MessageBuilderService });
462
+ MessageBuilderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: MessageBuilderService, providedIn: 'root' });
446
463
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: MessageBuilderService, decorators: [{
447
- type: Injectable
464
+ type: Injectable,
465
+ args: [{ providedIn: 'root' }]
448
466
  }], ctorParameters: function () { return [{ type: i1.TranslateService }]; } });
449
467
 
450
468
  class HttpRequestService {
@@ -459,9 +477,10 @@ class HttpRequestService {
459
477
  }
460
478
  }
461
479
  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 });
462
- HttpRequestService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: HttpRequestService });
480
+ HttpRequestService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: HttpRequestService, providedIn: 'root' });
463
481
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: HttpRequestService, decorators: [{
464
- type: Injectable
482
+ type: Injectable,
483
+ args: [{ providedIn: 'root' }]
465
484
  }], ctorParameters: function () { return [{ type: i1$1.HttpClient }]; } });
466
485
 
467
486
  class UtilService {
@@ -926,19 +945,21 @@ class UtilService {
926
945
  }
927
946
  }
928
947
  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 });
929
- UtilService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: UtilService });
948
+ UtilService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: UtilService, providedIn: 'root' });
930
949
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: UtilService, decorators: [{
931
- type: Injectable
950
+ type: Injectable,
951
+ args: [{ providedIn: 'root' }]
932
952
  }], ctorParameters: function () { return [{ type: HttpRequestService }, { type: NgAbsoluteValidatorService }]; } });
933
953
 
934
954
  class ValidateRuleService {
935
- constructor(mb, utl) {
955
+ constructor(mb, abs, utl) {
936
956
  this.mb = mb;
957
+ this.abs = abs;
937
958
  this.utl = utl;
938
959
  this.subMessageMethod = ['max', 'min'];
939
960
  this.wiredRulesMap = new WeakMap();
940
961
  }
941
- gererateRuleAndValidate(fieldName, control, rule, custom_message) {
962
+ gererateRuleAndValidate(fieldName, control, rule, customMessage) {
942
963
  let messages = {};
943
964
  let generateRules = toArray(rule, '|');
944
965
  let activeRules = generateRules.map(v => v.includes(':') ? v.split(':')[0] : v);
@@ -980,8 +1001,10 @@ class ValidateRuleService {
980
1001
  }
981
1002
  this.utl.setValidationRules(control, activeRules, emitData);
982
1003
  if (!isValid) {
983
- messages[messageKey] = this.mb.call(messageKey, fieldName, ...mulArg, custom_message);
984
- break;
1004
+ messages[messageKey] = this.mb.call(messageKey, fieldName, ...mulArg, customMessage);
1005
+ if (!this.abs.showAllErrors) {
1006
+ break;
1007
+ }
985
1008
  }
986
1009
  }
987
1010
  if (Object.keys(messages).length > 0) {
@@ -1021,11 +1044,12 @@ class ValidateRuleService {
1021
1044
  }
1022
1045
  }
1023
1046
  }
1024
- 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 });
1025
- ValidateRuleService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ValidateRuleService });
1047
+ 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 });
1048
+ ValidateRuleService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ValidateRuleService, providedIn: 'root' });
1026
1049
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ValidateRuleService, decorators: [{
1027
- type: Injectable
1028
- }], ctorParameters: function () { return [{ type: MessageBuilderService }, { type: UtilService }]; } });
1050
+ type: Injectable,
1051
+ args: [{ providedIn: 'root' }]
1052
+ }], ctorParameters: function () { return [{ type: MessageBuilderService }, { type: NgAbsoluteValidatorService }, { type: UtilService }]; } });
1029
1053
 
1030
1054
  class Rule {
1031
1055
  constructor(ruleValidate, el) {
@@ -3578,9 +3602,10 @@ class ReactiveValidator {
3578
3602
  }
3579
3603
  }
3580
3604
  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 });
3581
- ReactiveValidator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ReactiveValidator });
3605
+ ReactiveValidator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ReactiveValidator, providedIn: 'root' });
3582
3606
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ReactiveValidator, decorators: [{
3583
- type: Injectable
3607
+ type: Injectable,
3608
+ args: [{ providedIn: 'root' }]
3584
3609
  }], ctorParameters: function () { return [{ type: ValidateRuleService }, { type: UtilService }, { type: MessageBuilderService }]; } });
3585
3610
 
3586
3611
  class NativeElementDirective {
@@ -3613,6 +3638,74 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
3613
3638
  args: ['formControlName']
3614
3639
  }] } });
3615
3640
 
3641
+ var ar = {
3642
+ above: 'يجب أن يكون :attribute أعلى من :arg0.',
3643
+ accepted: 'يجب قبول :attribute.',
3644
+ after: 'يجب أن يكون :attribute تاريخًا بعد :arg0.',
3645
+ alpha: 'يجب أن يحتوي :attribute على أحرف فقط.',
3646
+ alpha_dash: 'يجب أن يحتوي :attribute على أحرف وأرقام وشرطات وشرطات سفلية فقط.',
3647
+ alpha_numeric: 'يجب أن يحتوي :attribute على أحرف وأرقام فقط.',
3648
+ array: 'يجب أن يكون :attribute مصفوفة.',
3649
+ before: 'يجب أن يكون :attribute تاريخًا قبل :arg0.',
3650
+ boolean: 'يجب أن يكون حقل :attribute صحيحًا أو خاطئًا (true أو false).',
3651
+ confirmed: 'تأكيد :attribute غير مطابق.',
3652
+ credit_card: 'يجب أن يكون :attribute رقم بطاقة ائتمان صالحًا.',
3653
+ cvv: 'يجب أن يكون :attribute رقم CVV صالحًا.',
3654
+ date: ':attribute ليس تاريخًا صالحًا.',
3655
+ date_format: ':attribute لا يطابق الصيغة :arg0.',
3656
+ debit_card: 'يجب أن يكون :attribute رقم بطاقة خصم صالحًا.',
3657
+ different: 'يجب أن يكون :attribute و :arg0 مختلفين.',
3658
+ dimension: 'أبعاد صورة :attribute غير صالحة.',
3659
+ email: 'يجب أن يكون :attribute عنوان بريد إلكتروني صالحًا.',
3660
+ ends_with: 'يجب أن ينتهي :attribute بأحد القيم التالية: :arg0',
3661
+ equals: 'يجب أن يساوي :attribute القيمة :arg0',
3662
+ exists: ':attribute المحدد غير صالح.',
3663
+ image: 'يجب أن يكون :attribute صورة صالحة.',
3664
+ in: 'يجب أن يكون :attribute المحدد ضمن :arg0.',
3665
+ includes: 'يجب أن يحتوي :attribute على :arg0.',
3666
+ integer: 'يجب أن يكون :attribute عددًا صحيحًا.',
3667
+ ip: 'يجب أن يكون :attribute عنوان IP صالحًا.',
3668
+ ipv4: 'يجب أن يكون :attribute عنوان IPv4 صالحًا.',
3669
+ ipv6: 'يجب أن يكون :attribute عنوان IPv6 صالحًا.',
3670
+ json: 'يجب أن يكون :attribute نص JSON صالحًا.',
3671
+ max: {
3672
+ array: 'لا يجوز أن يحتوي :attribute على أكثر من :arg0 عنصرًا.',
3673
+ numeric: 'يجب ألا يكون :attribute أكبر من :arg0.',
3674
+ string: 'يجب ألا يتجاوز :attribute :arg0 حرفًا.'
3675
+ },
3676
+ min: {
3677
+ array: 'يجب أن يحتوي :attribute على :arg0 عناصر على الأقل.',
3678
+ numeric: 'يجب أن يكون :attribute :arg0 على الأقل.',
3679
+ string: 'يجب أن يحتوي :attribute على :arg0 أحرف على الأقل.'
3680
+ },
3681
+ mimes: 'يجب أن يكون :attribute ملفًا من نوع :arg0.',
3682
+ not_equals: 'يجب ألا يساوي :attribute القيمة :arg0',
3683
+ not_in: 'يجب ألا يكون :attribute المحدد ضمن :arg0.',
3684
+ not_regex: 'صيغة :attribute غير صالحة.',
3685
+ number: 'يجب أن يكون :attribute رقمًا.',
3686
+ phone_no: 'يجب أن يكون :attribute رقم هاتف صالحًا.',
3687
+ range: 'يجب أن يكون :attribute بين :arg0 و :arg1.',
3688
+ between: 'يجب أن يكون :attribute بين :arg0 و :arg1، دون تضمين الحدين.',
3689
+ regex: 'صيغة :attribute غير صالحة.',
3690
+ required: 'حقل :attribute مطلوب.',
3691
+ required_if: 'حقل :attribute مطلوب عندما يكون :arg0 هو :arg1.',
3692
+ required_unless: 'حقل :attribute مطلوب ما لم يكن :arg0 ضمن :arg1.',
3693
+ required_with: 'حقل :attribute مطلوب عند وجود أي من :arg0.',
3694
+ required_with_all: 'حقل :attribute مطلوب عند وجود :arg0.',
3695
+ required_without: 'حقل :attribute مطلوب عند عدم وجود :arg0.',
3696
+ required_without_all: 'حقل :attribute مطلوب عند عدم وجود أي من :arg0.',
3697
+ same: 'يجب أن يتطابق :attribute و :arg0.',
3698
+ size: 'يجب ألا يتجاوز :attribute :arg0 كيلوبايت.',
3699
+ starts_with: 'يجب أن يبدأ :attribute بأحد القيم التالية: :arg0',
3700
+ string: 'يجب أن يكون :attribute نصًا (string).',
3701
+ strength: ':attribute ليس قويًا بما فيه الكفاية.',
3702
+ under: 'يجب أن يكون :attribute أقل من :arg0.',
3703
+ url: 'صيغة :attribute غير صالحة.',
3704
+ uuid: 'يجب أن يكون :attribute UUID صالحًا.',
3705
+ unique: ':attribute مُستخدم بالفعل.',
3706
+ video: 'يجب أن يكون :attribute فيديو صالحًا.',
3707
+ };
3708
+
3616
3709
  var en = {
3617
3710
  "above": "The :attribute should be above :arg0.",
3618
3711
  "accepted": "The :attribute must be accepted.",
@@ -4293,23 +4386,59 @@ var ru = {
4293
4386
  video: 'Поле :attribute должно быть действительным видео.',
4294
4387
  };
4295
4388
 
4296
- const BUILT_IN_TRANSLATIONS = { en, de, es, fr, hi, bn, pt, ja, zh, ru };
4389
+ const BUILT_IN_TRANSLATIONS = {
4390
+ ar: { [I18N_LANG_PREFIX]: ar },
4391
+ en: { [I18N_LANG_PREFIX]: en },
4392
+ de: { [I18N_LANG_PREFIX]: de },
4393
+ es: { [I18N_LANG_PREFIX]: es },
4394
+ fr: { [I18N_LANG_PREFIX]: fr },
4395
+ hi: { [I18N_LANG_PREFIX]: hi },
4396
+ bn: { [I18N_LANG_PREFIX]: bn },
4397
+ pt: { [I18N_LANG_PREFIX]: pt },
4398
+ ja: { [I18N_LANG_PREFIX]: ja },
4399
+ zh: { [I18N_LANG_PREFIX]: zh },
4400
+ ru: { [I18N_LANG_PREFIX]: ru }
4401
+ };
4402
+
4403
+ function TranslateLoaderFactory(config) {
4404
+ return new InlineTranslateLoader(config === null || config === void 0 ? void 0 : config.translations);
4405
+ }
4406
+ function appInitializerFactory(translate, config, activeLoader) {
4407
+ return () => {
4408
+ const languages = Object.keys(BUILT_IN_TRANSLATIONS);
4409
+ const browserLang = translate.getBrowserLang();
4410
+ const langToUse = browserLang && languages.includes(browserLang)
4411
+ ? browserLang
4412
+ : ((config === null || config === void 0 ? void 0 : config.defaultLanguage) || DEFAULT_LOCALE_LANG);
4413
+ const consumerHasOwnLoader = !(activeLoader instanceof InlineTranslateLoader);
4414
+ if (consumerHasOwnLoader) {
4415
+ const loader = new InlineTranslateLoader(config === null || config === void 0 ? void 0 : config.translations);
4416
+ const translations = loader.translations;
4417
+ translate.onLangChange.subscribe(event => {
4418
+ if (translations[event.lang]) {
4419
+ translate.setTranslation(event.lang, translations[event.lang], true);
4420
+ }
4421
+ });
4422
+ }
4423
+ return firstValueFrom(translate.use(langToUse));
4424
+ };
4425
+ }
4297
4426
  class InlineTranslateLoader {
4298
- constructor(mergeTranslations = {}, replaceTranslations = {}) {
4299
- this.mergeTranslations = mergeTranslations;
4427
+ constructor(replaceTranslations = {}) {
4300
4428
  this.replaceTranslations = replaceTranslations;
4301
4429
  this.translations = {};
4302
4430
  this.init();
4303
4431
  }
4304
4432
  init() {
4305
4433
  this.translations = Object.assign({}, BUILT_IN_TRANSLATIONS);
4306
- // Full replace happens first — wipes out all existing keys for that lang
4307
4434
  for (const lang of Object.keys(this.replaceTranslations)) {
4308
- this.translations[lang] = Object.assign({}, this.replaceTranslations[lang]);
4309
- }
4310
- // Merge happens second — adds new languages, or patches individual keys
4311
- for (const lang of Object.keys(this.mergeTranslations)) {
4312
- this.translations[lang] = Object.assign(Object.assign({}, (this.translations[lang] || {})), this.mergeTranslations[lang]);
4435
+ if (this.translations[lang]) {
4436
+ const translation = Object.assign(this.translations[lang][I18N_LANG_PREFIX], this.replaceTranslations[lang]);
4437
+ this.translations[lang] = { [I18N_LANG_PREFIX]: translation };
4438
+ }
4439
+ else {
4440
+ this.translations[lang] = { [I18N_LANG_PREFIX]: this.replaceTranslations[lang] };
4441
+ }
4313
4442
  }
4314
4443
  }
4315
4444
  getTranslation(lang) {
@@ -4318,21 +4447,20 @@ class InlineTranslateLoader {
4318
4447
  }
4319
4448
  }
4320
4449
 
4321
- function TranslateLoaderFactory(config) {
4322
- return new InlineTranslateLoader(config === null || config === void 0 ? void 0 : config.translations, config === null || config === void 0 ? void 0 : config.replaceTranslations);
4323
- }
4324
- function appInitializerFactory(translate, config) {
4325
- return () => {
4326
- var _a;
4327
- const builtIn = SUPPORTED_LOCALE_LANGS;
4328
- const supported = ((_a = config === null || config === void 0 ? void 0 : config.supportedLanguages) === null || _a === void 0 ? void 0 : _a.length) ? config.supportedLanguages : builtIn;
4329
- const browserLang = translate.getBrowserLang();
4330
- const langToUse = browserLang && supported.includes(browserLang)
4331
- ? browserLang
4332
- : ((config === null || config === void 0 ? void 0 : config.defaultLanguage) || DEFAULT_LOCALE_LANG);
4333
- return firstValueFrom(translate.use(langToUse));
4334
- };
4450
+ class ReplaceWithPipe {
4451
+ transform(value, data) {
4452
+ return formatMessage(value, { attr: data.attr, args: data.args });
4453
+ }
4335
4454
  }
4455
+ ReplaceWithPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ReplaceWithPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
4456
+ ReplaceWithPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: ReplaceWithPipe, name: "replaceWith" });
4457
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ReplaceWithPipe, decorators: [{
4458
+ type: Pipe,
4459
+ args: [{
4460
+ name: 'replaceWith'
4461
+ }]
4462
+ }] });
4463
+
4336
4464
  class NgAbsoluteValidatorModule {
4337
4465
  static forRoot(config = {}) {
4338
4466
  return {
@@ -4348,7 +4476,8 @@ class NgAbsoluteValidatorModule {
4348
4476
  NgAbsoluteValidatorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NgAbsoluteValidatorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4349
4477
  NgAbsoluteValidatorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: NgAbsoluteValidatorModule, declarations: [NgAbsoluteValidatorComponent,
4350
4478
  NativeElementDirective,
4351
- ErrorTriggerOn], imports: [CommonModule,
4479
+ ErrorTriggerOn,
4480
+ ReplaceWithPipe], imports: [CommonModule,
4352
4481
  RuleModule,
4353
4482
  HttpClientModule, i1.TranslateModule], exports: [RuleModule,
4354
4483
  NgAbsoluteValidatorComponent,
@@ -4365,7 +4494,7 @@ NgAbsoluteValidatorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0
4365
4494
  {
4366
4495
  provide: APP_INITIALIZER,
4367
4496
  useFactory: appInitializerFactory,
4368
- deps: [TranslateService, LIB_CONFIG],
4497
+ deps: [TranslateService, LIB_CONFIG, TranslateLoader],
4369
4498
  multi: true
4370
4499
  }
4371
4500
  ], imports: [CommonModule,
@@ -4386,7 +4515,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
4386
4515
  declarations: [
4387
4516
  NgAbsoluteValidatorComponent,
4388
4517
  NativeElementDirective,
4389
- ErrorTriggerOn
4518
+ ErrorTriggerOn,
4519
+ ReplaceWithPipe
4390
4520
  ],
4391
4521
  imports: [
4392
4522
  CommonModule,
@@ -4412,7 +4542,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
4412
4542
  {
4413
4543
  provide: APP_INITIALIZER,
4414
4544
  useFactory: appInitializerFactory,
4415
- deps: [TranslateService, LIB_CONFIG],
4545
+ deps: [TranslateService, LIB_CONFIG, TranslateLoader],
4416
4546
  multi: true
4417
4547
  }
4418
4548
  ],
@@ -4425,20 +4555,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
4425
4555
  }]
4426
4556
  }] });
4427
4557
 
4428
- const LOCALE_LANG_LABELS = {
4429
- en: 'English',
4430
- es: 'Español',
4431
- fr: 'Français',
4432
- de: 'Deutsch',
4433
- hi: 'हिन्दी',
4434
- bn: 'বাংলা',
4435
- pt: 'Português',
4436
- ar: 'العربية',
4437
- ja: '日本語',
4438
- zh: '中文',
4439
- ru: 'Русский',
4440
- };
4441
-
4442
4558
  /*
4443
4559
  * Public API Surface of ng-absolute-validator
4444
4560
  */
@@ -4447,5 +4563,5 @@ const LOCALE_LANG_LABELS = {
4447
4563
  * Generated bundle index. Do not edit.
4448
4564
  */
4449
4565
 
4450
- 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 };
4566
+ 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 };
4451
4567
  //# sourceMappingURL=sbcore-ng-absolute-validator.mjs.map