@kris701/ez-ui 1.1.7 → 1.1.9

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.
@@ -1,20 +1,20 @@
1
+ import * as i2$1 from '@angular/common';
2
+ import { CommonModule } from '@angular/common';
1
3
  import * as i0 from '@angular/core';
2
- import { EventEmitter, signal, Output, Input, Component, ViewChild, ContentChild, Directive, inject } from '@angular/core';
4
+ import { EventEmitter, Output, Input, Component, signal, ViewChild, ContentChild, Directive, inject } from '@angular/core';
3
5
  import * as i1 from '@angular/forms';
4
6
  import { FormsModule } from '@angular/forms';
7
+ import * as i3$1 from '@taiga-ui/core';
8
+ import { TuiIcon, TuiInput, TuiButton, TuiDropdown, TuiOption, TuiGroup, TuiScrollbar, TuiSelectLike, TuiDataList, TuiTextfield, TuiHint, TuiLoader, TuiCheckbox, TUI_DARK_MODE, TuiRoot } from '@taiga-ui/core';
9
+ import * as i4$1 from '@taiga-ui/kit';
10
+ import { TuiBlock, TuiSwitch, TuiInputDate, TuiInputDateTime, TuiFiles, TuiChevron, TuiTextarea, TuiMultiSelect, TuiInputNumber, TuiInputChip, TuiPassword, TuiBadge, TuiStatus, TuiDataListWrapper, TuiBadgeNotification, TuiBadgedContent, TuiButtonSelect, TuiStringifyContentPipe, TUI_CONFIRM } from '@taiga-ui/kit';
5
11
  import * as i3$3 from '@taiga-ui/addon-mobile';
6
12
  import { TuiDropdownSheet } from '@taiga-ui/addon-mobile';
7
13
  import { TuiDay, TuiTime } from '@taiga-ui/cdk/date-time';
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';
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';
12
14
  import * as i2 from '@taiga-ui/core/components/label';
13
15
  import * as i3 from '@taiga-ui/core/components/textfield';
14
16
  import * as i4 from '@taiga-ui/core/portals/dropdown';
15
17
  import * as i6 from '@taiga-ui/core/components/calendar';
16
- import * as i2$1 from '@angular/common';
17
- import { CommonModule } from '@angular/common';
18
18
  import { marked } from 'marked';
19
19
  import Compressor from 'compressorjs';
20
20
  import * as i7 from '@taiga-ui/cdk/directives/item';
@@ -28,6 +28,76 @@ import * as i1$1 from '@angular/common/http';
28
28
  import * as i3$4 from '@angular/router';
29
29
  import { RouterLink, NavigationEnd, RouterModule } from '@angular/router';
30
30
 
