@ptsecurity/mosaic 13.9.0 → 13.10.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 (183) hide show
  1. package/_theming.scss +80 -58
  2. package/_visual.scss +75 -58
  3. package/core/formatters/date/formatter.d.ts +6 -2
  4. package/design-tokens/legacy-2017/tokens/components/form-field.json5 +2 -2
  5. package/design-tokens/legacy-2017/tokens/components/popover.json5 +1 -0
  6. package/design-tokens/legacy-2017/tokens/components/radio.json5 +1 -0
  7. package/design-tokens/legacy-2017/tokens/properties/typography.json5 +42 -33
  8. package/design-tokens/legacy-2017/tokens.d.ts +44 -35
  9. package/design-tokens/pt-2022/tokens/components/form-field.json5 +3 -3
  10. package/design-tokens/pt-2022/tokens/components/link.json5 +2 -2
  11. package/design-tokens/pt-2022/tokens/components/popover.json5 +7 -6
  12. package/design-tokens/pt-2022/tokens/properties/colors.json5 +6 -6
  13. package/design-tokens/pt-2022/tokens/properties/typography.json5 +33 -24
  14. package/design-tokens/pt-2022/tokens.d.ts +66 -58
  15. package/esm2020/autocomplete/autocomplete.component.mjs +2 -2
  16. package/esm2020/button/button.component.mjs +2 -2
  17. package/esm2020/button-toggle/button-toggle.component.mjs +2 -2
  18. package/esm2020/card/card.component.mjs +2 -2
  19. package/esm2020/checkbox/checkbox.mjs +2 -2
  20. package/esm2020/core/formatters/date/formatter.mjs +7 -3
  21. package/esm2020/core/option/action.mjs +2 -2
  22. package/esm2020/core/option/optgroup.mjs +2 -2
  23. package/esm2020/core/option/option.mjs +2 -2
  24. package/esm2020/core/selection/pseudo-checkbox/pseudo-checkbox.mjs +2 -2
  25. package/esm2020/datepicker/calendar-body.component.mjs +2 -2
  26. package/esm2020/datepicker/calendar.component.mjs +2 -2
  27. package/esm2020/datepicker/datepicker-toggle.component.mjs +2 -2
  28. package/esm2020/datepicker/datepicker.component.mjs +3 -3
  29. package/esm2020/design-tokens/legacy-2017/tokens.mjs +45 -36
  30. package/esm2020/design-tokens/pt-2022/tokens.mjs +67 -59
  31. package/esm2020/divider/divider.component.mjs +2 -2
  32. package/esm2020/dl/dl.component.mjs +2 -2
  33. package/esm2020/dropdown/dropdown-item.component.mjs +2 -2
  34. package/esm2020/dropdown/dropdown.component.mjs +3 -3
  35. package/esm2020/form-field/form-field.mjs +2 -2
  36. package/esm2020/list/list-selection.component.mjs +229 -219
  37. package/esm2020/list/list.component.mjs +2 -2
  38. package/esm2020/loader-overlay/loader-overlay.component.mjs +7 -3
  39. package/esm2020/modal/modal.component.mjs +2 -2
  40. package/esm2020/navbar/navbar.component.mjs +2 -2
  41. package/esm2020/navbar/vertical-navbar.component.mjs +3 -3
  42. package/esm2020/popover/popover-confirm.component.mjs +3 -3
  43. package/esm2020/popover/popover.component.mjs +3 -3
  44. package/esm2020/progress-bar/progress-bar.component.mjs +2 -2
  45. package/esm2020/progress-spinner/progress-spinner.component.mjs +2 -2
  46. package/esm2020/radio/radio.component.mjs +2 -2
  47. package/esm2020/select/select.component.mjs +3 -3
  48. package/esm2020/sidepanel/sidepanel-container.component.mjs +3 -3
  49. package/esm2020/tabs/tab-group.component.mjs +2 -2
  50. package/esm2020/tabs/tab-header.component.mjs +2 -2
  51. package/esm2020/tabs/tab-nav-bar/tab-nav-bar.mjs +2 -2
  52. package/esm2020/tags/tag-list.component.mjs +2 -2
  53. package/esm2020/tags/tag.component.mjs +2 -2
  54. package/esm2020/toast/toast-container.component.mjs +2 -2
  55. package/esm2020/toast/toast.component.mjs +14 -11
  56. package/esm2020/toggle/toggle.component.mjs +3 -3
  57. package/esm2020/tooltip/tooltip.component.mjs +3 -3
  58. package/esm2020/tree/toggle.mjs +2 -2
  59. package/esm2020/tree/tree-option.component.mjs +7 -3
  60. package/esm2020/tree/tree-selection.component.mjs +7 -1
  61. package/esm2020/tree-select/tree-select.component.mjs +3 -3
  62. package/fesm2015/ptsecurity-mosaic-autocomplete.mjs +2 -2
  63. package/fesm2015/ptsecurity-mosaic-autocomplete.mjs.map +1 -1
  64. package/fesm2015/ptsecurity-mosaic-button-toggle.mjs +2 -2
  65. package/fesm2015/ptsecurity-mosaic-button-toggle.mjs.map +1 -1
  66. package/fesm2015/ptsecurity-mosaic-button.mjs +2 -2
  67. package/fesm2015/ptsecurity-mosaic-button.mjs.map +1 -1
  68. package/fesm2015/ptsecurity-mosaic-card.mjs +2 -2
  69. package/fesm2015/ptsecurity-mosaic-card.mjs.map +1 -1
  70. package/fesm2015/ptsecurity-mosaic-checkbox.mjs +2 -2
  71. package/fesm2015/ptsecurity-mosaic-checkbox.mjs.map +1 -1
  72. package/fesm2015/ptsecurity-mosaic-core.mjs +14 -10
  73. package/fesm2015/ptsecurity-mosaic-core.mjs.map +1 -1
  74. package/fesm2015/ptsecurity-mosaic-datepicker.mjs +8 -8
  75. package/fesm2015/ptsecurity-mosaic-datepicker.mjs.map +1 -1
  76. package/fesm2015/ptsecurity-mosaic-design-tokens.mjs +120 -94
  77. package/fesm2015/ptsecurity-mosaic-design-tokens.mjs.map +1 -1
  78. package/fesm2015/ptsecurity-mosaic-divider.mjs +2 -2
  79. package/fesm2015/ptsecurity-mosaic-divider.mjs.map +1 -1
  80. package/fesm2015/ptsecurity-mosaic-dl.mjs +2 -2
  81. package/fesm2015/ptsecurity-mosaic-dl.mjs.map +1 -1
  82. package/fesm2015/ptsecurity-mosaic-dropdown.mjs +4 -4
  83. package/fesm2015/ptsecurity-mosaic-dropdown.mjs.map +1 -1
  84. package/fesm2015/ptsecurity-mosaic-form-field.mjs +2 -2
  85. package/fesm2015/ptsecurity-mosaic-form-field.mjs.map +1 -1
  86. package/fesm2015/ptsecurity-mosaic-list.mjs +239 -229
  87. package/fesm2015/ptsecurity-mosaic-list.mjs.map +1 -1
  88. package/fesm2015/ptsecurity-mosaic-loader-overlay.mjs +6 -2
  89. package/fesm2015/ptsecurity-mosaic-loader-overlay.mjs.map +1 -1
  90. package/fesm2015/ptsecurity-mosaic-modal.mjs +2 -2
  91. package/fesm2015/ptsecurity-mosaic-modal.mjs.map +1 -1
  92. package/fesm2015/ptsecurity-mosaic-navbar.mjs +4 -4
  93. package/fesm2015/ptsecurity-mosaic-navbar.mjs.map +1 -1
  94. package/fesm2015/ptsecurity-mosaic-popover.mjs +4 -4
  95. package/fesm2015/ptsecurity-mosaic-popover.mjs.map +1 -1
  96. package/fesm2015/ptsecurity-mosaic-progress-bar.mjs +2 -2
  97. package/fesm2015/ptsecurity-mosaic-progress-bar.mjs.map +1 -1
  98. package/fesm2015/ptsecurity-mosaic-progress-spinner.mjs +2 -2
  99. package/fesm2015/ptsecurity-mosaic-progress-spinner.mjs.map +1 -1
  100. package/fesm2015/ptsecurity-mosaic-radio.mjs +2 -2
  101. package/fesm2015/ptsecurity-mosaic-radio.mjs.map +1 -1
  102. package/fesm2015/ptsecurity-mosaic-select.mjs +2 -2
  103. package/fesm2015/ptsecurity-mosaic-select.mjs.map +1 -1
  104. package/fesm2015/ptsecurity-mosaic-sidepanel.mjs +2 -2
  105. package/fesm2015/ptsecurity-mosaic-sidepanel.mjs.map +1 -1
  106. package/fesm2015/ptsecurity-mosaic-tabs.mjs +6 -6
  107. package/fesm2015/ptsecurity-mosaic-tabs.mjs.map +1 -1
  108. package/fesm2015/ptsecurity-mosaic-tags.mjs +4 -4
  109. package/fesm2015/ptsecurity-mosaic-tags.mjs.map +1 -1
  110. package/fesm2015/ptsecurity-mosaic-toast.mjs +16 -11
  111. package/fesm2015/ptsecurity-mosaic-toast.mjs.map +1 -1
  112. package/fesm2015/ptsecurity-mosaic-toggle.mjs +2 -2
  113. package/fesm2015/ptsecurity-mosaic-toggle.mjs.map +1 -1
  114. package/fesm2015/ptsecurity-mosaic-tooltip.mjs +2 -2
  115. package/fesm2015/ptsecurity-mosaic-tooltip.mjs.map +1 -1
  116. package/fesm2015/ptsecurity-mosaic-tree-select.mjs +2 -2
  117. package/fesm2015/ptsecurity-mosaic-tree-select.mjs.map +1 -1
  118. package/fesm2015/ptsecurity-mosaic-tree.mjs +14 -4
  119. package/fesm2015/ptsecurity-mosaic-tree.mjs.map +1 -1
  120. package/fesm2020/ptsecurity-mosaic-autocomplete.mjs +2 -2
  121. package/fesm2020/ptsecurity-mosaic-autocomplete.mjs.map +1 -1
  122. package/fesm2020/ptsecurity-mosaic-button-toggle.mjs +2 -2
  123. package/fesm2020/ptsecurity-mosaic-button-toggle.mjs.map +1 -1
  124. package/fesm2020/ptsecurity-mosaic-button.mjs +2 -2
  125. package/fesm2020/ptsecurity-mosaic-button.mjs.map +1 -1
  126. package/fesm2020/ptsecurity-mosaic-card.mjs +2 -2
  127. package/fesm2020/ptsecurity-mosaic-card.mjs.map +1 -1
  128. package/fesm2020/ptsecurity-mosaic-checkbox.mjs +2 -2
  129. package/fesm2020/ptsecurity-mosaic-checkbox.mjs.map +1 -1
  130. package/fesm2020/ptsecurity-mosaic-core.mjs +14 -10
  131. package/fesm2020/ptsecurity-mosaic-core.mjs.map +1 -1
  132. package/fesm2020/ptsecurity-mosaic-datepicker.mjs +8 -8
  133. package/fesm2020/ptsecurity-mosaic-datepicker.mjs.map +1 -1
  134. package/fesm2020/ptsecurity-mosaic-design-tokens.mjs +120 -94
  135. package/fesm2020/ptsecurity-mosaic-design-tokens.mjs.map +1 -1
  136. package/fesm2020/ptsecurity-mosaic-divider.mjs +2 -2
  137. package/fesm2020/ptsecurity-mosaic-divider.mjs.map +1 -1
  138. package/fesm2020/ptsecurity-mosaic-dl.mjs +2 -2
  139. package/fesm2020/ptsecurity-mosaic-dl.mjs.map +1 -1
  140. package/fesm2020/ptsecurity-mosaic-dropdown.mjs +4 -4
  141. package/fesm2020/ptsecurity-mosaic-dropdown.mjs.map +1 -1
  142. package/fesm2020/ptsecurity-mosaic-form-field.mjs +2 -2
  143. package/fesm2020/ptsecurity-mosaic-form-field.mjs.map +1 -1
  144. package/fesm2020/ptsecurity-mosaic-list.mjs +234 -224
  145. package/fesm2020/ptsecurity-mosaic-list.mjs.map +1 -1
  146. package/fesm2020/ptsecurity-mosaic-loader-overlay.mjs +6 -2
  147. package/fesm2020/ptsecurity-mosaic-loader-overlay.mjs.map +1 -1
  148. package/fesm2020/ptsecurity-mosaic-modal.mjs +2 -2
  149. package/fesm2020/ptsecurity-mosaic-modal.mjs.map +1 -1
  150. package/fesm2020/ptsecurity-mosaic-navbar.mjs +4 -4
  151. package/fesm2020/ptsecurity-mosaic-navbar.mjs.map +1 -1
  152. package/fesm2020/ptsecurity-mosaic-popover.mjs +4 -4
  153. package/fesm2020/ptsecurity-mosaic-popover.mjs.map +1 -1
  154. package/fesm2020/ptsecurity-mosaic-progress-bar.mjs +2 -2
  155. package/fesm2020/ptsecurity-mosaic-progress-bar.mjs.map +1 -1
  156. package/fesm2020/ptsecurity-mosaic-progress-spinner.mjs +2 -2
  157. package/fesm2020/ptsecurity-mosaic-progress-spinner.mjs.map +1 -1
  158. package/fesm2020/ptsecurity-mosaic-radio.mjs +2 -2
  159. package/fesm2020/ptsecurity-mosaic-radio.mjs.map +1 -1
  160. package/fesm2020/ptsecurity-mosaic-select.mjs +2 -2
  161. package/fesm2020/ptsecurity-mosaic-select.mjs.map +1 -1
  162. package/fesm2020/ptsecurity-mosaic-sidepanel.mjs +2 -2
  163. package/fesm2020/ptsecurity-mosaic-sidepanel.mjs.map +1 -1
  164. package/fesm2020/ptsecurity-mosaic-tabs.mjs +6 -6
  165. package/fesm2020/ptsecurity-mosaic-tabs.mjs.map +1 -1
  166. package/fesm2020/ptsecurity-mosaic-tags.mjs +4 -4
  167. package/fesm2020/ptsecurity-mosaic-tags.mjs.map +1 -1
  168. package/fesm2020/ptsecurity-mosaic-toast.mjs +14 -11
  169. package/fesm2020/ptsecurity-mosaic-toast.mjs.map +1 -1
  170. package/fesm2020/ptsecurity-mosaic-toggle.mjs +2 -2
  171. package/fesm2020/ptsecurity-mosaic-toggle.mjs.map +1 -1
  172. package/fesm2020/ptsecurity-mosaic-tooltip.mjs +2 -2
  173. package/fesm2020/ptsecurity-mosaic-tooltip.mjs.map +1 -1
  174. package/fesm2020/ptsecurity-mosaic-tree-select.mjs +2 -2
  175. package/fesm2020/ptsecurity-mosaic-tree-select.mjs.map +1 -1
  176. package/fesm2020/ptsecurity-mosaic-tree.mjs +14 -4
  177. package/fesm2020/ptsecurity-mosaic-tree.mjs.map +1 -1
  178. package/list/list-selection.component.d.ts +53 -52
  179. package/loader-overlay/loader-overlay.component.d.ts +1 -0
  180. package/package.json +4 -4
  181. package/prebuilt-themes/dark-theme.css +1 -1
  182. package/prebuilt-themes/default-theme.css +1 -1
  183. package/tree/tree-option.component.d.ts +1 -0
