@sbcore/ng-absolute-validator 14.0.2 → 14.1.1

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 (50) hide show
  1. package/README.md +14 -16
  2. package/deprecation.util.d.ts +1 -0
  3. package/esm2020/deprecation.util.mjs +9 -0
  4. package/esm2020/i18n/ar.mjs +68 -0
  5. package/esm2020/i18n/de.mjs +1 -1
  6. package/esm2020/i18n/en.mjs +1 -1
  7. package/esm2020/i18n/es.mjs +1 -1
  8. package/esm2020/i18n/fr.mjs +1 -1
  9. package/esm2020/i18n/hi.mjs +1 -1
  10. package/esm2020/i18n/index.mjs +12 -0
  11. package/esm2020/lib/common.utils.mjs +12 -1
  12. package/esm2020/lib/config-interface.mjs +1 -1
  13. package/esm2020/lib/constant.mjs +2 -2
  14. package/esm2020/lib/directive/error-trigger/error-trigger-on.directive.mjs +1 -1
  15. package/esm2020/lib/interface.mjs +2 -14
  16. package/esm2020/lib/lang.config.mjs +26 -0
  17. package/esm2020/lib/ng-absolute-validator.component.mjs +5 -3
  18. package/esm2020/lib/ng-absolute-validator.module.mjs +10 -22
  19. package/esm2020/lib/ng-absolute-validator.service.mjs +14 -6
  20. package/esm2020/lib/pipe/index.mjs +2 -0
  21. package/esm2020/lib/pipe/replaceWith/replace-with.pipe.mjs +17 -0
  22. package/esm2020/lib/rule/rule.directive.mjs +14 -3
  23. package/esm2020/lib/services/http.request.service.mjs +4 -3
  24. package/esm2020/lib/services/messages-builder.service.mjs +30 -33
  25. package/esm2020/lib/services/reactive.validate.mjs +4 -3
  26. package/esm2020/lib/services/utils.service.mjs +4 -3
  27. package/esm2020/lib/services/validate-rule.service.mjs +15 -10
  28. package/esm2020/lib/transator.loader.mjs +35 -24
  29. package/esm2020/public-api.mjs +2 -1
  30. package/fesm2015/sbcore-ng-absolute-validator.mjs +234 -99
  31. package/fesm2015/sbcore-ng-absolute-validator.mjs.map +1 -1
  32. package/fesm2020/sbcore-ng-absolute-validator.mjs +233 -101
  33. package/fesm2020/sbcore-ng-absolute-validator.mjs.map +1 -1
  34. package/i18n/ar.d.ts +68 -0
  35. package/i18n/index.d.ts +11 -0
  36. package/lib/common.utils.d.ts +4 -0
  37. package/lib/config-interface.d.ts +1 -2
  38. package/lib/constant.d.ts +1 -1
  39. package/lib/interface.d.ts +7 -3
  40. package/lib/lang.config.d.ts +1 -0
  41. package/lib/ng-absolute-validator.module.d.ts +6 -9
  42. package/lib/ng-absolute-validator.service.d.ts +8 -3
  43. package/lib/pipe/index.d.ts +1 -0
  44. package/lib/pipe/replaceWith/replace-with.pipe.d.ts +7 -0
  45. package/lib/rule/rule.directive.d.ts +5 -1
  46. package/lib/services/messages-builder.service.d.ts +5 -3
  47. package/lib/services/validate-rule.service.d.ts +4 -2
  48. package/lib/transator.loader.d.ts +5 -3
  49. package/package.json +2 -2
  50. 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];
413
- }
414
- if (hasCustomTemplate && lastElement[this.ts.currentLang]) {
415
- template = lastElement[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));
416
435
  }
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,21 @@ 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 }]; } });
1046
+
1047
+ const warnedRules = new Set();
1048
+ function warnDeprecatedRule(ruleName, replacement, reason) {
1049
+ if (warnedRules.has(ruleName))
1050
+ return;
1051
+ warnedRules.add(ruleName);
1052
+ const reasonText = reason ? ` (${reason})` : '';
1053
+ console.warn(`[ng-absolute-validator] The "${ruleName}" rule is deprecated and will be removed in a future version. Use "${replacement}" instead${reasonText}.`);
1054
+ }
1023
1055
 
