ngx-tethys 20.0.0 → 20.0.1

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.
@@ -3,8 +3,8 @@ import { input, inject, ViewContainerRef, effect, Directive, ElementRef, NgZone,
3
3
  import { reqAnimFrame, TabIndexDisabledControlValueAccessorMixin, ThyTranslate, mixinDisabled, MixinBase } from 'ngx-tethys/core';
4
4
  import { coerceBooleanProperty, keycodes, isTemplateRef, isUndefinedOrNull, coerceArray, ENTER, SPACE, hasModifierKey } from 'ngx-tethys/util';
5
5
  import { useHostRenderer } from '@tethys/cdk/dom';
6
- import { Subject, Observable, fromEvent, merge, throttleTime, of, defer } from 'rxjs';
7
- import { startWith, switchMap, takeUntil, take, debounceTime, map } from 'rxjs/operators';
6
+ import { Subject, Observable, fromEvent, merge, throttleTime, of } from 'rxjs';
7
+ import { startWith, switchMap, takeUntil } from 'rxjs/operators';
8
8
  import { normalizePassiveListenerOptions } from '@angular/cdk/platform';
9
9
  import { CdkDrag } from '@angular/cdk/drag-drop';
10
10
  import { ThyIcon, ThyIconModule } from 'ngx-tethys/icon';
@@ -12,7 +12,7 @@ import { ThyTag, ThyTagModule } from 'ngx-tethys/tag';
12
12
  import { NgClass, NgStyle, NgTemplateOutlet, CommonModule } from '@angular/common';
13
13
  import * as i1 from '@angular/forms';
14
14
  import { FormsModule } from '@angular/forms';
15
- import { takeUntilDestroyed, outputToObservable } from '@angular/core/rxjs-interop';
15
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
16
16
  import { ThyFlexibleText } from 'ngx-tethys/flexible-text';
17
17
  import * as i2 from 'ngx-tethys/grid';
18
18
  import { ThyGridModule } from 'ngx-tethys/grid';
@@ -1058,10 +1058,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
1058
1058
  }]
1059
1059
  }] });
1060
1060
 
1061
- /**
1062
- * Injection token used to provide the parent component to options.
1063
- */
1064
- const THY_OPTION_PARENT_COMPONENT = new InjectionToken('THY_OPTION_PARENT_COMPONENT');
1065
1061
  /**
1066
1062
  * Injection token used to provide the parent component to options.
1067
1063
  */
@@ -1148,8 +1144,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
1148
1144
  }]
1149
1145
  }] });
1150
1146
 
1151
- class SelectOptionBase {
1147
+ class ThySelectOptionGroup {
1148
+ constructor() {
1149
+ this.thyGroupLabel = input(...(ngDevMode ? [undefined, { debugName: "thyGroupLabel" }] : []));
1150
+ this.thyDisabled = input(false, ...(ngDevMode ? [{ debugName: "thyDisabled", transform: coerceBooleanProperty }] : [{ transform: coerceBooleanProperty }]));
1151
+ }
1152
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: ThySelectOptionGroup, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1153
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.14", type: ThySelectOptionGroup, isStandalone: true, selector: "thy-option-group", inputs: { thyGroupLabel: { classPropertyName: "thyGroupLabel", publicName: "thyGroupLabel", isSignal: true, isRequired: false, transformFunction: null }, thyDisabled: { classPropertyName: "thyDisabled", publicName: "thyDisabled", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true }); }
1152
1154
  }
1155
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: ThySelectOptionGroup, decorators: [{
1156
+ type: Component,
1157
+ args: [{
1158
+ selector: 'thy-option-group',
1159
+ template: `<ng-content></ng-content>`
1160
+ }]
1161
+ }], propDecorators: { thyGroupLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyGroupLabel", required: false }] }], thyDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyDisabled", required: false }] }] } });
1153
1162
 
