@kris701/ez-ui 1.1.7 → 1.1.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.
@@ -6,9 +6,9 @@ import * as i3$3 from '@taiga-ui/addon-mobile';
6
6
  import { TuiDropdownSheet } from '@taiga-ui/addon-mobile';
7
7
  import { TuiDay, TuiTime } from '@taiga-ui/cdk/date-time';
8
8
  import * as i3$1 from '@taiga-ui/core';
9
- import { TuiInput, TuiButton, TuiDropdown, TuiOption, TuiGroup, TuiScrollbar, TuiSelectLike, TuiDataList, TuiTextfield, TuiIcon, TuiHint, TuiLoader, TUI_DARK_MODE, TuiRoot } from '@taiga-ui/core';
9
+ import { TuiInput, TuiButton, TuiDropdown, TuiOption, TuiGroup, TuiScrollbar, TuiSelectLike, TuiDataList, TuiTextfield, TuiIcon, TuiHint, TuiLoader, TuiCheckbox, TUI_DARK_MODE, TuiRoot } from '@taiga-ui/core';
10
10
  import * as i4$1 from '@taiga-ui/kit';
11
- import { TuiInputDate, TuiInputDateTime, TuiFiles, TuiChevron, TuiTextarea, TuiMultiSelect, TuiInputNumber, TuiInputChip, TuiPassword, TuiBadge, TuiStatus, TuiDataListWrapper, TuiButtonSelect, TuiBadgeNotification, TuiStringifyContentPipe, TuiBadgedContent, TUI_CONFIRM } from '@taiga-ui/kit';
11
+ import { TuiInputDate, TuiInputDateTime, TuiFiles, TuiChevron, TuiTextarea, TuiMultiSelect, TuiInputNumber, TuiInputChip, TuiPassword, TuiBadge, TuiStatus, TuiDataListWrapper, TuiBadgeNotification, TuiBlock, TuiBadgedContent, TuiButtonSelect, TuiStringifyContentPipe, TUI_CONFIRM } from '@taiga-ui/kit';
12
12
  import * as i2 from '@taiga-ui/core/components/label';
13
13
  import * as i3 from '@taiga-ui/core/components/textfield';
14
14
  import * as i4 from '@taiga-ui/core/portals/dropdown';
@@ -3194,6 +3194,15 @@ class EzUIFilterHelpers {
3194
3194
  }
3195
3195
  return filtered;
3196
3196
  }
3197
+ static boolFilter(values, fn, column) {
3198
+ const filtered = [];
3199
+ for (const value of values) {
3200
+ const asBoolean = value[column];
3201
+ if (fn(asBoolean))
3202
+ filtered.push(value);
3203
+ }
3204
+ return filtered;
3205
+ }
3197
3206
  }
3198
3207
 
3199
3208
  class EzUITableFilterService {
@@ -3271,6 +3280,12 @@ class EzUITableFilterService {
3271
3280
  return i.getTime() > normal.getTime();
3272
3281
  }, column)
3273
3282
  },
3283
+ // Boolean filters
3284
+ {
3285
+ key: 'bol',
3286
+ action: 'true',
3287
+ filter: (values, column, value) => EzUIFilterHelpers.boolFilter(values, (i) => i === value, column)
3288
+ },
3274
3289
  ];
3275
3290
  sort(values, sort) {
3276
3291
  const target = this.sortMethods.find(x => x.state == sort.state);
@@ -3653,6 +3668,169 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
3653
3668
  type: Input
3654
3669
  }] } });
3655
3670
 