31
+ class EzUIBooleanInput {
32
+ icon = '';
33
+ label = '';
34
+ size = 'm';
35
+ disabled = false;
36
+ value = false;
37
+ valueChange = new EventEmitter();
38
+ ngOnChanges(changes) {
39
+ if (changes['value'] && changes['value'].currentValue != changes['value'].previousValue) {
40
+ this.value = changes['value'].currentValue;
41
+ }
42
+ }
43
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: EzUIBooleanInput, deps: [], target: i0.ɵɵFactoryTarget.Component });
44
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.0", type: EzUIBooleanInput, isStandalone: true, selector: "ezui-booleaninput", inputs: { icon: "icon", label: "label", size: "size", disabled: "disabled", value: "value" }, outputs: { valueChange: "valueChange" }, usesOnChanges: true, ngImport: i0, template: `
45
+ <label class="boolean-container" [tuiBlock]="size">
46
+ @if(icon && icon != ''){
47
+ <tui-icon [icon]="icon" />
48
+ }
49
+ {{label}}
50
+ <div style="flex-grow:1"></div>
51
+ <input
52
+ size="s"
53
+ tuiSwitch
54
+ type="checkbox"
55
+ [disabled]="disabled"
56
+ [(ngModel)]="value"
57
+ (ngModelChange)="valueChange.emit(value)"
58
+ />
59
+ </label>
60
+ `, isInline: true, styles: [".boolean-container{display:flex;flex-direction:row;gap:10px;width:100%;background-color:var(--tui-background-neutral-1)}\n"], dependencies: [{ 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: "ngmodule", type: CommonModule }, { kind: "directive", type: TuiBlock, selector: "label[tuiBlock],input[tuiBlock]", inputs: ["tuiBlock"] }, { kind: "component", type: TuiSwitch, selector: "input[type=\"checkbox\"][tuiSwitch]", inputs: ["showIcons"] }, { kind: "component", type: TuiIcon, selector: "tui-icon:not([tuiBadge])", inputs: ["background"] }] });
61
+ }
62
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: EzUIBooleanInput, decorators: [{
63
+ type: Component,
64
+ args: [{ selector: 'ezui-booleaninput', imports: [
65
+ FormsModule,
66
+ CommonModule,
67
+ TuiBlock,
68
+ TuiSwitch,
69
+ TuiIcon
70
+ ], template: `
71
+ <label class="boolean-container" [tuiBlock]="size">
72
+ @if(icon && icon != ''){
73
+ <tui-icon [icon]="icon" />
74
+ }
75
+ {{label}}
76
+ <div style="flex-grow:1"></div>
77
+ <input
78
+ size="s"
79
+ tuiSwitch
80
+ type="checkbox"
81
+ [disabled]="disabled"
82
+ [(ngModel)]="value"
83
+ (ngModelChange)="valueChange.emit(value)"
84
+ />
85
+ </label>
86
+ `, styles: [".boolean-container{display:flex;flex-direction:row;gap:10px;width:100%;background-color:var(--tui-background-neutral-1)}\n"] }]
87
+ }], propDecorators: { icon: [{
88
+ type: Input
89
+ }], label: [{
90
+ type: Input
91
+ }], size: [{
92
+ type: Input
93
+ }], disabled: [{
94
+ type: Input
95
+ }], value: [{
96
+ type: Input
97
+ }], valueChange: [{
98
+ type: Output
99
+ }] } });
100
+
31
101
  class EzUIDateInput {
32
102
  icon = '';
33
103
  label = '';
@@ -3194,6 +3264,15 @@ class EzUIFilterHelpers {
3194
3264
  }
3195
3265
  return filtered;
3196
3266
  }
3267
+ static boolFilter(values, fn, column) {
3268
+ const filtered = [];
3269
+ for (const value of values) {
3270
+ const asBoolean = value[column];
3271
+ if (fn(asBoolean))
3272
+ filtered.push(value);
3273
+ }
3274
+ return filtered;
3275
+ }
3197
3276
  }
3198
3277
 
3199
3278
  class EzUITableFilterService {
@@ -3271,6 +3350,12 @@ class EzUITableFilterService {
3271
3350
  return i.getTime() > normal.getTime();
3272
3351
  }, column)
3273
3352
  },
3353
+ // Boolean filters
3354
+ {
3355
+ key: 'bol',
3356
+ action: 'true',
3357
+ filter: (values, column, value) => EzUIFilterHelpers.boolFilter(values, (i) => i === value, column)
3358
+ },
3274
3359
  ];
3275
3360
  sort(values, sort) {
3276
3361
  const target = this.sortMethods.find(x => x.state == sort.state);
@@ -3653,6 +3738,169 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
3653
3738
  type: Input
3654
3739
  }] } });
3655
3740
 
3741
+ class EzUITableBooleanFilter {
3742
+ column;
3743
+ filterApplied = signal(false, /* @ts-ignore */
3744
+ ...(ngDevMode ? [{ debugName: "filterApplied" }] : /* istanbul ignore next */ []));
3745
+ filterVisible = signal(false, /* @ts-ignore */
3746
+ ...(ngDevMode ? [{ debugName: "filterVisible" }] : /* istanbul ignore next */ []));
3747
+ table;
3748
+ value = false;
3749
+ constructor(table) {
3750
+ this.table = table;
3751
+ this.table.onPresetChange.subscribe(x => {
3752
+ if (!x) {
3753
+ this.value = false;
3754
+ this.filterApplied.set(false);
3755
+ return;
3756
+ }
3757
+ const filter = x.filters.find(x => x.column == this.column);
3758
+ console.log(filter);
3759
+ if (!filter || filter.expression != "bol;true") {
3760
+ this.value = false;
3761
+ this.filterApplied.set(false);
3762
+ return;
3763
+ }
3764
+ this.value = filter.value;
3765
+ this.filterApplied.set(true);
3766
+ });
3767
+ }
3768
+ applyFilter() {
3769
+ this.table.setFilter({
3770
+ column: this.column,
3771
+ value: this.value,
3772
+ expression: "bol;true",
3773
+ });
3774
+ this.filterVisible.set(false);
3775
+ this.filterApplied.set(true);
3776
+ }
3777
+ clearFilter() {
3778
+ this.table.clearFilter(this.column);
3779
+ this.filterVisible.set(false);
3780
+ this.filterApplied.set(false);
3781
+ }
3782
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: EzUITableBooleanFilter, deps: [{ token: EzUITable }], target: i0.ɵɵFactoryTarget.Component });
3783
+ 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: `
3784
+ @if(column){
3785
+ <tui-badged-content>
3786
+ @if(filterApplied()){
3787
+ <tui-badge-notification
3788
+ size="s"
3789
+ tuiSlot="top"
3790
+ >
3791
+ 1
3792
+ </tui-badge-notification>
3793
+ }
3794
+ <button
3795
+ tuiButton size="s"
3796
+ iconStart="funnel"
3797
+ appearance="flat-grayscale"
3798
+ style="opacity:0.72"
3799
+ [tuiDropdown]="filterPop"
3800
+ [(tuiDropdownOpen)]="filterVisible"
3801
+ (click)="filterVisible.set(true)"
3802
+ ></button>
3803
+ </tui-badged-content>
3804
+
3805
+ <ng-template #filterPop>
3806
+ <div class="filterPopContainer">
3807
+ <label tuiBlock="s" style="justify-content:center">
3808
+ True
3809
+ <input
3810
+ size="s"
3811
+ tuiCheckbox
3812
+ type="checkbox"
3813
+ [(ngModel)]="value"
3814
+ />
3815
+ </label>
3816
+ <button
3817
+ tuiButton size="s"
3818
+ iconStart="funnel"
3819
+ tuiButton
3820
+ (click)="applyFilter()"
3821
+ >
3822
+ Apply
3823
+ </button>
3824
+
3825
+ @if(filterApplied()){
3826
+ <button
3827
+ tuiButton size="s"
3828
+ iconStart="circle-x"
3829
+ appearance="secondary"
3830
+ tuiButton
3831
+ (click)="clearFilter()"
3832
+ >
3833
+ Clear
3834
+ </button>
3835
+ }
3836
+ </div>
3837
+ </ng-template>
3838
+ }
3839
+ `, 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"] }] });
3840
+ }
3841
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: EzUITableBooleanFilter, decorators: [{
3842
+ type: Component,
3843
+ args: [{ selector: 'ezui-table-booleanfilter', imports: [CommonModule, FormsModule, TuiDropdown, TuiDataListWrapper, TuiButton, TuiBadgeNotification, TuiBadgedContent, TuiInput, TuiCheckbox, TuiBlock], template: `
3844
+ @if(column){
3845
+ <tui-badged-content>
3846
+ @if(filterApplied()){
3847
+ <tui-badge-notification
3848
+ size="s"
3849
+ tuiSlot="top"
3850
+ >
3851
+ 1
3852
+ </tui-badge-notification>
3853
+ }
3854
+ <button
3855
+ tuiButton size="s"
3856
+ iconStart="funnel"
3857
+ appearance="flat-grayscale"
3858
+ style="opacity:0.72"
3859
+ [tuiDropdown]="filterPop"
3860
+ [(tuiDropdownOpen)]="filterVisible"
3861
+ (click)="filterVisible.set(true)"
3862
+ ></button>
3863
+ </tui-badged-content>
3864
+
3865
+ <ng-template #filterPop>
3866
+ <div class="filterPopContainer">
3867
+ <label tuiBlock="s" style="justify-content:center">
3868
+ True
3869
+ <input
3870
+ size="s"
3871
+ tuiCheckbox
3872
+ type="checkbox"
3873
+ [(ngModel)]="value"
3874
+ />
3875
+ </label>
3876
+ <button
3877
+ tuiButton size="s"
3878
+ iconStart="funnel"
3879
+ tuiButton
3880
+ (click)="applyFilter()"
3881
+ >
3882
+ Apply
3883
+ </button>
3884
+
3885
+ @if(filterApplied()){
3886
+ <button
3887
+ tuiButton size="s"
3888
+ iconStart="circle-x"
3889
+ appearance="secondary"
3890
+ tuiButton
3891
+ (click)="clearFilter()"
3892
+ >
3893
+ Clear
3894
+ </button>
3895
+ }
3896
+ </div>
3897
+ </ng-template>
3898
+ }
3899
+ `, styles: [".filterPopContainer{display:flex;flex-direction:column;gap:10px;padding:10px;min-width:20rem}\n"] }]
3900
+ }], ctorParameters: () => [{ type: EzUITable }], propDecorators: { column: [{
3901
+ type: Input
3902
+ }] } });
3903
+
3656
3904
  class EzUITableDateFilter {
3657
3905
  column;
3658
3906
  filterApplied = signal(false, /* @ts-ignore */
@@ -3778,6 +4026,7 @@ class EzUITableDateFilter {
3778
4026
  <button
3779
4027
  tuiButton size="s"
3780
4028
  iconStart="circle-x"
4029
+ appearance="secondary"
3781
4030
  tuiButton
3782
4031
  (click)="clearFilter()"
3783
4032
  >
@@ -3851,6 +4100,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
3851
4100
  <button
3852
4101
  tuiButton size="s"
3853
4102
  iconStart="circle-x"
4103
+ appearance="secondary"
3854
4104
  tuiButton
3855
4105
  (click)="clearFilter()"
3856
4106
  >
@@ -4010,6 +4260,7 @@ class EzUITableSelectFilter {
4010
4260
  <button
4011
4261
  tuiButton size="s"
4012
4262
  iconStart="circle-x"
4263
+ appearance="secondary"
4013
4264
  tuiButton
4014
4265
  (click)="clearFilter()"
4015
4266
  >
@@ -4102,6 +4353,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
4102
4353
  <button
4103
4354
  tuiButton size="s"
4104
4355
  iconStart="circle-x"
4356
+ appearance="secondary"
4105
4357
  tuiButton
4106
4358
  (click)="clearFilter()"
4107
4359
  >
@@ -4246,6 +4498,7 @@ class EzUITableTextFilter {
4246
4498
  <button
4247
4499
  tuiButton size="s"
4248
4500
  iconStart="circle-x"
4501
+ appearance="secondary"
4249
4502
  tuiButton
4250
4503
  (click)="clearFilter()"
4251
4504
  >
@@ -4314,6 +4567,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
4314
4567
  <button
4315
4568
  tuiButton size="s"
4316
4569
  iconStart="circle-x"
4570
+ appearance="secondary"
4317
4571
  tuiButton
4318
4572
  (click)="clearFilter()"
4319
4573
  >
@@ -5006,5 +5260,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
5006
5260
  * Generated bundle index. Do not edit.
5007
5261
  */
5008
5262
 
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 };
5263
+ export { BaseCRUDInterface, BaseListInterface, EzUIBooleanInput, EzUIDateInput, EzUIDateTimeInput, EzUIFileInput, EzUIFilterHelpers, EzUIIconSelector, EzUILayout, EzUILayoutService, EzUIMarkdownEditor, EzUIMenuBar, EzUIMenuBarSubDataList, EzUIMultiSelect, EzUINumberInput, EzUIPasswordInput, EzUITTableSortableColumn, EzUITable, EzUITableBooleanFilter, EzUITableDateFilter, EzUITableFilterService, EzUITableSelectFilter, EzUITableTextFilter, EzUITextInput, compressImage };
5010
5264
  //# sourceMappingURL=kris701-ez-ui.mjs.map