@koobiq/components 18.2.0 → 18.3.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 (93) hide show
  1. package/core/common-behaviors/error-state.d.ts +1 -1
  2. package/core/error/error-state-matcher.d.ts +26 -0
  3. package/core/form-field/form-field-ref.d.ts +7 -0
  4. package/core/forms/index.d.ts +1 -0
  5. package/core/forms/validators.d.ts +86 -0
  6. package/core/locales/locale-service.d.ts +11 -0
  7. package/core/option/action.d.ts +1 -1
  8. package/core/pop-up/pop-up-trigger.d.ts +3 -3
  9. package/core/public-api.d.ts +1 -2
  10. package/core/validation/validation.d.ts +1 -0
  11. package/esm2022/core/common-behaviors/error-state.mjs +1 -1
  12. package/esm2022/core/error/error-state-matcher.mjs +43 -0
  13. package/esm2022/core/form-field/form-field-ref.mjs +4 -1
  14. package/esm2022/core/forms/index.mjs +2 -1
  15. package/esm2022/core/forms/validators.mjs +132 -0
  16. package/esm2022/core/locales/locale-service.mjs +30 -1
  17. package/esm2022/core/option/action.mjs +5 -8
  18. package/esm2022/core/pop-up/pop-up-trigger.mjs +12 -12
  19. package/esm2022/core/public-api.mjs +2 -3
  20. package/esm2022/core/validation/validation.mjs +2 -1
  21. package/esm2022/core/version.mjs +2 -2
  22. package/esm2022/datepicker/calendar-header.component.mjs +5 -6
  23. package/esm2022/file-upload/single-file-upload.component.mjs +3 -3
  24. package/esm2022/form-field/form-field-control.mjs +1 -1
  25. package/esm2022/form-field/form-field.mjs +7 -8
  26. package/esm2022/icon/icon.component.mjs +2 -2
  27. package/esm2022/icon/icon.module.mjs +1 -1
  28. package/esm2022/input/input-number.mjs +74 -80
  29. package/esm2022/list/list-selection.component.mjs +8 -12
  30. package/esm2022/navbar/navbar-item.component.mjs +6 -9
  31. package/esm2022/navbar/navbar.component.mjs +12 -13
  32. package/esm2022/popover/popover-confirm.component.mjs +3 -3
  33. package/esm2022/select/select.component.mjs +15 -14
  34. package/esm2022/select/select.module.mjs +3 -7
  35. package/esm2022/tabs/paginated-tab-header.mjs +10 -12
  36. package/esm2022/tags/tag-list.component.mjs +9 -11
  37. package/esm2022/toast/toast.component.mjs +5 -6
  38. package/esm2022/tree/padding.directive.mjs +3 -9
  39. package/esm2022/tree/tree-base.mjs +5 -8
  40. package/esm2022/tree/tree-selection.component.mjs +10 -13
  41. package/esm2022/tree-select/tree-select.component.mjs +13 -13
  42. package/fesm2022/koobiq-components-core.mjs +205 -27
  43. package/fesm2022/koobiq-components-core.mjs.map +1 -1
  44. package/fesm2022/koobiq-components-datepicker.mjs +8 -9
  45. package/fesm2022/koobiq-components-datepicker.mjs.map +1 -1
  46. package/fesm2022/koobiq-components-file-upload.mjs +2 -2
  47. package/fesm2022/koobiq-components-file-upload.mjs.map +1 -1
  48. package/fesm2022/koobiq-components-form-field.mjs +6 -7
  49. package/fesm2022/koobiq-components-form-field.mjs.map +1 -1
  50. package/fesm2022/koobiq-components-icon.mjs +1 -1
  51. package/fesm2022/koobiq-components-icon.mjs.map +1 -1
  52. package/fesm2022/koobiq-components-input.mjs +74 -80
  53. package/fesm2022/koobiq-components-input.mjs.map +1 -1
  54. package/fesm2022/koobiq-components-list.mjs +7 -11
  55. package/fesm2022/koobiq-components-list.mjs.map +1 -1
  56. package/fesm2022/koobiq-components-navbar.mjs +13 -18
  57. package/fesm2022/koobiq-components-navbar.mjs.map +1 -1
  58. package/fesm2022/koobiq-components-popover.mjs +3 -3
  59. package/fesm2022/koobiq-components-popover.mjs.map +1 -1
  60. package/fesm2022/koobiq-components-select.mjs +18 -20
  61. package/fesm2022/koobiq-components-select.mjs.map +1 -1
  62. package/fesm2022/koobiq-components-tabs.mjs +9 -11
  63. package/fesm2022/koobiq-components-tabs.mjs.map +1 -1
  64. package/fesm2022/koobiq-components-tags.mjs +7 -9
  65. package/fesm2022/koobiq-components-tags.mjs.map +1 -1
  66. package/fesm2022/koobiq-components-toast.mjs +4 -5
  67. package/fesm2022/koobiq-components-toast.mjs.map +1 -1
  68. package/fesm2022/koobiq-components-tree-select.mjs +12 -12
  69. package/fesm2022/koobiq-components-tree-select.mjs.map +1 -1
  70. package/fesm2022/koobiq-components-tree.mjs +13 -24
  71. package/fesm2022/koobiq-components-tree.mjs.map +1 -1
  72. package/form-field/form-field-control.d.ts +3 -2
  73. package/form-field/form-field.d.ts +1 -1
  74. package/form-field/hint.scss +0 -3
  75. package/input/input-number.d.ts +24 -14
  76. package/list/list-selection.component.d.ts +2 -4
  77. package/navbar/navbar-item.component.d.ts +2 -3
  78. package/navbar/navbar.component.d.ts +7 -5
  79. package/package.json +6 -5
  80. package/schematics/ng-add/index.js +4 -4
  81. package/select/select.component.d.ts +1 -2
  82. package/select/select.module.d.ts +1 -2
  83. package/tabs/paginated-tab-header.d.ts +1 -3
  84. package/tags/tag-list.component.d.ts +1 -2
  85. package/toast/toast.component.d.ts +0 -1
  86. package/tree/padding.directive.d.ts +2 -4
  87. package/tree/tree-base.d.ts +2 -3
  88. package/tree/tree-selection.component.d.ts +2 -4
  89. package/tree-select/tree-select.component.d.ts +1 -2
  90. package/core/error/error-options.d.ts +0 -14
  91. package/core/label/label-options.d.ts +0 -13
  92. package/esm2022/core/error/error-options.mjs +0 -26
  93. package/esm2022/core/label/label-options.mjs +0 -4
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Directive, EventEmitter, isDevMode, ElementRef, TemplateRef, Component, ViewEncapsulation, ChangeDetectionStrategy, Optional, Self, Inject, ViewChild, ContentChild, ViewChildren, ContentChildren, Input, Output, NgModule } from '@angular/core';
2
+ import { Directive, EventEmitter, inject, DestroyRef, isDevMode, ElementRef, TemplateRef, Component, ViewEncapsulation, ChangeDetectionStrategy, Optional, Self, Inject, ViewChild, ContentChild, ViewChildren, ContentChildren, Input, Output, NgModule } from '@angular/core';
3
3
  import * as i1 from '@koobiq/components/core';