3671
+ class EzUITableBooleanFilter {
3672
+ column;
3673
+ filterApplied = signal(false, /* @ts-ignore */
3674
+ ...(ngDevMode ? [{ debugName: "filterApplied" }] : /* istanbul ignore next */ []));
3675
+ filterVisible = signal(false, /* @ts-ignore */
3676
+ ...(ngDevMode ? [{ debugName: "filterVisible" }] : /* istanbul ignore next */ []));
3677
+ table;
3678
+ value = false;
3679
+ constructor(table) {
3680
+ this.table = table;
3681
+ this.table.onPresetChange.subscribe(x => {
3682
+ if (!x) {
3683
+ this.value = false;
3684
+ this.filterApplied.set(false);
3685
+ return;
3686
+ }
3687
+ const filter = x.filters.find(x => x.column == this.column);
3688
+ console.log(filter);
3689
+ if (!filter || filter.expression != "bol;true") {
3690
+ this.value = false;
3691
+ this.filterApplied.set(false);
3692
+ return;
3693
+ }
3694
+ this.value = filter.value;
3695
+ this.filterApplied.set(true);
3696
+ });
3697
+ }
3698
+ applyFilter() {
3699
+ this.table.setFilter({
3700
+ column: this.column,
3701
+ value: this.value,
3702
+ expression: "bol;true",
3703
+ });
3704
+ this.filterVisible.set(false);
3705
+ this.filterApplied.set(true);
3706
+ }
3707
+ clearFilter() {
3708
+ this.table.clearFilter(this.column);
3709
+ this.filterVisible.set(false);
3710
+ this.filterApplied.set(false);
3711
+ }
3712
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: EzUITableBooleanFilter, deps: [{ token: EzUITable }], target: i0.ɵɵFactoryTarget.Component });
3713
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.0", type: EzUITableBooleanFilter, isStandalone: true, selector: "ezui-table-booleanfilter", inputs: { column: "column" }, ngImport: i0, template: `
3714
+ @if(column){
3715
+ <tui-badged-content>
3716
+ @if(filterApplied()){
3717
+ <tui-badge-notification
3718
+ size="s"
3719
+ tuiSlot="top"
3720
+ >
3721
+ 1
3722
+ </tui-badge-notification>
3723
+ }
3724
+ <button
3725
+ tuiButton size="s"
3726
+ iconStart="funnel"
3727
+ appearance="flat-grayscale"
3728
+ style="opacity:0.72"
3729
+ [tuiDropdown]="filterPop"
3730
+ [(tuiDropdownOpen)]="filterVisible"
3731
+ (click)="filterVisible.set(true)"
3732
+ ></button>
3733
+ </tui-badged-content>
3734
+
3735
+ <ng-template #filterPop>
3736
+ <div class="filterPopContainer">
3737
+ <label tuiBlock="s" style="justify-content:center">
3738
+ True
3739
+ <input
3740
+ size="s"
3741
+ tuiCheckbox
3742
+ type="checkbox"
3743
+ [(ngModel)]="value"
3744
+ />
3745
+ </label>
3746
+ <button
3747
+ tuiButton size="s"
3748
+ iconStart="funnel"
3749
+ tuiButton
3750
+ (click)="applyFilter()"
3751
+ >
3752
+ Apply
3753
+ </button>
3754
+
3755
+ @if(filterApplied()){
3756
+ <button
3757
+ tuiButton size="s"
3758
+ iconStart="circle-x"
3759
+ appearance="secondary"
3760
+ tuiButton
3761
+ (click)="clearFilter()"
3762
+ >
3763
+ Clear
3764
+ </button>
3765
+ }
3766
+ </div>
3767
+ </ng-template>
3768
+ }
3769
+ `, isInline: true, styles: [".filterPopContainer{display:flex;flex-direction:column;gap:10px;padding:10px;min-width:20rem}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { 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: "directive", type: i3$1.TuiDropdownDirective, selector: "[tuiDropdown]:not(ng-container):not(ng-template)", inputs: ["tuiDropdown"], exportAs: ["tuiDropdown"] }, { kind: "directive", type: i3$1.TuiDropdownOpen, selector: "[tuiDropdown][tuiDropdownAuto],[tuiDropdown][tuiDropdownOpen],[tuiDropdown][tuiDropdownOpenChange]", inputs: ["tuiDropdownEnabled", "tuiDropdownOpen"], outputs: ["tuiDropdownOpenChange"] }, { kind: "directive", type: TuiButton, selector: "a[tuiButton],button[tuiButton],a[tuiIconButton],button[tuiIconButton]", inputs: ["size"] }, { kind: "component", type: TuiBadgeNotification, selector: "tui-badge-notification", inputs: ["size"] }, { kind: "directive", type: i4$1.TuiBadgedContentDirective, selector: "[tuiSlot]", inputs: ["tuiSlot"] }, { kind: "component", type: i4$1.TuiBadgedContentComponent, selector: "tui-badged-content" }, { kind: "component", type: TuiCheckbox, selector: "input[type=\"checkbox\"][tuiCheckbox]" }, { kind: "directive", type: TuiBlock, selector: "label[tuiBlock],input[tuiBlock]", inputs: ["tuiBlock"] }] });
3770
+ }
3771
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: EzUITableBooleanFilter, decorators: [{
3772
+ type: Component,
3773
+ args: [{ selector: 'ezui-table-booleanfilter', imports: [CommonModule, FormsModule, TuiDropdown, TuiDataListWrapper, TuiButton, TuiBadgeNotification, TuiBadgedContent, TuiInput, TuiCheckbox, TuiBlock], template: `
3774
+ @if(column){
3775
+ <tui-badged-content>
3776
+ @if(filterApplied()){
3777
+ <tui-badge-notification
3778
+ size="s"
3779
+ tuiSlot="top"
3780
+ >
3781
+ 1
3782
+ </tui-badge-notification>
3783
+ }
3784
+ <button
3785
+ tuiButton size="s"
3786
+ iconStart="funnel"
3787
+ appearance="flat-grayscale"
3788
+ style="opacity:0.72"
3789
+ [tuiDropdown]="filterPop"
3790
+ [(tuiDropdownOpen)]="filterVisible"
3791
+ (click)="filterVisible.set(true)"
3792
+ ></button>
3793
+ </tui-badged-content>
3794
+
3795
+ <ng-template #filterPop>
3796
+ <div class="filterPopContainer">
3797
+ <label tuiBlock="s" style="justify-content:center">
3798
+ True
3799
+ <input
3800
+ size="s"
3801
+ tuiCheckbox
3802
+ type="checkbox"
3803
+ [(ngModel)]="value"
3804
+ />
3805
+ </label>
3806
+ <button
3807
+ tuiButton size="s"
3808
+ iconStart="funnel"
3809
+ tuiButton
3810
+ (click)="applyFilter()"
3811
+ >
3812
+ Apply
3813
+ </button>
3814
+
3815
+ @if(filterApplied()){
3816
+ <button
3817
+ tuiButton size="s"
3818
+ iconStart="circle-x"
3819
+ appearance="secondary"
3820
+ tuiButton
3821
+ (click)="clearFilter()"
3822
+ >
3823
+ Clear
3824
+ </button>
3825
+ }
3826
+ </div>
3827
+ </ng-template>
3828
+ }
3829
+ `, styles: [".filterPopContainer{display:flex;flex-direction:column;gap:10px;padding:10px;min-width:20rem}\n"] }]
3830
+ }], ctorParameters: () => [{ type: EzUITable }], propDecorators: { column: [{
3831
+ type: Input
3832
+ }] } });
3833
+
3656
3834
  class EzUITableDateFilter {
3657
3835
  column;
3658
3836
  filterApplied = signal(false, /* @ts-ignore */
@@ -3778,6 +3956,7 @@ class EzUITableDateFilter {
3778
3956
  <button
3779
3957
  tuiButton size="s"
3780
3958
  iconStart="circle-x"
3959
+ appearance="secondary"
3781
3960
  tuiButton
3782
3961
  (click)="clearFilter()"
3783
3962
  >
@@ -3851,6 +4030,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
3851
4030
  <button
3852
4031
  tuiButton size="s"
3853
4032
  iconStart="circle-x"
4033
+ appearance="secondary"
3854
4034
  tuiButton
3855
4035
  (click)="clearFilter()"
3856
4036
  >
@@ -4010,6 +4190,7 @@ class EzUITableSelectFilter {
4010
4190
  <button
4011
4191
  tuiButton size="s"
4012
4192
  iconStart="circle-x"
4193
+ appearance="secondary"
4013
4194
  tuiButton
4014
4195
  (click)="clearFilter()"
4015
4196
  >
@@ -4102,6 +4283,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
4102
4283
  <button
4103
4284
  tuiButton size="s"
4104
4285
  iconStart="circle-x"
4286
+ appearance="secondary"
4105
4287
  tuiButton
4106
4288
  (click)="clearFilter()"
4107
4289
  >
@@ -4246,6 +4428,7 @@ class EzUITableTextFilter {
4246
4428
  <button
4247
4429
  tuiButton size="s"
4248
4430
  iconStart="circle-x"
4431
+ appearance="secondary"
4249
4432
  tuiButton
4250
4433
  (click)="clearFilter()"
4251
4434
  >
@@ -4314,6 +4497,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
4314
4497
  <button
4315
4498
  tuiButton size="s"
4316
4499
  iconStart="circle-x"
4500
+ appearance="secondary"
4317
4501
  tuiButton
4318
4502
  (click)="clearFilter()"
4319
4503
  >
@@ -5006,5 +5190,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
5006
5190
  * Generated bundle index. Do not edit.
5007
5191
  */
5008
5192
 
5009
- export { BaseCRUDInterface, BaseListInterface, EzUIDateInput, EzUIDateTimeInput, EzUIFileInput, EzUIFilterHelpers, EzUIIconSelector, EzUILayout, EzUILayoutService, EzUIMarkdownEditor, EzUIMenuBar, EzUIMenuBarSubDataList, EzUIMultiSelect, EzUINumberInput, EzUIPasswordInput, EzUITTableSortableColumn, EzUITable, EzUITableDateFilter, EzUITableFilterService, EzUITableSelectFilter, EzUITableTextFilter, EzUITextInput, compressImage };
5193
+ export { BaseCRUDInterface, BaseListInterface, EzUIDateInput, EzUIDateTimeInput, EzUIFileInput, EzUIFilterHelpers, EzUIIconSelector, EzUILayout, EzUILayoutService, EzUIMarkdownEditor, EzUIMenuBar, EzUIMenuBarSubDataList, EzUIMultiSelect, EzUINumberInput, EzUIPasswordInput, EzUITTableSortableColumn, EzUITable, EzUITableBooleanFilter, EzUITableDateFilter, EzUITableFilterService, EzUITableSelectFilter, EzUITableTextFilter, EzUITextInput, compressImage };
5010
5194
  //# sourceMappingURL=kris701-ez-ui.mjs.map