@leanix/components 0.2.110 → 0.2.111

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.
@@ -3607,6 +3607,36 @@
3607
3607
  args: ['itemTemplate']
3608
3608
  }] } });
3609
3609
 
3610
+ var ErrorMessageComponent = /** @class */ (function () {
3611
+ function ErrorMessageComponent(cd) {
3612
+ this.cd = cd;
3613
+ }
3614
+ Object.defineProperty(ErrorMessageComponent.prototype, "key", {
3615
+ set: function (value) {
3616
+ if (value !== this._key) {
3617
+ this._key = value;
3618
+ this.cd.detectChanges();
3619
+ }
3620
+ },
3621
+ enumerable: false,
3622
+ configurable: true
3623
+ });
3624
+ return ErrorMessageComponent;
3625
+ }());
3626
+ ErrorMessageComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.4", ngImport: i0__namespace, type: ErrorMessageComponent, deps: [{ token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
3627
+ ErrorMessageComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.4", type: ErrorMessageComponent, selector: "lx-error-message", inputs: { key: "key" }, ngImport: i0__namespace, template: "<div class=\"error\" *ngIf=\"_key\">{{ _key | translate }}</div>", isInline: true, styles: [".error{color:#f96464;padding:4px}"], directives: [{ type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "translate": i1__namespace$2.TranslatePipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
3628
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.4", ngImport: i0__namespace, type: ErrorMessageComponent, decorators: [{
3629
+ type: i0.Component,
3630
+ args: [{
3631
+ selector: 'lx-error-message',
3632
+ template: "<div class=\"error\" *ngIf=\"_key\">{{ _key | translate }}</div>",
3633
+ styleUrls: ['./error-message.component.scss'],
3634
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
3635
+ }]
3636
+ }], ctorParameters: function () { return [{ type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { key: [{
3637
+ type: i0.Input
3638
+ }] } });
3639
+
3610
3640
  var FormErrorComponent = /** @class */ (function () {
3611
3641
  function FormErrorComponent() {
3612
3642
  this.translationKeys = [];
@@ -5609,6 +5639,114 @@
5609
5639
  type: i0.Output
5610
5640
  }] } });
5611
5641
 