4
4
  import { mixinTabIndex, mixinDisabled, mixinErrorState, getKbqSelectDynamicMultipleError, getKbqSelectNonFunctionValueError, getKbqSelectNonArrayValueError, KbqVirtualOption, SELECT_PANEL_PADDING_X, SELECT_PANEL_INDENT_PADDING_X, SELECT_PANEL_VIEWPORT_PADDING, KBQ_SELECT_SCROLL_STRATEGY, KBQ_LOCALE_SERVICE, KBQ_OPTION_PARENT_COMPONENT, KbqSelectFooter, KbqSelectTrigger, KbqSelectMatcher, KbqSelectSearch, KbqOption, KbqOptgroup, kbqSelectAnimations, KbqOptionModule, KbqSelectSearchEmptyResult, KBQ_SELECT_SCROLL_STRATEGY_PROVIDER } from '@koobiq/components/core';
5
5
  import { KbqTooltipTrigger, KbqToolTipModule } from '@koobiq/components/tooltip';
@@ -9,16 +9,17 @@ import { SelectionModel } from '@angular/cdk/collections';
9
9
  import * as i2 from '@angular/cdk/overlay';
10
10
  import { CdkConnectedOverlay, OverlayModule } from '@angular/cdk/overlay';
11
11
  import { CdkVirtualForOf } from '@angular/cdk/scrolling';
