@kris701/ez-ui 1.4.11 → 1.4.13

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.
@@ -5,7 +5,7 @@ import { EventEmitter, Output, Input, Component, signal, ContentChild, ViewChild
5
5
  import * as i1 from '@angular/forms';
6
6
  import { FormsModule } from '@angular/forms';
7
7
  import * as i3$1 from '@taiga-ui/core';
8
- import { TuiIcon, TuiInput, TuiButton, TuiTitle, TuiLoader, TuiDialog, TuiDropdown, TuiOption, TuiGroup, TuiScrollbar, TuiSelectLike, TuiDataList, TuiTextfield, TuiLink, TuiHint, TuiCheckbox, TUI_DARK_MODE, TuiRoot } from '@taiga-ui/core';
8
+ import { TuiIcon, TuiInput, TuiButton, TuiTitle, TuiLoader, TuiDialog, TuiDropdown, TuiOption, TuiGroup, TuiScrollbar, TuiSelectLike, TuiDataList, TuiTextfield, TuiCheckbox, TuiLabel, TuiLink, TuiHint, TUI_DARK_MODE, TuiRoot } from '@taiga-ui/core';
9
9
  import * as i4$1 from '@taiga-ui/kit';
10
10
  import { TuiBlock, TuiSwitch, TuiInputDate, TuiInputDateTime, TuiFiles, TuiChevron, TuiTextarea, TuiChip, TuiMultiSelect, TuiInputChip, TuiTree, TuiInputNumber, TuiPassword, TuiSelect, TuiBadge, TuiStatus, TuiDataListWrapper, TuiBadgeNotification, TuiBadgedContent, tuiCreateDefaultDayRangePeriods, TuiButtonSelect, TuiInputDateDirective, TuiCalendarRange, TuiStringifyContentPipe, TUI_CONFIRM } from '@taiga-ui/kit';
11
11
  import * as i3$3 from '@taiga-ui/addon-mobile';
@@ -19,7 +19,7 @@ import * as i2$2 from '@taiga-ui/layout';
19
19
  import { TuiHeader, TuiBlockStatus, TuiElasticContainer, TuiNavigation, TuiAsideGroupComponent } from '@taiga-ui/layout';
20
20
  import { marked } from 'marked';
21
21
  import Compressor from 'compressorjs';
22
- import { TuiAutoFocus } from '@taiga-ui/cdk';
22
+ import { TuiAutoFocus, TuiMapperPipe } from '@taiga-ui/cdk';
23
23
  import * as i5 from '@taiga-ui/cdk/directives/item';
24
24
  import { moveItemInArray, CdkDropList, CdkDrag, CdkDragHandle } from '@angular/cdk/drag-drop';
25
25
  import * as i3$2 from '@taiga-ui/addon-table';
@@ -3293,9 +3293,29 @@ class EzUITreeMultiSelect {
3293
3293
  ...(ngDevMode ? [{ debugName: "searchValue" }] : /* istanbul ignore next */ []));
3294
3294
  showClear = true;
3295
3295
  map = new Map();
3296
+ visMap = new Map();
3296
3297
  ngOnChanges(changes) {
3298
+ if (changes['options'] && changes['options'].currentValue != changes['options'].previousValue) {
3299
+ let index = 0;
3300
+ for (let option of this.options)
3301
+ this.setIDs(option, "" + index++);
3302
+ }
3297
3303
  if (changes['selected'] && changes['selected'].currentValue != changes['selected'].previousValue) {
3298
3304
  this.selected = changes['selected'].currentValue;
3305
+ let newMap = new Map();
3306
+ if (this.selected)
3307
+ for (let item of this.selected)
3308
+ newMap.set(item.id, true);
3309
+ this.map = newMap;
3310
+ }
3311
+ }
3312
+ setIDs(parent, prefix) {
3313
+ if (!parent.id || parent.id == '')
3314
+ parent.id = prefix;
3315
+ if (parent.children) {
3316
+ let subIndex = 0;
3317
+ for (let child of parent.children)
3318
+ this.setIDs(child, prefix + ";" + subIndex++);
3299
3319
  }
3300
3320
  }
3301
3321
  stringify = (value) => value.label;
@@ -3304,7 +3324,7 @@ class EzUITreeMultiSelect {
3304
3324
  this.expandAllRec(option);
3305
3325
  }
3306
3326
  expandAllRec(from) {
3307
- this.map.set(from, true);
3327
+ this.visMap.set(from, true);
3308
3328
  if (from.children && from.children.length > 0)
3309
3329
  for (let child of from.children)
3310
3330
  this.expandAllRec(child);
@@ -3314,7 +3334,7 @@ class EzUITreeMultiSelect {
3314
3334
  this.collapseAllRec(option);
3315
3335
  }
3316
3336
  collapseAllRec(from) {
3317
- this.map.set(from, false);
3337
+ this.visMap.set(from, false);
3318
3338
  if (from.children && from.children.length > 0)
3319
3339
  for (let child of from.children)
3320
3340
  this.collapseAllRec(child);
@@ -3323,7 +3343,7 @@ class EzUITreeMultiSelect {
3323
3343
  let newMap = new Map();
3324
3344
  for (let option of this.options)
3325
3345
  this.expandSearchRec(option, newMap);
3326
- this.map = newMap;
3346
+ this.visMap = newMap;
3327
3347
  }
3328
3348
  expandSearchRec(from, newMap) {
3329
3349
  let expanded = false;
@@ -3341,15 +3361,55 @@ class EzUITreeMultiSelect {
3341
3361
  }
3342
3362
  return expanded;
3343
3363
  }
3364
+ onChecked(node, value) {
3365
+ flatten(node).filter(x => x.selectable != false).forEach((item) => {
3366
+ this.map.set(item.id, value);
3367
+ });
3368
+ this.map = new Map(this.map.entries());
3369
+ let newSelected = [];
3370
+ for (let node of this.options) {
3371
+ let nodes = flatten(node);
3372
+ for (let sub of nodes)
3373
+ if (this.map.get(sub.id) == true && !newSelected.find(x => x.id == sub.id))
3374
+ newSelected.push(sub);
3375
+ }
3376
+ this.selected = newSelected;
3377
+ this.selectedChange.emit(this.selected);
3378
+ }
3379
+ getValue = (item, map) => {
3380
+ let result = null;
3381
+ const flat = flatten(item);
3382
+ const key = flat[0];
3383
+ if (key) {
3384
+ result = !!map.get(key.id);
3385
+ }
3386
+ for (const item of flat) {
3387
+ if (result !== !!map.get(item.id)) {
3388
+ return null;
3389
+ }
3390
+ }
3391
+ return result;
3392
+ };
3344
3393
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: EzUITreeMultiSelect, deps: [], target: i0.ɵɵFactoryTarget.Component });
3345
3394
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.0", type: EzUITreeMultiSelect, isStandalone: true, selector: "ezui-treemultiselect", inputs: { icon: "icon", label: "label", size: "size", options: "options", disabled: "disabled", selected: "selected", enableSearch: "enableSearch", showClear: "showClear" }, outputs: { selectedChange: "selectedChange" }, queries: [{ propertyName: "itemTemplate", first: true, predicate: ["itemTemplate"], descendants: true }], usesOnChanges: true, ngImport: i0, template: `
3346
3395
  <tui-textfield multi tuiChevron [stringify]="stringify" [tuiTextfieldSize]="size" [iconStart]="icon" [tuiTextfieldCleaner]="showClear">
3347
3396
  @if(label != '' && size != 's'){
3348
3397
  <label tuiLabel>{{label}}</label>
3349
3398
  }
3350
- <input tuiInputChip tuiSelectLike [(ngModel)]="selected" [placeholder]="size == 's' ? label : ''" (ngModelChange)="selectedChange.emit(this.selected)" [disabled]="disabled"/>
3399
+ <input
3400
+ tuiInputChip
3401
+ tuiSelectLike
3402
+ [(ngModel)]="selected"
3403
+ [placeholder]="size == 's' ? label : ''"
3404
+ (ngModelChange)="selectedChange.emit(this.selected)"
3405
+ [disabled]="disabled"
3406
+ />
3351
3407
  <tui-input-chip *tuiItem/>
3352
- <tui-data-list *tuiDropdown tuiMultiSelectGroup >
3408
+ <div
3409
+ *tuiDropdown
3410
+ tuiMultiSelectGroup
3411
+ style="padding:.25rem;"
3412
+ >
3353
3413
  @if(enableSearch){
3354
3414
  <tui-textfield tuiTextfieldSize="s" iconStart="search" style="margin-bottom:5px">
3355
3415
  <input tuiInput tuiAutoFocus #field [(ngModel)]="searchValue" (click)="field.focus()" (ngModelChange)="searchChange()"/>
@@ -3367,33 +3427,39 @@ class EzUITreeMultiSelect {
3367
3427
  [content]="treeContent"
3368
3428
  [tuiTreeController]="false"
3369
3429
  [value]="root"
3370
- [map]="map"
3430
+ [map]="visMap"
3371
3431
  />
3372
3432
  }
3373
- </tui-data-list>
3433
+ </div>
3374
3434
  </tui-textfield>
3375
3435
 
3376
- <ng-template #treeContent let-node="node" let-value>
3377
- <div class="wrapper">
3378
- <button
3379
- tuiOption
3380
- [value]="value"
3381
- [disabled]="value.selectable === false"
3382
- [style.opacity]="!enableSearch || (searchValue() == '' || value.label.toLowerCase().includes(searchValue().toLowerCase())) ? (value.selectable === false ? 0.5 : 1) : 0.2"
3383
- >
3384
- @if(itemTemplate){
3385
- <ng-container [ngTemplateOutlet]="itemTemplate" [ngTemplateOutletContext]="{ $implicit: value }"></ng-container>
3386
- }
3387
- @else {
3388
- @if (value.icon) {
3389
- <tui-icon class="t-icon" [icon]="value.icon"/>
3390
- }
3391
- {{ value.label }}
3436
+ <ng-template #treeContent let-item>
3437
+ @let isDisabled = item.selectable === false && (!item.children || item.children.length == 0);
3438
+ <label
3439
+ tuiLabel
3440
+ [class]="{'wrapper':true, 'wrapperActive':!isDisabled}"
3441
+ [style.opacity]="!enableSearch || (searchValue() == '' || item.label.toLowerCase().includes(searchValue().toLowerCase())) ? (isDisabled ? 0.8 : 1) : 0.2"
3442
+ >
3443
+ <input
3444
+ size="s"
3445
+ tuiCheckbox
3446
+ type="checkbox"
3447
+ [disabled]="isDisabled"
3448
+ [ngModel]="item | tuiMapper: getValue : map"
3449
+ (ngModelChange)="onChecked(item, $event)"
3450
+ />
3451
+ @if(itemTemplate){
3452
+ <ng-container [ngTemplateOutlet]="itemTemplate" [ngTemplateOutletContext]="{ $implicit: item }"></ng-container>
3453
+ }
3454
+ @else {
3455
+ @if (item.icon) {
3456
+ <tui-icon class="t-icon" [icon]="item.icon"/>
3392
3457
  }
3393
- </button>
3394
- </div>
3458
+ <small>{{ item.label }}</small>
3459
+ }
3460
+ </label>
3395
3461
  </ng-template>
3396
- `, isInline: true, styles: [".toolbar{display:flex;flex-direction:row;gap:5px}.wrapper{display:flex;align-items:center;width:100%}.wrapper button{width:100%}.t-icon:before{font-size:1rem}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i4$1.TuiMultiSelectGroupDirective, selector: "[tuiMultiSelectGroup]" }, { kind: "component", type: i3$1.TuiDataListComponent, selector: "tui-data-list", inputs: ["emptyContent", "size"] }, { kind: "directive", type: i3$1.TuiOption, selector: "button[tuiOption], a[tuiOption], label[tuiOption]", inputs: ["disabled"] }, { kind: "directive", type: i3$1.TuiOptionWithValue, selector: "button[tuiOption][value], a[tuiOption][value], label[tuiOption][value]", inputs: ["disabled", "value"] }, { kind: "directive", type: i5.TuiItem, selector: "[tuiItem]" }, { kind: "directive", type: i2.TuiLabel, selector: "label[tuiLabel]" }, { kind: "component", type: i3$1.TuiTextfieldComponent, selector: "tui-textfield:not([multi])", inputs: ["content", "filler", "invalid", "tuiAppearanceFocus", "tuiAppearanceState"] }, { kind: "directive", type: i3$1.TuiTextfieldOptionsDirective, selector: "[tuiTextfieldAppearance],[tuiTextfieldSize],[tuiTextfieldCleaner]", inputs: ["tuiTextfieldAppearance", "tuiTextfieldSize", "tuiTextfieldCleaner"] }, { kind: "component", type: i3$1.TuiTextfieldMultiComponent, selector: "tui-textfield[multi]", inputs: ["rows"] }, { kind: "directive", type: i4.TuiDropdownContent, selector: "ng-template[tuiDropdown]" }, { kind: "directive", type: i4$1.TuiInputChipDirective, selector: "input[tuiInputChip]", inputs: ["separator", "unique"] }, { kind: "component", type: i4$1.TuiInputChipComponent, selector: "tui-input-chip", inputs: ["editable"] }, { kind: "directive", type: TuiSelectLike, selector: "[tuiSelectLike]" }, { kind: "directive", type: TuiChevron, selector: "[tuiChevron]", inputs: ["tuiChevron"] }, { kind: "directive", type: TuiAutoFocus, selector: "[tuiAutoFocus]", inputs: ["tuiAutoFocus"] }, { kind: "directive", type: i3$1.TuiInputDirective, selector: "input[tuiInput]", inputs: ["readOnly", "readonly", "invalid", "focused", "state"] }, { kind: "component", type: TuiIcon, selector: "tui-icon:not([tuiBadge])", inputs: ["background"] }, { kind: "directive", type: TuiButton, selector: "a[tuiButton],button[tuiButton],label[tuiButton],a[tuiIconButton],button[tuiIconButton],label[tuiIconButton]", inputs: ["size"] }, { kind: "component", type: i4$1.TuiTreeComponent, selector: "tui-tree", inputs: ["value", "trackBy", "content"] }, { kind: "directive", type: i4$1.TuiTreeChildren, selector: "tui-tree[childrenHandler]", inputs: ["childrenHandler"] }, { kind: "directive", type: i4$1.TuiTreeControllerDirective, selector: "[tuiTreeController][map]", inputs: ["tuiTreeController", "map"], outputs: ["toggled"], exportAs: ["tuiTreeController"] }] });
3462
+ `, isInline: true, styles: [".toolbar{display:flex;flex-direction:row;gap:5px}.wrapper{display:flex;flex-direction:row;align-items:center;width:100%!important;margin:3px;padding:2px;border-radius:var(--tui-radius-s)}.wrapper input{line-height:100%!important}.wrapperActive{cursor:pointer}.wrapperActive:hover{background:var(--tui-background-neutral-1)}.t-icon:before{font-size:1rem}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.CheckboxControlValueAccessor, selector: "input[type=checkbox]:not([ngNoCva])[formControlName],input[type=checkbox]:not([ngNoCva])[formControl],input[type=checkbox]:not([ngNoCva])[ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i4$1.TuiMultiSelectGroupDirective, selector: "[tuiMultiSelectGroup]" }, { kind: "directive", type: i5.TuiItem, selector: "[tuiItem]" }, { kind: "directive", type: i2.TuiLabel, selector: "label[tuiLabel]" }, { kind: "component", type: i3$1.TuiTextfieldComponent, selector: "tui-textfield:not([multi])", inputs: ["content", "filler", "invalid", "tuiAppearanceFocus", "tuiAppearanceState"] }, { kind: "directive", type: i3$1.TuiTextfieldOptionsDirective, selector: "[tuiTextfieldAppearance],[tuiTextfieldSize],[tuiTextfieldCleaner]", inputs: ["tuiTextfieldAppearance", "tuiTextfieldSize", "tuiTextfieldCleaner"] }, { kind: "component", type: i3$1.TuiTextfieldMultiComponent, selector: "tui-textfield[multi]", inputs: ["rows"] }, { kind: "directive", type: i4.TuiDropdownContent, selector: "ng-template[tuiDropdown]" }, { kind: "directive", type: i4$1.TuiInputChipDirective, selector: "input[tuiInputChip]", inputs: ["separator", "unique"] }, { kind: "component", type: i4$1.TuiInputChipComponent, selector: "tui-input-chip", inputs: ["editable"] }, { kind: "directive", type: TuiSelectLike, selector: "[tuiSelectLike]" }, { kind: "directive", type: TuiChevron, selector: "[tuiChevron]", inputs: ["tuiChevron"] }, { kind: "directive", type: TuiAutoFocus, selector: "[tuiAutoFocus]", inputs: ["tuiAutoFocus"] }, { kind: "directive", type: i3$1.TuiInputDirective, selector: "input[tuiInput]", inputs: ["readOnly", "readonly", "invalid", "focused", "state"] }, { kind: "component", type: TuiIcon, selector: "tui-icon:not([tuiBadge])", inputs: ["background"] }, { kind: "directive", type: TuiButton, selector: "a[tuiButton],button[tuiButton],label[tuiButton],a[tuiIconButton],button[tuiIconButton],label[tuiIconButton]", inputs: ["size"] }, { kind: "component", type: i4$1.TuiTreeComponent, selector: "tui-tree", inputs: ["value", "trackBy", "content"] }, { kind: "directive", type: i4$1.TuiTreeChildren, selector: "tui-tree[childrenHandler]", inputs: ["childrenHandler"] }, { kind: "directive", type: i4$1.TuiTreeControllerDirective, selector: "[tuiTreeController][map]", inputs: ["tuiTreeController", "map"], outputs: ["toggled"], exportAs: ["tuiTreeController"] }, { kind: "component", type: TuiCheckbox, selector: "input[type=\"checkbox\"][tuiCheckbox]" }, { kind: "pipe", type: TuiMapperPipe, name: "tuiMapper" }] });
3397
3463
  }
