@kris701/ez-ui 0.0.9 → 1.0.0

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 (34) hide show
  1. package/fesm2022/kris701-ez-ui.mjs +2536 -0
  2. package/fesm2022/kris701-ez-ui.mjs.map +1 -0
  3. package/package.json +22 -8
  4. package/types/kris701-ez-ui.d.ts +348 -0
  5. package/index.ts +0 -2
  6. package/ng-package.json +0 -15
  7. package/public-api.ts +0 -15
  8. package/src/components/dateinput.ts +0 -58
  9. package/src/components/floatfileupload.ts +0 -52
  10. package/src/components/floattable/filters/tuiThDateFilter.ts +0 -159
  11. package/src/components/floattable/filters/tuiThSelectFilter.ts +0 -178
  12. package/src/components/floattable/filters/tuiThTextFilter.ts +0 -161
  13. package/src/components/floattable/floattable.presets.ts +0 -197
  14. package/src/components/floattable/floattable.ts +0 -309
  15. package/src/components/floattable/helpers/floattable.filterhelpers.ts +0 -23
  16. package/src/components/floattable/models/FloatTableFilter.ts +0 -5
  17. package/src/components/floattable/models/FloatTableFilterMethod.ts +0 -5
  18. package/src/components/floattable/models/FloatTableSort.ts +0 -4
  19. package/src/components/floattable/models/FloatTableSortFilterPreset.ts +0 -10
  20. package/src/components/floattable/models/FloatTableSortFilterPresetSave.ts +0 -6
  21. package/src/components/floattable/models/FloatTableSortMethod.ts +0 -4
  22. package/src/components/floattable/services/floattable.filterservice.ts +0 -110
  23. package/src/components/floattable/sorts/tuiThSortable.ts +0 -75
  24. package/src/components/markdowneditor.ts +0 -340
  25. package/src/components/menubar.ts +0 -144
  26. package/src/components/multiselect.ts +0 -77
  27. package/src/components/numberinput.ts +0 -45
  28. package/src/components/passwordinput.ts +0 -44
  29. package/src/components/textinput.ts +0 -40
  30. package/src/helpers/compressImage.ts +0 -20
  31. package/src/interfaces/baseCRUDInterface.ts +0 -181
  32. package/src/interfaces/baseListService.ts +0 -62
  33. package/tsconfig.lib.json +0 -12
  34. package/tsconfig.lib.prod.json +0 -11