1024
1056
  class Rule {
1025
1057
  constructor(ruleValidate, el) {
@@ -1029,6 +1061,13 @@ class Rule {
1029
1061
  this.fieldName = 'field';
1030
1062
  this.fieldName = this.el.nativeElement.name;
1031
1063
  }
1064
+ /**
1065
+ * @deprecated Use `rule` (lowercase) instead. Will be removed in 16.0.0.
1066
+ **/
1067
+ set legacyRule(value) {
1068
+ warnDeprecatedRule('rule-capital-r', '[Rule] (capital R) is deprecated and will be removed in 16.0.0. Use [rule] instead.');
1069
+ this.rule = value;
1070
+ }
1032
1071
  set message(data) {
1033
1072
  this.vmessage = data;
1034
1073
  }
@@ -1037,14 +1076,17 @@ class Rule {
1037
1076
  }
1038
1077
  }
1039
1078
  Rule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: Rule, deps: [{ token: ValidateRuleService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1040
- Rule.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: Rule, selector: "[Rule], [rule]", inputs: { rule: ["Rule", "rule"], message: "message" }, providers: [{ provide: NG_VALIDATORS, useExisting: Rule, multi: true }], ngImport: i0 });
1079
+ Rule.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: Rule, selector: "[rule],[Rule]", inputs: { rule: "rule", legacyRule: ["Rule", "legacyRule"], message: "message" }, providers: [{ provide: NG_VALIDATORS, useExisting: Rule, multi: true }], ngImport: i0 });
1041
1080
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: Rule, decorators: [{
1042
1081
  type: Directive,
1043
1082
  args: [{
1044
- selector: '[Rule], [rule]',
1083
+ selector: '[rule],[Rule]',
1045
1084
  providers: [{ provide: NG_VALIDATORS, useExisting: Rule, multi: true }]
1046
1085
  }]
1047
1086
  }], ctorParameters: function () { return [{ type: ValidateRuleService }, { type: i0.ElementRef }]; }, propDecorators: { rule: [{
1087
+ type: Input,
1088
+ args: ['rule']
1089
+ }], legacyRule: [{
1048
1090
  type: Input,
1049
1091
  args: ['Rule']
1050
1092
  }], message: [{
@@ -3569,9 +3611,10 @@ class ReactiveValidator {
3569
3611
  }
3570
3612
  }
3571
3613
  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 });
3614
+ ReactiveValidator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ReactiveValidator, providedIn: 'root' });
3573
3615
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ReactiveValidator, decorators: [{
3574
- type: Injectable
3616
+ type: Injectable,
3617
+ args: [{ providedIn: 'root' }]
3575
3618
  }], ctorParameters: function () { return [{ type: ValidateRuleService }, { type: UtilService }, { type: MessageBuilderService }]; } });
3576
3619
 
3577
3620
  class NativeElementDirective {
@@ -3604,6 +3647,74 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
3604
3647
  args: ['formControlName']
3605
3648
  }] } });
3606
3649
 
