ngx-tethys 19.1.0-next.6 → 19.1.0-next.8
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.
- package/CHANGELOG.md +19 -0
- package/color-picker/coordinates.directive.d.ts +1 -2
- package/date-picker/abstract-picker.component.d.ts +1 -1
- package/date-picker/base-picker.component.d.ts +1 -0
- package/date-picker/picker.component.d.ts +4 -5
- package/dropdown/dropdown-menu.component.d.ts +1 -1
- package/dropdown/dropdown.directive.d.ts +2 -2
- package/fesm2022/ngx-tethys-cascader.mjs +1 -1
- package/fesm2022/ngx-tethys-cascader.mjs.map +1 -1
- package/fesm2022/ngx-tethys-color-picker.mjs +4 -6
- package/fesm2022/ngx-tethys-color-picker.mjs.map +1 -1
- package/fesm2022/ngx-tethys-copy.mjs +2 -2
- package/fesm2022/ngx-tethys-copy.mjs.map +1 -1
- package/fesm2022/ngx-tethys-date-picker.mjs +32 -32
- package/fesm2022/ngx-tethys-date-picker.mjs.map +1 -1
- package/fesm2022/ngx-tethys-dropdown.mjs +7 -10
- package/fesm2022/ngx-tethys-dropdown.mjs.map +1 -1
- package/fesm2022/ngx-tethys-flexible-text.mjs +4 -5
- package/fesm2022/ngx-tethys-flexible-text.mjs.map +1 -1
- package/fesm2022/ngx-tethys-image.mjs +5 -7
- package/fesm2022/ngx-tethys-image.mjs.map +1 -1
- package/fesm2022/ngx-tethys-list.mjs +140 -160
- package/fesm2022/ngx-tethys-list.mjs.map +1 -1
- package/fesm2022/ngx-tethys-message.mjs +1 -2
- package/fesm2022/ngx-tethys-message.mjs.map +1 -1
- package/fesm2022/ngx-tethys-select.mjs +1 -1
- package/fesm2022/ngx-tethys-select.mjs.map +1 -1
- package/fesm2022/ngx-tethys-shared.mjs +97 -123
- package/fesm2022/ngx-tethys-shared.mjs.map +1 -1
- package/fesm2022/ngx-tethys-skeleton.mjs +1 -2
- package/fesm2022/ngx-tethys-skeleton.mjs.map +1 -1
- package/fesm2022/ngx-tethys-table.mjs +1 -2
- package/fesm2022/ngx-tethys-table.mjs.map +1 -1
- package/fesm2022/ngx-tethys-tooltip.mjs +109 -93
- package/fesm2022/ngx-tethys-tooltip.mjs.map +1 -1
- package/fesm2022/ngx-tethys-tree-select.mjs +1 -1
- package/fesm2022/ngx-tethys-tree-select.mjs.map +1 -1
- package/fesm2022/ngx-tethys.mjs +1 -1
- package/fesm2022/ngx-tethys.mjs.map +1 -1
- package/image/preview/image-preview.component.d.ts +2 -2
- package/list/selection/selection-list.d.ts +33 -46
- package/package.json +54 -54
- package/schematics/version.d.ts +1 -1
- package/schematics/version.js +1 -1
- package/shared/directives/thy-contextmenu.directive.d.ts +2 -2
- package/shared/directives/thy-ctrl-enter.directive.d.ts +2 -2
- package/shared/directives/thy-enter.directive.d.ts +2 -2
- package/shared/directives/thy-show.d.ts +2 -2
- package/shared/option/list-option/list-option.component.d.ts +5 -5
- package/shared/option/option.token.d.ts +4 -3
- package/shared/select/select-control/select-control.component.d.ts +8 -7
- package/table/table-column.component.d.ts +15 -5
- package/tooltip/tooltip.directive.d.ts +20 -22
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, Component, inject, Renderer2, ElementRef, NgZone, ChangeDetectorRef,
|
|
2
|
+
import { input, Component, inject, Renderer2, ElementRef, NgZone, ChangeDetectorRef, computed, output, effect, forwardRef, ContentChildren, ChangeDetectionStrategy, contentChild, NgModule } from '@angular/core';
|
|
3
3
|
import { NgTemplateOutlet, CommonModule } from '@angular/common';
|
|
4
4
|
import { coerceBooleanProperty, dom, helpers, keycodes } from 'ngx-tethys/util';
|
|
5
5
|
import { ScrollToService } from 'ngx-tethys/core';
|
|
6
6
|
import { ThyListOption, THY_LIST_OPTION_PARENT_COMPONENT, ThyOptionModule } from 'ngx-tethys/shared';
|
|
7
|
-
import { Subscription } from 'rxjs';
|
|
8
|
-
import { startWith } from 'rxjs/operators';
|
|
9
7
|
import { useHostRenderer } from '@tethys/cdk/dom';
|
|
10
8
|
import { ActiveDescendantKeyManager } from '@angular/cdk/a11y';
|
|
11
9
|
import { SelectionModel } from '@angular/cdk/collections';
|
|
12
10
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
11
|
+
import { startWith } from 'rxjs/operators';
|
|
13
12
|
import { ThyAvatar, ThyAvatarModule } from 'ngx-tethys/avatar';
|
|
14
13
|
|
|
15
14
|
/**
|
|
@@ -71,62 +70,68 @@ class ThySelectionList {
|
|
|
71
70
|
this.elementRef = inject(ElementRef);
|
|
72
71
|
this.ngZone = inject(NgZone);
|
|
73
72
|
this.changeDetectorRef = inject(ChangeDetectorRef);
|
|
74
|
-
this._selectionChangesUnsubscribe$ = Subscription.EMPTY;
|
|
75
73
|
this.hostRenderer = useHostRenderer();
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
this.multiple = true;
|
|
80
|
-
|
|
81
|
-
|
|
74
|
+
/**
|
|
75
|
+
* 改变 grid item 的选择模式,使其支持多选
|
|
76
|
+
*/
|
|
77
|
+
this.multiple = input(true, { alias: 'thyMultiple', transform: coerceBooleanProperty });
|
|
78
|
+
/**
|
|
79
|
+
* 绑定键盘事件的容器
|
|
80
|
+
* @type HTMLElement | ElementRef | string
|
|
81
|
+
* @default thy-selection-list 组件绑定的元素
|
|
82
|
+
*/
|
|
83
|
+
this.thyBindKeyEventContainer = input();
|
|
84
|
+
/**
|
|
85
|
+
* 出现滚动条的容器
|
|
86
|
+
* @type HTMLElement | ElementRef | string
|
|
87
|
+
* @default thy-selection-list 组件绑定的元素
|
|
88
|
+
*/
|
|
89
|
+
this.thyScrollContainer = input();
|
|
90
|
+
/**
|
|
91
|
+
* 键盘事件触发 Before 调用,如果返回 false 则停止继续执行
|
|
92
|
+
*/
|
|
93
|
+
this.thyBeforeKeydown = input();
|
|
94
|
+
/**
|
|
95
|
+
* Option Value 唯一的 Key,用于存储哪些选择被选中的唯一值,只有 Option 的 thyValue 是对象的时才可以传入该选项
|
|
96
|
+
*/
|
|
97
|
+
this.thyUniqueKey = input();
|
|
98
|
+
/**
|
|
99
|
+
* 比较2个选项的 Value 是否相同
|
|
100
|
+
*/
|
|
101
|
+
this.thyCompareWith = input();
|
|
102
|
+
/**
|
|
103
|
+
* grid item 的展示样式
|
|
104
|
+
* @type list | grid
|
|
105
|
+
*/
|
|
106
|
+
this.layout = input('list', { alias: 'thyLayout' });
|
|
107
|
+
this.isLayoutGrid = computed(() => this.layout() === 'grid');
|
|
108
|
+
/**
|
|
109
|
+
* 是否自动激活第一项
|
|
110
|
+
*/
|
|
111
|
+
this.thyAutoActiveFirstItem = input(false, { transform: coerceBooleanProperty });
|
|
112
|
+
/**
|
|
113
|
+
* 改变 grid item 的大小,支持默认以及 sm 两种大小
|
|
114
|
+
* @type sm | md | lg
|
|
115
|
+
*/
|
|
116
|
+
this.thySize = input();
|
|
117
|
+
/**
|
|
118
|
+
* 是否按下空格切换聚焦选项
|
|
119
|
+
*/
|
|
120
|
+
this.thySpaceKeyEnabled = input(true, { transform: coerceBooleanProperty });
|
|
82
121
|
/**
|
|
83
122
|
* 每当选项的选定状态发生更改时,都会触发更改事件
|
|
84
|
-
* @type EventEmitter<ThySelectionListChange>
|
|
85
123
|
*/
|
|
86
|
-
this.thySelectionChange =
|
|
87
|
-
this.
|
|
88
|
-
this.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
const previousValue = this.multiple;
|
|
96
|
-
this.multiple = value;
|
|
97
|
-
if (previousValue !== this.multiple) {
|
|
98
|
-
this._instanceSelectionModel();
|
|
99
|
-
}
|
|
124
|
+
this.thySelectionChange = output();
|
|
125
|
+
this.onTouched = () => { };
|
|
126
|
+
this.onChange = (_) => { };
|
|
127
|
+
effect(() => {
|
|
128
|
+
this.setListSize();
|
|
129
|
+
});
|
|
130
|
+
effect(() => {
|
|
131
|
+
this.instanceSelectionModel();
|
|
132
|
+
});
|
|
100
133
|
}
|
|
101
|
-
|
|
102
|
-
* grid item 的展示样式
|
|
103
|
-
* @type list | grid
|
|
104
|
-
* @default list
|
|
105
|
-
*/
|
|
106
|
-
set thyLayout(value) {
|
|
107
|
-
this.layout = value;
|
|
108
|
-
this.isLayoutGrid = value === 'grid';
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* 是否自动激活第一项
|
|
112
|
-
*/
|
|
113
|
-
set thyAutoActiveFirstItem(value) {
|
|
114
|
-
this.autoActiveFirstItem = value;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* 改变 grid item 的大小,支持默认以及 sm 两种大小
|
|
118
|
-
* @type sm | md | lg
|
|
119
|
-
*/
|
|
120
|
-
set thySize(value) {
|
|
121
|
-
this._setListSize(value);
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* 是否按下空格切换聚焦选项
|
|
125
|
-
*/
|
|
126
|
-
set thySpaceKeyEnabled(value) {
|
|
127
|
-
this.spaceEnabled = value;
|
|
128
|
-
}
|
|
129
|
-
_emitChangeEvent(option, event) {
|
|
134
|
+
emitChangeEvent(option, event) {
|
|
130
135
|
this.thySelectionChange.emit({
|
|
131
136
|
source: this,
|
|
132
137
|
value: option.thyValue(),
|
|
@@ -135,86 +140,91 @@ class ThySelectionList {
|
|
|
135
140
|
selected: this.isSelected(option)
|
|
136
141
|
});
|
|
137
142
|
}
|
|
138
|
-
|
|
143
|
+
emitModelValueChange() {
|
|
144
|
+
const uniqueKey = this.thyUniqueKey();
|
|
139
145
|
if (this.options) {
|
|
140
146
|
let selectedValues = this.selectionModel.selected;
|
|
141
|
-
if (
|
|
147
|
+
if (uniqueKey) {
|
|
142
148
|
selectedValues = selectedValues.map(selectedValue => {
|
|
143
149
|
const selectedOption = this.options.find(option => {
|
|
144
|
-
return option.thyValue()[
|
|
150
|
+
return option.thyValue()[uniqueKey] === selectedValue;
|
|
145
151
|
});
|
|
146
152
|
if (selectedOption) {
|
|
147
153
|
return selectedOption.thyValue();
|
|
148
154
|
}
|
|
149
155
|
else {
|
|
150
|
-
return this.
|
|
151
|
-
return value[
|
|
156
|
+
return this.modelValues.find(value => {
|
|
157
|
+
return value[uniqueKey] === selectedValue;
|
|
152
158
|
});
|
|
153
159
|
}
|
|
154
160
|
});
|
|
155
161
|
}
|
|
156
|
-
this.
|
|
162
|
+
this.modelValues = selectedValues;
|
|
157
163
|
let changeValue = selectedValues;
|
|
158
|
-
if (!this.multiple && selectedValues && selectedValues.length > 0) {
|
|
164
|
+
if (!this.multiple() && selectedValues && selectedValues.length > 0) {
|
|
159
165
|
changeValue = selectedValues[0];
|
|
160
166
|
}
|
|
161
|
-
this.
|
|
167
|
+
this.onChange(changeValue);
|
|
162
168
|
}
|
|
163
169
|
}
|
|
164
|
-
|
|
165
|
-
if (this.
|
|
170
|
+
toggleFocusedOption(event) {
|
|
171
|
+
if (this.keyManager.activeItem) {
|
|
166
172
|
this.ngZone.run(() => {
|
|
167
|
-
this.toggleOption(this.
|
|
173
|
+
this.toggleOption(this.keyManager.activeItem, event);
|
|
168
174
|
});
|
|
169
175
|
}
|
|
170
176
|
}
|
|
171
|
-
|
|
172
|
-
this.
|
|
177
|
+
initializeFocusKeyManager() {
|
|
178
|
+
this.keyManager = new ActiveDescendantKeyManager(this.options)
|
|
173
179
|
.withWrap()
|
|
174
180
|
// .withTypeAhead()
|
|
175
181
|
// Allow disabled items to be focusable. For accessibility reasons, there must be a way for
|
|
176
182
|
// screenreader users, that allows reading the different options of the list.
|
|
177
183
|
.skipPredicate(() => false);
|
|
178
184
|
}
|
|
179
|
-
|
|
180
|
-
this.selectionModel = new SelectionModel(this.multiple);
|
|
185
|
+
instanceSelectionModel() {
|
|
186
|
+
this.selectionModel = new SelectionModel(this.multiple());
|
|
181
187
|
}
|
|
182
|
-
|
|
188
|
+
getElementBySelector(element) {
|
|
183
189
|
return dom.getHTMLElementBySelector(element, this.elementRef);
|
|
184
190
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
191
|
+
compareValue(value1, value2) {
|
|
192
|
+
const thyUniqueKey = this.thyUniqueKey();
|
|
193
|
+
const thyCompareWith = this.thyCompareWith();
|
|
194
|
+
if (thyCompareWith) {
|
|
195
|
+
const compareFn = thyCompareWith;
|
|
188
196
|
return compareFn(value1, value2);
|
|
189
197
|
}
|
|
190
|
-
else if (
|
|
191
|
-
return value1 && value1[
|
|
198
|
+
else if (thyUniqueKey) {
|
|
199
|
+
return value1 && value1[thyUniqueKey] === value2 && value2[thyUniqueKey];
|
|
192
200
|
}
|
|
193
201
|
else {
|
|
194
202
|
return value1 === value2;
|
|
195
203
|
}
|
|
196
204
|
}
|
|
197
|
-
|
|
205
|
+
getOptionSelectionValue(option) {
|
|
198
206
|
const thyValue = option.thyValue();
|
|
199
207
|
if (thyValue) {
|
|
200
|
-
|
|
208
|
+
const thyUniqueKey = this.thyUniqueKey();
|
|
209
|
+
return thyUniqueKey ? thyValue[thyUniqueKey] : thyValue;
|
|
201
210
|
}
|
|
202
211
|
else {
|
|
203
212
|
return option;
|
|
204
213
|
}
|
|
205
214
|
}
|
|
206
|
-
|
|
215
|
+
setSelectionByValues(values) {
|
|
207
216
|
this.selectionModel.clear();
|
|
208
217
|
values.forEach(value => {
|
|
209
|
-
|
|
210
|
-
|
|
218
|
+
const thyUniqueKey = this.thyUniqueKey();
|
|
219
|
+
if (thyUniqueKey) {
|
|
220
|
+
this.selectionModel.select(value[thyUniqueKey]);
|
|
211
221
|
}
|
|
212
222
|
else {
|
|
213
223
|
this.selectionModel.select(value);
|
|
214
224
|
}
|
|
215
225
|
});
|
|
216
226
|
}
|
|
217
|
-
|
|
227
|
+
setAllOptionsSelected(toIsSelected) {
|
|
218
228
|
// Keep track of whether anything changed, because we only want to
|
|
219
229
|
// emit the changed event when something actually changed.
|
|
220
230
|
let hasChanged = false;
|
|
@@ -226,23 +236,24 @@ class ThySelectionList {
|
|
|
226
236
|
}
|
|
227
237
|
});
|
|
228
238
|
if (hasChanged) {
|
|
229
|
-
this.
|
|
239
|
+
this.emitModelValueChange();
|
|
230
240
|
}
|
|
231
241
|
}
|
|
232
|
-
|
|
242
|
+
getOptionByValue(value) {
|
|
233
243
|
return this.options.find(option => {
|
|
234
|
-
return this.
|
|
244
|
+
return this.compareValue(option.thyValue(), value);
|
|
235
245
|
});
|
|
236
246
|
}
|
|
237
|
-
|
|
238
|
-
if (this.
|
|
239
|
-
return this.
|
|
247
|
+
getActiveOption() {
|
|
248
|
+
if (this.keyManager.activeItem) {
|
|
249
|
+
return this.getOptionByValue(this.keyManager.activeItem.thyValue());
|
|
240
250
|
}
|
|
241
251
|
else {
|
|
242
252
|
return null;
|
|
243
253
|
}
|
|
244
254
|
}
|
|
245
|
-
|
|
255
|
+
setListSize() {
|
|
256
|
+
const size = this.thySize();
|
|
246
257
|
for (const key in listSizesMap) {
|
|
247
258
|
if (listSizesMap.hasOwnProperty(key)) {
|
|
248
259
|
this.hostRenderer.removeClass(listSizesMap[key]);
|
|
@@ -253,55 +264,57 @@ class ThySelectionList {
|
|
|
253
264
|
}
|
|
254
265
|
}
|
|
255
266
|
ngOnInit() {
|
|
256
|
-
const bindKeyEventElement = this.
|
|
267
|
+
const bindKeyEventElement = this.getElementBySelector(this.thyBindKeyEventContainer());
|
|
257
268
|
this.ngZone.runOutsideAngular(() => {
|
|
258
|
-
this.
|
|
269
|
+
this.bindKeyEventUnsubscribe = this.renderer.listen(bindKeyEventElement, 'keydown', this.onKeydown.bind(this));
|
|
259
270
|
});
|
|
260
|
-
this.
|
|
271
|
+
this.instanceSelectionModel();
|
|
261
272
|
}
|
|
262
273
|
writeValue(value) {
|
|
263
274
|
if ((typeof ngDevMode === 'undefined' || ngDevMode) && value) {
|
|
264
|
-
|
|
275
|
+
const multiple = this.multiple();
|
|
276
|
+
if (multiple && !helpers.isArray(value)) {
|
|
265
277
|
throw new Error(`The multiple selection ngModel must be an array.`);
|
|
266
278
|
}
|
|
267
|
-
if (!
|
|
279
|
+
if (!multiple && helpers.isArray(value)) {
|
|
268
280
|
throw new Error(`The single selection ngModel should not be an array.`);
|
|
269
281
|
}
|
|
270
282
|
}
|
|
271
283
|
const values = helpers.isArray(value) ? value : value ? [value] : [];
|
|
272
|
-
this.
|
|
284
|
+
this.modelValues = values;
|
|
273
285
|
if (this.options) {
|
|
274
|
-
this.
|
|
286
|
+
this.setSelectionByValues(values);
|
|
275
287
|
}
|
|
276
288
|
this.changeDetectorRef.markForCheck();
|
|
277
289
|
}
|
|
278
290
|
registerOnChange(fn) {
|
|
279
|
-
this.
|
|
291
|
+
this.onChange = fn;
|
|
280
292
|
}
|
|
281
293
|
registerOnTouched(fn) {
|
|
282
|
-
this.
|
|
294
|
+
this.onTouched = fn;
|
|
283
295
|
}
|
|
284
296
|
setDisabledState(isDisabled) {
|
|
285
297
|
this.disabled = isDisabled;
|
|
286
298
|
}
|
|
287
299
|
onKeydown(event) {
|
|
288
|
-
|
|
300
|
+
const thyBeforeKeydown = this.thyBeforeKeydown();
|
|
301
|
+
if (thyBeforeKeydown) {
|
|
289
302
|
// stop key down event
|
|
290
|
-
const isContinue =
|
|
303
|
+
const isContinue = thyBeforeKeydown(event);
|
|
291
304
|
if (!isContinue) {
|
|
292
305
|
return;
|
|
293
306
|
}
|
|
294
307
|
}
|
|
295
308
|
const keyCode = event.keyCode || event.which;
|
|
296
|
-
const manager = this.
|
|
309
|
+
const manager = this.keyManager;
|
|
297
310
|
const previousFocusIndex = manager.activeItemIndex;
|
|
298
311
|
switch (keyCode) {
|
|
299
312
|
case keycodes.SPACE:
|
|
300
313
|
case keycodes.ENTER:
|
|
301
|
-
if (keyCode === keycodes.SPACE && !this.
|
|
314
|
+
if (keyCode === keycodes.SPACE && !this.thySpaceKeyEnabled()) {
|
|
302
315
|
return;
|
|
303
316
|
}
|
|
304
|
-
this.
|
|
317
|
+
this.toggleFocusedOption(event);
|
|
305
318
|
// Always prevent space from scrolling the page since the list has focus
|
|
306
319
|
event.preventDefault();
|
|
307
320
|
break;
|
|
@@ -311,64 +324,63 @@ class ThySelectionList {
|
|
|
311
324
|
if ((keyCode === keycodes.UP_ARROW || keyCode === keycodes.DOWN_ARROW) &&
|
|
312
325
|
event.shiftKey &&
|
|
313
326
|
manager.activeItemIndex !== previousFocusIndex) {
|
|
314
|
-
this.
|
|
327
|
+
this.toggleFocusedOption(event);
|
|
315
328
|
}
|
|
316
329
|
}
|
|
317
330
|
toggleOption(option, event) {
|
|
318
331
|
if (option && !option.thyDisabled()) {
|
|
319
|
-
this.selectionModel.toggle(this.
|
|
332
|
+
this.selectionModel.toggle(this.getOptionSelectionValue(option));
|
|
320
333
|
// Emit a change event because the focused option changed its state through user
|
|
321
334
|
// interaction.
|
|
322
|
-
this.
|
|
323
|
-
this.
|
|
335
|
+
this.emitModelValueChange();
|
|
336
|
+
this.emitChangeEvent(option, event);
|
|
324
337
|
}
|
|
325
338
|
}
|
|
326
339
|
setActiveOption(option) {
|
|
327
|
-
this.
|
|
340
|
+
this.keyManager.updateActiveItem(option); // .updateActiveItemIndex(this._getOptionIndex(option));
|
|
328
341
|
}
|
|
329
342
|
scrollIntoView(option) {
|
|
330
|
-
const scrollContainerElement = dom.getHTMLElementBySelector(this.thyScrollContainer, this.elementRef);
|
|
343
|
+
const scrollContainerElement = dom.getHTMLElementBySelector(this.thyScrollContainer(), this.elementRef);
|
|
331
344
|
ScrollToService.scrollToElement(option.element.nativeElement, scrollContainerElement);
|
|
332
345
|
}
|
|
333
346
|
isSelected(option) {
|
|
334
|
-
return this.selectionModel.isSelected(this.
|
|
347
|
+
return this.selectionModel.isSelected(this.getOptionSelectionValue(option));
|
|
335
348
|
}
|
|
336
349
|
clearActiveItem() {
|
|
337
|
-
if (this.
|
|
338
|
-
this.
|
|
350
|
+
if (this.keyManager.activeItem) {
|
|
351
|
+
this.keyManager.setActiveItem(-1);
|
|
339
352
|
}
|
|
340
353
|
}
|
|
341
354
|
determineClearActiveItem() {
|
|
342
|
-
if (!this.
|
|
355
|
+
if (!this.getActiveOption()) {
|
|
343
356
|
this.clearActiveItem();
|
|
344
357
|
}
|
|
345
358
|
}
|
|
346
359
|
/** Selects all of the options. */
|
|
347
360
|
selectAll() {
|
|
348
|
-
this.
|
|
361
|
+
this.setAllOptionsSelected(true);
|
|
349
362
|
}
|
|
350
363
|
/** Deselects all of the options. */
|
|
351
364
|
deselectAll() {
|
|
352
|
-
this.
|
|
365
|
+
this.setAllOptionsSelected(false);
|
|
353
366
|
}
|
|
354
367
|
ngAfterContentInit() {
|
|
355
|
-
this.
|
|
368
|
+
this.initializeFocusKeyManager();
|
|
356
369
|
this.options.changes.pipe(startWith(true)).subscribe(() => {
|
|
357
|
-
if (this.
|
|
358
|
-
if (!this.
|
|
359
|
-
this.
|
|
370
|
+
if (this.thyAutoActiveFirstItem()) {
|
|
371
|
+
if (!this.keyManager.activeItem || this.options.toArray().indexOf(this.keyManager.activeItem) < 0) {
|
|
372
|
+
this.keyManager.setFirstItemActive();
|
|
360
373
|
}
|
|
361
374
|
}
|
|
362
375
|
});
|
|
363
376
|
}
|
|
364
377
|
ngOnDestroy() {
|
|
365
|
-
this.
|
|
366
|
-
|
|
367
|
-
this._bindKeyEventUnsubscribe();
|
|
378
|
+
if (this.bindKeyEventUnsubscribe) {
|
|
379
|
+
this.bindKeyEventUnsubscribe();
|
|
368
380
|
}
|
|
369
381
|
}
|
|
370
382
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThySelectionList, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
371
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
383
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.8", type: ThySelectionList, isStandalone: true, selector: "thy-selection-list,[thy-selection-list]", inputs: { multiple: { classPropertyName: "multiple", publicName: "thyMultiple", isSignal: true, isRequired: false, transformFunction: null }, thyBindKeyEventContainer: { classPropertyName: "thyBindKeyEventContainer", publicName: "thyBindKeyEventContainer", isSignal: true, isRequired: false, transformFunction: null }, thyScrollContainer: { classPropertyName: "thyScrollContainer", publicName: "thyScrollContainer", isSignal: true, isRequired: false, transformFunction: null }, thyBeforeKeydown: { classPropertyName: "thyBeforeKeydown", publicName: "thyBeforeKeydown", isSignal: true, isRequired: false, transformFunction: null }, thyUniqueKey: { classPropertyName: "thyUniqueKey", publicName: "thyUniqueKey", isSignal: true, isRequired: false, transformFunction: null }, thyCompareWith: { classPropertyName: "thyCompareWith", publicName: "thyCompareWith", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "thyLayout", isSignal: true, isRequired: false, transformFunction: null }, thyAutoActiveFirstItem: { classPropertyName: "thyAutoActiveFirstItem", publicName: "thyAutoActiveFirstItem", isSignal: true, isRequired: false, transformFunction: null }, thySize: { classPropertyName: "thySize", publicName: "thySize", isSignal: true, isRequired: false, transformFunction: null }, thySpaceKeyEnabled: { classPropertyName: "thySpaceKeyEnabled", publicName: "thySpaceKeyEnabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { thySelectionChange: "thySelectionChange" }, host: { properties: { "class.thy-multiple-selection-list": "multiple()", "class.thy-grid-list": "isLayoutGrid()" }, classAttribute: "thy-list thy-selection-list" }, providers: [
|
|
372
384
|
{
|
|
373
385
|
provide: THY_LIST_OPTION_PARENT_COMPONENT,
|
|
374
386
|
useExisting: ThySelectionList
|
|
@@ -396,48 +408,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
396
408
|
multi: true
|
|
397
409
|
}
|
|
398
410
|
],
|
|
411
|
+
host: {
|
|
412
|
+
class: 'thy-list thy-selection-list',
|
|
413
|
+
'[class.thy-multiple-selection-list]': 'multiple()',
|
|
414
|
+
'[class.thy-grid-list]': 'isLayoutGrid()'
|
|
415
|
+
},
|
|
399
416
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
400
417
|
}]
|
|
401
|
-
}], propDecorators: {
|
|
402
|
-
type: HostBinding,
|
|
403
|
-
args: [`class.thy-list`]
|
|
404
|
-
}], _isSelectionList: [{
|
|
405
|
-
type: HostBinding,
|
|
406
|
-
args: [`class.thy-selection-list`]
|
|
407
|
-
}], multiple: [{
|
|
408
|
-
type: HostBinding,
|
|
409
|
-
args: [`class.thy-multiple-selection-list`]
|
|
410
|
-
}], isLayoutGrid: [{
|
|
411
|
-
type: HostBinding,
|
|
412
|
-
args: [`class.thy-grid-list`]
|
|
413
|
-
}], options: [{
|
|
418
|
+
}], ctorParameters: () => [], propDecorators: { options: [{
|
|
414
419
|
type: ContentChildren,
|
|
415
420
|
args: [ThyListOption, { descendants: true }]
|
|
416
|
-
}], thyMultiple: [{
|
|
417
|
-
type: Input,
|
|
418
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
419
|
-
}], thyBindKeyEventContainer: [{
|
|
420
|
-
type: Input
|
|
421
|
-
}], thyScrollContainer: [{
|
|
422
|
-
type: Input
|
|
423
|
-
}], thyBeforeKeydown: [{
|
|
424
|
-
type: Input
|
|
425
|
-
}], thyUniqueKey: [{
|
|
426
|
-
type: Input
|
|
427
|
-
}], thyCompareWith: [{
|
|
428
|
-
type: Input
|
|
429
|
-
}], thyLayout: [{
|
|
430
|
-
type: Input
|
|
431
|
-
}], thyAutoActiveFirstItem: [{
|
|
432
|
-
type: Input,
|
|
433
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
434
|
-
}], thySize: [{
|
|
435
|
-
type: Input
|
|
436
|
-
}], thySpaceKeyEnabled: [{
|
|
437
|
-
type: Input,
|
|
438
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
439
|
-
}], thySelectionChange: [{
|
|
440
|
-
type: Output
|
|
441
421
|
}] } });
|
|
442
422
|
|
|
443
423
|
/**
|