1154
1163
  class ThyOptionSelectionChangeEvent {
1155
1164
  constructor(option, isUserInput = false) {
@@ -1157,39 +1166,155 @@ class ThyOptionSelectionChangeEvent {
1157
1166
  this.isUserInput = isUserInput;
1158
1167
  }
1159
1168
  }
1160
- class ThyOptionVisibleChangeEvent {
1161
- }
1162
1169
  /**
1163
- * @private
1164
- * @order 20
1170
+ * 选项组件
1171
+ * @name thy-option
1165
1172
  */
1166
- class ThyOption extends SelectOptionBase {
1167
- // 继承至 Highlightable,无法修改为 Signal
1168
- get disabled() {
1169
- return this.hidden() || this.thyDisabled();
1170
- }
1171
- get tabIndex() {
1172
- return this.disabled ? '-1' : '0';
1173
- }
1173
+ class ThyOption {
1174
1174
  constructor() {
1175
- super();
1176
- this.element = inject(ElementRef);
1177
- this.parent = inject(THY_OPTION_PARENT_COMPONENT, { optional: true });
1178
- this.cdr = inject(ChangeDetectorRef);
1175
+ /**
1176
+ * 选项的值,具有唯一性
1177
+ */
1178
+ this.thyValue = input(...(ngDevMode ? [undefined, { debugName: "thyValue" }] : []));
1179
+ /**
1180
+ * 选项的原始值
1181
+ */
1182
+ this.thyRawValue = input(...(ngDevMode ? [undefined, { debugName: "thyRawValue" }] : []));
1183
+ /**
1184
+ * 选项的文本
1185
+ */
1186
+ this.thyLabelText = input(...(ngDevMode ? [undefined, { debugName: "thyLabelText" }] : []));
1187
+ /**
1188
+ * 是否显示自定义模板
1189
+ */
1179
1190
  this.thyShowOptionCustom = input(...(ngDevMode ? [undefined, { debugName: "thyShowOptionCustom" }] : []));
1191
+ /**
1192
+ * 搜索关键字
1193
+ */
1180
1194
  this.thySearchKey = input(...(ngDevMode ? [undefined, { debugName: "thySearchKey" }] : []));
1181
- this.template = viewChild(TemplateRef, ...(ngDevMode ? [{ debugName: "template" }] : []));
1182
- this.thyDisabled = input(false, ...(ngDevMode ? [{ debugName: "thyDisabled", transform: coerceBooleanProperty }] : [{ transform: coerceBooleanProperty }]));
1183
- this.hidden = signal(false, ...(ngDevMode ? [{ debugName: "hidden" }] : []));
1195
+ /**
1196
+ * 是否禁用
1197
+ */
1198
+ this.thyDisabled = input(...(ngDevMode ? [undefined, { debugName: "thyDisabled" }] : []));
1199
+ /**
1200
+ * 是否选中,会跟随 ThyOptionSelectionChangeEvent 抛出去
1201
+ */
1184
1202
  this.selected = signal(false, ...(ngDevMode ? [{ debugName: "selected" }] : []));
1203
+ /**
1204
+ * 选项被选中时的回调
1205
+ */
1185
1206
  this.selectionChange = output();
1186
- this.visibleChange = output();
1207
+ /**
1208
+ * 模板
1209
+ */
1210
+ this.template = viewChild(TemplateRef, ...(ngDevMode ? [{ debugName: "template" }] : []));
1211
+ this.optionGroupComponent = inject(ThySelectOptionGroup, { optional: true });
1187
1212
  }
1188
- getHostElement() {
1189
- return this.element.nativeElement;
1213
+ get groupLabel() {
1214
+ return this.optionGroupComponent?.thyGroupLabel() || '';
1190
1215
  }
1191
- onClick(event) {
1192
- this.selectViaInteraction();
1216
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: ThyOption, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1217
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.3.14", type: ThyOption, isStandalone: true, selector: "thy-option", inputs: { thyValue: { classPropertyName: "thyValue", publicName: "thyValue", isSignal: true, isRequired: false, transformFunction: null }, thyRawValue: { classPropertyName: "thyRawValue", publicName: "thyRawValue", isSignal: true, isRequired: false, transformFunction: null }, thyLabelText: { classPropertyName: "thyLabelText", publicName: "thyLabelText", isSignal: true, isRequired: false, transformFunction: null }, thyShowOptionCustom: { classPropertyName: "thyShowOptionCustom", publicName: "thyShowOptionCustom", isSignal: true, isRequired: false, transformFunction: null }, thySearchKey: { classPropertyName: "thySearchKey", publicName: "thySearchKey", isSignal: true, isRequired: false, transformFunction: null }, thyDisabled: { classPropertyName: "thyDisabled", publicName: "thyDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectionChange: "selectionChange" }, viewQueries: [{ propertyName: "template", first: true, predicate: TemplateRef, descendants: true, isSignal: true }], ngImport: i0, template: `
1218
+ <ng-template>
1219
+ <ng-content></ng-content>
1220
+ </ng-template>
1221
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1222
+ }
1223
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: ThyOption, decorators: [{
1224
+ type: Component,
1225
+ args: [{
1226
+ selector: 'thy-option',
1227
+ template: `
1228
+ <ng-template>
1229
+ <ng-content></ng-content>
1230
+ </ng-template>
1231
+ `,
1232
+ changeDetection: ChangeDetectionStrategy.OnPush
1233
+ }]
1234
+ }], propDecorators: { thyValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyValue", required: false }] }], thyRawValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyRawValue", required: false }] }], thyLabelText: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyLabelText", required: false }] }], thyShowOptionCustom: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyShowOptionCustom", required: false }] }], thySearchKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "thySearchKey", required: false }] }], thyDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyDisabled", required: false }] }], selectionChange: [{ type: i0.Output, args: ["selectionChange"] }], template: [{ type: i0.ViewChild, args: [i0.forwardRef(() => TemplateRef), { isSignal: true }] }] } });
1235
+
1236
+ /**
1237
+ * 选项渲染组件
1238
+ * @private
1239
+ * @name thy-option-render
1240
+ */
1241
+ class ThyOptionRender {
1242
+ constructor() {
1243
+ this.element = inject(ElementRef);
1244
+ this.hostRenderer = useHostRenderer();
1245
+ /**
1246
+ * 选项的值,具有唯一性
1247
+ */
1248
+ this.thyValue = input(...(ngDevMode ? [undefined, { debugName: "thyValue" }] : []));
1249
+ /**
1250
+ * 选项的原始值
1251
+ */
1252
+ this.thyRawValue = input(...(ngDevMode ? [undefined, { debugName: "thyRawValue" }] : []));
1253
+ /**
1254
+ * 选项的文本
1255
+ */
1256
+ this.thyLabelText = input(...(ngDevMode ? [undefined, { debugName: "thyLabelText" }] : []));
1257
+ /**
1258
+ * 搜索关键字
1259
+ */
1260
+ this.thySearchKey = input(...(ngDevMode ? [undefined, { debugName: "thySearchKey" }] : []));
1261
+ /**
1262
+ * 是否禁用
1263
+ */
1264
+ this.thyDisabled = input(false, ...(ngDevMode ? [{ debugName: "thyDisabled", transform: coerceBooleanProperty }] : [{ transform: coerceBooleanProperty }]));
1265
+ /**
1266
+ * 是否显示自定义模板
1267
+ */
1268
+ this.thyShowOptionCustom = input(false, ...(ngDevMode ? [{ debugName: "thyShowOptionCustom", transform: coerceBooleanProperty }] : [{ transform: coerceBooleanProperty }]));
1269
+ /**
1270
+ * 模板
1271
+ */
1272
+ this.thyTemplate = input(...(ngDevMode ? [undefined, { debugName: "thyTemplate" }] : []));
1273
+ /**
1274
+ * 模板上下文
1275
+ */
1276
+ this.thyTemplateContext = input(...(ngDevMode ? [undefined, { debugName: "thyTemplateContext" }] : []));
1277
+ /**
1278
+ * 被选中时,是否显示勾选图标
1279
+ */
1280
+ this.thyShowCheckedIcon = input(false, ...(ngDevMode ? [{ debugName: "thyShowCheckedIcon", transform: coerceBooleanProperty }] : [{ transform: coerceBooleanProperty }]));
1281
+ /**
1282
+ * Select 组件选中的值
1283
+ */
1284
+ this.thySelectedValuesMap = input(new Map(), ...(ngDevMode ? [{ debugName: "thySelectedValuesMap" }] : []));
1285
+ /**
1286
+ * 当前高亮选项的值
1287
+ */
1288
+ this.thyActivatedValue = input(...(ngDevMode ? [undefined, { debugName: "thyActivatedValue" }] : []));
1289
+ /**
1290
+ * 点击选项时的回调
1291
+ */
1292
+ this.optionClick = output();
1293
+ /**
1294
+ * 鼠标悬浮时的回调
1295
+ */
1296
+ this.optionHover = output();
1297
+ /**
1298
+ * 是否被选中
1299
+ */
1300
+ this.selected = computed(() => {
1301
+ return this.thySelectedValuesMap().has(this.thyValue());
1302
+ }, ...(ngDevMode ? [{ debugName: "selected" }] : []));
1303
+ /**
1304
+ * 是否高亮
1305
+ */
1306
+ this.activated = computed(() => {
1307
+ return this.thyActivatedValue() === this.thyValue();
1308
+ }, ...(ngDevMode ? [{ debugName: "activated" }] : []));
1309
+ this.tabIndex = computed(() => {
1310
+ return this.thyDisabled() ? '-1' : '0';
1311
+ }, ...(ngDevMode ? [{ debugName: "tabIndex" }] : []));
1312
+ effect(() => {
1313
+ this.activated() ? this.setActiveStyles() : this.setInactiveStyles();
1314
+ });
1315
+ }
1316
+ mouseEnter() {
1317
+ this.optionHover.emit(this.thyValue());
1193
1318
  }
1194
1319
  handleKeydown(event) {
1195
1320
  if ((event.keyCode === ENTER || event.keyCode === SPACE) && !hasModifierKey(event)) {
@@ -1198,190 +1323,66 @@ class ThyOption extends SelectOptionBase {
1198
1323
  }
1199
1324
  }
1200
1325
  selectViaInteraction() {
1201
- if (!this.disabled) {
1202
- const selected = this.parent.isMultiple ? !this.selected() : true;
1203
- this.selected.set(selected);
1204
- this.cdr.markForCheck();
1205
- this.emitSelectionChangeEvent(true);
1326
+ if (!this.thyDisabled()) {
1327
+ this.optionClick.emit({ value: this.thyValue(), isUserInput: true });
1206
1328
  }
1207
1329
  }
1208
- select(event) {
1209
- if (!this.disabled) {
1330
+ select() {
1331
+ if (!this.thyDisabled()) {
1210
1332
  if (!this.selected()) {
1211
- this.selected.set(true);
1212
- this.emitSelectionChangeEvent();
1213
- this.cdr.markForCheck();
1333
+ this.optionClick.emit({ value: this.thyValue() });
1214
1334
  }
1215
1335
  }
1216
1336
  }
1217
1337
  deselect() {
1218
- if (this.selected() || this.disabled) {
1219
- this.selected.set(false);
1220
- this.emitSelectionChangeEvent();
1221
- this.cdr.markForCheck();
1222
- }
1223
- }
1224
- hideOption() {
1225
- if (!this.hidden()) {
1226
- this.hidden.set(true);
1227
- this.visibleChange.emit({ option: this });
1228
- this.cdr.markForCheck();
1229
- }
1230
- }
1231
- showOption() {
1232
- if (this.hidden()) {
1233
- this.hidden.set(false);
1234
- this.visibleChange.emit({ option: this });
1235
- this.cdr.markForCheck();
1236
- }
1237
- }
1238
- matchSearchText(searchText) {
1239
- const thySearchKey = this.thySearchKey();
1240
- if (thySearchKey) {
1241
- if (thySearchKey.toLowerCase().indexOf(searchText.toLowerCase()) >= 0) {
1242
- return true;
1243
- }
1244
- else {
1245
- return false;
1246
- }
1247
- }
1248
- else {
1249
- if (this.thyLabelText.toLowerCase().indexOf(searchText.toLowerCase()) >= 0) {
1250
- return true;
1251
- }
1252
- else {
1253
- return false;
1254
- }
1338
+ if (this.selected() || this.thyDisabled()) {
1339
+ this.optionClick.emit({ value: this.thyValue() });
1255
1340
  }
1256
1341
  }
1257
1342
  setActiveStyles() {
1258
- this.getHostElement().classList.add('hover');
1259
- this.cdr.markForCheck();
1343
+ this.hostRenderer.addClass('hover');
1260
1344
  }
1261
1345
  setInactiveStyles() {
1262
- this.getHostElement().classList.remove('hover');
1263
- this.cdr.markForCheck();
1264
- }
1265
- getLabel() {
1266
- return '';
1346
+ this.hostRenderer.removeClass('hover');
1267
1347
  }
1268
- emitSelectionChangeEvent(isUserInput = false) {
1269
- this.selectionChange.emit(new ThyOptionSelectionChangeEvent(this, isUserInput));
1270
- }
1271
- ngOnDestroy() { }
1272
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: ThyOption, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1273
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.14", type: ThyOption, isStandalone: true, selector: "thy-option", inputs: { thyValue: { classPropertyName: "thyValue", publicName: "thyValue", isSignal: false, isRequired: false, transformFunction: null }, thyRawValue: { classPropertyName: "thyRawValue", publicName: "thyRawValue", isSignal: false, isRequired: false, transformFunction: null }, thyLabelText: { classPropertyName: "thyLabelText", publicName: "thyLabelText", isSignal: false, isRequired: false, transformFunction: null }, thyShowOptionCustom: { classPropertyName: "thyShowOptionCustom", publicName: "thyShowOptionCustom", isSignal: true, isRequired: false, transformFunction: null }, thySearchKey: { classPropertyName: "thySearchKey", publicName: "thySearchKey", isSignal: true, isRequired: false, transformFunction: null }, thyDisabled: { classPropertyName: "thyDisabled", publicName: "thyDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectionChange: "selectionChange", visibleChange: "visibleChange" }, host: { listeners: { "click": "onClick($event)", "keydown": "handleKeydown($event)" }, properties: { "class.disabled": "thyDisabled()", "class.hidden": "hidden()", "attr.tabindex": "tabIndex", "class.active": "selected()" }, classAttribute: "thy-option-item" }, viewQueries: [{ propertyName: "template", first: true, predicate: TemplateRef, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "@if (thyShowOptionCustom()) {\n <ng-content></ng-content>\n <thy-icon class=\"checked-icon\" thyIconName=\"check\"></thy-icon>\n} @else {\n <span class=\"text-truncate\">{{ thyLabelText }}</span>\n <thy-icon class=\"checked-icon\" thyIconName=\"check\"></thy-icon>\n}\n", dependencies: [{ kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1348
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: ThyOptionRender, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1349
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.14", type: ThyOptionRender, isStandalone: true, selector: "thy-option-render", inputs: { thyValue: { classPropertyName: "thyValue", publicName: "thyValue", isSignal: true, isRequired: false, transformFunction: null }, thyRawValue: { classPropertyName: "thyRawValue", publicName: "thyRawValue", isSignal: true, isRequired: false, transformFunction: null }, thyLabelText: { classPropertyName: "thyLabelText", publicName: "thyLabelText", isSignal: true, isRequired: false, transformFunction: null }, thySearchKey: { classPropertyName: "thySearchKey", publicName: "thySearchKey", isSignal: true, isRequired: false, transformFunction: null }, thyDisabled: { classPropertyName: "thyDisabled", publicName: "thyDisabled", isSignal: true, isRequired: false, transformFunction: null }, thyShowOptionCustom: { classPropertyName: "thyShowOptionCustom", publicName: "thyShowOptionCustom", isSignal: true, isRequired: false, transformFunction: null }, thyTemplate: { classPropertyName: "thyTemplate", publicName: "thyTemplate", isSignal: true, isRequired: false, transformFunction: null }, thyTemplateContext: { classPropertyName: "thyTemplateContext", publicName: "thyTemplateContext", isSignal: true, isRequired: false, transformFunction: null }, thyShowCheckedIcon: { classPropertyName: "thyShowCheckedIcon", publicName: "thyShowCheckedIcon", isSignal: true, isRequired: false, transformFunction: null }, thySelectedValuesMap: { classPropertyName: "thySelectedValuesMap", publicName: "thySelectedValuesMap", isSignal: true, isRequired: false, transformFunction: null }, thyActivatedValue: { classPropertyName: "thyActivatedValue", publicName: "thyActivatedValue", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { optionClick: "optionClick", optionHover: "optionHover" }, host: { listeners: { "click": "selectViaInteraction()", "mouseenter": "mouseEnter()", "keydown": "handleKeydown($event)" }, properties: { "class.disabled": "thyDisabled()", "attr.tabindex": "tabIndex()", "class.active": "selected()" }, classAttribute: "thy-option-item" }, ngImport: i0, template: "@if (thyShowOptionCustom()) {\n <ng-container *ngTemplateOutlet=\"thyTemplate(); context: thyTemplateContext()\"></ng-container>\n} @else {\n <span class=\"text-truncate\">{{ thyLabelText() }}</span>\n}\n@if (thyShowCheckedIcon() && selected()) {\n <thy-icon class=\"checked-icon\" thyIconName=\"check\"></thy-icon>\n}\n", dependencies: [{ kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
1274
1350
  }
1275
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: ThyOption, decorators: [{
1351
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: ThyOptionRender, decorators: [{
1276
1352
  type: Component,
1277
- args: [{ selector: 'thy-option', changeDetection: ChangeDetectionStrategy.OnPush, imports: [ThyIcon], host: {
1353
+ args: [{ selector: 'thy-option-render', imports: [ThyIcon, NgTemplateOutlet], host: {
1278
1354
  class: 'thy-option-item',
1279
1355
  '[class.disabled]': 'thyDisabled()',
1280
- '[class.hidden]': 'hidden()',
1281
- '[attr.tabindex]': `tabIndex`,
1282
- '[class.active]': 'selected()'
1283
- }, template: "@if (thyShowOptionCustom()) {\n <ng-content></ng-content>\n <thy-icon class=\"checked-icon\" thyIconName=\"check\"></thy-icon>\n} @else {\n <span class=\"text-truncate\">{{ thyLabelText }}</span>\n <thy-icon class=\"checked-icon\" thyIconName=\"check\"></thy-icon>\n}\n" }]
1284
- }], ctorParameters: () => [], propDecorators: { thyValue: [{
1285
- type: Input
1286
- }], thyRawValue: [{
1287
- type: Input
1288
- }], thyLabelText: [{
1289
- type: Input
1290
- }], thyShowOptionCustom: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyShowOptionCustom", required: false }] }], thySearchKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "thySearchKey", required: false }] }], template: [{ type: i0.ViewChild, args: [i0.forwardRef(() => TemplateRef), { isSignal: true }] }], thyDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyDisabled", required: false }] }], selectionChange: [{ type: i0.Output, args: ["selectionChange"] }], visibleChange: [{ type: i0.Output, args: ["visibleChange"] }], onClick: [{
1291
- type: HostListener,
1292
- args: ['click', ['$event']]
1293
- }], handleKeydown: [{
1294
- type: HostListener,
1295
- args: ['keydown', ['$event']]
1296
- }] } });
1356
+ '[attr.tabindex]': `tabIndex()`,
1357
+ '[class.active]': 'selected()',
1358
+ '(click)': 'selectViaInteraction()',
1359
+ '(mouseenter)': 'mouseEnter()',
1360
+ '(keydown)': 'handleKeydown($event)'
1361
+ }, template: "@if (thyShowOptionCustom()) {\n <ng-container *ngTemplateOutlet=\"thyTemplate(); context: thyTemplateContext()\"></ng-container>\n} @else {\n <span class=\"text-truncate\">{{ thyLabelText() }}</span>\n}\n@if (thyShowCheckedIcon() && selected()) {\n <thy-icon class=\"checked-icon\" thyIconName=\"check\"></thy-icon>\n}\n" }]
1362
+ }], ctorParameters: () => [], propDecorators: { thyValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyValue", required: false }] }], thyRawValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyRawValue", required: false }] }], thyLabelText: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyLabelText", required: false }] }], thySearchKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "thySearchKey", required: false }] }], thyDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyDisabled", required: false }] }], thyShowOptionCustom: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyShowOptionCustom", required: false }] }], thyTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyTemplate", required: false }] }], thyTemplateContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyTemplateContext", required: false }] }], thyShowCheckedIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyShowCheckedIcon", required: false }] }], thySelectedValuesMap: [{ type: i0.Input, args: [{ isSignal: true, alias: "thySelectedValuesMap", required: false }] }], thyActivatedValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyActivatedValue", required: false }] }], optionClick: [{ type: i0.Output, args: ["optionClick"] }], optionHover: [{ type: i0.Output, args: ["optionHover"] }] } });
1297
1363
 
1298
1364
  /**
1299
1365
  * @private
1300
1366
  */
1301
- class ThySelectOptionGroup {
1367
+ class ThyOptionGroupRender {
1302
1368
  constructor() {
1303
- this._ngZone = inject(NgZone);
1304
- this.cdr = inject(ChangeDetectorRef);
1305
- this.thyDisabled = input(false, ...(ngDevMode ? [{ debugName: "thyDisabled", transform: coerceBooleanProperty }] : [{ transform: coerceBooleanProperty }]));
1306
- this.hidden = signal(false, ...(ngDevMode ? [{ debugName: "hidden" }] : []));
1307
1369
  this.thyGroupLabel = input(undefined, ...(ngDevMode ? [{ debugName: "thyGroupLabel" }] : []));
1308
- this._destroy$ = new Subject();
1309
- this.optionVisibleChanges = defer(() => {
1310
- if (this.options) {
1311
- return merge(...this.options.map(option => outputToObservable(option.visibleChange)));
1312
- }
1313
- return this._ngZone.onStable.asObservable().pipe(take(1), switchMap(() => this.optionVisibleChanges));
1314
- });
1315
- }
1316
- ngAfterContentInit() {
1317
- this.options.changes.pipe(startWith(null), takeUntil(this._destroy$)).subscribe(() => {
1318
- this._resetOptions();
1319
- });
1320
- }
1321
- _resetOptions() {
1322
- const changedOrDestroyed$ = merge(this.options.changes, this._destroy$);
1323
- merge(...this.options.map(option => outputToObservable(option.visibleChange)))
1324
- .pipe(takeUntil(changedOrDestroyed$), debounceTime(10), map((event) => {
1325
- const hasOption = this.options.find(option => {
1326
- if (!option.hidden()) {
1327
- return true;
1328
- }
1329
- });
1330
- if (hasOption) {
1331
- return false;
1332
- }
1333
- else {
1334
- return true;
1335
- }
1336
- }))
1337
- .subscribe((data) => {
1338
- this.hidden.set(data);
1339
- this.cdr.markForCheck();
1340
- });
1341
- }
1342
- ngOnDestroy() {
1343
- this._destroy$.next();
1344
- this._destroy$.complete();
1345
- }
1346
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: ThySelectOptionGroup, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1347
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.14", type: ThySelectOptionGroup, isStandalone: true, selector: "thy-option-group", inputs: { thyDisabled: { classPropertyName: "thyDisabled", publicName: "thyDisabled", isSignal: true, isRequired: false, transformFunction: null }, thyGroupLabel: { classPropertyName: "thyGroupLabel", publicName: "thyGroupLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.disabled": "thyDisabled()", "class.thy-select-option-group-hidden": "hidden()" }, classAttribute: "thy-option-item-group" }, queries: [{ propertyName: "options", predicate: ThyOption }], ngImport: i0, template: "<span class=\"group-name text-truncate\">{{ thyGroupLabel() }}</span>\n<ng-content></ng-content>\n" }); }
1348
- }
1349
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: ThySelectOptionGroup, decorators: [{
1350
- type: Component,
1351
- args: [{ selector: 'thy-option-group', host: {
1352
- class: 'thy-option-item-group',
1353
- '[class.disabled]': 'thyDisabled()',
1354
- '[class.thy-select-option-group-hidden]': 'hidden()'
1355
- }, template: "<span class=\"group-name text-truncate\">{{ thyGroupLabel() }}</span>\n<ng-content></ng-content>\n" }]
1356
- }], propDecorators: { thyDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyDisabled", required: false }] }], thyGroupLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyGroupLabel", required: false }] }], options: [{
1357
- type: ContentChildren,
1358
- args: [ThyOption]
1359
- }] } });
1360
-
1361
- class ThyOptionsContainer {
1362
- constructor() {
1363
- this.optionsTemplate = viewChild('options', ...(ngDevMode ? [{ debugName: "optionsTemplate" }] : []));
1370
+ this.thyDisabled = input(false, ...(ngDevMode ? [{ debugName: "thyDisabled", transform: coerceBooleanProperty }] : [{ transform: coerceBooleanProperty }]));
1364
1371
  }
1365
- ngOnInit() { }
1366
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: ThyOptionsContainer, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1367
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.3.14", type: ThyOptionsContainer, isStandalone: true, selector: "thy-options-container", viewQueries: [{ propertyName: "optionsTemplate", first: true, predicate: ["options"], descendants: true, isSignal: true }], ngImport: i0, template: `
1368
- <ng-template #options>
1369
- <ng-content></ng-content>
1370
- </ng-template>
1371
- `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1372
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: ThyOptionGroupRender, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1373
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.14", type: ThyOptionGroupRender, isStandalone: true, selector: "thy-option-group-render", inputs: { thyGroupLabel: { classPropertyName: "thyGroupLabel", publicName: "thyGroupLabel", isSignal: true, isRequired: false, transformFunction: null }, thyDisabled: { classPropertyName: "thyDisabled", publicName: "thyDisabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.disabled": "thyDisabled()" }, classAttribute: "thy-option-group-render" }, ngImport: i0, template: `<span class="group-name text-truncate">{{ thyGroupLabel() }}</span>`, isInline: true }); }
1372
1374
  }
1373
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: ThyOptionsContainer, decorators: [{
1375
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: ThyOptionGroupRender, decorators: [{
1374
1376
  type: Component,
1375
1377
  args: [{
1376
- selector: 'thy-options-container',
1377
- template: `
1378
- <ng-template #options>
1379
- <ng-content></ng-content>
1380
- </ng-template>
1381
- `,
1382
- changeDetection: ChangeDetectionStrategy.OnPush
1378
+ selector: 'thy-option-group-render',
1379
+ template: `<span class="group-name text-truncate">{{ thyGroupLabel() }}</span>`,
1380
+ host: {
1381
+ class: 'thy-option-group-render',
1382
+ '[class.disabled]': 'thyDisabled()'
1383
+ }
1383
1384
  }]
1384
- }], ctorParameters: () => [], propDecorators: { optionsTemplate: [{ type: i0.ViewChild, args: ['options', { isSignal: true }] }] } });
1385
+ }], propDecorators: { thyGroupLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyGroupLabel", required: false }] }], thyDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyDisabled", required: false }] }] } });
1385
1386
 
1386
1387
  /**
1387
1388
  * @license
@@ -1392,20 +1393,42 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
1392
1393
  */
1393
1394
  class ThyOptionModule {
1394
1395
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: ThyOptionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1395
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.14", ngImport: i0, type: ThyOptionModule, imports: [CommonModule, ThyIconModule, ThyListOption, ThyOptionGroup, ThyOption, ThySelectOptionGroup, ThyOptionsContainer], exports: [ThyListOption, ThyOptionGroup, ThyOption, ThySelectOptionGroup, ThyOptionsContainer] }); }
1396
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: ThyOptionModule, imports: [CommonModule, ThyIconModule, ThyListOption, ThyOption] }); }
1396
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.14", ngImport: i0, type: ThyOptionModule, imports: [CommonModule,
1397
+ ThyIconModule,
1398
+ ThyListOption,
1399
+ ThyOptionGroup,
1400
+ ThyOption,
1401
+ ThyOptionRender,
1402
+ ThySelectOptionGroup,
1403
+ ThyOptionGroupRender], exports: [ThyListOption, ThyOptionGroup, ThyOption, ThyOptionRender, ThySelectOptionGroup, ThyOptionGroupRender] }); }
1404
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: ThyOptionModule, imports: [CommonModule,
1405
+ ThyIconModule,
1406
+ ThyListOption,
1407
+ ThyOptionRender] }); }
1397
1408
  }
1398
1409
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: ThyOptionModule, decorators: [{
1399
1410
  type: NgModule,
1400
1411
  args: [{
1401
- imports: [CommonModule, ThyIconModule, ThyListOption, ThyOptionGroup, ThyOption, ThySelectOptionGroup, ThyOptionsContainer],
1402
- exports: [ThyListOption, ThyOptionGroup, ThyOption, ThySelectOptionGroup, ThyOptionsContainer]
1412
+ imports: [
1413
+ CommonModule,
1414
+ ThyIconModule,
1415
+ ThyListOption,
1416
+ ThyOptionGroup,
1417
+ ThyOption,
1418
+ ThyOptionRender,
1419
+ ThySelectOptionGroup,
1420
+ ThyOptionGroupRender
1421
+ ],
1422
+ exports: [ThyListOption, ThyOptionGroup, ThyOption, ThyOptionRender, ThySelectOptionGroup, ThyOptionGroupRender]
1403
1423
  }]
1404
1424
  }] });
1405
1425
 
1426
+ class SelectOptionBase {
1427
+ }
1428
+
1406
1429
  /**
1407
1430
  * Generated bundle index. Do not edit.
1408
1431
  */
1409
1432
 
1410
- export { SelectOptionBase, THY_LIST_OPTION_PARENT_COMPONENT, THY_OPTION_PARENT_COMPONENT, ThyAutofocusDirective, ThyContextMenuDirective, ThyCtrlEnterDirective, ThyDragDropDirective, ThyEnterDirective, ThyFormCheckBaseComponent, ThyListOption, ThyOption, ThyOptionGroup, ThyOptionModule, ThyOptionSelectionChangeEvent, ThyOptionVisibleChangeEvent, ThyOptionsContainer, ThyScrollDirective, ThySelectCommonModule, ThySelectControl, ThySelectOptionGroup, ThySharedModule, ThyShowDirective, ThyStopPropagationDirective, ThyStringOrTemplateOutletDirective, ThyTranscludeDirective, ThyViewOutletDirective };
1433
+ export { SelectOptionBase, THY_LIST_OPTION_PARENT_COMPONENT, ThyAutofocusDirective, ThyContextMenuDirective, ThyCtrlEnterDirective, ThyDragDropDirective, ThyEnterDirective, ThyFormCheckBaseComponent, ThyListOption, ThyOption, ThyOptionGroup, ThyOptionGroupRender, ThyOptionModule, ThyOptionRender, ThyOptionSelectionChangeEvent, ThyScrollDirective, ThySelectCommonModule, ThySelectControl, ThySelectOptionGroup, ThySharedModule, ThyShowDirective, ThyStopPropagationDirective, ThyStringOrTemplateOutletDirective, ThyTranscludeDirective, ThyViewOutletDirective };
1411
1434
  //# sourceMappingURL=ngx-tethys-shared.mjs.map