5642
+ var FORM_CONTROL_ERROR_NAMESPACE = new i0.InjectionToken('FORM_CONTROL_ERROR_NAMESPACE');
5643
+ var FORM_CONTROL_ERROR_DISPLAY_STRATEGY = new i0.InjectionToken('FORM_CONTROL_ERROR_DISPLAY_STRATEGY');
5644
+ var provideFormControlErrorNamespace = function (namespace) { return ({
5645
+ provide: FORM_CONTROL_ERROR_NAMESPACE,
5646
+ useValue: namespace
5647
+ }); };
5648
+ var provideFormControlErrorDisplayStrategy = function (fn) { return ({
5649
+ provide: FORM_CONTROL_ERROR_DISPLAY_STRATEGY,
5650
+ useValue: fn
5651
+ }); };
5652
+ var FormErrorDirective = /** @class */ (function () {
5653
+ function FormErrorDirective(viewContainer, componentFactoryResolver, ngControl, namespace, strategy) {
5654
+ this.viewContainer = viewContainer;
5655
+ this.componentFactoryResolver = componentFactoryResolver;
5656
+ this.ngControl = ngControl;
5657
+ this.namespace = namespace;
5658
+ this.strategy = strategy;
5659
+ }
5660
+ Object.defineProperty(FormErrorDirective.prototype, "control", {
5661
+ get: function () {
5662
+ var _a;
5663
+ return ((_a = this.ngControl) === null || _a === void 0 ? void 0 : _a.control) || this.ctrl;
5664
+ },
5665
+ enumerable: false,
5666
+ configurable: true
5667
+ });
5668
+ Object.defineProperty(FormErrorDirective.prototype, "name", {
5669
+ get: function () {
5670
+ var _a;
5671
+ return ((_a = this.ngControl) === null || _a === void 0 ? void 0 : _a.name) || this.controlName;
5672
+ },
5673
+ enumerable: false,
5674
+ configurable: true
5675
+ });
5676
+ FormErrorDirective.prototype.ngOnInit = function () {
5677
+ var _this = this;
5678
+ var control = this.control;
5679
+ if (isAbstractControl(control)) {
5680
+ this.subscritpion = control.valueChanges
5681
+ .pipe(operators.startWith(control.value), operators.map(function () { return (_this.strategy ? _this.strategy(control) : true); }))
5682
+ .subscribe(function (display) {
5683
+ var errors = control.errors;
5684
+ if (errors && display) {
5685
+ var firstErrorKey = Object.keys(errors)[0];
5686
+ var translationKey = _this.buildTranslationKey(firstErrorKey);
5687
+ _this.setError(translationKey);
5688
+ }
5689
+ else if (_this.ref) {
5690
+ _this.setError();
5691
+ }
5692
+ });
5693
+ }
5694
+ };
5695
+ FormErrorDirective.prototype.buildTranslationKey = function (errorKey) {
5696
+ if (this.control) {
5697
+ return (this.namespace || 'form') + ".errors." + (this.name ? this.name + "." : '') + errorKey;
5698
+ }
5699
+ else {
5700
+ return '';
5701
+ }
5702
+ };
5703
+ FormErrorDirective.prototype.setError = function (key) {
5704
+ if (!this.ref) {
5705
+ var factory = this.componentFactoryResolver.resolveComponentFactory(ErrorMessageComponent);
5706
+ this.ref = this.viewContainer.createComponent(factory);
5707
+ }
5708
+ this.ref.instance.key = key;
5709
+ };
5710
+ FormErrorDirective.prototype.ngOnDestroy = function () {
5711
+ if (this.subscritpion) {
5712
+ this.subscritpion.unsubscribe();
5713
+ }
5714
+ };
5715
+ return FormErrorDirective;
5716
+ }());
5717
+ FormErrorDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.4", ngImport: i0__namespace, type: FormErrorDirective, deps: [{ token: i0__namespace.ViewContainerRef }, { token: i0__namespace.ComponentFactoryResolver }, { token: i3__namespace$1.NgControl, optional: true, self: true }, { token: FORM_CONTROL_ERROR_NAMESPACE, optional: true }, { token: FORM_CONTROL_ERROR_DISPLAY_STRATEGY, optional: true }], target: i0__namespace.ɵɵFactoryTarget.Directive });
5718
+ FormErrorDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.1.4", type: FormErrorDirective, selector: "[lxFormError]", inputs: { ctrl: ["lxFormError", "ctrl"], controlName: "controlName" }, ngImport: i0__namespace });
5719
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.4", ngImport: i0__namespace, type: FormErrorDirective, decorators: [{
5720
+ type: i0.Directive,
5721
+ args: [{
5722
+ selector: '[lxFormError]'
5723
+ }]
5724
+ }], ctorParameters: function () {
5725
+ return [{ type: i0__namespace.ViewContainerRef }, { type: i0__namespace.ComponentFactoryResolver }, { type: i3__namespace$1.NgControl, decorators: [{
5726
+ type: i0.Optional
5727
+ }, {
5728
+ type: i0.Self
5729
+ }] }, { type: undefined, decorators: [{
5730
+ type: i0.Optional
5731
+ }, {
5732
+ type: i0.Inject,
5733
+ args: [FORM_CONTROL_ERROR_NAMESPACE]
5734
+ }] }, { type: undefined, decorators: [{
5735
+ type: i0.Optional
5736
+ }, {
5737
+ type: i0.Inject,
5738
+ args: [FORM_CONTROL_ERROR_DISPLAY_STRATEGY]
5739
+ }] }];
5740
+ }, propDecorators: { ctrl: [{
5741
+ type: i0.Input,
5742
+ args: ['lxFormError']
5743
+ }], controlName: [{
5744
+ type: i0.Input
5745
+ }] } });
5746
+ function isAbstractControl(ctrl) {
5747
+ return !!ctrl;
5748
+ }
5749
+
5612
5750
  var FilterSelectionPipe = /** @class */ (function () {
5613
5751
  function FilterSelectionPipe() {
5614
5752
  }
@@ -5770,7 +5908,9 @@
5770
5908
  SortingDropdownComponent,
5771
5909
  SortingDropdownTriggerComponent,
5772
5910
  InputComponent,
5773
- FormatNumberPipe], imports: [i2.CommonModule,
5911
+ FormatNumberPipe,
5912
+ FormErrorDirective,
5913
+ ErrorMessageComponent], imports: [i2.CommonModule,
5774
5914
  i3$3.DragDropModule,
5775
5915
  i3$2.FormsModule,
5776
5916
  i3$2.ReactiveFormsModule, i1__namespace$2.TranslateModule, i1$3.DatepickerModule,
@@ -5810,7 +5950,9 @@
5810
5950
  SliderToggleComponent,
5811
5951
  SortingDropdownComponent,
5812
5952
  SortingDropdownTriggerComponent,
5813
- FormatNumberPipe] });
5953
+ FormatNumberPipe,
5954
+ FormErrorDirective,
5955
+ ErrorMessageComponent] });
5814
5956
  LxFormsModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.4", ngImport: i0__namespace, type: LxFormsModule, imports: [[
