@kris701/ez-ui 0.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.
Files changed (31) hide show
  1. package/README.md +64 -0
  2. package/ng-package.json +7 -0
  3. package/package.json +18 -0
  4. package/src/components/dateinput.ts +58 -0
  5. package/src/components/floatfileupload.ts +52 -0
  6. package/src/components/floattable/filters/tuiThDateFilter.ts +159 -0
  7. package/src/components/floattable/filters/tuiThSelectFilter.ts +178 -0
  8. package/src/components/floattable/filters/tuiThTextFilter.ts +161 -0
  9. package/src/components/floattable/floattable.presets.ts +197 -0
  10. package/src/components/floattable/floattable.ts +309 -0
  11. package/src/components/floattable/helpers/floattable.filterhelpers.ts +23 -0
  12. package/src/components/floattable/models/FloatTableFilter.ts +5 -0
  13. package/src/components/floattable/models/FloatTableFilterMethod.ts +5 -0
  14. package/src/components/floattable/models/FloatTableSort.ts +4 -0
  15. package/src/components/floattable/models/FloatTableSortFilterPreset.ts +10 -0
  16. package/src/components/floattable/models/FloatTableSortFilterPresetSave.ts +6 -0
  17. package/src/components/floattable/models/FloatTableSortMethod.ts +4 -0
  18. package/src/components/floattable/services/floattable.filterservice.ts +110 -0
  19. package/src/components/floattable/sorts/tuiThSortable.ts +75 -0
  20. package/src/components/markdowneditor.ts +340 -0
  21. package/src/components/menubar.ts +144 -0
  22. package/src/components/multiselect.ts +77 -0
  23. package/src/components/numberinput.ts +45 -0
  24. package/src/components/passwordinput.ts +44 -0
  25. package/src/components/textinput.ts +40 -0
  26. package/src/helpers/compressImage.ts +20 -0
  27. package/src/interfaces/baseCRUDInterface.ts +181 -0
  28. package/src/interfaces/baseListService.ts +62 -0
  29. package/src/public-api.ts +15 -0
  30. package/tsconfig.lib.json +12 -0
  31. package/tsconfig.lib.prod.json +11 -0
