@kris701/ez-ui 0.0.3 → 0.0.4

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kris701/ez-ui",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^22.0.0",
6
6
  "@angular/core": "^22.0.0"
@@ -1,159 +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
- }
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
+ }
@@ -1,178 +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
- }
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
+ }