12
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
12
13
  import * as i4 from '@angular/forms';
13
14
  import { ActiveDescendantKeyManager } from '@koobiq/cdk/a11y';
14
15
  import { DOWN_ARROW, UP_ARROW, LEFT_ARROW, RIGHT_ARROW, ENTER, SPACE, ESCAPE, TAB, HOME, END, PAGE_UP, PAGE_DOWN, A, BACKSPACE, DELETE } from '@koobiq/cdk/keycodes';
15
16
  import * as i5 from '@koobiq/components/form-field';
16
- import { KbqFormFieldControl, KbqFormFieldModule } from '@koobiq/components/form-field';
17
+ import { KbqFormFieldControl } from '@koobiq/components/form-field';
17
18
  import * as i7 from '@koobiq/components/tags';
18
19
  import { KbqTag, KbqTagsModule } from '@koobiq/components/tags';
19
20
  import { SelectSizeMultipleContentGap } from '@koobiq/design-tokens';
20
21
  import { Subject, defer, merge, Subscription, BehaviorSubject } from 'rxjs';
21
- import { switchMap, take, filter, map, distinctUntilChanged, takeUntil, startWith, delay } from 'rxjs/operators';
22
+ import { switchMap, take, filter, map, distinctUntilChanged, startWith, delay, takeUntil } from 'rxjs/operators';
22
23
  import * as i6 from '@koobiq/components/icon';
23
24
  import { KbqIconModule } from '@koobiq/components/icon';
24
25
  import * as i8 from '@angular/common';