3650
+ var ar = {
3651
+ above: 'يجب أن يكون :attribute أعلى من :arg0.',
3652
+ accepted: 'يجب قبول :attribute.',
3653
+ after: 'يجب أن يكون :attribute تاريخًا بعد :arg0.',
3654
+ alpha: 'يجب أن يحتوي :attribute على أحرف فقط.',
3655
+ alpha_dash: 'يجب أن يحتوي :attribute على أحرف وأرقام وشرطات وشرطات سفلية فقط.',
3656
+ alpha_numeric: 'يجب أن يحتوي :attribute على أحرف وأرقام فقط.',
3657
+ array: 'يجب أن يكون :attribute مصفوفة.',
3658
+ before: 'يجب أن يكون :attribute تاريخًا قبل :arg0.',
3659
+ boolean: 'يجب أن يكون حقل :attribute صحيحًا أو خاطئًا (true أو false).',
3660
+ confirmed: 'تأكيد :attribute غير مطابق.',
3661
+ credit_card: 'يجب أن يكون :attribute رقم بطاقة ائتمان صالحًا.',
3662
+ cvv: 'يجب أن يكون :attribute رقم CVV صالحًا.',
3663
+ date: ':attribute ليس تاريخًا صالحًا.',
3664
+ date_format: ':attribute لا يطابق الصيغة :arg0.',
3665
+ debit_card: 'يجب أن يكون :attribute رقم بطاقة خصم صالحًا.',
3666
+ different: 'يجب أن يكون :attribute و :arg0 مختلفين.',
3667
+ dimension: 'أبعاد صورة :attribute غير صالحة.',
3668
+ email: 'يجب أن يكون :attribute عنوان بريد إلكتروني صالحًا.',
3669
+ ends_with: 'يجب أن ينتهي :attribute بأحد القيم التالية: :arg0',
3670
+ equals: 'يجب أن يساوي :attribute القيمة :arg0',
3671
+ exists: ':attribute المحدد غير صالح.',
3672
+ image: 'يجب أن يكون :attribute صورة صالحة.',
3673
+ in: 'يجب أن يكون :attribute المحدد ضمن :arg0.',
3674
+ includes: 'يجب أن يحتوي :attribute على :arg0.',
3675
+ integer: 'يجب أن يكون :attribute عددًا صحيحًا.',
3676
+ ip: 'يجب أن يكون :attribute عنوان IP صالحًا.',
3677
+ ipv4: 'يجب أن يكون :attribute عنوان IPv4 صالحًا.',
3678
+ ipv6: 'يجب أن يكون :attribute عنوان IPv6 صالحًا.',
3679
+ json: 'يجب أن يكون :attribute نص JSON صالحًا.',
3680
+ max: {
3681
+ array: 'لا يجوز أن يحتوي :attribute على أكثر من :arg0 عنصرًا.',
3682
+ numeric: 'يجب ألا يكون :attribute أكبر من :arg0.',
3683
+ string: 'يجب ألا يتجاوز :attribute :arg0 حرفًا.'
3684
+ },
3685
+ min: {
3686
+ array: 'يجب أن يحتوي :attribute على :arg0 عناصر على الأقل.',
3687
+ numeric: 'يجب أن يكون :attribute :arg0 على الأقل.',
3688
+ string: 'يجب أن يحتوي :attribute على :arg0 أحرف على الأقل.'
3689
+ },
3690
+ mimes: 'يجب أن يكون :attribute ملفًا من نوع :arg0.',
3691
+ not_equals: 'يجب ألا يساوي :attribute القيمة :arg0',
3692
+ not_in: 'يجب ألا يكون :attribute المحدد ضمن :arg0.',
3693
+ not_regex: 'صيغة :attribute غير صالحة.',
3694
+ number: 'يجب أن يكون :attribute رقمًا.',
3695
+ phone_no: 'يجب أن يكون :attribute رقم هاتف صالحًا.',
3696
+ range: 'يجب أن يكون :attribute بين :arg0 و :arg1.',
3697
+ between: 'يجب أن يكون :attribute بين :arg0 و :arg1، دون تضمين الحدين.',
3698
+ regex: 'صيغة :attribute غير صالحة.',
3699
+ required: 'حقل :attribute مطلوب.',
3700
+ required_if: 'حقل :attribute مطلوب عندما يكون :arg0 هو :arg1.',
3701
+ required_unless: 'حقل :attribute مطلوب ما لم يكن :arg0 ضمن :arg1.',
3702
+ required_with: 'حقل :attribute مطلوب عند وجود أي من :arg0.',
3703
+ required_with_all: 'حقل :attribute مطلوب عند وجود :arg0.',
3704
+ required_without: 'حقل :attribute مطلوب عند عدم وجود :arg0.',
3705
+ required_without_all: 'حقل :attribute مطلوب عند عدم وجود أي من :arg0.',
3706
+ same: 'يجب أن يتطابق :attribute و :arg0.',
3707
+ size: 'يجب ألا يتجاوز :attribute :arg0 كيلوبايت.',
3708
+ starts_with: 'يجب أن يبدأ :attribute بأحد القيم التالية: :arg0',
3709
+ string: 'يجب أن يكون :attribute نصًا (string).',
3710
+ strength: ':attribute ليس قويًا بما فيه الكفاية.',
3711
+ under: 'يجب أن يكون :attribute أقل من :arg0.',
3712
+ url: 'صيغة :attribute غير صالحة.',
3713
+ uuid: 'يجب أن يكون :attribute UUID صالحًا.',
3714
+ unique: ':attribute مُستخدم بالفعل.',
3715
+ video: 'يجب أن يكون :attribute فيديو صالحًا.',
3716
+ };
3717
+
3607
3718
  var en = {
3608
3719
  "above": "The :attribute should be above :arg0.",
3609
3720
  "accepted": "The :attribute must be accepted.",
@@ -4284,26 +4395,59 @@ var ru = {
4284
4395
  video: 'Поле :attribute должно быть действительным видео.',
4285
4396
  };
4286
4397
 
4287
- const BUILT_IN_TRANSLATIONS = { en, de, es, fr, hi, bn, pt, ja, zh, ru };
4398
+ const BUILT_IN_TRANSLATIONS = {
4399
+ ar: { [I18N_LANG_PREFIX]: ar },
4400
+ en: { [I18N_LANG_PREFIX]: en },
4401
+ de: { [I18N_LANG_PREFIX]: de },
4402
+ es: { [I18N_LANG_PREFIX]: es },
4403
+ fr: { [I18N_LANG_PREFIX]: fr },
4404
+ hi: { [I18N_LANG_PREFIX]: hi },
4405
+ bn: { [I18N_LANG_PREFIX]: bn },
4406
+ pt: { [I18N_LANG_PREFIX]: pt },
4407
+ ja: { [I18N_LANG_PREFIX]: ja },
4408
+ zh: { [I18N_LANG_PREFIX]: zh },
4409
+ ru: { [I18N_LANG_PREFIX]: ru }
4410
+ };
4411
+
4412
+ function TranslateLoaderFactory(config) {
4413
+ return new InlineTranslateLoader(config?.translations);
4414
+ }
4415
+ function appInitializerFactory(translate, config, activeLoader) {
4416
+ return () => {
4417
+ const languages = Object.keys(BUILT_IN_TRANSLATIONS);
4418
+ const browserLang = translate.getBrowserLang();
4419
+ const langToUse = browserLang && languages.includes(browserLang)
4420
+ ? browserLang
4421
+ : (config?.defaultLanguage || DEFAULT_LOCALE_LANG);
4422
+ const consumerHasOwnLoader = !(activeLoader instanceof InlineTranslateLoader);
4423
+ if (consumerHasOwnLoader) {
4424
+ const loader = new InlineTranslateLoader(config?.translations);
4425
+ const translations = loader.translations;
4426
+ translate.onLangChange.subscribe(event => {
4427
+ if (translations[event.lang]) {
4428
+ translate.setTranslation(event.lang, translations[event.lang], true);
4429
+ }
4430
+ });
4431
+ }
4432
+ return firstValueFrom(translate.use(langToUse));
4433
+ };
4434
+ }
4288
4435
  class InlineTranslateLoader {
4289
- constructor(mergeTranslations = {}, replaceTranslations = {}) {
4290
- this.mergeTranslations = mergeTranslations;
4436
+ constructor(replaceTranslations = {}) {
4291
4437
  this.replaceTranslations = replaceTranslations;
4292
4438
  this.translations = {};
4293
4439
  this.init();
4294
4440
  }
4295
4441
  init() {
4296
4442
  this.translations = { ...BUILT_IN_TRANSLATIONS };
4297
- // Full replace happens first — wipes out all existing keys for that lang
4298
4443
  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
- };
4444
+ if (this.translations[lang]) {
4445
+ const translation = Object.assign(this.translations[lang][I18N_LANG_PREFIX], this.replaceTranslations[lang]);
4446
+ this.translations[lang] = { [I18N_LANG_PREFIX]: translation };
4447
+ }
4448
+ else {
4449
+ this.translations[lang] = { [I18N_LANG_PREFIX]: this.replaceTranslations[lang] };
4450
+ }
4307
4451
  }
4308
4452
  }
4309
4453
  getTranslation(lang) {
@@ -4311,20 +4455,20 @@ class InlineTranslateLoader {
4311
4455
  }
4312
4456
  }
4313
4457
 
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
- };
4458
+ class ReplaceWithPipe {
4459
+ transform(value, data) {
4460
+ return formatMessage(value, { attr: data.attr, args: data.args });
4461
+ }
4327
4462
  }