package/README.md ADDED
@@ -0,0 +1,64 @@
1
+ # EzUI
2
+
3
+ This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 22.0.0.
4
+
5
+ ## Code scaffolding
6
+
7
+ Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
8
+
9
+ ```bash
10
+ ng generate component component-name
11
+ ```
12
+
13
+ For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
14
+
15
+ ```bash
16
+ ng generate --help
17
+ ```
18
+
19
+ ## Building
20
+
21
+ To build the library, run:
22
+
23
+ ```bash
24
+ ng build EzUI
25
+ ```
26
+
27
+ This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
28
+
29
+ ### Publishing the Library
30
+
31
+ Once the project is built, you can publish your library by following these steps:
32
+
33
+ 1. Navigate to the `dist` directory:
34
+
35
+ ```bash
36
+ cd dist/ez-ui
37
+ ```
38
+
39
+ 2. Run the `npm publish` command to publish your library to the npm registry:
40
+ ```bash
41
+ npm publish
42
+ ```
43
+
44
+ ## Running unit tests
45
+
46
+ To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
47
+
48
+ ```bash
49
+ ng test
50
+ ```
51
+
52
+ ## Running end-to-end tests
53
+
54
+ For end-to-end (e2e) testing, run:
55
+
56
+ ```bash
57
+ ng e2e
58
+ ```
59
+
60
+ Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
61
+
62
+ ## Additional Resources
63
+
64
+ For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
+ "dest": "../../dist/ez-ui",
4
+ "lib": {
5
+ "entryFile": "src/public-api.ts"
6
+ }
7
+ }
package/package.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "@kris701/ez-ui",
3
+ "version": "0.0.1",
4
+ "peerDependencies": {
5
+ "@angular/common": "^22.0.0",
6
+ "@angular/core": "^22.0.0",
7
+ "@taiga-ui/addon-mobile": "^5.15.0",
8
+ "@taiga-ui/core": "^5.15.0",
9
+ "@taiga-ui/kit": "^5.15.0",
10
+ "@taiga-ui/icons": "^5.15.0",
11
+ "compressorjs": "^1.3.0",
12
+ "marked": "^18.0.6"
13
+ },
14
+ "dependencies": {
15
+ "tslib": "^2.3.0"
16
+ },
17
+ "sideEffects": false
18
+ }
@@ -0,0 +1,58 @@
1
+ import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
2
+ import { FormsModule } from '@angular/forms';
3
+ import { TuiDay } from '@taiga-ui/cdk/date-time';
4
+ import { TuiInput } from '@taiga-ui/core';
5
+ import { TuiInputDate } from '@taiga-ui/kit';
6
+
7
+ @Component({
8
+ selector: 'ezui-dateinput',
9
+ imports: [
10
+ FormsModule,
11
+ TuiInput,
12
+ TuiInputDate
13
+ ],
14
+ template: `
15
+ <tui-textfield [tuiTextfieldSize]="size" [iconStart]="icon">
16
+ @if(label){
17
+ <label tuiLabel>{{label}}</label>
18
+ }
19
+ <input tuiInputDate [(ngModel)]="internalValue" (ngModelChange)="updateValue()" [disabled]="disabled" [min]="min ? TuiDay.fromLocalNativeDate(min) : null" [max]="max ? TuiDay.fromLocalNativeDate(max) : null"/>
20
+ <tui-calendar *tuiDropdown />
21
+ </tui-textfield>
22
+ `,
23
+ styles: `
24
+ `
25
+ })
26
+ export class EzUIDateInput implements OnChanges {
27
+ @Input() icon: string = '';
28
+ @Input() label: string = '';
29
+
30
+ @Input() size: "l" | "m" | "s" = 'm';
31
+
32
+ @Input() disabled: boolean = false;
33
+
34
+ @Input() min : Date | null = null;
35
+ @Input() max : Date | null = null;
36
+
37
+ TuiDay = TuiDay;
38
+
39
+ @Input() value: Date | string = new Date;
40
+ @Output() valueChange = new EventEmitter<Date | string>();
41
+
42
+ internalValue : TuiDay | null = null;
43
+
44
+ ngOnChanges(changes: SimpleChanges) {
45
+ if (changes['value'] && changes['value'].currentValue != changes['value'].previousValue) {
46
+ this.value = changes['value'].currentValue;
47
+ this.value = new Date(this.value);
48
+ this.internalValue = TuiDay.fromUtcNativeDate(this.value);
49
+ }
50
+ }
51
+
52
+ updateValue(){
53
+ if (this.internalValue){
54
+ this.value = this.internalValue?.toUtcNativeDate();
55
+ this.valueChange.emit(this.value);
56
+ }
57
+ }
58
+ }
@@ -0,0 +1,52 @@
1
+ import { Component, signal } from '@angular/core';
2
+ import { FormsModule } from '@angular/forms';
3
+ import { TuiFiles } from '@taiga-ui/kit';
4
+
5
+ @Component({
6
+ selector: 'app-floatfileupload',
7
+ imports: [FormsModule, TuiFiles],
8
+ template:`
9
+ <label tuiInputFiles>
10
+ <input
11
+ #validator="tuiInputFilesValidator"
12
+ accept="*/*"
13
+ tuiInputFiles
14
+ [ngModel]="files()"
15
+ (ngModelChange)="onChange($event)"
16
+ />
17
+ </label>
18
+
19
+ <tui-files>
20
+ @for(file of files(); track file){
21
+ <tui-file
22
+ state="normal"
23
+ [file]="file"
24
+ (remove)="removeFile(file)"
25
+ />
26
+ }
27
+ </tui-files>
28
+ `
29
+ })
30
+ export default class FloatFileUpload {
31
+ public files = signal<File[]>([]);
32
+
33
+ public clear(){
34
+ this.files.set([]);
35
+ }
36
+
37
+ protected onChange(files: File[] | File): void {
38
+ if (files instanceof File)
39
+ this.files.set([files]);
40
+ else
41
+ this.files.set(files);
42
+ }
43
+
44
+ removeFile(file : File){
45
+ var files = this.files();
46
+ var index = files.indexOf(file);
47
+ if (index != -1){
48
+ files.splice(index, 1);
49
+ this.files.set(files);
50
+ }
51
+ }
52
+ }
@@ -0,0 +1,159 @@
1
+ import { CommonModule } from "@angular/common";
2
+ import { Component, Input, signal } from "@angular/core";
3
+ import { FormsModule } from "@angular/forms";
4
+ import { TuiDay, TuiTime } from "@taiga-ui/cdk/date-time";
5
+ import { TuiButton, TuiDropdown, TuiInput } from "@taiga-ui/core";
6
+ import { TuiBadgeNotification, TuiBadgedContent, TuiButtonSelect, TuiDataListWrapper, TuiInputDateTime, TuiStringifyContentPipe } from "@taiga-ui/kit";
7
+ import { FloatTable } from "../floattable";
8
+ import { FloatTableFilter } from "../models/FloatTableFilter";
9
+
10
+ @Component({
11
+ selector: 'tuiThDateFilter',
12
+ imports: [CommonModule, FormsModule, TuiDropdown, TuiDataListWrapper, TuiButton, TuiButtonSelect, TuiStringifyContentPipe, TuiBadgeNotification, TuiBadgedContent, TuiInput, TuiInputDateTime],
13
+ template: `
14
+ @if(tuiThDateFilter){
15
+ <tui-badged-content>
16
+ @if(filterApplied()){
17
+ <tui-badge-notification
18
+ size="s"
19
+ tuiSlot="top"
20
+ >
21
+ 1
22
+ </tui-badge-notification>
23
+ }
24
+ <button
25
+ tuiButton size="s"
26
+ iconStart="funnel"
27
+ appearance="flat-grayscale"
28
+ style="opacity:0.72"
29
+ [tuiDropdown]="filterPop"
30
+ [(tuiDropdownOpen)]="filterVisible"
31
+ (click)="filterVisible.set(true)"
32
+ ></button>
33
+ </tui-badged-content>
34
+
35
+ <ng-template #filterPop>
36
+ <div class="flex flex-col gap-2 p-4" style="min-width:20rem">
37
+ <button
38
+ appearance="outline-grayscale"
39
+ size="s"
40
+ tuiButton
41
+ tuiButtonSelect
42
+ [(ngModel)]="filterType"
43
+ >
44
+ {{ filterType.label }}
45
+ <tui-data-list-wrapper
46
+ *tuiDropdown
47
+ [itemContent]="stringify | tuiStringifyContent"
48
+ [items]="filterTypes"
49
+ />
50
+ </button>
51
+
52
+ <tui-textfield (keydown.enter)="applyFilter(filterType.expression)">
53
+ <label tuiLabel>Choose a date</label>
54
+ <input
55
+ tuiInputDateTime
56
+ [(ngModel)]="value"
57
+ />
58
+ <tui-calendar *tuiDropdown />
59
+ </tui-textfield>
60
+ <button
61
+ tuiButton size="s"
62
+ iconStart="funnel"
63
+ tuiButton
64
+ (click)="applyFilter(filterType.expression)"
65
+ >
66
+ Apply
67
+ </button>
68
+
69
+ @if(filterApplied()){
70
+ <button
71
+ tuiButton size="s"
72
+ iconStart="circle-x"
73
+ tuiButton
74
+ (click)="clearFilter()"
75
+ >
76
+ Clear
77
+ </button>
78
+ }
79
+ </div>
80
+ </ng-template>
81
+ }
82
+ `
83
+ })
84
+ export class TableDateFilter {
85
+ @Input() tuiThDateFilter!: string;
86
+
87
+ filterApplied = signal<boolean>(false);
88
+ filterVisible = signal<boolean>(false);
89
+
90
+ table : FloatTable;
91
+
92
+ value : [TuiDay, TuiTime] = [TuiDay.currentLocal(), TuiTime.currentLocal()];
93
+ filterType : any;
94
+ filterTypes : any[];
95
+
96
+ protected readonly stringify = (item: any): string => `${item.label}`;
97
+
98
+ constructor(table : FloatTable){
99
+ this.table = table;
100
+
101
+ this.filterTypes = [
102
+ {
103
+ label: 'After',
104
+ expression: 'dat;aft'
105
+ },
106
+ {
107
+ label: 'Before',
108
+ expression: 'dat;bef'
109
+ }
110
+ ];
111
+ this.filterType = this.filterTypes[0];
112
+
113
+ this.table.onPresetChange.subscribe(x => {
114
+ if (!x)
115
+ {
116
+ this.filterType = this.filterTypes[0];
117
+ this.value = [TuiDay.currentLocal(), TuiTime.currentLocal()];
118
+ this.filterApplied.set(false);
119
+ return;
120
+ }
121
+ var filter = x.filters.find(x => x.column == this.tuiThDateFilter);
122
+ if (!filter)
123
+ {
124
+ this.filterType = this.filterTypes[0];
125
+ this.value = [TuiDay.currentLocal(), TuiTime.currentLocal()];
126
+ this.filterApplied.set(false);
127
+ return;
128
+ }
129
+ var type = this.filterTypes.find(x => x.expression == filter!.expression);
130
+ if (!type)
131
+ {
132
+ this.filterType = this.filterTypes[0];
133
+ this.value = [TuiDay.currentLocal(), TuiTime.currentLocal()];
134
+ this.filterApplied.set(false);
135
+ return;
136
+ }
137
+
138
+ this.filterType = type;
139
+ this.value = filter.value;
140
+ this.filterApplied.set(true);
141
+ })
142
+ }
143
+
144
+ applyFilter(expression : string){
145
+ this.table.setFilter({
146
+ column: this.tuiThDateFilter,
147
+ value: this.value,
148
+ expression: expression,
149
+ } as FloatTableFilter);
150
+ this.filterVisible.set(false);
151
+ this.filterApplied.set(true);
152
+ }
153
+
154
+ clearFilter(){
155
+ this.table.clearFilter(this.tuiThDateFilter);
156
+ this.filterVisible.set(false);
157
+ this.filterApplied.set(false);
158
+ }
159
+ }
@@ -0,0 +1,178 @@
1
+ import { CommonModule } from "@angular/common";
2
+ import { Component, Input, signal } from "@angular/core";
3
+ import { FormsModule } from "@angular/forms";
4
+ import { TuiButton, TuiDataList, TuiDropdown, TuiInput } from "@taiga-ui/core";
5
+ import { TuiBadgeNotification, TuiBadgedContent, TuiButtonSelect, TuiDataListWrapper, TuiMultiSelect, TuiStringifyContentPipe } from "@taiga-ui/kit";
6
+ import { FloatTable } from "../floattable";
7
+ import { FloatTableFilter } from "../models/FloatTableFilter";
8
+
9
+ @Component({
10
+ selector: 'tuiThSelectFilter',
11
+ imports: [CommonModule, FormsModule, TuiDropdown, TuiDataListWrapper, TuiButton, TuiButtonSelect, TuiStringifyContentPipe, TuiBadgeNotification, TuiBadgedContent, TuiInput, TuiMultiSelect, TuiDataList],
12
+ template: `
13
+ @if(tuiThSelectFilter){
14
+ <tui-badged-content>
15
+ @if(filterApplied()){
16
+ <tui-badge-notification
17
+ size="s"
18
+ tuiSlot="top"
19
+ >
20
+ 1
21
+ </tui-badge-notification>
22
+ }
23
+ <button
24
+ tuiButton size="s"
25
+ iconStart="funnel"
26
+ appearance="flat-grayscale"
27
+ style="opacity:0.72"
28
+ [tuiDropdown]="filterPop"
29
+ [(tuiDropdownOpen)]="filterVisible"
30
+ (click)="filterVisible.set(true)"
31
+ ></button>
32
+ </tui-badged-content>
33
+
34
+ <ng-template #filterPop>
35
+ <div class="flex flex-col gap-2 p-4" style="min-width:20rem">
36
+ <button
37
+ appearance="outline-grayscale"
38
+ size="s"
39
+ tuiButton
40
+ tuiButtonSelect
41
+ [(ngModel)]="filterType"
42
+ >
43
+ {{ filterType.label }}
44
+ <tui-data-list-wrapper
45
+ *tuiDropdown
46
+ [itemContent]="stringify | tuiStringifyContent"
47
+ [items]="filterTypes"
48
+ />
49
+ </button>
50
+
51
+ <button
52
+ appearance="secondary-grayscale"
53
+ size="s"
54
+ tuiButton
55
+ tuiButtonSelect
56
+ [(ngModel)]="selected"
57
+ >
58
+ {{selected.length === 1 ? selected[0] : 'Selected ' + selected.length}}
59
+
60
+ <tui-data-list *tuiDropdown>
61
+ <tui-opt-group
62
+ label="Options"
63
+ tuiMultiSelectGroup
64
+ >
65
+ @for (option of options; track option) {
66
+ <button
67
+ tuiOption
68
+ type="button"
69
+ [value]="option"
70
+ >
71
+ {{ option }}
72
+ </button>
73
+ }
74
+ </tui-opt-group>
75
+ </tui-data-list>
76
+ </button>
77
+
78
+ <button
79
+ tuiButton size="s"
80
+ iconStart="funnel"
81
+ tuiButton
82
+ (click)="applyFilter(filterType.expression)"
83
+ >
84
+ Apply
85
+ </button>
86
+
87
+ @if(filterApplied()){
88
+ <button
89
+ tuiButton size="s"
90
+ iconStart="circle-x"
91
+ tuiButton
92
+ (click)="clearFilter()"
93
+ >
94
+ Clear
95
+ </button>
96
+ }
97
+ </div>
98
+ </ng-template>
99
+ }
100
+ `
101
+ })
102
+ export class TableSelectFilter {
103
+ @Input() tuiThSelectFilter!: string;
104
+
105
+ filterApplied = signal<boolean>(false);
106
+ filterVisible = signal<boolean>(false);
107
+
108
+ table : FloatTable;
109
+
110
+ @Input() options : string[] = [];
111
+ selected : string[] = [];
112
+ filterType : any;
113
+ filterTypes : any[];
114
+
115
+ protected readonly stringify = (item: any): string => `${item.label}`;
116
+
117
+ constructor(table : FloatTable){
118
+ this.table = table;
119
+
120
+ this.filterTypes = [
121
+ {
122
+ label: 'Contains',
123
+ expression: 'sel;con'
124
+ },
125
+ {
126
+ label: 'Not Contains',
127
+ expression: 'sel;ncon'
128
+ }
129
+ ];
130
+ this.filterType = this.filterTypes[0];
131
+
132
+ this.table.onPresetChange.subscribe(x => {
133
+ if (!x)
134
+ {
135
+ this.filterType = this.filterTypes[0];
136
+ this.selected = [];
137
+ this.filterApplied.set(false);
138
+ return;
139
+ }
140
+ var filter = x.filters.find(x => x.column == this.tuiThSelectFilter);
141
+ if (!filter)
142
+ {
143
+ this.filterType = this.filterTypes[0];
144
+ this.selected = [];
145
+ this.filterApplied.set(false);
146
+ return;
147
+ }
148
+ var type = this.filterTypes.find(x => x.expression == filter!.expression);
149
+ if (!type)
150
+ {
151
+ this.filterType = this.filterTypes[0];
152
+ this.selected = [];
153
+ this.filterApplied.set(false);
154
+ return;
155
+ }
156
+
157
+ this.filterType = type;
158
+ this.selected = filter.value;
159
+ this.filterApplied.set(true);
160
+ })
161
+ }
162
+
163
+ applyFilter(expression : string){
164
+ this.table.setFilter({
165
+ column: this.tuiThSelectFilter,
166
+ value: this.selected,
167
+ expression: expression,
168
+ } as FloatTableFilter);
169
+ this.filterVisible.set(false);
170
+ this.filterApplied.set(true);
171
+ }
172
+
173
+ clearFilter(){
174
+ this.table.clearFilter(this.tuiThSelectFilter);
175
+ this.filterVisible.set(false);
176
+ this.filterApplied.set(false);
177
+ }
178
+ }
@@ -0,0 +1,161 @@
1
+ import { CommonModule } from "@angular/common";
2
+ import { Component, Input, signal } from "@angular/core";
3
+ import { FormsModule } from "@angular/forms";
4
+ import { TuiButton, TuiDropdown, TuiInput } from "@taiga-ui/core";
5
+ import { TuiBadgeNotification, TuiBadgedContent, TuiButtonSelect, TuiDataListWrapper, TuiStringifyContentPipe } from "@taiga-ui/kit";
6
+ import { FloatTable } from "../floattable";
7
+ import { FloatTableFilter } from "../models/FloatTableFilter";
8
+
9
+ @Component({
10
+ selector: 'tuiThTextFilter',
11
+ imports: [CommonModule, FormsModule, TuiDropdown, TuiDataListWrapper, TuiButton, TuiButtonSelect, TuiStringifyContentPipe, TuiBadgeNotification, TuiBadgedContent, TuiInput],
12
+ template: `
13
+ @if(tuiThTextFilter){
14
+ <tui-badged-content>
15
+ @if(filterApplied()){
16
+ <tui-badge-notification
17
+ size="s"
18
+ tuiSlot="top"
19
+ >
20
+ 1
21
+ </tui-badge-notification>
22
+ }
23
+ <button
24
+ tuiButton size="s"
25
+ iconStart="funnel"
26
+ appearance="flat-grayscale"
27
+ style="opacity:0.72"
28
+ [tuiDropdown]="filterPop"
29
+ [(tuiDropdownOpen)]="filterVisible"
30
+ (click)="filterVisible.set(true)"
31
+ ></button>
32
+ </tui-badged-content>
33
+
34
+ <ng-template #filterPop>
35
+ <div class="flex flex-col gap-2 p-4" style="min-width:20rem">
36
+ <button
37
+ appearance="outline-grayscale"
38
+ size="s"
39
+ tuiButton
40
+ tuiButtonSelect
41
+ [(ngModel)]="filterType"
42
+ >
43
+ {{ filterType.label }}
44
+ <tui-data-list-wrapper
45
+ *tuiDropdown
46
+ [itemContent]="stringify | tuiStringifyContent"
47
+ [items]="filterTypes"
48
+ />
49
+ </button>
50
+
51
+ <tui-textfield tuiTextfieldSize="s" (keydown.enter)="applyFilter(filterType.expression)">
52
+ <input tuiInput [(ngModel)]="value"/>
53
+ </tui-textfield>
54
+ <button
55
+ tuiButton size="s"
56
+ iconStart="funnel"
57
+ tuiButton
58
+ (click)="applyFilter(filterType.expression)"
59
+ >
60
+ Apply
61
+ </button>
62
+
63
+ @if(filterApplied()){
64
+ <button
65
+ tuiButton size="s"
66
+ iconStart="circle-x"
67
+ tuiButton
68
+ (click)="clearFilter()"
69
+ >
70
+ Clear
71
+ </button>
72
+ }
73
+ </div>
74
+ </ng-template>
75
+ }
76
+ `
77
+ })
78
+ export class TableTextFilter {
79
+ @Input() tuiThTextFilter!: string;
80
+
81
+ filterApplied = signal<boolean>(false);
82
+ filterVisible = signal<boolean>(false);
83
+
84
+ table : FloatTable;
85
+
86
+ value : string = '';
87
+ filterType : any;
88
+ filterTypes : any[];
89
+
90
+ protected readonly stringify = (item: any): string => `${item.label}`;
91
+
92
+ constructor(table : FloatTable){
93
+ this.table = table;
94
+
95
+ this.filterTypes = [
96
+ {
97
+ label: 'Contains',
98
+ expression: 'str;con'
99
+ },
100
+ {
101
+ label: 'Not Contains',
102
+ expression: 'str;ncon'
103
+ },
104
+ {
105
+ label: 'Starts With',
106
+ expression: 'str;sta'
107
+ },
108
+ {
109
+ label: 'Ends With',
110
+ expression: 'str;end'
111
+ }
112
+ ];
113
+ this.filterType = this.filterTypes[0];
114
+
115
+ this.table.onPresetChange.subscribe(x => {
116
+ if (!x)
117
+ {
118
+ this.filterType = this.filterTypes[0];
119
+ this.value = "";
120
+ this.filterApplied.set(false);
121
+ return;
122
+ }
123
+ var filter = x.filters.find(x => x.column == this.tuiThTextFilter);
124
+ if (!filter)
125
+ {
126
+ this.filterType = this.filterTypes[0];
127
+ this.value = "";
128
+ this.filterApplied.set(false);
129
+ return;
130
+ }
131
+ var type = this.filterTypes.find(x => x.expression == filter!.expression);
132
+ if (!type)
133
+ {
134
+ this.filterType = this.filterTypes[0];
135
+ this.value = "";
136
+ this.filterApplied.set(false);
137
+ return;
138
+ }
139
+
140
+ this.filterType = type;
141
+ this.value = filter.value;
142
+ this.filterApplied.set(true);
143
+ })
144
+ }
145
+
146
+ applyFilter(expression : string){
147
+ this.table.setFilter({
148
+ column: this.tuiThTextFilter,
149
+ value: this.value,
150
+ expression: expression,
151
+ } as FloatTableFilter);
152
+ this.filterVisible.set(false);
153
+ this.filterApplied.set(true);
154
+ }
155
+
156
+ clearFilter(){
157
+ this.table.clearFilter(this.tuiThTextFilter);
158
+ this.filterVisible.set(false);
159
+ this.filterApplied.set(false);
160
+ }
161
+ }