3398
3464
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: EzUITreeMultiSelect, decorators: [{
3399
3465
  type: Component,
@@ -3413,15 +3479,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
3413
3479
  TuiInput,
3414
3480
  TuiIcon,
3415
3481
  TuiButton,
3416
- TuiTree
3482
+ TuiTree,
3483
+ TuiLabel,
3484
+ TuiCheckbox,
3485
+ TuiMapperPipe
3417
3486
  ], template: `
3418
3487
  <tui-textfield multi tuiChevron [stringify]="stringify" [tuiTextfieldSize]="size" [iconStart]="icon" [tuiTextfieldCleaner]="showClear">
3419
3488
  @if(label != '' && size != 's'){
3420
3489
  <label tuiLabel>{{label}}</label>
3421
3490
  }
3422
- <input tuiInputChip tuiSelectLike [(ngModel)]="selected" [placeholder]="size == 's' ? label : ''" (ngModelChange)="selectedChange.emit(this.selected)" [disabled]="disabled"/>
3491
+ <input
3492
+ tuiInputChip
3493
+ tuiSelectLike
3494
+ [(ngModel)]="selected"
3495
+ [placeholder]="size == 's' ? label : ''"
3496
+ (ngModelChange)="selectedChange.emit(this.selected)"
3497
+ [disabled]="disabled"
3498
+ />
3423
3499
  <tui-input-chip *tuiItem/>
3424
- <tui-data-list *tuiDropdown tuiMultiSelectGroup >
3500
+ <div
3501
+ *tuiDropdown
3502
+ tuiMultiSelectGroup
3503
+ style="padding:.25rem;"
3504
+ >
3425
3505
  @if(enableSearch){
3426
3506
  <tui-textfield tuiTextfieldSize="s" iconStart="search" style="margin-bottom:5px">
3427
3507
  <input tuiInput tuiAutoFocus #field [(ngModel)]="searchValue" (click)="field.focus()" (ngModelChange)="searchChange()"/>
@@ -3439,33 +3519,39 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
3439
3519
  [content]="treeContent"
3440
3520
  [tuiTreeController]="false"
3441
3521
  [value]="root"
3442
- [map]="map"
3522
+ [map]="visMap"
3443
3523
  />
3444
3524
  }
3445
- </tui-data-list>
3525
+ </div>
3446
3526
  </tui-textfield>
3447
3527
 
3448
- <ng-template #treeContent let-node="node" let-value>
3449
- <div class="wrapper">
3450
- <button
3451
- tuiOption
3452
- [value]="value"
3453
- [disabled]="value.selectable === false"
3454
- [style.opacity]="!enableSearch || (searchValue() == '' || value.label.toLowerCase().includes(searchValue().toLowerCase())) ? (value.selectable === false ? 0.5 : 1) : 0.2"
3455
- >
3456
- @if(itemTemplate){
3457
- <ng-container [ngTemplateOutlet]="itemTemplate" [ngTemplateOutletContext]="{ $implicit: value }"></ng-container>
3458
- }
3459
- @else {
3460
- @if (value.icon) {
3461
- <tui-icon class="t-icon" [icon]="value.icon"/>
3462
- }
3463
- {{ value.label }}
3528
+ <ng-template #treeContent let-item>
3529
+ @let isDisabled = item.selectable === false && (!item.children || item.children.length == 0);
3530
+ <label
3531
+ tuiLabel
3532
+ [class]="{'wrapper':true, 'wrapperActive':!isDisabled}"
3533
+ [style.opacity]="!enableSearch || (searchValue() == '' || item.label.toLowerCase().includes(searchValue().toLowerCase())) ? (isDisabled ? 0.8 : 1) : 0.2"
3534
+ >
3535
+ <input
3536
+ size="s"
3537
+ tuiCheckbox
3538
+ type="checkbox"
3539
+ [disabled]="isDisabled"
3540
+ [ngModel]="item | tuiMapper: getValue : map"
3541
+ (ngModelChange)="onChecked(item, $event)"
3542
+ />
3543
+ @if(itemTemplate){
3544
+ <ng-container [ngTemplateOutlet]="itemTemplate" [ngTemplateOutletContext]="{ $implicit: item }"></ng-container>
3545
+ }
3546
+ @else {
3547
+ @if (item.icon) {
3548
+ <tui-icon class="t-icon" [icon]="item.icon"/>
3464
3549
  }
3465
- </button>
3466
- </div>
3550
+ <small>{{ item.label }}</small>
3551
+ }
3552
+ </label>
3467
3553
  </ng-template>
3468
- `, styles: [".toolbar{display:flex;flex-direction:row;gap:5px}.wrapper{display:flex;align-items:center;width:100%}.wrapper button{width:100%}.t-icon:before{font-size:1rem}\n"] }]
3554
+ `, styles: [".toolbar{display:flex;flex-direction:row;gap:5px}.wrapper{display:flex;flex-direction:row;align-items:center;width:100%!important;margin:3px;padding:2px;border-radius:var(--tui-radius-s)}.wrapper input{line-height:100%!important}.wrapperActive{cursor:pointer}.wrapperActive:hover{background:var(--tui-background-neutral-1)}.t-icon:before{font-size:1rem}\n"] }]
3469
3555
  }], propDecorators: { itemTemplate: [{
3470
3556
  type: ContentChild,
3471
3557
  args: ['itemTemplate', { static: false }]
@@ -3488,6 +3574,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
3488
3574
  }], showClear: [{
3489
3575
  type: Input
3490
3576
  }] } });
3577
+ function flatten(item) {
3578
+ return item.children
3579
+ ? item.children.map(flatten).reduce((arr, item) => [...arr, ...item], [])
3580
+ : [item];
3581
+ }
3491
3582
 
3492
3583
  class EzUINumberInput {
3493
3584
  icon = '';
@@ -4257,11 +4348,12 @@ class EzUITreeSelect {
4257
4348
 
4258
4349
  <ng-template #treeContent let-node="node" let-value>
4259
4350
  <div class="wrapper">
4351
+ @let isDisabled = value.selectable === false || (value.children && value.children.length > 0);
4260
4352
  <button
4261
4353
  tuiOption
4262
4354
  [value]="value"
4263
- [disabled]="value.selectable === false"
4264
- [style.opacity]="!enableSearch || (searchValue() == '' || value.label.toLowerCase().includes(searchValue().toLowerCase())) ? (value.selectable === false ? 0.5 : 1) : 0.2"
4355
+ [disabled]="isDisabled"
4356
+ [style.opacity]="!enableSearch || (searchValue() == '' || value.label.toLowerCase().includes(searchValue().toLowerCase())) ? (isDisabled ? 0.8 : 1) : 0.2"
4265
4357
  >
4266
4358
  @if(itemTemplate){
4267
4359
  <ng-container [ngTemplateOutlet]="itemTemplate" [ngTemplateOutletContext]="{ $implicit: value }"></ng-container>
@@ -4334,11 +4426,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
4334
4426
 
4335
4427
  <ng-template #treeContent let-node="node" let-value>
4336
4428
  <div class="wrapper">
4429
+ @let isDisabled = value.selectable === false || (value.children && value.children.length > 0);
4337
4430
  <button
4338
4431
  tuiOption
4339
4432
  [value]="value"
4340
- [disabled]="value.selectable === false"
4341
- [style.opacity]="!enableSearch || (searchValue() == '' || value.label.toLowerCase().includes(searchValue().toLowerCase())) ? (value.selectable === false ? 0.5 : 1) : 0.2"
4433
+ [disabled]="isDisabled"
4434
+ [style.opacity]="!enableSearch || (searchValue() == '' || value.label.toLowerCase().includes(searchValue().toLowerCase())) ? (isDisabled ? 0.8 : 1) : 0.2"
4342
4435
  >
4343
4436
  @if(itemTemplate){
4344
4437
  <ng-container [ngTemplateOutlet]="itemTemplate" [ngTemplateOutletContext]="{ $implicit: value }"></ng-container>