4463
+ ReplaceWithPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ReplaceWithPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
4464
+ ReplaceWithPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: ReplaceWithPipe, name: "replaceWith" });
4465
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ReplaceWithPipe, decorators: [{
4466
+ type: Pipe,
4467
+ args: [{
4468
+ name: 'replaceWith'
4469
+ }]
4470
+ }] });
4471
+
4328
4472
  class NgAbsoluteValidatorModule {
4329
4473
  static forRoot(config = {}) {
4330
4474
  return {
@@ -4340,7 +4484,8 @@ class NgAbsoluteValidatorModule {
4340
4484
  NgAbsoluteValidatorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NgAbsoluteValidatorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4341
4485
  NgAbsoluteValidatorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: NgAbsoluteValidatorModule, declarations: [NgAbsoluteValidatorComponent,
4342
4486
  NativeElementDirective,
4343
- ErrorTriggerOn], imports: [CommonModule,
4487
+ ErrorTriggerOn,
4488
+ ReplaceWithPipe], imports: [CommonModule,
4344
4489
  RuleModule,
4345
4490
  HttpClientModule, i1.TranslateModule], exports: [RuleModule,
4346
4491
  NgAbsoluteValidatorComponent,
@@ -4357,7 +4502,7 @@ NgAbsoluteValidatorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0
4357
4502
  {
4358
4503
  provide: APP_INITIALIZER,
4359
4504
  useFactory: appInitializerFactory,
4360
- deps: [TranslateService, LIB_CONFIG],
4505
+ deps: [TranslateService, LIB_CONFIG, TranslateLoader],
4361
4506
  multi: true
4362
4507
  }
4363
4508
  ], imports: [CommonModule,
@@ -4378,7 +4523,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
4378
4523
  declarations: [
4379
4524
  NgAbsoluteValidatorComponent,
4380
4525
  NativeElementDirective,
4381
- ErrorTriggerOn
4526
+ ErrorTriggerOn,
4527
+ ReplaceWithPipe
4382
4528
  ],
4383
4529
  imports: [
4384
4530
  CommonModule,
@@ -4404,7 +4550,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
4404
4550
  {
4405
4551
  provide: APP_INITIALIZER,
4406
4552
  useFactory: appInitializerFactory,
4407
- deps: [TranslateService, LIB_CONFIG],
4553
+ deps: [TranslateService, LIB_CONFIG, TranslateLoader],
4408
4554
  multi: true
4409
4555
  }
4410
4556
  ],
@@ -4417,20 +4563,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
4417
4563
  }]
4418
4564
  }] });
4419
4565
 
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
4566
  /*
4435
4567
  * Public API Surface of ng-absolute-validator
4436
4568
  */
@@ -4439,5 +4571,5 @@ const LOCALE_LANG_LABELS = {
4439
4571
  * Generated bundle index. Do not edit.
4440
4572
  */
4441
4573
 
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 };
4574
+ 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
4575
  //# sourceMappingURL=sbcore-ng-absolute-validator.mjs.map