@@ -1,229 +1,22 @@
1
1
  import { A11yModule } from '@angular/cdk/a11y';
2
- import * as i2 from '@angular/common';
2
+ import * as i3 from '@angular/common';
3
3
  import { CommonModule } from '@angular/common';
4
4
  import * as i0 from '@angular/core';
5
- import { forwardRef, Component, ViewEncapsulation, ChangeDetectionStrategy, Inject, Optional, ContentChild, ViewChild, Input, EventEmitter, Attribute, ContentChildren, Output, NgModule } from '@angular/core';
6
- import * as i1 from '@ptsecurity/mosaic/core';
7
- import { toBoolean, MC_OPTION_ACTION_PARENT, McOptionActionComponent, mixinTabIndex, mixinDisabled, MultipleMode, McLineSetter, McLine, McPseudoCheckboxModule, McLineModule, McOptionModule } from '@ptsecurity/mosaic/core';
8
- import * as i3 from '@angular/cdk/clipboard';
5
+ import { forwardRef, EventEmitter, Component, ChangeDetectionStrategy, ViewEncapsulation, Attribute, Optional, ContentChildren, Output, Input, Inject, ContentChild, ViewChild, NgModule } from '@angular/core';
6
+ import * as i2 from '@ptsecurity/mosaic/core';
7
+ import { mixinTabIndex, mixinDisabled, MultipleMode, toBoolean, MC_OPTION_ACTION_PARENT, McOptionActionComponent, McLineSetter, McLine, McPseudoCheckboxModule, McLineModule, McOptionModule } from '@ptsecurity/mosaic/core';
8
+ import * as i1 from '@angular/cdk/clipboard';
9
9
  import { coerceBooleanProperty } from '@angular/cdk/coercion';