@@ -314,8 +315,7 @@ class KbqSelect extends KbqSelectMixinBase {
314
315
  /** Unique id for this input. */
315
316
  this.uid = `kbq-select-${nextUniqueId++}`;
316
317
  this.visibleChanges = new BehaviorSubject(false);
317
- /** Emits whenever the component is destroyed. */
318
- this.destroy = new Subject();
318
+ this.destroyRef = inject(DestroyRef);
319
319
  /** `View -> model callback called when value changes` */
320
320
  this.onChange = () => { };
321
321
  /** `View -> model callback called when select has been touched` */
@@ -341,7 +341,9 @@ class KbqSelect extends KbqSelectMixinBase {
341
341
  // We need `distinctUntilChanged` here, because some browsers will
342
342
  // fire the animation end event twice for the same animation. See:
343
343
  // https://github.com/angular/angular/issues/24084
344
- this.panelDoneAnimatingStream.pipe(distinctUntilChanged(), takeUntil(this.destroy)).subscribe(() => {
344
+ this.panelDoneAnimatingStream
345
+ .pipe(distinctUntilChanged(), takeUntilDestroyed(this.destroyRef))
346
+ .subscribe(() => {
345
347
  if (this.panelOpen) {
346
348
  this.scrollTop = 0;
347
349
  if (this.search) {
@@ -355,17 +357,17 @@ class KbqSelect extends KbqSelectMixinBase {
355
357
  }
356
358
  });
357
359
  merge(this.optionSelectionChanges, this.visibleChanges)
358
- .pipe(distinctUntilChanged(), takeUntil(this.destroy))
360
+ .pipe(distinctUntilChanged(), takeUntilDestroyed(this.destroyRef))
359
361
  .subscribe(() => setTimeout(() => this.calculateHiddenItems(), 0));
360
362
  }
361
363
  ngAfterContentInit() {
362
364
  this.withVirtualScroll = !!this.cdkVirtualForOf;
363
365
  this.initKeyManager();
364
- this.selectionModel.changed.pipe(takeUntil(this.destroy)).subscribe((event) => {
366
+ this.selectionModel.changed.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((event) => {
365
367
  event.added.forEach((option) => option.select());
366
368
  event.removed.forEach((option) => option.deselect());
367
369
  });
368
- this.options.changes.pipe(startWith(null), takeUntil(this.destroy)).subscribe(() => {
370
+ this.options.changes.pipe(startWith(null), takeUntilDestroyed(this.destroyRef)).subscribe(() => {
369
371
  this.resetOptions();
370
372
  this.initializeSelection();
371
373
  });
@@ -389,8 +391,6 @@ class KbqSelect extends KbqSelectMixinBase {
389
391
  }
390
392
  }
391
393
  ngOnDestroy() {
392
- this.destroy.next();
393
- this.destroy.complete();
394
394
  this.stateChanges.complete();
395
395
  this.closeSubscription.unsubscribe();
396
396
  }
@@ -814,7 +814,7 @@ class KbqSelect extends KbqSelectMixinBase {
814
814
  .withTypeAhead(typeAheadDebounce, this.search ? -1 : 0)
815
815
  .withVerticalOrientation()
816
816
  .withHorizontalOrientation(this.isRtl() ? 'rtl' : 'ltr');
817
- this.keyManager.change.pipe(takeUntil(this.destroy)).subscribe(() => {
817
+ this.keyManager.change.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
818
818
  if (this.panelOpen && this.panel) {
819
819
  this.scrollActiveOptionIntoView();
820
820
  }
@@ -825,8 +825,9 @@ class KbqSelect extends KbqSelectMixinBase {
825
825
  }
826
826
  /** Drops current option subscriptions and IDs and resets from scratch. */
827
827
  resetOptions() {
828
- const changedOrDestroyed = merge(this.options.changes, this.destroy);
829
- this.optionSelectionChanges.pipe(takeUntil(changedOrDestroyed)).subscribe((event) => {
828
+ this.optionSelectionChanges
829
+ .pipe(takeUntilDestroyed(this.destroyRef), takeUntil(this.options.changes))
830
+ .subscribe((event) => {
830
831
  this.onSelect(event.source, event.isUserInput);
831
832
  if (this.search && this.search.isSearchChanged) {
832
833
  Promise.resolve().then(() => this.keyManager.updateActiveItem(0));
@@ -840,7 +841,7 @@ class KbqSelect extends KbqSelectMixinBase {
840
841
  // Listen to changes in the internal state of the options and react accordingly.
841
842
  // Handles cases like the labels of the selected options changing.
842
843
  merge(...this.options.map((option) => option.stateChanges))
843
- .pipe(takeUntil(changedOrDestroyed))
844
+ .pipe(takeUntilDestroyed(this.destroyRef), takeUntil(this.options.changes))
844
845
  .subscribe(() => {
845
846
  this._changeDetectorRef.markForCheck();
846
847
  this.stateChanges.next();
@@ -1169,8 +1170,7 @@ class KbqSelectModule {
1169
1170
  KbqSelectTrigger,
1170
1171
  KbqSelectSearchEmptyResult,
1171
1172
  NgClass,
1172
- NgTemplateOutlet], exports: [KbqFormFieldModule,
1173
- KbqSelect,
1173
+ NgTemplateOutlet], exports: [KbqSelect,
1174
1174
  KbqOptionTooltip,
1175
1175
  KbqOptionModule,
1176
1176
  KbqSelectSearch,
@@ -1182,8 +1182,7 @@ class KbqSelectModule {
1182
1182
  KbqOptionModule,
1183
1183
  KbqIconModule,
1184
1184
  KbqTagsModule,
1185
- KbqToolTipModule, KbqFormFieldModule,
1186
- KbqOptionModule] }); }
1185
+ KbqToolTipModule, KbqOptionModule] }); }
1187
1186
  }
1188
1187
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: KbqSelectModule, decorators: [{
1189
1188
  type: NgModule,
@@ -1203,7 +1202,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImpor
1203
1202
  NgTemplateOutlet
1204
1203
  ],
1205
1204
  exports: [
1206
- KbqFormFieldModule,
1207
1205
  KbqSelect,
1208
1206
  KbqOptionTooltip,
1209
1207
  KbqOptionModule,