@@ -0,0 +1,348 @@
1
+ import * as i0 from '@angular/core';
2
+ import { OnChanges, EventEmitter, SimpleChanges, ElementRef, TemplateRef } from '@angular/core';
3
+ import { TuiDay, TuiTime } from '@taiga-ui/cdk/date-time';
4
+ import { HttpClient } from '@angular/common/http';
5
+ import { TuiResponsiveDialogService } from '@taiga-ui/addon-mobile';
6
+ import { TuiNotificationService } from '@taiga-ui/core';
7
+
8
+ declare class EzUIDateInput implements OnChanges {
9
+ icon: string;
10
+ label: string;
11
+ size: "l" | "m" | "s";
12
+ disabled: boolean;
13
+ min: Date | null;
14
+ max: Date | null;
15
+ TuiDay: typeof TuiDay;
16
+ value: Date | string;
17
+ valueChange: EventEmitter<string | Date>;
18
+ internalValue: TuiDay | null;
19
+ ngOnChanges(changes: SimpleChanges): void;
20
+ updateValue(): void;
21
+ static ɵfac: i0.ɵɵFactoryDeclaration<EzUIDateInput, never>;
22
+ static ɵcmp: i0.ɵɵComponentDeclaration<EzUIDateInput, "ezui-dateinput", never, { "icon": { "alias": "icon"; "required": false; }; "label": { "alias": "label"; "required": false; }; "size": { "alias": "size"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "min": { "alias": "min"; "required": false; }; "max": { "alias": "max"; "required": false; }; "value": { "alias": "value"; "required": false; }; }, { "valueChange": "valueChange"; }, never, never, true, never>;
23
+ }
24
+
25
+ declare class EzUIFileInput {
26
+ files: i0.WritableSignal<File[]>;
27
+ clear(): void;
28
+ protected onChange(files: File[] | File): void;
29
+ removeFile(file: File): void;
30
+ static ɵfac: i0.ɵɵFactoryDeclaration<EzUIFileInput, never>;
31
+ static ɵcmp: i0.ɵɵComponentDeclaration<EzUIFileInput, "ezui-fileinput", never, {}, {}, never, never, true, never>;
32
+ }
33
+
34
+ interface MenuBarItem {
35
+ label: string | null;
36
+ icon: string | null;
37
+ items: MenuBarItem[];
38
+ disabled: boolean;
39
+ expanded: boolean;
40
+ command(): Promise<any>;
41
+ }
42
+
43
+ declare class EzUIMarkdownEditor implements OnChanges {
44
+ preview: ElementRef<HTMLDivElement> | undefined;
45
+ editor: ElementRef<HTMLTextAreaElement> | undefined;
46
+ fileUpload: ElementRef<HTMLInputElement> | undefined;
47
+ disabled: boolean;
48
+ value: string | null;
49
+ valueChange: EventEmitter<string | null>;
50
+ unsavedValue: i0.WritableSignal<string>;
51
+ isFirst: boolean;
52
+ isEditing: i0.WritableSignal<boolean>;
53
+ items: i0.WritableSignal<MenuBarItem[]>;
54
+ onFileSelected(event: any): Promise<void>;
55
+ toBase65(file: File): Promise<unknown>;
56
+ onPaste(event: any): Promise<void>;
57
+ insertImageInEditor(file: File): Promise<void>;
58
+ replaceSection(newStr: string, finalStart: number, finalFinish: number): Promise<void>;
59
+ ngOnChanges(changes: SimpleChanges): Promise<void>;
60
+ formatPreview(): Promise<void>;
61
+ toggleEdit(save: boolean): Promise<void>;
62
+ static ɵfac: i0.ɵɵFactoryDeclaration<EzUIMarkdownEditor, never>;
63
+ static ɵcmp: i0.ɵɵComponentDeclaration<EzUIMarkdownEditor, "ezui-markdowneditor", never, { "disabled": { "alias": "disabled"; "required": false; }; "value": { "alias": "value"; "required": false; }; }, { "valueChange": "valueChange"; }, never, never, true, never>;
64
+ }
65
+
66
+ declare class EzUIMultiSelect implements OnChanges {
67
+ icon: string;
68
+ label: string;
69
+ size: "l" | "m" | "s";
70
+ optionLabel: string | undefined;
71
+ optionValue: string | undefined;
72
+ options: any[];
73
+ disabled: boolean;
74
+ selected: any[] | null | undefined;
75
+ selectedChange: EventEmitter<any[] | null | undefined>;
76
+ ngOnChanges(changes: SimpleChanges): void;
77
+ stringify: (value: string) => string;
78
+ getOptionLabel(item: any): any;
79
+ getOptionValue(item: any): any;
80
+ static ɵfac: i0.ɵɵFactoryDeclaration<EzUIMultiSelect, never>;
81
+ static ɵcmp: i0.ɵɵComponentDeclaration<EzUIMultiSelect, "ezui-multiselect", never, { "icon": { "alias": "icon"; "required": false; }; "label": { "alias": "label"; "required": false; }; "size": { "alias": "size"; "required": false; }; "optionLabel": { "alias": "optionLabel"; "required": false; }; "optionValue": { "alias": "optionValue"; "required": false; }; "options": { "alias": "options"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "selected": { "alias": "selected"; "required": false; }; }, { "selectedChange": "selectedChange"; }, never, never, true, never>;
82
+ }
83
+
84
+ declare class EzUINumberInput implements OnChanges {
85
+ icon: string;
86
+ label: string;
87
+ size: "l" | "m" | "s";
88
+ disabled: boolean;
89
+ min: number | null;
90
+ max: number | null;
91
+ value: number | string;
92
+ valueChange: EventEmitter<string | number>;
93
+ ngOnChanges(changes: SimpleChanges): void;
94
+ static ɵfac: i0.ɵɵFactoryDeclaration<EzUINumberInput, never>;
95
+ static ɵcmp: i0.ɵɵComponentDeclaration<EzUINumberInput, "ezui-numberinput", never, { "icon": { "alias": "icon"; "required": false; }; "label": { "alias": "label"; "required": false; }; "size": { "alias": "size"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "min": { "alias": "min"; "required": false; }; "max": { "alias": "max"; "required": false; }; "value": { "alias": "value"; "required": false; }; }, { "valueChange": "valueChange"; }, never, never, true, never>;
96
+ }
97
+
98
+ declare class EzUIPasswordInput implements OnChanges {
99
+ icon: string;
100
+ label: string;
101
+ size: "l" | "m" | "s";
102
+ disabled: boolean;
103
+ value: string;
104
+ valueChange: EventEmitter<string>;
105
+ ngOnChanges(changes: SimpleChanges): void;
106
+ static ɵfac: i0.ɵɵFactoryDeclaration<EzUIPasswordInput, never>;
107
+ static ɵcmp: i0.ɵɵComponentDeclaration<EzUIPasswordInput, "ezui-passwordinput", never, { "icon": { "alias": "icon"; "required": false; }; "label": { "alias": "label"; "required": false; }; "size": { "alias": "size"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "value": { "alias": "value"; "required": false; }; }, { "valueChange": "valueChange"; }, never, never, true, never>;
108
+ }
109
+
110
+ interface EzUITableFilter {
111
+ column: string;
112
+ value: any;
113
+ expression: string;
114
+ }
115
+
116
+ interface EzUITableSort {
117
+ column: string;
118
+ state: 'asc' | 'desc' | 'none';
119
+ }
120
+
121
+ interface EzUITableSortFilterPreset {
122
+ id: string;
123
+ name: string;
124
+ sorts: EzUITableSort[];
125
+ filters: EzUITableFilter[];
126
+ edit: boolean;
127
+ }
128
+
129
+ interface EzUITableFilterMethod {
130
+ key: string;
131
+ action: string;
132
+ filter(values: any[], column: string, value: any): any[];
133
+ }
134
+
135
+ interface EzUITableSortMethod {
136
+ state: 'asc' | 'desc' | 'none';
137
+ sort(a: any, b: any, column: string): number;
138
+ }
139
+
140
+ declare class EzUITableFilterService {
141
+ sortMethods: EzUITableSortMethod[];
142
+ filterMethods: EzUITableFilterMethod[];
143
+ sort(values: any[], sort: EzUITableSort): any[];
144
+ filter(values: any[], filter: EzUITableFilter): any[];
145
+ }
146
+
147
+ declare class EzUITablePresets implements OnChanges {
148
+ private table;
149
+ storageKey: string | null;
150
+ currentPreset: i0.WritableSignal<EzUITableSortFilterPreset | null>;
151
+ presets: i0.WritableSignal<EzUITableSortFilterPreset[]>;
152
+ constructor(table: EzUITable);
153
+ ngOnChanges(changes: SimpleChanges): Promise<void>;
154
+ ngOnInit(): void;
155
+ onPresetChange: EventEmitter<EzUITableSortFilterPreset | null>;
156
+ saveCurrentPreset(): void;
157
+ selectPreset(id: string): void;
158
+ createPreset(): void;
159
+ removePreset(id: string): void;
160
+ savePresets(): void;
161
+ clearFilters(): void;
162
+ static ɵfac: i0.ɵɵFactoryDeclaration<EzUITablePresets, never>;
163
+ static ɵcmp: i0.ɵɵComponentDeclaration<EzUITablePresets, "ezui-table-presets", never, { "storageKey": { "alias": "storageKey"; "required": false; }; }, { "onPresetChange": "onPresetChange"; }, never, never, true, never>;
164
+ }
165
+
166
+ declare class EzUITable implements OnChanges {
167
+ private filterService;
168
+ tableHeader: TemplateRef<any> | undefined;
169
+ tableRows: TemplateRef<any> | undefined;
170
+ tableExpandedrow: TemplateRef<any> | undefined;
171
+ presetHeader: EzUITablePresets | undefined;
172
+ disabled: boolean;
173
+ isLoading: i0.WritableSignal<boolean>;
174
+ showAdd: boolean;
175
+ showRefresh: boolean;
176
+ showClearFilters: boolean;
177
+ expandable: boolean;
178
+ values: any[];
179
+ internalValues: any[];
180
+ displayValues: i0.WritableSignal<any[]>;
181
+ sorts: i0.WritableSignal<EzUITableSort[]>;
182
+ filters: i0.WritableSignal<EzUITableFilter[]>;
183
+ storageKey: string | null;
184
+ allowPresets: boolean;
185
+ constructor(filterService: EzUITableFilterService);
186
+ ngOnChanges(changes: SimpleChanges): Promise<void>;
187
+ onAddItem: EventEmitter<any>;
188
+ onLoadItems: EventEmitter<any>;
189
+ onRowExpanded: EventEmitter<any>;
190
+ onPresetChange: EventEmitter<EzUITableSortFilterPreset | null>;
191
+ pageSize: i0.WritableSignal<number>;
192
+ page: i0.WritableSignal<number>;
193
+ pages: i0.WritableSignal<number>;
194
+ readonly pageSizes: number[];
195
+ processPage(): void;
196
+ applySorts(): void;
197
+ applyFilter(): void;
198
+ state: Record<number, boolean>;
199
+ setSort(sort: EzUITableSort): void;
200
+ clearSort(column: string): void;
201
+ setFilter(filter: EzUITableFilter): void;
202
+ clearFilter(column: string): void;
203
+ clearFilters(): void;
204
+ static ɵfac: i0.ɵɵFactoryDeclaration<EzUITable, never>;
205
+ static ɵcmp: i0.ɵɵComponentDeclaration<EzUITable, "ezui-table", never, { "disabled": { "alias": "disabled"; "required": false; }; "isLoading": { "alias": "isLoading"; "required": false; }; "showAdd": { "alias": "showAdd"; "required": false; }; "showRefresh": { "alias": "showRefresh"; "required": false; }; "showClearFilters": { "alias": "showClearFilters"; "required": false; }; "expandable": { "alias": "expandable"; "required": false; }; "values": { "alias": "values"; "required": false; }; "storageKey": { "alias": "storageKey"; "required": false; }; "allowPresets": { "alias": "allowPresets"; "required": false; }; "pageSize": { "alias": "pageSize"; "required": false; }; }, { "onAddItem": "onAddItem"; "onLoadItems": "onLoadItems"; "onRowExpanded": "onRowExpanded"; "onPresetChange": "onPresetChange"; }, ["tableHeader", "tableRows", "tableExpandedrow"], never, true, never>;
206
+ }
207
+
208
+ declare class EzUITableDateFilter {
209
+ column: string;
210
+ filterApplied: i0.WritableSignal<boolean>;
211
+ filterVisible: i0.WritableSignal<boolean>;
212
+ table: EzUITable;
213
+ value: [TuiDay, TuiTime];
214
+ filterType: any;
215
+ filterTypes: any[];
216
+ protected readonly stringify: (item: any) => string;
217
+ constructor(table: EzUITable);
218
+ applyFilter(expression: string): void;
219
+ clearFilter(): void;
220
+ static ɵfac: i0.ɵɵFactoryDeclaration<EzUITableDateFilter, never>;
221
+ static ɵcmp: i0.ɵɵComponentDeclaration<EzUITableDateFilter, "ezui-table-datefilter", never, { "column": { "alias": "column"; "required": false; }; }, {}, never, never, true, never>;
222
+ }
223
+
224
+ declare class EzUITableSelectFilter {
225
+ column: string;
226
+ filterApplied: i0.WritableSignal<boolean>;
227
+ filterVisible: i0.WritableSignal<boolean>;
228
+ table: EzUITable;
229
+ options: string[];
230
+ selected: string[];
231
+ filterType: any;
232
+ filterTypes: any[];
233
+ protected readonly stringify: (item: any) => string;
234
+ constructor(table: EzUITable);
235
+ applyFilter(expression: string): void;
236
+ clearFilter(): void;
237
+ static ɵfac: i0.ɵɵFactoryDeclaration<EzUITableSelectFilter, never>;
238
+ static ɵcmp: i0.ɵɵComponentDeclaration<EzUITableSelectFilter, "ezui-table-selectfilter", never, { "column": { "alias": "column"; "required": false; }; "options": { "alias": "options"; "required": false; }; }, {}, never, never, true, never>;
239
+ }
240
+
241
+ declare class EzUITableTextFilter {
242
+ column: string;
243
+ filterApplied: i0.WritableSignal<boolean>;
244
+ filterVisible: i0.WritableSignal<boolean>;
245
+ table: EzUITable;
246
+ value: string;
247
+ filterType: any;
248
+ filterTypes: any[];
249
+ protected readonly stringify: (item: any) => string;
250
+ constructor(table: EzUITable);
251
+ applyFilter(expression: string): void;
252
+ clearFilter(): void;
253
+ static ɵfac: i0.ɵɵFactoryDeclaration<EzUITableTextFilter, never>;
254
+ static ɵcmp: i0.ɵɵComponentDeclaration<EzUITableTextFilter, "ezui-table-textfilter", never, { "column": { "alias": "column"; "required": false; }; }, {}, never, never, true, never>;
255
+ }
256
+
257
+ declare class EzUIFilterHelpers {
258
+ static textFilter(values: any[], fn: (i: string) => boolean, column: string): any[];
259
+ static dateFilter(values: any[], fn: (i: Date) => boolean, column: string): any[];
260
+ }
261
+
262
+ interface EzUITableSortFilterPresetSave {
263
+ current: string | null;
264
+ presets: EzUITableSortFilterPreset[];
265
+ }
266
+
267
+ declare class EzUITTableSortableColumn {
268
+ column: string;
269
+ table: EzUITable;
270
+ state: 'asc' | 'desc' | 'none';
271
+ icon: i0.WritableSignal<string | null | undefined>;
272
+ constructor(table: EzUITable);
273
+ sort(): void;
274
+ static ɵfac: i0.ɵɵFactoryDeclaration<EzUITTableSortableColumn, never>;
275
+ static ɵcmp: i0.ɵɵComponentDeclaration<EzUITTableSortableColumn, "ezui-table-sortable", never, { "column": { "alias": "column"; "required": false; }; }, {}, never, never, true, never>;
276
+ }
277
+
278
+ declare class EzUITextInput implements OnChanges {
279
+ icon: string;
280
+ label: string;
281
+ size: "l" | "m" | "s";
282
+ disabled: boolean;
283
+ value: string;
284
+ valueChange: EventEmitter<string>;
285
+ ngOnChanges(changes: SimpleChanges): void;
286
+ static ɵfac: i0.ɵɵFactoryDeclaration<EzUITextInput, never>;
287
+ static ɵcmp: i0.ɵɵComponentDeclaration<EzUITextInput, "ezui-textinput", never, { "icon": { "alias": "icon"; "required": false; }; "label": { "alias": "label"; "required": false; }; "size": { "alias": "size"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "value": { "alias": "value"; "required": false; }; }, { "valueChange": "valueChange"; }, never, never, true, never>;
288
+ }
289
+
290
+ declare const compressImage: (file: File, quality: number, maxHeight: number, maxWidth: number, convertSize?: number) => Promise<File | Blob>;
291
+
292
+ declare abstract class BaseCRUDInterface {
293
+ http: HttpClient;
294
+ messageService: TuiNotificationService;
295
+ confirmationService: TuiResponsiveDialogService;
296
+ isLoading: i0.WritableSignal<boolean>;
297
+ allItems: i0.WritableSignal<any[]>;
298
+ currentItem: i0.WritableSignal<any>;
299
+ newItemTemplate(): any;
300
+ getAllEndpoint: string;
301
+ getEndpoint: string;
302
+ patchEndpoint: string;
303
+ postEndpoint: string;
304
+ deleteEndpoint: string;
305
+ canRead: boolean;
306
+ canWrite: boolean;
307
+ showDialog: i0.WritableSignal<boolean>;
308
+ loadOnInit: boolean;
309
+ showDeleteDialog: boolean;
310
+ deleteDialogMessage: string;
311
+ showSaveDialog: boolean;
312
+ savewDialogMessage: string;
313
+ constructor(http: HttpClient, messageService: TuiNotificationService, confirmationService: TuiResponsiveDialogService);
314
+ ngOnInit(): Promise<void>;
315
+ loadItems(): Promise<void>;
316
+ saveItem(): Promise<void>;
317
+ saveItemInner(): Promise<void>;
318
+ deleteItem(): Promise<void>;
319
+ deleteItemInner(): Promise<void>;
320
+ showEditItem(id: string): Promise<void>;
321
+ showAddItem(): Promise<void>;
322
+ static ɵfac: i0.ɵɵFactoryDeclaration<BaseCRUDInterface, never>;
323
+ static ɵdir: i0.ɵɵDirectiveDeclaration<BaseCRUDInterface, never, never, {}, {}, never, never, true, never>;
324
+ }
325
+
326
+ declare class BaseListService<T, TList extends IIdentifiable> {
327
+ http: HttpClient;
328
+ items: i0.WritableSignal<TList[]>;
329
+ getAllEndpoint: string;
330
+ getEndpoint: string;
331
+ isLoaded: boolean;
332
+ isLoading: boolean;
333
+ onUpdated: EventEmitter<any>;
334
+ constructor(http: HttpClient);
335
+ Load(): Promise<void>;
336
+ List(): Promise<TList[]>;
337
+ ListGet(id: string): Promise<TList | null>;
338
+ Get(id: string): Promise<T>;
339
+ waitForValue(test: any): Promise<void>;
340
+ static ɵfac: i0.ɵɵFactoryDeclaration<BaseListService<any, any>, never>;
341
+ static ɵdir: i0.ɵɵDirectiveDeclaration<BaseListService<any, any>, never, never, {}, {}, never, never, true, never>;
342
+ }
343
+ interface IIdentifiable {
344
+ id: string;
345
+ }
346
+
347
+ export { BaseCRUDInterface, BaseListService, EzUIDateInput, EzUIFileInput, EzUIFilterHelpers, EzUIMarkdownEditor, EzUIMultiSelect, EzUINumberInput, EzUIPasswordInput, EzUITTableSortableColumn, EzUITable, EzUITableDateFilter, EzUITableFilterService, EzUITableSelectFilter, EzUITableTextFilter, EzUITextInput, compressImage };
348
+ export type { EzUITableFilter, EzUITableFilterMethod, EzUITableSort, EzUITableSortFilterPreset, EzUITableSortFilterPresetSave, EzUITableSortMethod, IIdentifiable };
package/index.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './public-api';
2
-
package/ng-package.json DELETED
@@ -1,15 +0,0 @@
1
- {
2
- "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
- "dest": "../../dist/ez-ui",
4
- "lib": {
5
- "entryFile": "public-api.ts"
6
- },
7
- "allowedNonPeerDependencies":[
8
- "@taiga-ui/addon-mobile",
9
- "@taiga-ui/core",
10
- "@taiga-ui/kit",
11
- "@taiga-ui/icons",
12
- "compressorjs",
13
- "marked"
14
- ]
15
- }
package/public-api.ts DELETED
@@ -1,15 +0,0 @@
1
- // Components
2
- export * from './src/components/dateinput';
3
- export * from './src/components/markdowneditor';
4
- export * from './src/components/multiselect';
5
- export * from './src/components/numberinput';
6
- export * from './src/components/passwordinput';
7
- export * from './src/components/textinput';
8
-
9
- // Helpers
10
- export * from './src/helpers/compressImage';
11
-
12
- // Interfaces
13
- export * from './src/interfaces/baseCRUDInterface';
14
- export * from './src/interfaces/baseListService';
15
-
@@ -1,58 +0,0 @@
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
- }
@@ -1,52 +0,0 @@
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
- }
@@ -1,159 +0,0 @@
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
- }