10
10
  import { SelectionModel } from '@angular/cdk/collections';
11
11
  import { NG_VALUE_ACCESSOR } from '@angular/forms';
12
12
  import { FocusKeyManager } from '@ptsecurity/cdk/a11y';
13
- import { hasModifierKey, TAB, SPACE, ENTER, LEFT_ARROW, RIGHT_ARROW, isVerticalMovement, isSelectAll, isCopy, DOWN_ARROW, UP_ARROW, HOME, END, PAGE_UP, PAGE_DOWN } from '@ptsecurity/cdk/keycodes';
13
+ import { SPACE, ENTER, LEFT_ARROW, RIGHT_ARROW, isVerticalMovement, isSelectAll, isCopy, TAB, DOWN_ARROW, UP_ARROW, HOME, END, PAGE_UP, PAGE_DOWN, hasModifierKey } from '@ptsecurity/cdk/keycodes';
14
14
  import { McDropdownTrigger } from '@ptsecurity/mosaic/dropdown';
15
15
  import { McTooltipTrigger } from '@ptsecurity/mosaic/tooltip';
16
16
  import { Subject, merge } from 'rxjs';
17
- import { take, takeUntil, startWith } from 'rxjs/operators';
17
+ import { takeUntil, startWith, take } from 'rxjs/operators';
18
18
 
19
19
  /* tslint:disable:no-empty */
20
- /**
21
- * Component for list-options of selection-list. Each list-option can automatically
22
- * generate a checkbox and can put current item into the selectionModel of selection-list
23
- * if the current item is selected.
24
- */
25
- class McListOption {
26
- constructor(elementRef, changeDetector, ngZone, listSelection, group) {
27
- this.elementRef = elementRef;
28
- this.changeDetector = changeDetector;
29
- this.ngZone = ngZone;
30
- this.listSelection = listSelection;
31
- this.group = group;
32
- this.hasFocus = false;
33
- this.onFocus = new Subject();
34
- this.onBlur = new Subject();
35
- /**
36
- * This is set to true after the first OnChanges cycle so we don't clear the value of `selected`
37
- * in the first cycle.
38
- */
39
- this.inputsInitialized = false;
40
- this._disabled = false;
41
- this._selected = false;
42
- }
43
- get value() { return this._value; }
44
- set value(newValue) {
45
- if (this.selected && newValue !== this.value && this.inputsInitialized) {
46
- this.selected = false;
47
- }
48
- this._value = newValue;
49
- }
50
- get disabled() {
51
- const listSelectionDisabled = this.listSelection && this.listSelection.disabled;
52
- const groupDisabled = this.group && this.group.disabled;
53
- return listSelectionDisabled || groupDisabled || this._disabled;
54
- }
55
- set disabled(value) {
56
- const newValue = toBoolean(value);
57
- if (newValue !== this._disabled) {
58
- this._disabled = newValue;
59
- this.changeDetector.markForCheck();
60
- }
61
- }
62
- get showCheckbox() {
63
- return this._showCheckbox !== undefined ? this._showCheckbox : this.listSelection.showCheckbox;
64
- }
65
- set showCheckbox(value) {
66
- this._showCheckbox = coerceBooleanProperty(value);
67
- }
68
- get selected() {
69
- return this.listSelection.selectionModel?.isSelected(this) || false;
70
- }
71
- set selected(value) {
72
- const isSelected = toBoolean(value);
73
- if (isSelected !== this._selected) {
74
- this.setSelected(isSelected);
75
- }
76
- }
77
- get tabIndex() {
78
- return this.disabled ? null : -1;
79
- }
80
- ngOnInit() {
81
- const list = this.listSelection;
82
- if (list._value && list._value.some((value) => list.compareWith(value, this._value))) {
83
- this.setSelected(true);
84
- }
85
- const wasSelected = this._selected;
86
- // List options that are selected at initialization can't be reported properly to the form
87
- // control. This is because it takes some time until the selection-list knows about all
88
- // available options. Also it can happen that the ControlValueAccessor has an initial value
89
- // that should be used instead. Deferring the value change report to the next tick ensures
90
- // that the form control value is not being overwritten.
91
- Promise.resolve().then(() => {
92
- if (this._selected || wasSelected) {
93
- this.selected = true;
94
- this.changeDetector.markForCheck();
95
- }
96
- });
97
- this.inputsInitialized = true;
98
- }
99
- ngOnDestroy() {
100
- if (this.selected) {
101
- // We have to delay this until the next tick in order
102
- // to avoid changed after checked errors.
103
- Promise.resolve().then(() => this.selected = false);
104
- }
105
- this.listSelection.removeOptionFromList(this);
106
- }
107
- toggle() {
108
- this.selected = !this.selected;
109
- }
110
- getLabel() {
111
- return this.text ? this.text.nativeElement.textContent : '';
112
- }
113
- setSelected(selected) {
114
- if (this._selected === selected || !this.listSelection.selectionModel) {
115
- return;
116
- }
117
- this._selected = selected;
118
- if (selected) {
119
- this.listSelection.selectionModel.select(this);
120
- }
121
- else {
122
- this.listSelection.selectionModel.deselect(this);
123
- }
124
- this.changeDetector.markForCheck();
125
- }
126
- getHeight() {
127
- const clientRects = this.elementRef.nativeElement.getClientRects();
128
- return clientRects.length ? clientRects[0].height : 0;
129
- }
130
- handleClick($event) {
131
- if (this.disabled) {
132
- return;
133
- }
134
- this.listSelection.setSelectedOptionsByClick(this, hasModifierKey($event, 'shiftKey'), hasModifierKey($event, 'ctrlKey'));
135
- }
136
- onKeydown($event) {
137
- if (!this.actionButton) {
138
- return;
139
- }
140
- if ($event.keyCode === TAB && !$event.shiftKey && !this.actionButton.hasFocus) {
141
- this.actionButton.focus();
142
- $event.preventDefault();
143
- }
144
- }
145
- focus() {
146
- if (this.disabled || this.hasFocus || this.actionButton?.hasFocus) {
147
- return;
148
- }
149
- this.elementRef.nativeElement.focus();
150
- this.onFocus.next({ option: this });
151
- Promise.resolve().then(() => {
152
- this.hasFocus = true;
153
- this.changeDetector.markForCheck();
154
- });
155
- }
156
- blur() {
157
- // When animations are enabled, Angular may end up removing the option from the DOM a little
158
- // earlier than usual, causing it to be blurred and throwing off the logic in the list
159
- // that moves focus not the next item. To work around the issue, we defer marking the option
160
- // as not focused until the next time the zone stabilizes.
161
- this.ngZone.onStable
162
- .asObservable()
163
- .pipe(take(1))
164
- .subscribe(() => {
165
- this.ngZone.run(() => {
166
- this.hasFocus = false;
167
- if (this.actionButton?.hasFocus) {
168
- return;
169
- }
170
- this.onBlur.next({ option: this });
171
- });
172
- });
173
- }
174
- getHostElement() {
175
- return this.elementRef.nativeElement;
176
- }
177
- }
178
- /** @nocollapse */ /** @nocollapse */ McListOption.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McListOption, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: forwardRef(() => McListSelection) }, { token: i1.McOptgroup, optional: true }], target: i0.ɵɵFactoryTarget.Component });
179
- /** @nocollapse */ /** @nocollapse */ McListOption.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: McListOption, selector: "mc-list-option", inputs: { checkboxPosition: "checkboxPosition", value: "value", disabled: "disabled", showCheckbox: "showCheckbox", selected: "selected" }, host: { listeners: { "focusin": "focus()", "blur": "blur()", "click": "handleClick($event)", "keydown": "onKeydown($event)" }, properties: { "class.mc-selected": "selected", "class.mc-disabled": "disabled", "class.mc-focused": "hasFocus", "class.mc-action-button-focused": "actionButton?.active", "attr.tabindex": "tabIndex", "attr.disabled": "disabled || null" }, classAttribute: "mc-list-option" }, providers: [
180
- { provide: MC_OPTION_ACTION_PARENT, useExisting: McListOption }
181
- ], queries: [{ propertyName: "actionButton", first: true, predicate: McOptionActionComponent, descendants: true }, { propertyName: "tooltipTrigger", first: true, predicate: McTooltipTrigger, descendants: true }, { propertyName: "dropdownTrigger", first: true, predicate: McDropdownTrigger, descendants: true }], viewQueries: [{ propertyName: "text", first: true, predicate: ["text"], descendants: true }], exportAs: ["mcListOption"], ngImport: i0, template: "<mc-pseudo-checkbox\n *ngIf=\"showCheckbox\"\n [state]=\"selected ? 'checked' : 'unchecked'\"\n [disabled]=\"disabled\">\n</mc-pseudo-checkbox>\n\n<ng-content select=\"[mc-icon]\"></ng-content>\n\n<div class=\"mc-list-text\" #text>\n <ng-content></ng-content>\n</div>\n\n<ng-content select=\"mc-option-action\"></ng-content>\n", components: [{ type: i1.McPseudoCheckbox, selector: "mc-pseudo-checkbox", inputs: ["color", "state", "disabled"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
182
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McListOption, decorators: [{
183
- type: Component,
184
- args: [{ exportAs: 'mcListOption', selector: 'mc-list-option', host: {
185
- class: 'mc-list-option',
186
- '[class.mc-selected]': 'selected',
187
- '[class.mc-disabled]': 'disabled',
188
- '[class.mc-focused]': 'hasFocus',
189
- '[class.mc-action-button-focused]': 'actionButton?.active',
190
- '[attr.tabindex]': 'tabIndex',
191
- '[attr.disabled]': 'disabled || null',
192
- '(focusin)': 'focus()',
193
- '(blur)': 'blur()',
194
- '(click)': 'handleClick($event)',
195
- '(keydown)': 'onKeydown($event)'
196
- }, encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
197
- { provide: MC_OPTION_ACTION_PARENT, useExisting: McListOption }
198
- ], template: "<mc-pseudo-checkbox\n *ngIf=\"showCheckbox\"\n [state]=\"selected ? 'checked' : 'unchecked'\"\n [disabled]=\"disabled\">\n</mc-pseudo-checkbox>\n\n<ng-content select=\"[mc-icon]\"></ng-content>\n\n<div class=\"mc-list-text\" #text>\n <ng-content></ng-content>\n</div>\n\n<ng-content select=\"mc-option-action\"></ng-content>\n" }]
199
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: McListSelection, decorators: [{
200
- type: Inject,
201
- args: [forwardRef(() => McListSelection)]
202
- }] }, { type: i1.McOptgroup, decorators: [{
203
- type: Optional
204
- }] }]; }, propDecorators: { actionButton: [{
205
- type: ContentChild,
206
- args: [McOptionActionComponent]
207
- }], tooltipTrigger: [{
208
- type: ContentChild,
209
- args: [McTooltipTrigger]
210
- }], dropdownTrigger: [{
211
- type: ContentChild,
212
- args: [McDropdownTrigger]
213
- }], text: [{
214
- type: ViewChild,
215
- args: ['text', { static: false }]
216
- }], checkboxPosition: [{
217
- type: Input
218
- }], value: [{
219
- type: Input
220
- }], disabled: [{
221
- type: Input
222
- }], showCheckbox: [{
223
- type: Input
224
- }], selected: [{
225
- type: Input
226
- }] } });
227
20
  const MC_SELECTION_LIST_VALUE_ACCESSOR = {
228
21
  provide: NG_VALUE_ACCESSOR,
229
22
  useExisting: forwardRef(() => McListSelection),
@@ -634,21 +427,27 @@ class McListSelection extends McListSelectionMixinBase {
634
427
  this.onSelectAll.emit(new McListSelectAllEvent(this, optionsToSelect));
635
428
  }
636
429
  copyActiveOption() {
430
+ if (!this.keyManager.activeItem) {
431
+ return;
432
+ }
433
+ const option = this.keyManager.activeItem;
434
+ option.preventBlur = true;
637
435
  if (this.onCopy.observers.length) {
638
- this.onCopy.emit(new McListCopyEvent(this, this.keyManager.activeItem));
436
+ this.onCopy.emit(new McListCopyEvent(this, option));
639
437
  }
640
438
  else {
641
439
  this.onCopyDefaultHandler();
642
440
  }
441
+ option.preventBlur = false;
643
442
  }
644
443
  }