5815
5957
  i2.CommonModule,
5816
5958
  i3$3.DragDropModule,
@@ -5861,7 +6003,9 @@
5861
6003
  SortingDropdownComponent,
5862
6004
  SortingDropdownTriggerComponent,
5863
6005
  InputComponent,
5864
- FormatNumberPipe
6006
+ FormatNumberPipe,
6007
+ FormErrorDirective,
6008
+ ErrorMessageComponent
5865
6009
  ],
5866
6010
  imports: [
5867
6011
  i2.CommonModule,
@@ -5909,7 +6053,9 @@
5909
6053
  SliderToggleComponent,
5910
6054
  SortingDropdownComponent,
5911
6055
  SortingDropdownTriggerComponent,
5912
- FormatNumberPipe
6056
+ FormatNumberPipe,
6057
+ FormErrorDirective,
6058
+ ErrorMessageComponent
5913
6059
  ]
5914
6060
  }]
5915
6061
  }] });
@@ -6804,9 +6950,13 @@
6804
6950
  exports.ENTER = ENTER;
6805
6951
  exports.ESCAPE = ESCAPE;
6806
6952
  exports.EllipsisComponent = EllipsisComponent;
6953
+ exports.ErrorMessageComponent = ErrorMessageComponent;
6954
+ exports.FORM_CONTROL_ERROR_DISPLAY_STRATEGY = FORM_CONTROL_ERROR_DISPLAY_STRATEGY;
6955
+ exports.FORM_CONTROL_ERROR_NAMESPACE = FORM_CONTROL_ERROR_NAMESPACE;
6807
6956
  exports.FilterSelectionPipe = FilterSelectionPipe;
6808
6957
  exports.FilterTermPipe = FilterTermPipe;
6809
6958
  exports.FormErrorComponent = FormErrorComponent;
6959
+ exports.FormErrorDirective = FormErrorDirective;
6810
6960
  exports.FormatNumberPipe = FormatNumberPipe;
6811
6961
  exports.GLOBAL_TRANSLATION_OPTIONS = GLOBAL_TRANSLATION_OPTIONS;
6812
6962
  exports.HighlightRangePipe = HighlightRangePipe;
@@ -6879,6 +7029,8 @@
6879
7029
  exports.isValidHexColor = isValidHexColor;
6880
7030
  exports.isValidX = isValidX;
6881
7031
  exports.isValidY = isValidY;
7032
+ exports.provideFormControlErrorDisplayStrategy = provideFormControlErrorDisplayStrategy;
7033
+ exports.provideFormControlErrorNamespace = provideFormControlErrorNamespace;
6882
7034
  exports.shorthandHexHandle = shorthandHexHandle;
6883
7035
 
6884
7036
  Object.defineProperty(exports, '__esModule', { value: true });