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