645
- /** @nocollapse */ /** @nocollapse */ McListSelection.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McListSelection, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: 'multiple', attribute: true }, { token: i3.Clipboard, optional: true }], target: i0.ɵɵFactoryTarget.Component });
646
- /** @nocollapse */ /** @nocollapse */ McListSelection.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: McListSelection, selector: "mc-list-selection", inputs: { disabled: "disabled", autoSelect: "autoSelect", noUnselectLast: "noUnselectLast", horizontal: "horizontal", tabIndex: "tabIndex", compareWith: "compareWith" }, outputs: { onSelectAll: "onSelectAll", onCopy: "onCopy", selectionChange: "selectionChange" }, host: { listeners: { "keydown": "onKeyDown($event)", "window:resize": "updateScrollSize()" }, properties: { "attr.tabindex": "-1", "attr.disabled": "disabled || null" }, classAttribute: "mc-list-selection" }, providers: [MC_SELECTION_LIST_VALUE_ACCESSOR], queries: [{ propertyName: "options", predicate: McListOption, descendants: true }], exportAs: ["mcListSelection"], usesInheritance: true, ngImport: i0, template: `
444
+ /** @nocollapse */ /** @nocollapse */ McListSelection.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McListSelection, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: 'multiple', attribute: true }, { token: i1.Clipboard, optional: true }], target: i0.ɵɵFactoryTarget.Component });
445
+ /** @nocollapse */ /** @nocollapse */ McListSelection.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: McListSelection, selector: "mc-list-selection", inputs: { disabled: "disabled", autoSelect: "autoSelect", noUnselectLast: "noUnselectLast", horizontal: "horizontal", tabIndex: "tabIndex", compareWith: "compareWith" }, outputs: { onSelectAll: "onSelectAll", onCopy: "onCopy", selectionChange: "selectionChange" }, host: { listeners: { "keydown": "onKeyDown($event)", "window:resize": "updateScrollSize()" }, properties: { "attr.tabindex": "-1", "attr.disabled": "disabled || null" }, classAttribute: "mc-list-selection" }, providers: [MC_SELECTION_LIST_VALUE_ACCESSOR], queries: [{ propertyName: "options", predicate: i0.forwardRef(function () { return McListOption; }), descendants: true }], exportAs: ["mcListSelection"], usesInheritance: true, ngImport: i0, template: `
647
446
  <div [attr.tabindex]="tabIndex"
648
447
  (focus)="focus()"
649
448
  (blur)="blur()">
650
449
  <ng-content></ng-content>
