@fundamental-ngx/platform 0.43.49 → 0.43.51

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.
@@ -1,12 +1,12 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, Directive, Input, Component, ChangeDetectionStrategy, ViewEncapsulation, ContentChild, Injectable, Inject, forwardRef, isDevMode, EventEmitter, TemplateRef, ElementRef, Optional, Self, SkipSelf, Output, ViewChild, ContentChildren, Host, Attribute, ViewChildren, HostListener, NgModule, Injector, Pipe, LOCALE_ID } from '@angular/core';
2
+ import { InjectionToken, Directive, Input, Component, ChangeDetectionStrategy, ViewEncapsulation, ContentChild, Injectable, Inject, forwardRef, isDevMode, EventEmitter, TemplateRef, ElementRef, Optional, Self, SkipSelf, Output, ViewChild, ContentChildren, Host, Attribute, ViewChildren, HostListener, NgModule, inject, NgZone, Injector, Pipe, LOCALE_ID } from '@angular/core';
3
3
  import * as i1$1 from '@angular/forms';
4
4
  import { Validators, FormControl, FormGroup, FormsModule, ReactiveFormsModule, NgControl, NgForm, FormGroupDirective } from '@angular/forms';
5
5
  import { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';
6
6
  import { FD_FORM_FIELD, FD_FORM_FIELD_CONTROL } from '@fundamental-ngx/cdk/forms';
7
7
  import { uniqBy, merge as merge$1, cloneDeep } from 'lodash-es';
8
8
  import * as i15 from 'rxjs';
9
- import { Subject, BehaviorSubject, tap, combineLatest, filter, Subscription, merge, fromEvent, isObservable, firstValueFrom, of, timer, interval } from 'rxjs';
9
+ import { Subject, BehaviorSubject, tap, combineLatest, filter, Subscription, merge, fromEvent, isObservable, takeUntil as takeUntil$1, firstValueFrom, of, timer, interval } from 'rxjs';
10
10
  import { distinctUntilChanged, map, takeUntil, switchMap, startWith, debounceTime, filter as filter$1, take, skip } from 'rxjs/operators';
11
11
  import * as i1 from '@fundamental-ngx/platform/shared';
12
12
  import { ColumnLayoutGridClass, ResponsiveBreakPointConfig, RESPONSIVE_BREAKPOINTS_CONFIG, FormFieldGroup, BaseInput, InLineLayoutCollectionBaseInput, coerceArraySafe, CollectionBaseInput, isOptionItem, isJsObject, isString, MatchingStrategy, isFunction, isDataSource, ArrayMultiInputDataSource, ObservableMultiInputDataSource, MultiInputDataSource, DATA_PROVIDERS, PlatformContentDensityDeprecationsModule, ArrayComboBoxDataSource, ObservableComboBoxDataSource, ComboBoxDataSource, FormGroupContainer, ArrayMultiComboBoxDataSource, ObservableMultiComboBoxDataSource, isSelectableOptionItem, MultiComboBoxDataSource } from '@fundamental-ngx/platform/shared';
@@ -24,12 +24,12 @@ import { IconModule } from '@fundamental-ngx/core/icon';
24
24
  import * as i7 from '@fundamental-ngx/core/link';
25
25
  import { LinkModule } from '@fundamental-ngx/core/link';
26
26
  import * as i3$2 from '@fundamental-ngx/cdk/utils';
27
- import { RangeSelector, KeyUtil, TemplateDirective, isFunction as isFunction$1, selectStrategy, PipeModule, TemplateModule, DynamicComponentService, resizeObservable, InitialFocusModule, OnlyDigitsModule } from '@fundamental-ngx/cdk/utils';
27
+ import { RangeSelector, KeyUtil, TemplateDirective, DestroyedService, isFunction as isFunction$1, selectStrategy, PipeModule, TemplateModule, DynamicComponentService, resizeObservable, InitialFocusModule, OnlyDigitsModule } from '@fundamental-ngx/cdk/utils';
28
28
  import { SelectionModel } from '@angular/cdk/collections';
29
29
  import * as i2$1 from '@fundamental-ngx/core/checkbox';
30
30
  import { CheckboxComponent as CheckboxComponent$1, CheckboxModule } from '@fundamental-ngx/core/checkbox';
31
31
  import { FocusKeyManager } from '@angular/cdk/a11y';
32
- import { DOWN_ARROW, UP_ARROW, LEFT_ARROW, RIGHT_ARROW, DELETE, BACKSPACE, ENTER, ESCAPE, CONTROL, TAB, SHIFT, ALT, NUMPAD_ZERO, NUMPAD_ONE, NUMPAD_TWO, NUMPAD_THREE, NUMPAD_FOUR, NUMPAD_FIVE, NUMPAD_SIX, NUMPAD_SEVEN, NUMPAD_EIGHT, NUMPAD_NINE, A, SPACE, PAGE_UP, PAGE_DOWN } from '@angular/cdk/keycodes';
32
+ import { DOWN_ARROW, UP_ARROW, LEFT_ARROW, RIGHT_ARROW, DELETE, BACKSPACE, ENTER, ESCAPE, CONTROL, TAB, SHIFT, ALT, NUMPAD_ZERO, NUMPAD_ONE, NUMPAD_TWO, NUMPAD_THREE, NUMPAD_FOUR, NUMPAD_FIVE, NUMPAD_SIX, NUMPAD_SEVEN, NUMPAD_EIGHT, NUMPAD_NINE, SPACE, A, PAGE_UP, PAGE_DOWN } from '@angular/cdk/keycodes';
33
33
  import * as i3$1 from '@fundamental-ngx/core/radio';
34
34
  import { RadioButtonComponent as RadioButtonComponent$1, RadioModule } from '@fundamental-ngx/core/radio';
35
35
  import * as i5$1 from '@fundamental-ngx/i18n';
@@ -4300,11 +4300,35 @@ class AutoCompleteDirective {
4300
4300
  /** Event thrown, when the auto ahead text is accepted */
4301
4301
  this.onComplete = new EventEmitter();
4302
4302
  /** @hidden */
4303
+ this._destroyed$ = inject(DestroyedService);
4304
+ /** @hidden */
4303
4305
  this._completeKeys = [ENTER];
4304
4306
  /** @hidden */
4305
4307
  this._fillKeys = [LEFT_ARROW, RIGHT_ARROW];
4306
4308
  /** @hidden */
4307
4309
  this._stopKeys = [BACKSPACE, DELETE, ESCAPE];
4310
+ /** @hidden */
4311
+ this._isComposing = false;
4312
+ /** @hidden */
4313
+ this._zone = inject(NgZone);
4314
+ /**
4315
+ * Fixes #10710 / #12983
4316
+ * With chinese characters inputText property update was triggered after the keyup event trigger.
4317
+ * By ensuring that we set all properties we can proceed with stable data.
4318
+ */
4319
+ this._zone.runOutsideAngular(() => {
4320
+ const keyupEvent = fromEvent(this._elementRef.nativeElement, 'keyup');
4321
+ const compositionStartEvent = fromEvent(this._elementRef.nativeElement, 'compositionstart');
4322
+ const compositionEndEvent = fromEvent(this._elementRef.nativeElement, 'compositionend');
4323
+ keyupEvent.pipe(takeUntil$1(this._destroyed$)).subscribe((evt) => this.handleKeyboardEvent(evt));
4324
+ compositionStartEvent.pipe(takeUntil$1(this._destroyed$)).subscribe(() => {
4325
+ this._isComposing = true;
4326
+ });
4327
+ compositionEndEvent.pipe(takeUntil$1(this._destroyed$)).subscribe(() => {
4328
+ this._isComposing = false;
4329
+ this.inputText = this._elementRef.nativeElement.value;
4330
+ });
4331
+ });
4308
4332
  }
4309
4333
  /** @hidden */
4310
4334
  handleBlur() {
@@ -4314,24 +4338,26 @@ class AutoCompleteDirective {
4314
4338
  }
4315
4339
  /** @hidden */
4316
4340
  handleKeyboardEvent(event) {
4317
- if (KeyUtil.isKeyCode(event, this._stopKeys)) {
4318
- this._element.value = this.inputText;
4319
- }
4320
- else if (KeyUtil.isKeyCode(event, this._completeKeys)) {
4321
- this._sendCompleteEvent(true);
4322
- }
4323
- else if (KeyUtil.isKeyCode(event, this._fillKeys)) {
4324
- this._sendCompleteEvent(false);
4325
- }
4326
- else if (!this._isControlKey(event) && this.inputText) {
4327
- /** Prevention from triggering typeahead, when having crtl/cmd + keys */
4328
- if (!this._triggerTypeAhead()) {
4329
- return;
4341
+ if (!this._isComposing) {
4342
+ if (KeyUtil.isKeyCode(event, this._stopKeys)) {
4343
+ this._element.value = this.inputText;
4344
+ }
4345
+ else if (KeyUtil.isKeyCode(event, this._completeKeys)) {
4346
+ this._sendCompleteEvent(true);
4330
4347
  }
4331
- this._oldValue = this.inputText;
4332
- const item = this._searchByStrategy();
4333
- if (item) {
4334
- this._typeahead(item.label);
4348
+ else if (KeyUtil.isKeyCode(event, this._fillKeys)) {
4349
+ this._sendCompleteEvent(false);
4350
+ }
4351
+ else if (!this._isControlKey(event) && this.inputText) {
4352
+ /** Prevention from triggering typeahead, when having crtl/cmd + keys */
4353
+ if (!this._triggerTypeAhead()) {
4354
+ return;
4355
+ }
4356
+ this._oldValue = this.inputText;
4357
+ const item = this._searchByStrategy();
4358
+ if (item) {
4359
+ this._typeahead(item.label);
4360
+ }
4335
4361
  }
4336
4362
  }
4337
4363
  this._lastKeyUpEvent = event;
@@ -6101,6 +6127,7 @@ class BaseCombobox extends CollectionBaseInput {
6101
6127
  this.isOpenChangeHandle(true);
6102
6128
  }
6103
6129
  const acceptedKeys = !KeyUtil.isKeyCode(event, BACKSPACE) &&
6130
+ !KeyUtil.isKeyCode(event, SPACE) &&
6104
6131
  !KeyUtil.isKeyType(event, 'alphabetical') &&
6105
6132
  !KeyUtil.isKeyType(event, 'numeric') &&
6106
6133
  !KeyUtil.isKeyCode(event, this._numberPadNumberKeys);