651
- </div>`, isInline: true, styles: [".mc-divider{display:block;margin:0}.mc-divider.mc-divider_horizontal{border-top-width:var(--mc-divider-size-width, 1px);border-top-style:solid}.mc-divider.mc-divider_vertical{height:100%;border-right-width:var(--mc-divider-size-width, 1px);border-right-style:solid}.mc-divider.mc-divider_inset{margin-left:var(--mc-divider-size-inset-margin, 80px)}[dir=rtl] .mc-divider.mc-divider_inset{margin-left:auto;margin-right:var(--mc-divider-size-inset-margin, 80px)}.mc-no-select{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}.mc-list,.mc-list-selection{display:block;outline:none}.mc-list-item,.mc-list-option{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;position:relative;display:flex;align-items:center;box-sizing:border-box;height:var(--mc-list-size-item-height, 32px);border:2px solid transparent;padding-left:var(--mc-list-size-horizontal-padding, 12px)}.mc-list-item .mc-list-text,.mc-list-option .mc-list-text{display:flex;flex-direction:column;width:100%;box-sizing:border-box;overflow:hidden;padding-right:var(--mc-list-size-horizontal-padding, 12px)}.mc-list-item .mc-list-text>*,.mc-list-option .mc-list-text>*{margin:0;padding:0;font-weight:400;font-size:inherit}.mc-list-item .mc-list-text:empty,.mc-list-option .mc-list-text:empty{display:none}.mc-list-item .mc-divider,.mc-list-option .mc-divider{position:absolute;bottom:0;left:0;width:100%;margin:0}[dir=rtl] .mc-list-item .mc-divider,[dir=rtl] .mc-list-option .mc-divider{margin-left:auto;margin-right:0}.mc-list-item .mc-divider.mc-divider_inset,.mc-list-option .mc-divider.mc-divider_inset{position:absolute}.mc-list-item.mc-progress:after,.mc-list-option.mc-progress:after{top:-2px;right:-2px;bottom:-2px;left:-2px}.mc-list-item .mc-pseudo-checkbox,.mc-list-item .mc-icon,.mc-list-option .mc-pseudo-checkbox,.mc-list-option .mc-icon{margin-right:var(--mc-list-size-icon-right-margin, 8px)}.mc-list-item .mc-option-action,.mc-list-option .mc-option-action{display:none}.mc-list-item:not([disabled]):hover .mc-option-action,.mc-list-item:not([disabled]).mc-focused .mc-option-action,.mc-list-item:not([disabled]).mc-action-button-focused .mc-option-action,.mc-list-option:not([disabled]):hover .mc-option-action,.mc-list-option:not([disabled]).mc-focused .mc-option-action,.mc-list-option:not([disabled]).mc-action-button-focused .mc-option-action{display:flex}.mc-list-option:not([disabled]):not(.mc-disabled){cursor:pointer}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
450
+ </div>`, isInline: true, styles: [".mc-divider{display:block;margin:0}.mc-divider.mc-divider_horizontal{border-top-width:1px;border-top-width:var(--mc-divider-size-width, 1px);border-top-style:solid}.mc-divider.mc-divider_vertical{height:100%;border-right-width:1px;border-right-width:var(--mc-divider-size-width, 1px);border-right-style:solid}.mc-divider.mc-divider_inset{margin-left:80px;margin-left:var(--mc-divider-size-inset-margin, 80px)}[dir=rtl] .mc-divider.mc-divider_inset{margin-left:auto;margin-right:80px;margin-right:var(--mc-divider-size-inset-margin, 80px)}.mc-no-select{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}.mc-list,.mc-list-selection{display:block;outline:none}.mc-list-item,.mc-list-option{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;position:relative;display:flex;align-items:center;box-sizing:border-box;height:32px;height:var(--mc-list-size-item-height, 32px);border:2px solid transparent;padding-left:12px;padding-left:var(--mc-list-size-horizontal-padding, 12px)}.mc-list-item .mc-list-text,.mc-list-option .mc-list-text{display:flex;flex-direction:column;width:100%;box-sizing:border-box;overflow:hidden;padding-right:12px;padding-right:var(--mc-list-size-horizontal-padding, 12px)}.mc-list-item .mc-list-text>*,.mc-list-option .mc-list-text>*{margin:0;padding:0;font-weight:400;font-size:inherit}.mc-list-item .mc-list-text:empty,.mc-list-option .mc-list-text:empty{display:none}.mc-list-item .mc-divider,.mc-list-option .mc-divider{position:absolute;bottom:0;left:0;width:100%;margin:0}[dir=rtl] .mc-list-item .mc-divider,[dir=rtl] .mc-list-option .mc-divider{margin-left:auto;margin-right:0}.mc-list-item .mc-divider.mc-divider_inset,.mc-list-option .mc-divider.mc-divider_inset{position:absolute}.mc-list-item.mc-progress:after,.mc-list-option.mc-progress:after{top:-2px;right:-2px;bottom:-2px;left:-2px}.mc-list-item .mc-pseudo-checkbox,.mc-list-item .mc-icon,.mc-list-option .mc-pseudo-checkbox,.mc-list-option .mc-icon{margin-right:8px;margin-right:var(--mc-list-size-icon-right-margin, 8px)}.mc-list-item .mc-option-action,.mc-list-option .mc-option-action{display:none}.mc-list-item:not([disabled]):hover .mc-option-action,.mc-list-item:not([disabled]).mc-focused .mc-option-action,.mc-list-item:not([disabled]).mc-action-button-focused .mc-option-action,.mc-list-option:not([disabled]):hover .mc-option-action,.mc-list-option:not([disabled]).mc-focused .mc-option-action,.mc-list-option:not([disabled]).mc-action-button-focused .mc-option-action{display:flex}.mc-list-option:not([disabled]):not(.mc-disabled){cursor:pointer}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
652
451
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McListSelection, decorators: [{
653
452
  type: Component,
654
453
  args: [{ exportAs: 'mcListSelection', selector: 'mc-list-selection', template: `
@@ -662,15 +461,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
662
461
  '[attr.disabled]': 'disabled || null',
663
462
  '(keydown)': 'onKeyDown($event)',
664
463
  '(window:resize)': 'updateScrollSize()'
665
- }, providers: [MC_SELECTION_LIST_VALUE_ACCESSOR], preserveWhitespaces: false, styles: [".mc-divider{display:block;margin:0}.mc-divider.mc-divider_horizontal{border-top-width:var(--mc-divider-size-width, 1px);border-top-style:solid}.mc-divider.mc-divider_vertical{height:100%;border-right-width:var(--mc-divider-size-width, 1px);border-right-style:solid}.mc-divider.mc-divider_inset{margin-left:var(--mc-divider-size-inset-margin, 80px)}[dir=rtl] .mc-divider.mc-divider_inset{margin-left:auto;margin-right:var(--mc-divider-size-inset-margin, 80px)}.mc-no-select{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}.mc-list,.mc-list-selection{display:block;outline:none}.mc-list-item,.mc-list-option{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;position:relative;display:flex;align-items:center;box-sizing:border-box;height:var(--mc-list-size-item-height, 32px);border:2px solid transparent;padding-left:var(--mc-list-size-horizontal-padding, 12px)}.mc-list-item .mc-list-text,.mc-list-option .mc-list-text{display:flex;flex-direction:column;width:100%;box-sizing:border-box;overflow:hidden;padding-right:var(--mc-list-size-horizontal-padding, 12px)}.mc-list-item .mc-list-text>*,.mc-list-option .mc-list-text>*{margin:0;padding:0;font-weight:400;font-size:inherit}.mc-list-item .mc-list-text:empty,.mc-list-option .mc-list-text:empty{display:none}.mc-list-item .mc-divider,.mc-list-option .mc-divider{position:absolute;bottom:0;left:0;width:100%;margin:0}[dir=rtl] .mc-list-item .mc-divider,[dir=rtl] .mc-list-option .mc-divider{margin-left:auto;margin-right:0}.mc-list-item .mc-divider.mc-divider_inset,.mc-list-option .mc-divider.mc-divider_inset{position:absolute}.mc-list-item.mc-progress:after,.mc-list-option.mc-progress:after{top:-2px;right:-2px;bottom:-2px;left:-2px}.mc-list-item .mc-pseudo-checkbox,.mc-list-item .mc-icon,.mc-list-option .mc-pseudo-checkbox,.mc-list-option .mc-icon{margin-right:var(--mc-list-size-icon-right-margin, 8px)}.mc-list-item .mc-option-action,.mc-list-option .mc-option-action{display:none}.mc-list-item:not([disabled]):hover .mc-option-action,.mc-list-item:not([disabled]).mc-focused .mc-option-action,.mc-list-item:not([disabled]).mc-action-button-focused .mc-option-action,.mc-list-option:not([disabled]):hover .mc-option-action,.mc-list-option:not([disabled]).mc-focused .mc-option-action,.mc-list-option:not([disabled]).mc-action-button-focused .mc-option-action{display:flex}.mc-list-option:not([disabled]):not(.mc-disabled){cursor:pointer}\n"] }]
666
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1.MultipleMode, decorators: [{
464
+ }, providers: [MC_SELECTION_LIST_VALUE_ACCESSOR], preserveWhitespaces: false, styles: [".mc-divider{display:block;margin:0}.mc-divider.mc-divider_horizontal{border-top-width:1px;border-top-width:var(--mc-divider-size-width, 1px);border-top-style:solid}.mc-divider.mc-divider_vertical{height:100%;border-right-width:1px;border-right-width:var(--mc-divider-size-width, 1px);border-right-style:solid}.mc-divider.mc-divider_inset{margin-left:80px;margin-left:var(--mc-divider-size-inset-margin, 80px)}[dir=rtl] .mc-divider.mc-divider_inset{margin-left:auto;margin-right:80px;margin-right:var(--mc-divider-size-inset-margin, 80px)}.mc-no-select{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}.mc-list,.mc-list-selection{display:block;outline:none}.mc-list-item,.mc-list-option{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;position:relative;display:flex;align-items:center;box-sizing:border-box;height:32px;height:var(--mc-list-size-item-height, 32px);border:2px solid transparent;padding-left:12px;padding-left:var(--mc-list-size-horizontal-padding, 12px)}.mc-list-item .mc-list-text,.mc-list-option .mc-list-text{display:flex;flex-direction:column;width:100%;box-sizing:border-box;overflow:hidden;padding-right:12px;padding-right:var(--mc-list-size-horizontal-padding, 12px)}.mc-list-item .mc-list-text>*,.mc-list-option .mc-list-text>*{margin:0;padding:0;font-weight:400;font-size:inherit}.mc-list-item .mc-list-text:empty,.mc-list-option .mc-list-text:empty{display:none}.mc-list-item .mc-divider,.mc-list-option .mc-divider{position:absolute;bottom:0;left:0;width:100%;margin:0}[dir=rtl] .mc-list-item .mc-divider,[dir=rtl] .mc-list-option .mc-divider{margin-left:auto;margin-right:0}.mc-list-item .mc-divider.mc-divider_inset,.mc-list-option .mc-divider.mc-divider_inset{position:absolute}.mc-list-item.mc-progress:after,.mc-list-option.mc-progress:after{top:-2px;right:-2px;bottom:-2px;left:-2px}.mc-list-item .mc-pseudo-checkbox,.mc-list-item .mc-icon,.mc-list-option .mc-pseudo-checkbox,.mc-list-option .mc-icon{margin-right:8px;margin-right:var(--mc-list-size-icon-right-margin, 8px)}.mc-list-item .mc-option-action,.mc-list-option .mc-option-action{display:none}.mc-list-item:not([disabled]):hover .mc-option-action,.mc-list-item:not([disabled]).mc-focused .mc-option-action,.mc-list-item:not([disabled]).mc-action-button-focused .mc-option-action,.mc-list-option:not([disabled]):hover .mc-option-action,.mc-list-option:not([disabled]).mc-focused .mc-option-action,.mc-list-option:not([disabled]).mc-action-button-focused .mc-option-action{display:flex}.mc-list-option:not([disabled]):not(.mc-disabled){cursor:pointer}\n"] }]
465
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i2.MultipleMode, decorators: [{
667
466
  type: Attribute,
668
467
  args: ['multiple']
669
- }] }, { type: i3.Clipboard, decorators: [{
468
+ }] }, { type: i1.Clipboard, decorators: [{
670
469
  type: Optional
671
470
  }] }]; }, propDecorators: { options: [{
672
471
  type: ContentChildren,
673
- args: [McListOption, { descendants: true }]
472
+ args: [forwardRef(() => McListOption), { descendants: true }]
674
473
  }], onSelectAll: [{
675
474
  type: Output
676
475
  }], onCopy: [{
@@ -688,15 +487,226 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
688
487
  }], compareWith: [{
689
488
  type: Input
690
489
  }] } });
490
+ /**
491
+ * Component for list-options of selection-list. Each list-option can automatically
492
+ * generate a checkbox and can put current item into the selectionModel of selection-list
493
+ * if the current item is selected.
494
+ */
495
+ class McListOption {
496
+ constructor(elementRef, changeDetector, ngZone, listSelection, group) {
497
+ this.elementRef = elementRef;
498
+ this.changeDetector = changeDetector;
499
+ this.ngZone = ngZone;
500
+ this.listSelection = listSelection;
501
+ this.group = group;
502
+ this.hasFocus = false;
503
+ this.preventBlur = false;
504
+ this.onFocus = new Subject();
505
+ this.onBlur = new Subject();
506
+ /**
507
+ * This is set to true after the first OnChanges cycle so we don't clear the value of `selected`
508
+ * in the first cycle.
509
+ */
510
+ this.inputsInitialized = false;
511
+ this._disabled = false;
512
+ this._selected = false;
513
+ }
514
+ get value() { return this._value; }
515
+ set value(newValue) {
516
+ if (this.selected && newValue !== this.value && this.inputsInitialized) {
517
+ this.selected = false;
518
+ }
519
+ this._value = newValue;
520
+ }
521
+ get disabled() {
522
+ const listSelectionDisabled = this.listSelection && this.listSelection.disabled;
523
+ const groupDisabled = this.group && this.group.disabled;
524
+ return listSelectionDisabled || groupDisabled || this._disabled;
525
+ }
526
+ set disabled(value) {
527
+ const newValue = toBoolean(value);
528
+ if (newValue !== this._disabled) {
529
+ this._disabled = newValue;
530
+ this.changeDetector.markForCheck();
531
+ }
532
+ }
533
+ get showCheckbox() {
534
+ return this._showCheckbox !== undefined ? this._showCheckbox : this.listSelection.showCheckbox;
535
+ }
536
+ set showCheckbox(value) {
537
+ this._showCheckbox = coerceBooleanProperty(value);
538
+ }
539
+ get selected() {
540
+ return this.listSelection.selectionModel?.isSelected(this) || false;
541
+ }
542
+ set selected(value) {
543
+ const isSelected = toBoolean(value);
544
+ if (isSelected !== this._selected) {
545
+ this.setSelected(isSelected);
546
+ }
547
+ }
548
+ get tabIndex() {
549
+ return this.disabled ? null : -1;
550
+ }
551
+ ngOnInit() {
552
+ const list = this.listSelection;
553
+ if (list._value && list._value.some((value) => list.compareWith(value, this._value))) {
554
+ this.setSelected(true);
555
+ }
556
+ const wasSelected = this._selected;
557
+ // List options that are selected at initialization can't be reported properly to the form
558
+ // control. This is because it takes some time until the selection-list knows about all
559
+ // available options. Also it can happen that the ControlValueAccessor has an initial value
560
+ // that should be used instead. Deferring the value change report to the next tick ensures
561
+ // that the form control value is not being overwritten.
562
+ Promise.resolve().then(() => {
563
+ if (this._selected || wasSelected) {
564
+ this.selected = true;
565
+ this.changeDetector.markForCheck();
566
+ }
567
+ });
568
+ this.inputsInitialized = true;
569
+ }
570
+ ngOnDestroy() {
571
+ if (this.selected) {
572
+ // We have to delay this until the next tick in order
573
+ // to avoid changed after checked errors.
574
+ Promise.resolve().then(() => this.selected = false);
575
+ }
576
+ this.listSelection.removeOptionFromList(this);
577
+ }
578
+ toggle() {
579
+ this.selected = !this.selected;
580
+ }
581
+ getLabel() {
582
+ return this.text ? this.text.nativeElement.textContent : '';
583
+ }
584
+ setSelected(selected) {
585
+ if (this._selected === selected || !this.listSelection.selectionModel) {
586
+ return;
587
+ }
588
+ this._selected = selected;
589
+ if (selected) {
590
+ this.listSelection.selectionModel.select(this);
591
+ }
592
+ else {
593
+ this.listSelection.selectionModel.deselect(this);
594
+ }
595
+ this.changeDetector.markForCheck();
596
+ }
597
+ getHeight() {
598
+ const clientRects = this.elementRef.nativeElement.getClientRects();
599
+ return clientRects.length ? clientRects[0].height : 0;
600
+ }
601
+ handleClick($event) {
602
+ if (this.disabled) {
603
+ return;
604
+ }
605
+ this.listSelection.setSelectedOptionsByClick(this, hasModifierKey($event, 'shiftKey'), hasModifierKey($event, 'ctrlKey'));
606
+ }
607
+ onKeydown($event) {
608
+ if (!this.actionButton) {
609
+ return;
610
+ }
611
+ if ($event.keyCode === TAB && !$event.shiftKey && !this.actionButton.hasFocus) {
612
+ this.actionButton.focus();
613
+ $event.preventDefault();
614
+ }
615
+ }
616
+ focus() {
617
+ if (this.disabled || this.hasFocus || this.actionButton?.hasFocus) {
618
+ return;
619
+ }
620
+ this.elementRef.nativeElement.focus();
621
+ this.onFocus.next({ option: this });
622
+ Promise.resolve().then(() => {
623
+ this.hasFocus = true;
624
+ this.changeDetector.markForCheck();
625
+ });
626
+ }
627
+ blur() {
628
+ if (this.preventBlur) {
629
+ return;
630
+ }
631
+ // When animations are enabled, Angular may end up removing the option from the DOM a little
632
+ // earlier than usual, causing it to be blurred and throwing off the logic in the list
633
+ // that moves focus not the next item. To work around the issue, we defer marking the option
634
+ // as not focused until the next time the zone stabilizes.
635
+ this.ngZone.onStable
636
+ .asObservable()
637
+ .pipe(take(1))
638
+ .subscribe(() => {
639
+ this.ngZone.run(() => {
640
+ this.hasFocus = false;
641
+ if (this.actionButton?.hasFocus) {
642
+ return;
643
+ }
644
+ this.onBlur.next({ option: this });
645
+ });
646
+ });
647
+ }
648
+ getHostElement() {
649
+ return this.elementRef.nativeElement;
650
+ }
651
+ }
652
+ /** @nocollapse */ /** @nocollapse */ McListOption.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McListOption, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: forwardRef(() => McListSelection) }, { token: i2.McOptgroup, optional: true }], target: i0.ɵɵFactoryTarget.Component });
653
+ /** @nocollapse */ /** @nocollapse */ McListOption.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: McListOption, selector: "mc-list-option", inputs: { checkboxPosition: "checkboxPosition", value: "value", disabled: "disabled", showCheckbox: "showCheckbox", selected: "selected" }, host: { listeners: { "focusin": "focus()", "blur": "blur()", "click": "handleClick($event)", "keydown": "onKeydown($event)" }, properties: { "class.mc-selected": "selected", "class.mc-disabled": "disabled", "class.mc-focused": "hasFocus", "class.mc-action-button-focused": "actionButton?.active", "attr.tabindex": "tabIndex", "attr.disabled": "disabled || null" }, classAttribute: "mc-list-option" }, providers: [
654
+ { provide: MC_OPTION_ACTION_PARENT, useExisting: McListOption }
655
+ ], queries: [{ propertyName: "actionButton", first: true, predicate: McOptionActionComponent, descendants: true }, { propertyName: "tooltipTrigger", first: true, predicate: McTooltipTrigger, descendants: true }, { propertyName: "dropdownTrigger", first: true, predicate: McDropdownTrigger, descendants: true }], viewQueries: [{ propertyName: "text", first: true, predicate: ["text"], descendants: true }], exportAs: ["mcListOption"], ngImport: i0, template: "<mc-pseudo-checkbox\n *ngIf=\"showCheckbox\"\n [state]=\"selected ? 'checked' : 'unchecked'\"\n [disabled]=\"disabled\">\n</mc-pseudo-checkbox>\n\n<ng-content select=\"[mc-icon]\"></ng-content>\n\n<div class=\"mc-list-text\" #text>\n <ng-content></ng-content>\n</div>\n\n<ng-content select=\"mc-option-action\"></ng-content>\n", components: [{ type: i2.McPseudoCheckbox, selector: "mc-pseudo-checkbox", inputs: ["color", "state", "disabled"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
656
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McListOption, decorators: [{
657
+ type: Component,
658
+ args: [{ exportAs: 'mcListOption', selector: 'mc-list-option', host: {
659
+ class: 'mc-list-option',
660
+ '[class.mc-selected]': 'selected',
661
+ '[class.mc-disabled]': 'disabled',
662
+ '[class.mc-focused]': 'hasFocus',
663
+ '[class.mc-action-button-focused]': 'actionButton?.active',
664
+ '[attr.tabindex]': 'tabIndex',
665
+ '[attr.disabled]': 'disabled || null',
666
+ '(focusin)': 'focus()',
667
+ '(blur)': 'blur()',
668
+ '(click)': 'handleClick($event)',
669
+ '(keydown)': 'onKeydown($event)'
670
+ }, encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
671
+ { provide: MC_OPTION_ACTION_PARENT, useExisting: McListOption }
672
+ ], template: "<mc-pseudo-checkbox\n *ngIf=\"showCheckbox\"\n [state]=\"selected ? 'checked' : 'unchecked'\"\n [disabled]=\"disabled\">\n</mc-pseudo-checkbox>\n\n<ng-content select=\"[mc-icon]\"></ng-content>\n\n<div class=\"mc-list-text\" #text>\n <ng-content></ng-content>\n</div>\n\n<ng-content select=\"mc-option-action\"></ng-content>\n" }]
673
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: McListSelection, decorators: [{
674
+ type: Inject,
675
+ args: [forwardRef(() => McListSelection)]
676
+ }] }, { type: i2.McOptgroup, decorators: [{
677
+ type: Optional
678
+ }] }]; }, propDecorators: { actionButton: [{
679
+ type: ContentChild,
680
+ args: [McOptionActionComponent]
681
+ }], tooltipTrigger: [{
682
+ type: ContentChild,
683
+ args: [McTooltipTrigger]
684
+ }], dropdownTrigger: [{
685
+ type: ContentChild,
686
+ args: [McDropdownTrigger]
687
+ }], text: [{
688
+ type: ViewChild,
689
+ args: ['text', { static: false }]
690
+ }], checkboxPosition: [{
691
+ type: Input
692
+ }], value: [{
693
+ type: Input
694
+ }], disabled: [{
695
+ type: Input
696
+ }], showCheckbox: [{
697
+ type: Input
698
+ }], selected: [{
699
+ type: Input
700
+ }] } });
691
701
 
692
702
  // todo пока не делаем, перенесено из материала, но у нас в доках таких простых списков нет.
693
703
  class McList {
694
704
  }
695
705
  /** @nocollapse */ /** @nocollapse */ McList.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McList, deps: [], target: i0.ɵɵFactoryTarget.Component });
696
- /** @nocollapse */ /** @nocollapse */ McList.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: McList, selector: "mc-list", host: { classAttribute: "mc-list" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [".mc-divider{display:block;margin:0}.mc-divider.mc-divider_horizontal{border-top-width:var(--mc-divider-size-width, 1px);border-top-style:solid}.mc-divider.mc-divider_vertical{height:100%;border-right-width:var(--mc-divider-size-width, 1px);border-right-style:solid}.mc-divider.mc-divider_inset{margin-left:var(--mc-divider-size-inset-margin, 80px)}[dir=rtl] .mc-divider.mc-divider_inset{margin-left:auto;margin-right:var(--mc-divider-size-inset-margin, 80px)}.mc-no-select{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}.mc-list,.mc-list-selection{display:block;outline:none}.mc-list-item,.mc-list-option{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;position:relative;display:flex;align-items:center;box-sizing:border-box;height:var(--mc-list-size-item-height, 32px);border:2px solid transparent;padding-left:var(--mc-list-size-horizontal-padding, 12px)}.mc-list-item .mc-list-text,.mc-list-option .mc-list-text{display:flex;flex-direction:column;width:100%;box-sizing:border-box;overflow:hidden;padding-right:var(--mc-list-size-horizontal-padding, 12px)}.mc-list-item .mc-list-text>*,.mc-list-option .mc-list-text>*{margin:0;padding:0;font-weight:400;font-size:inherit}.mc-list-item .mc-list-text:empty,.mc-list-option .mc-list-text:empty{display:none}.mc-list-item .mc-divider,.mc-list-option .mc-divider{position:absolute;bottom:0;left:0;width:100%;margin:0}[dir=rtl] .mc-list-item .mc-divider,[dir=rtl] .mc-list-option .mc-divider{margin-left:auto;margin-right:0}.mc-list-item .mc-divider.mc-divider_inset,.mc-list-option .mc-divider.mc-divider_inset{position:absolute}.mc-list-item.mc-progress:after,.mc-list-option.mc-progress:after{top:-2px;right:-2px;bottom:-2px;left:-2px}.mc-list-item .mc-pseudo-checkbox,.mc-list-item .mc-icon,.mc-list-option .mc-pseudo-checkbox,.mc-list-option .mc-icon{margin-right:var(--mc-list-size-icon-right-margin, 8px)}.mc-list-item .mc-option-action,.mc-list-option .mc-option-action{display:none}.mc-list-item:not([disabled]):hover .mc-option-action,.mc-list-item:not([disabled]).mc-focused .mc-option-action,.mc-list-item:not([disabled]).mc-action-button-focused .mc-option-action,.mc-list-option:not([disabled]):hover .mc-option-action,.mc-list-option:not([disabled]).mc-focused .mc-option-action,.mc-list-option:not([disabled]).mc-action-button-focused .mc-option-action{display:flex}.mc-list-option:not([disabled]):not(.mc-disabled){cursor:pointer}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
706
+ /** @nocollapse */ /** @nocollapse */ McList.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: McList, selector: "mc-list", host: { classAttribute: "mc-list" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [".mc-divider{display:block;margin:0}.mc-divider.mc-divider_horizontal{border-top-width:1px;border-top-width:var(--mc-divider-size-width, 1px);border-top-style:solid}.mc-divider.mc-divider_vertical{height:100%;border-right-width:1px;border-right-width:var(--mc-divider-size-width, 1px);border-right-style:solid}.mc-divider.mc-divider_inset{margin-left:80px;margin-left:var(--mc-divider-size-inset-margin, 80px)}[dir=rtl] .mc-divider.mc-divider_inset{margin-left:auto;margin-right:80px;margin-right:var(--mc-divider-size-inset-margin, 80px)}.mc-no-select{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}.mc-list,.mc-list-selection{display:block;outline:none}.mc-list-item,.mc-list-option{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;position:relative;display:flex;align-items:center;box-sizing:border-box;height:32px;height:var(--mc-list-size-item-height, 32px);border:2px solid transparent;padding-left:12px;padding-left:var(--mc-list-size-horizontal-padding, 12px)}.mc-list-item .mc-list-text,.mc-list-option .mc-list-text{display:flex;flex-direction:column;width:100%;box-sizing:border-box;overflow:hidden;padding-right:12px;padding-right:var(--mc-list-size-horizontal-padding, 12px)}.mc-list-item .mc-list-text>*,.mc-list-option .mc-list-text>*{margin:0;padding:0;font-weight:400;font-size:inherit}.mc-list-item .mc-list-text:empty,.mc-list-option .mc-list-text:empty{display:none}.mc-list-item .mc-divider,.mc-list-option .mc-divider{position:absolute;bottom:0;left:0;width:100%;margin:0}[dir=rtl] .mc-list-item .mc-divider,[dir=rtl] .mc-list-option .mc-divider{margin-left:auto;margin-right:0}.mc-list-item .mc-divider.mc-divider_inset,.mc-list-option .mc-divider.mc-divider_inset{position:absolute}.mc-list-item.mc-progress:after,.mc-list-option.mc-progress:after{top:-2px;right:-2px;bottom:-2px;left:-2px}.mc-list-item .mc-pseudo-checkbox,.mc-list-item .mc-icon,.mc-list-option .mc-pseudo-checkbox,.mc-list-option .mc-icon{margin-right:8px;margin-right:var(--mc-list-size-icon-right-margin, 8px)}.mc-list-item .mc-option-action,.mc-list-option .mc-option-action{display:none}.mc-list-item:not([disabled]):hover .mc-option-action,.mc-list-item:not([disabled]).mc-focused .mc-option-action,.mc-list-item:not([disabled]).mc-action-button-focused .mc-option-action,.mc-list-option:not([disabled]):hover .mc-option-action,.mc-list-option:not([disabled]).mc-focused .mc-option-action,.mc-list-option:not([disabled]).mc-action-button-focused .mc-option-action{display:flex}.mc-list-option:not([disabled]):not(.mc-disabled){cursor:pointer}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
697
707
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: McList, decorators: [{
698
708
  type: Component,
699
- args: [{ selector: 'mc-list', host: { class: 'mc-list' }, template: '<ng-content></ng-content>', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, styles: [".mc-divider{display:block;margin:0}.mc-divider.mc-divider_horizontal{border-top-width:var(--mc-divider-size-width, 1px);border-top-style:solid}.mc-divider.mc-divider_vertical{height:100%;border-right-width:var(--mc-divider-size-width, 1px);border-right-style:solid}.mc-divider.mc-divider_inset{margin-left:var(--mc-divider-size-inset-margin, 80px)}[dir=rtl] .mc-divider.mc-divider_inset{margin-left:auto;margin-right:var(--mc-divider-size-inset-margin, 80px)}.mc-no-select{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}.mc-list,.mc-list-selection{display:block;outline:none}.mc-list-item,.mc-list-option{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;position:relative;display:flex;align-items:center;box-sizing:border-box;height:var(--mc-list-size-item-height, 32px);border:2px solid transparent;padding-left:var(--mc-list-size-horizontal-padding, 12px)}.mc-list-item .mc-list-text,.mc-list-option .mc-list-text{display:flex;flex-direction:column;width:100%;box-sizing:border-box;overflow:hidden;padding-right:var(--mc-list-size-horizontal-padding, 12px)}.mc-list-item .mc-list-text>*,.mc-list-option .mc-list-text>*{margin:0;padding:0;font-weight:400;font-size:inherit}.mc-list-item .mc-list-text:empty,.mc-list-option .mc-list-text:empty{display:none}.mc-list-item .mc-divider,.mc-list-option .mc-divider{position:absolute;bottom:0;left:0;width:100%;margin:0}[dir=rtl] .mc-list-item .mc-divider,[dir=rtl] .mc-list-option .mc-divider{margin-left:auto;margin-right:0}.mc-list-item .mc-divider.mc-divider_inset,.mc-list-option .mc-divider.mc-divider_inset{position:absolute}.mc-list-item.mc-progress:after,.mc-list-option.mc-progress:after{top:-2px;right:-2px;bottom:-2px;left:-2px}.mc-list-item .mc-pseudo-checkbox,.mc-list-item .mc-icon,.mc-list-option .mc-pseudo-checkbox,.mc-list-option .mc-icon{margin-right:var(--mc-list-size-icon-right-margin, 8px)}.mc-list-item .mc-option-action,.mc-list-option .mc-option-action{display:none}.mc-list-item:not([disabled]):hover .mc-option-action,.mc-list-item:not([disabled]).mc-focused .mc-option-action,.mc-list-item:not([disabled]).mc-action-button-focused .mc-option-action,.mc-list-option:not([disabled]):hover .mc-option-action,.mc-list-option:not([disabled]).mc-focused .mc-option-action,.mc-list-option:not([disabled]).mc-action-button-focused .mc-option-action{display:flex}.mc-list-option:not([disabled]):not(.mc-disabled){cursor:pointer}\n"] }]
709
+ args: [{ selector: 'mc-list', host: { class: 'mc-list' }, template: '<ng-content></ng-content>', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, styles: [".mc-divider{display:block;margin:0}.mc-divider.mc-divider_horizontal{border-top-width:1px;border-top-width:var(--mc-divider-size-width, 1px);border-top-style:solid}.mc-divider.mc-divider_vertical{height:100%;border-right-width:1px;border-right-width:var(--mc-divider-size-width, 1px);border-right-style:solid}.mc-divider.mc-divider_inset{margin-left:80px;margin-left:var(--mc-divider-size-inset-margin, 80px)}[dir=rtl] .mc-divider.mc-divider_inset{margin-left:auto;margin-right:80px;margin-right:var(--mc-divider-size-inset-margin, 80px)}.mc-no-select{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}.mc-list,.mc-list-selection{display:block;outline:none}.mc-list-item,.mc-list-option{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;position:relative;display:flex;align-items:center;box-sizing:border-box;height:32px;height:var(--mc-list-size-item-height, 32px);border:2px solid transparent;padding-left:12px;padding-left:var(--mc-list-size-horizontal-padding, 12px)}.mc-list-item .mc-list-text,.mc-list-option .mc-list-text{display:flex;flex-direction:column;width:100%;box-sizing:border-box;overflow:hidden;padding-right:12px;padding-right:var(--mc-list-size-horizontal-padding, 12px)}.mc-list-item .mc-list-text>*,.mc-list-option .mc-list-text>*{margin:0;padding:0;font-weight:400;font-size:inherit}.mc-list-item .mc-list-text:empty,.mc-list-option .mc-list-text:empty{display:none}.mc-list-item .mc-divider,.mc-list-option .mc-divider{position:absolute;bottom:0;left:0;width:100%;margin:0}[dir=rtl] .mc-list-item .mc-divider,[dir=rtl] .mc-list-option .mc-divider{margin-left:auto;margin-right:0}.mc-list-item .mc-divider.mc-divider_inset,.mc-list-option .mc-divider.mc-divider_inset{position:absolute}.mc-list-item.mc-progress:after,.mc-list-option.mc-progress:after{top:-2px;right:-2px;bottom:-2px;left:-2px}.mc-list-item .mc-pseudo-checkbox,.mc-list-item .mc-icon,.mc-list-option .mc-pseudo-checkbox,.mc-list-option .mc-icon{margin-right:8px;margin-right:var(--mc-list-size-icon-right-margin, 8px)}.mc-list-item .mc-option-action,.mc-list-option .mc-option-action{display:none}.mc-list-item:not([disabled]):hover .mc-option-action,.mc-list-item:not([disabled]).mc-focused .mc-option-action,.mc-list-item:not([disabled]).mc-action-button-focused .mc-option-action,.mc-list-option:not([disabled]):hover .mc-option-action,.mc-list-option:not([disabled]).mc-focused .mc-option-action,.mc-list-option:not([disabled]).mc-action-button-focused .mc-option-action{display:flex}.mc-list-option:not([disabled]):not(.mc-disabled){cursor:pointer}\n"] }]
700
710
  }] });
701
711
  class McListItem {
702
712
  constructor(elementRef) {