verben-ng-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.
- package/README.md +24 -0
- package/ng-package.json +10 -0
- package/package.json +34 -0
- package/src/lib/Verbena-input/error.service.ts +23 -0
- package/src/lib/Verbena-input/verbena-input.component.css +59 -0
- package/src/lib/Verbena-input/verbena-input.component.html +64 -0
- package/src/lib/Verbena-input/verbena-input.component.spec.ts +25 -0
- package/src/lib/Verbena-input/verbena-input.component.ts +162 -0
- package/src/lib/Verbena-input/verbena-input.module.ts +12 -0
- package/src/lib/components/TemplateDirective.directive.ts +10 -0
- package/src/lib/components/card/card.component.css +20 -0
- package/src/lib/components/card/card.component.html +23 -0
- package/src/lib/components/card/card.component.spec.ts +23 -0
- package/src/lib/components/card/card.component.ts +33 -0
- package/src/lib/components/card/card.module.ts +10 -0
- package/src/lib/components/card-data-view/card-data-view-footer/card-data-view-footer.component.css +3 -0
- package/src/lib/components/card-data-view/card-data-view-footer/card-data-view-footer.component.html +1 -0
- package/src/lib/components/card-data-view/card-data-view-footer/card-data-view-footer.component.spec.ts +23 -0
- package/src/lib/components/card-data-view/card-data-view-footer/card-data-view-footer.component.ts +10 -0
- package/src/lib/components/card-data-view/card-data-view-header/card-data-view-header.component.css +7 -0
- package/src/lib/components/card-data-view/card-data-view-header/card-data-view-header.component.html +1 -0
- package/src/lib/components/card-data-view/card-data-view-header/card-data-view-header.component.spec.ts +23 -0
- package/src/lib/components/card-data-view/card-data-view-header/card-data-view-header.component.ts +10 -0
- package/src/lib/components/card-data-view/card-data-view.component.css +39 -0
- package/src/lib/components/card-data-view/card-data-view.component.html +29 -0
- package/src/lib/components/card-data-view/card-data-view.component.spec.ts +23 -0
- package/src/lib/components/card-data-view/card-data-view.component.ts +66 -0
- package/src/lib/components/card-data-view/card-data-view.module.ts +20 -0
- package/src/lib/components/card-data-view/card-data.ts +7 -0
- package/src/lib/components/card-data-view/left-card-data/left-card-data.component.css +15 -0
- package/src/lib/components/card-data-view/left-card-data/left-card-data.component.html +4 -0
- package/src/lib/components/card-data-view/left-card-data/left-card-data.component.spec.ts +23 -0
- package/src/lib/components/card-data-view/left-card-data/left-card-data.component.ts +19 -0
- package/src/lib/components/card-data-view/left-card-data-view/left-card-data-view.component.css +0 -0
- package/src/lib/components/card-data-view/left-card-data-view/left-card-data-view.component.html +4 -0
- package/src/lib/components/card-data-view/left-card-data-view/left-card-data-view.component.spec.ts +23 -0
- package/src/lib/components/card-data-view/left-card-data-view/left-card-data-view.component.ts +12 -0
- package/src/lib/components/card-data-view/right-card-data-view/right-card-data-view.component.css +3 -0
- package/src/lib/components/card-data-view/right-card-data-view/right-card-data-view.component.html +1 -0
- package/src/lib/components/card-data-view/right-card-data-view/right-card-data-view.component.spec.ts +23 -0
- package/src/lib/components/card-data-view/right-card-data-view/right-card-data-view.component.ts +10 -0
- package/src/lib/components/chip/ChipChangeEvent.ts +4 -0
- package/src/lib/components/chip/chip.component.css +94 -0
- package/src/lib/components/chip/chip.component.html +49 -0
- package/src/lib/components/chip/chip.component.spec.ts +23 -0
- package/src/lib/components/chip/chip.component.ts +209 -0
- package/src/lib/components/chip/chip.module.ts +24 -0
- package/src/lib/components/chip/documentation.md +26 -0
- package/src/lib/components/data-export/data-export.component.css +0 -0
- package/src/lib/components/data-export/data-export.component.html +90 -0
- package/src/lib/components/data-export/data-export.component.spec.ts +23 -0
- package/src/lib/components/data-export/data-export.component.ts +158 -0
- package/src/lib/components/data-export/data-export.module.ts +13 -0
- package/src/lib/components/data-export/data-export.service.spec.ts +16 -0
- package/src/lib/components/data-export/data-export.service.ts +152 -0
- package/src/lib/components/data-export/data-export.types.ts +21 -0
- package/src/lib/components/data-table/column.directive.spec.ts +8 -0
- package/src/lib/components/data-table/column.directive.ts +19 -0
- package/src/lib/components/data-table/data-table.component.css +0 -0
- package/src/lib/components/data-table/data-table.component.html +55 -0
- package/src/lib/components/data-table/data-table.component.spec.ts +21 -0
- package/src/lib/components/data-table/data-table.component.ts +336 -0
- package/src/lib/components/data-table/data-table.module.ts +11 -0
- package/src/lib/components/data-table/data-table.types.ts +13 -0
- package/src/lib/components/data-table/style.types.ts +55 -0
- package/src/lib/components/data-view/data-view-click-outside.directive.ts +44 -0
- package/src/lib/components/data-view/data-view.component.css +74 -0
- package/src/lib/components/data-view/data-view.component.html +161 -0
- package/src/lib/components/data-view/data-view.component.spec.ts +23 -0
- package/src/lib/components/data-view/data-view.component.ts +136 -0
- package/src/lib/components/data-view/data-view.module.ts +16 -0
- package/src/lib/components/date-picker/date-picker.component.css +65 -0
- package/src/lib/components/date-picker/date-picker.component.html +60 -0
- package/src/lib/components/date-picker/date-picker.component.specs.ts +23 -0
- package/src/lib/components/date-picker/date-picker.component.ts +143 -0
- package/src/lib/components/date-picker/date-picker.module.ts +12 -0
- package/src/lib/components/drop-down/DropdownChangeEvent.ts +4 -0
- package/src/lib/components/drop-down/DropdownLoadEvent.ts +19 -0
- package/src/lib/components/drop-down/DropdownMenuItem.ts +42 -0
- package/src/lib/components/drop-down/documentation.md +69 -0
- package/src/lib/components/drop-down/drop-down-item/drop-down-item.component.css +123 -0
- package/src/lib/components/drop-down/drop-down-item/drop-down-item.component.html +133 -0
- package/src/lib/components/drop-down/drop-down-item/drop-down-item.component.spec.ts +23 -0
- package/src/lib/components/drop-down/drop-down-item/drop-down-item.component.ts +88 -0
- package/src/lib/components/drop-down/drop-down.component.css +317 -0
- package/src/lib/components/drop-down/drop-down.component.html +177 -0
- package/src/lib/components/drop-down/drop-down.component.spec.ts +23 -0
- package/src/lib/components/drop-down/drop-down.component.ts +757 -0
- package/src/lib/components/drop-down/drop-down.module.ts +24 -0
- package/src/lib/components/image/image.component.css +12 -0
- package/src/lib/components/image/image.component.html +18 -0
- package/src/lib/components/image/image.component.spec.ts +23 -0
- package/src/lib/components/image/image.component.ts +45 -0
- package/src/lib/components/image/image.module.ts +11 -0
- package/src/lib/components/notification/notification.component.css +3 -0
- package/src/lib/components/notification/notification.component.html +19 -0
- package/src/lib/components/notification/notification.component.spec.ts +23 -0
- package/src/lib/components/notification/notification.component.ts +77 -0
- package/src/lib/components/notification/notification.module.ts +14 -0
- package/src/lib/components/shared.module.ts +9 -0
- package/src/lib/components/sort-table/sort-table.component.css +67 -0
- package/src/lib/components/sort-table/sort-table.component.html +164 -0
- package/src/lib/components/sort-table/sort-table.component.spec.ts +23 -0
- package/src/lib/components/sort-table/sort-table.component.ts +204 -0
- package/src/lib/components/sort-table/sort-table.module.ts +11 -0
- package/src/lib/components/svg/svg.component.css +0 -0
- package/src/lib/components/svg/svg.component.html +1 -0
- package/src/lib/components/svg/svg.component.spec.ts +23 -0
- package/src/lib/components/svg/svg.component.ts +64 -0
- package/src/lib/components/svg/svg.module.ts +10 -0
- package/src/lib/components/table-filter/table-filter.component.css +93 -0
- package/src/lib/components/table-filter/table-filter.component.html +293 -0
- package/src/lib/components/table-filter/table-filter.component.spec.ts +23 -0
- package/src/lib/components/table-filter/table-filter.component.ts +221 -0
- package/src/lib/components/table-filter/table-filter.module.ts +25 -0
- package/src/lib/components/tooltip/tooltip.component.css +8 -0
- package/src/lib/components/tooltip/tooltip.component.html +13 -0
- package/src/lib/components/tooltip/tooltip.component.spec.ts +23 -0
- package/src/lib/components/tooltip/tooltip.component.ts +84 -0
- package/src/lib/components/tooltip/tooltip.module.ts +11 -0
- package/src/lib/components/verben-mail/verben-mail.component.config.ts +11 -0
- package/src/lib/components/verben-mail/verben-mail.component.css +71 -0
- package/src/lib/components/verben-mail/verben-mail.component.html +139 -0
- package/src/lib/components/verben-mail/verben-mail.component.ts +151 -0
- package/src/lib/components/verben-mail/verben-mail.module.ts +18 -0
- package/src/lib/components/visible-column/visible-column.component.css +83 -0
- package/src/lib/components/visible-column/visible-column.component.html +77 -0
- package/src/lib/components/visible-column/visible-column.component.spec.ts +23 -0
- package/src/lib/components/visible-column/visible-column.component.ts +106 -0
- package/src/lib/components/visible-column/visible-column.module.ts +11 -0
- package/src/lib/config.ts +37 -0
- package/src/lib/control-options/control-options.directive.ts +129 -0
- package/src/lib/control-options/control-options.module.ts +10 -0
- package/src/lib/convert-to-integer/convert-to-integer.directive.ts +28 -0
- package/src/lib/convert-to-integer/convert-to-integer.module.ts +10 -0
- package/src/lib/convert-to-integer/public-api.ts +1 -0
- package/src/lib/convert-to-number/convert-to-number.directive.ts +22 -0
- package/src/lib/convert-to-number/convert-to-number.module.ts +8 -0
- package/src/lib/convert-to-number/public-api.ts +1 -0
- package/src/lib/email-validator/email-validator.directive.ts +24 -0
- package/src/lib/email-validator/email-validator.module.ts +14 -0
- package/src/lib/models/column-filter.ts +5 -0
- package/src/lib/models/data-filter.ts +8 -0
- package/src/lib/models/mail-model.ts +8 -0
- package/src/lib/models/sort-filter.ts +0 -0
- package/src/lib/models/table-filter.ts +34 -0
- package/src/lib/number-range/number-range.directive.ts +35 -0
- package/src/lib/number-range/number-range.module.ts +11 -0
- package/src/lib/phone-number/phone-number.directive.ts +22 -0
- package/src/lib/phone-number/phone-number.module.ts +10 -0
- package/src/lib/phone-number/public-api.ts +1 -0
- package/src/lib/required-input/required-input.directive.ts +18 -0
- package/src/lib/required-input/required-input.module.ts +8 -0
- package/src/lib/theme-switcher/theme-switcher.directive.spec.ts +8 -0
- package/src/lib/theme-switcher/theme-switcher.directive.ts +70 -0
- package/src/lib/theme-switcher/theme-switcher.module.ts +8 -0
- package/src/lib/validate/error-message.service.ts +104 -0
- package/src/lib/validate/validate.directive.ts +110 -0
- package/src/lib/validate/validate.module.ts +17 -0
- package/src/lib/validate-input/validate-input.directive.ts +8 -0
- package/src/lib/validate-input/validate-input.module.ts +8 -0
- package/src/lib/verben-ng-ui.component.spec.ts +23 -0
- package/src/lib/verben-ng-ui.component.ts +16 -0
- package/src/lib/verben-ng-ui.service.spec.ts +16 -0
- package/src/lib/verben-ng-ui.service.ts +9 -0
- package/src/lib/verbena-badge/verbena-badge.component.css +16 -0
- package/src/lib/verbena-badge/verbena-badge.component.html +13 -0
- package/src/lib/verbena-badge/verbena-badge.component.spec.ts +25 -0
- package/src/lib/verbena-badge/verbena-badge.component.ts +18 -0
- package/src/lib/verbena-badge/verbena-badge.module.ts +10 -0
- package/src/lib/verbena-button/verbena-button.component.css +20 -0
- package/src/lib/verbena-button/verbena-button.component.html +25 -0
- package/src/lib/verbena-button/verbena-button.component.spec.ts +25 -0
- package/src/lib/verbena-button/verbena-button.component.ts +92 -0
- package/src/lib/verbena-button/verbena-button.module.ts +11 -0
- package/src/lib/verbena-switch/verbena-switch.component.css +45 -0
- package/src/lib/verbena-switch/verbena-switch.component.html +8 -0
- package/src/lib/verbena-switch/verbena-switch.component.spec.ts +25 -0
- package/src/lib/verbena-switch/verbena-switch.component.ts +31 -0
- package/src/lib/verbena-switch/verbena-switch.module.ts +10 -0
- package/src/lib/verbena-textarea/verbena-textarea.component.css +0 -0
- package/src/lib/verbena-textarea/verbena-textarea.component.html +19 -0
- package/src/lib/verbena-textarea/verbena-textarea.component.spec.ts +33 -0
- package/src/lib/verbena-textarea/verbena-textarea.component.ts +44 -0
- package/src/lib/verbena-textarea/verbena-textarea.module.ts +11 -0
- package/src/public-api.ts +122 -0
- package/src/styles.css +103 -0
- package/tsconfig.lib.json +15 -0
- package/tsconfig.lib.prod.json +11 -0
- package/tsconfig.spec.json +15 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
EventEmitter,
|
|
4
|
+
Input,
|
|
5
|
+
Output,
|
|
6
|
+
} from '@angular/core';
|
|
7
|
+
import { DataFilterType } from '../../models/table-filter';
|
|
8
|
+
import { IDataFilter } from '../../models/data-filter';
|
|
9
|
+
|
|
10
|
+
@Component({
|
|
11
|
+
selector: 'verben-sort-table',
|
|
12
|
+
templateUrl: './sort-table.component.html',
|
|
13
|
+
styleUrls: ['./sort-table.component.css'],
|
|
14
|
+
|
|
15
|
+
})
|
|
16
|
+
export class SortTableComponent {
|
|
17
|
+
@Input() enableDragAndDrop: boolean = false;
|
|
18
|
+
@Input() sortOptions: IDataFilter[] = [];
|
|
19
|
+
@Input() resetText: string = 'Reset';
|
|
20
|
+
@Input() displayedOptions: number = 4;
|
|
21
|
+
@Input() propertyText: string = 'Property';
|
|
22
|
+
@Input() showMoreText: string = 'Show more';
|
|
23
|
+
@Input() sortButtonText: string = 'Sort';
|
|
24
|
+
@Input() pd?: string;
|
|
25
|
+
@Input() mg?: string;
|
|
26
|
+
@Input() height?: string;
|
|
27
|
+
@Input() width?: string;
|
|
28
|
+
@Input() bgColor?: string;
|
|
29
|
+
@Input() boxShadow?: string;
|
|
30
|
+
@Input() textColor?: string;
|
|
31
|
+
@Input() primaryColor?: string;
|
|
32
|
+
@Input() secondaryColor?: string;
|
|
33
|
+
@Input() tertiaryColor?: string;
|
|
34
|
+
@Input() border?: string="";
|
|
35
|
+
@Input() borderRadius?: string;
|
|
36
|
+
@Input() selectWidth?: string;
|
|
37
|
+
@Input() containerHeight?:string="400px"
|
|
38
|
+
@Output() selectedOptions = new EventEmitter<IDataFilter[]>();
|
|
39
|
+
draggedIndex: number | null = null;
|
|
40
|
+
visibleSortOptions: IDataFilter[]= [];
|
|
41
|
+
hiddenSortOptions: IDataFilter[] = [];
|
|
42
|
+
showMore: boolean = false;
|
|
43
|
+
disableSortButton: boolean = false;
|
|
44
|
+
selectedOrders: Map<number, 'asc' | 'desc'> = new Map();
|
|
45
|
+
defaultSortOptions: IDataFilter[] = [];
|
|
46
|
+
checkAll: boolean = false;
|
|
47
|
+
ngOnInit() {
|
|
48
|
+
this.defaultSortOptions = [...this.sortOptions];
|
|
49
|
+
this.updateVisibleOptions();
|
|
50
|
+
this.updateSortButtonState();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
updateVisibleOptions() {
|
|
54
|
+
if (this.sortOptions.length > this.displayedOptions) {
|
|
55
|
+
this.visibleSortOptions = this.sortOptions.slice(
|
|
56
|
+
0,
|
|
57
|
+
this.displayedOptions
|
|
58
|
+
);
|
|
59
|
+
this.hiddenSortOptions = this.sortOptions.slice(this.displayedOptions);
|
|
60
|
+
this.showMore = true;
|
|
61
|
+
} else {
|
|
62
|
+
this.visibleSortOptions = this.sortOptions;
|
|
63
|
+
this.showMore = false;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
toggleShowMore() {
|
|
68
|
+
if (this.showMoreText === 'Show more') {
|
|
69
|
+
this.visibleSortOptions.push(...this.hiddenSortOptions);
|
|
70
|
+
this.showMoreText = 'Show less';
|
|
71
|
+
} else {
|
|
72
|
+
this.updateVisibleOptions();
|
|
73
|
+
this.showMoreText = 'Show more';
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
applySort() {
|
|
77
|
+
const selectedSorts = this.sortOptions.filter((option) => option.checked);
|
|
78
|
+
const selectedSortDetails = selectedSorts.map((sort, index) => {
|
|
79
|
+
return {
|
|
80
|
+
name:sort.name,
|
|
81
|
+
type: sort.type || 'String',
|
|
82
|
+
value:
|
|
83
|
+
this.getSortOrder(
|
|
84
|
+
sort.type,
|
|
85
|
+
this.selectedOrders.get(index) || 'asc'
|
|
86
|
+
) || '',
|
|
87
|
+
checked: sort.checked || false,
|
|
88
|
+
};
|
|
89
|
+
});
|
|
90
|
+
this.selectedOptions.emit(selectedSortDetails);
|
|
91
|
+
return selectedSortDetails;
|
|
92
|
+
}
|
|
93
|
+
getSortOrder(type: DataFilterType, selectedOrder: 'asc' | 'desc') {
|
|
94
|
+
if (type === 'Number') {
|
|
95
|
+
return selectedOrder === 'asc' ? 'asc' : 'desc';
|
|
96
|
+
} else if (type === 'String') {
|
|
97
|
+
return selectedOrder === 'asc' ? 'asc' : 'desc';
|
|
98
|
+
} else if (type === 'Date') {
|
|
99
|
+
return selectedOrder === 'asc' ? 'asc' : 'desc';
|
|
100
|
+
}
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
toggleSort(index: number) {
|
|
105
|
+
const option = this.sortOptions[index];
|
|
106
|
+
option.checked = !option.checked;
|
|
107
|
+
if (!option.checked) {
|
|
108
|
+
this.checkAll = false;
|
|
109
|
+
} else if (this.sortOptions.every(option => option.checked)) {
|
|
110
|
+
this.checkAll = true;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (option.checked) {
|
|
114
|
+
this.selectedOrders.set(index, 'asc');
|
|
115
|
+
} else {
|
|
116
|
+
this.selectedOrders.delete(index);
|
|
117
|
+
}
|
|
118
|
+
this.updateSortButtonState();
|
|
119
|
+
}
|
|
120
|
+
toggleSelectAll() {
|
|
121
|
+
this.checkAll = !this.checkAll; // Toggle checkAll state
|
|
122
|
+
|
|
123
|
+
// Set all options to checked/unchecked and assign default sort order when checked
|
|
124
|
+
this.sortOptions.forEach((option, index) => {
|
|
125
|
+
option.checked = this.checkAll;
|
|
126
|
+
|
|
127
|
+
if (this.checkAll) {
|
|
128
|
+
// If checked, set the default sort order to 'asc' for all
|
|
129
|
+
this.selectedOrders.set(index, 'asc');
|
|
130
|
+
} else {
|
|
131
|
+
// If unchecked, remove the sort order
|
|
132
|
+
this.selectedOrders.delete(index);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
this.updateSortButtonState(); // Update the state of the sort button
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
resetSort() {
|
|
140
|
+
this.sortOptions.forEach((option, index) => {
|
|
141
|
+
option.checked = false;
|
|
142
|
+
this.selectedOrders.delete(index);
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
this.sortOptions = [...this.defaultSortOptions];
|
|
146
|
+
this.updateVisibleOptions();
|
|
147
|
+
this.updateSortButtonState();
|
|
148
|
+
this.checkAll=false
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
updateSortButtonState() {
|
|
152
|
+
this.disableSortButton = this.countSelectedSorts() === 0;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
countSelectedSorts(): number {
|
|
156
|
+
return this.sortOptions.filter((option) => option.checked).length;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
setSortOrder(index: number, order: 'asc' | 'desc') {
|
|
160
|
+
this.selectedOrders.set(index, order);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
onDragStart(index: number, event: DragEvent) {
|
|
164
|
+
if (!this.enableDragAndDrop) return;
|
|
165
|
+
this.draggedIndex = index;
|
|
166
|
+
event.dataTransfer?.setData('text/plain', String(index));
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
onDragOver(event: DragEvent) {
|
|
170
|
+
if (!this.enableDragAndDrop) return;
|
|
171
|
+
event.preventDefault();
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
onDrop(index: number, event: DragEvent) {
|
|
175
|
+
if (!this.enableDragAndDrop) return;
|
|
176
|
+
event.preventDefault();
|
|
177
|
+
if (this.draggedIndex !== null) {
|
|
178
|
+
this.swapColumns(this.draggedIndex, index);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
swapColumns(fromIndex: number, toIndex: number) {
|
|
183
|
+
if (
|
|
184
|
+
fromIndex < this.visibleSortOptions.length &&
|
|
185
|
+
toIndex < this.visibleSortOptions.length
|
|
186
|
+
) {
|
|
187
|
+
const temp = this.visibleSortOptions[fromIndex];
|
|
188
|
+
this.visibleSortOptions[fromIndex] = this.visibleSortOptions[toIndex];
|
|
189
|
+
this.visibleSortOptions[toIndex] = temp;
|
|
190
|
+
|
|
191
|
+
const globalFromIndex = this.sortOptions.indexOf(temp);
|
|
192
|
+
const globalToIndex = this.sortOptions.indexOf(
|
|
193
|
+
this.visibleSortOptions[fromIndex]
|
|
194
|
+
);
|
|
195
|
+
|
|
196
|
+
if (globalFromIndex !== -1 && globalToIndex !== -1) {
|
|
197
|
+
const tempGlobal = this.sortOptions[globalFromIndex];
|
|
198
|
+
this.sortOptions[globalFromIndex] = this.sortOptions[globalToIndex];
|
|
199
|
+
this.sortOptions[globalToIndex] = tempGlobal;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
this.draggedIndex = null;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { FormsModule } from '@angular/forms'
|
|
3
|
+
import { CommonModule } from '@angular/common';
|
|
4
|
+
import { SortTableComponent } from './sort-table.component';
|
|
5
|
+
import { SvgModule } from '../svg/svg.module';
|
|
6
|
+
@NgModule({
|
|
7
|
+
declarations:[SortTableComponent],
|
|
8
|
+
imports: [FormsModule,CommonModule,CommonModule, FormsModule, SvgModule],
|
|
9
|
+
exports: [SortTableComponent]
|
|
10
|
+
})
|
|
11
|
+
export class SortTableModule {}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p>svg works!</p>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { SvgComponent } from './svg.component';
|
|
4
|
+
|
|
5
|
+
describe('SvgComponent', () => {
|
|
6
|
+
let component: SvgComponent;
|
|
7
|
+
let fixture: ComponentFixture<SvgComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [SvgComponent]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(SvgComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Component, Input, OnInit, ElementRef, ViewChild } from '@angular/core';
|
|
2
|
+
import { HttpClient } from '@angular/common/http';
|
|
3
|
+
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'verben-svg',
|
|
7
|
+
template: '<span #svgContainer></span>',
|
|
8
|
+
styleUrls: ['./svg.component.css']
|
|
9
|
+
})
|
|
10
|
+
export class SvgComponent implements OnInit {
|
|
11
|
+
@Input() icon: string = '';
|
|
12
|
+
@Input() width: number = 24;
|
|
13
|
+
@Input() height: number = 24;
|
|
14
|
+
@Input() fill: string = '';
|
|
15
|
+
@Input() stroke: string = '';
|
|
16
|
+
|
|
17
|
+
@ViewChild('svgContainer', { static: true }) svgContainer!: ElementRef;
|
|
18
|
+
|
|
19
|
+
constructor(private http: HttpClient, private sanitizer: DomSanitizer) {}
|
|
20
|
+
|
|
21
|
+
ngOnInit(): void {
|
|
22
|
+
this.loadSvgIcon(this.icon);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
ngOnChanges(): void {
|
|
26
|
+
this.loadSvgIcon(this.icon);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
loadSvgIcon(iconName: string): void {
|
|
30
|
+
this.http.get(`assets/icons/${iconName}.svg`, { responseType: 'text' })
|
|
31
|
+
.subscribe((svgContent: string) => {
|
|
32
|
+
this.updateSvg(svgContent);
|
|
33
|
+
}, (error) => {
|
|
34
|
+
console.error(`Error loading SVG icon: ${error}`);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
private updateSvg(svgContent: string): void {
|
|
39
|
+
const parser = new DOMParser();
|
|
40
|
+
const svgDoc = parser.parseFromString(svgContent, 'image/svg+xml');
|
|
41
|
+
const svgElement = svgDoc.documentElement;
|
|
42
|
+
|
|
43
|
+
svgElement.setAttribute('width', this.width.toString());
|
|
44
|
+
svgElement.setAttribute('height', this.height.toString());
|
|
45
|
+
|
|
46
|
+
const elementsToUpdate = ['path', 'circle', 'line', 'rect', 'polygon', 'polyline', 'ellipse'];
|
|
47
|
+
|
|
48
|
+
elementsToUpdate.forEach(tag => {
|
|
49
|
+
const elements = svgElement.querySelectorAll(tag);
|
|
50
|
+
elements.forEach(element => {
|
|
51
|
+
if (this.fill) {
|
|
52
|
+
element.setAttribute('fill', this.fill);
|
|
53
|
+
}
|
|
54
|
+
if (this.stroke) {
|
|
55
|
+
element.setAttribute('stroke', this.stroke);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const svgContainerEl = this.svgContainer.nativeElement;
|
|
61
|
+
svgContainerEl.innerHTML = '';
|
|
62
|
+
svgContainerEl.appendChild(svgElement);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { SvgComponent } from './svg.component';
|
|
3
|
+
import { CommonModule } from '@angular/common';
|
|
4
|
+
|
|
5
|
+
@NgModule({
|
|
6
|
+
declarations: [SvgComponent],
|
|
7
|
+
imports: [CommonModule],
|
|
8
|
+
exports: [SvgComponent]
|
|
9
|
+
})
|
|
10
|
+
export class SvgModule {}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
|
|
2
|
+
h3,p{
|
|
3
|
+
margin-top: 0px !important;
|
|
4
|
+
margin-bottom: 0px !important;
|
|
5
|
+
}
|
|
6
|
+
.top{
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: end;
|
|
9
|
+
justify-content: space-between;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
hr{
|
|
13
|
+
border: 1px solid rgba(232, 234, 241, 1);
|
|
14
|
+
margin:0.8rem 0rem;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.centerInnerWrapper{
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: space-between;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.savedWrapper{
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
justify-content: space-between;
|
|
27
|
+
margin-bottom: 0.5rem;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.checkboxWrapper{
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
gap: 0.3rem;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.iconWrapper{
|
|
37
|
+
display: flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
gap:0.7rem;
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.moreWrapper{
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
gap:0.4rem;
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
.inputsWrapper{
|
|
52
|
+
margin-top: 0.5rem;
|
|
53
|
+
display: flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
gap:0.5rem;
|
|
56
|
+
/* justify-content: space-between; */
|
|
57
|
+
/* flex-wrap: wrap; */
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.btnWrapper{
|
|
61
|
+
display: flex;
|
|
62
|
+
justify-content: end;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.inputsWrapper select:nth-of-type(1) {
|
|
66
|
+
width: 120px;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.inputsWrapper select:nth-of-type(2) {
|
|
70
|
+
width: 70px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
input[type="checkbox"].checked {
|
|
74
|
+
accent-color: #3479E9
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.selectAllWrapper{
|
|
78
|
+
display: flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
gap: 0.25rem;
|
|
81
|
+
margin-bottom: 0.5rem;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.selectAllWrapper > input{
|
|
85
|
+
cursor: pointer;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.disablebtn {
|
|
89
|
+
cursor:not-allowed;
|
|
90
|
+
}
|
|
91
|
+
.enableBtn {
|
|
92
|
+
cursor:pointer;
|
|
93
|
+
}
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
<section
|
|
2
|
+
[style.background-color]="bgColor"
|
|
3
|
+
[style.box-shadow]="boxShadow"
|
|
4
|
+
[style.border]="border"
|
|
5
|
+
[style.border-radius]="borderRadius"
|
|
6
|
+
[style.color]="textColor"
|
|
7
|
+
[style.width]="width"
|
|
8
|
+
[style.height]="height"
|
|
9
|
+
[style.padding]="pd"
|
|
10
|
+
>
|
|
11
|
+
<div class="top">
|
|
12
|
+
<h3 [style.color]="tertiaryColor" [style.font-size]="'14px'">
|
|
13
|
+
Filters
|
|
14
|
+
<span [style.color]="secondaryColor"
|
|
15
|
+
><sup>({{ filterCount }})</sup></span
|
|
16
|
+
>
|
|
17
|
+
</h3>
|
|
18
|
+
<button
|
|
19
|
+
[style.color]="secondaryColor"
|
|
20
|
+
[style.background-color]="bgColor"
|
|
21
|
+
[style.border]="'none'"
|
|
22
|
+
[style.cursor]="'pointer'"
|
|
23
|
+
[style.font-size]="'12px'"
|
|
24
|
+
(click)="resetFilters()"
|
|
25
|
+
>
|
|
26
|
+
Reset
|
|
27
|
+
</button>
|
|
28
|
+
</div>
|
|
29
|
+
<hr />
|
|
30
|
+
|
|
31
|
+
<!-- Saved Filters Section -->
|
|
32
|
+
<div class="center">
|
|
33
|
+
<div class="savedWrapper">
|
|
34
|
+
<h3 [style.font-size]="'13px'">Saved Filters</h3>
|
|
35
|
+
<verben-svg
|
|
36
|
+
icon="info"
|
|
37
|
+
[width]="15"
|
|
38
|
+
[height]="15"
|
|
39
|
+
fill="grey"
|
|
40
|
+
></verben-svg>
|
|
41
|
+
</div>
|
|
42
|
+
<div class="selectAllWrapper" *ngIf="savedFilters.length">
|
|
43
|
+
<input
|
|
44
|
+
type="checkbox"
|
|
45
|
+
[checked]="checkAll"
|
|
46
|
+
(change)="toggleSelectAll()"
|
|
47
|
+
/>
|
|
48
|
+
<p [style.font-size]="'13px'" [style.font-weight]="'500'">Select All</p>
|
|
49
|
+
</div>
|
|
50
|
+
<div
|
|
51
|
+
*ngFor="let filter of visibleFilters; let i = index"
|
|
52
|
+
class="centerInnerWrapper"
|
|
53
|
+
>
|
|
54
|
+
<div class="checkboxWrapper">
|
|
55
|
+
<span
|
|
56
|
+
><input
|
|
57
|
+
type="checkbox"
|
|
58
|
+
[checked]="filter.checked"
|
|
59
|
+
(click)="toggleCheckbox(i)"
|
|
60
|
+
/></span>
|
|
61
|
+
<p
|
|
62
|
+
[style.font-size]="'13px'"
|
|
63
|
+
[style.font-weight]="'500'"
|
|
64
|
+
[style.color]="tertiaryColor"
|
|
65
|
+
>
|
|
66
|
+
{{ filter.name }} {{ filter.condition }} {{ filter.value}}
|
|
67
|
+
</p>
|
|
68
|
+
</div>
|
|
69
|
+
<div class="iconWrapper">
|
|
70
|
+
<verben-svg
|
|
71
|
+
icon="edit"
|
|
72
|
+
[width]="15"
|
|
73
|
+
[height]="15"
|
|
74
|
+
stroke="#3479E9"
|
|
75
|
+
fill="white"
|
|
76
|
+
(click)="editFilter(i)"
|
|
77
|
+
></verben-svg>
|
|
78
|
+
<verben-svg
|
|
79
|
+
icon="delete"
|
|
80
|
+
[width]="15"
|
|
81
|
+
[height]="15"
|
|
82
|
+
stroke="#E20000"
|
|
83
|
+
(click)="deleteFilter(i)"
|
|
84
|
+
></verben-svg>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
|
|
88
|
+
<div
|
|
89
|
+
class="moreWrapper"
|
|
90
|
+
*ngIf="savedFilters.length > maxFilterLength"
|
|
91
|
+
(click)="toggleShowMore()"
|
|
92
|
+
>
|
|
93
|
+
<p
|
|
94
|
+
[style.font-size]="'12px'"
|
|
95
|
+
[style.font-weight]="'500'"
|
|
96
|
+
[style.color]="tertiaryColor"
|
|
97
|
+
>
|
|
98
|
+
{{ showAllFilters ? "Show less" : "Show more" }}
|
|
99
|
+
</p>
|
|
100
|
+
<verben-svg
|
|
101
|
+
icon="chevron"
|
|
102
|
+
[width]="8"
|
|
103
|
+
[height]="6"
|
|
104
|
+
fill="black"
|
|
105
|
+
stroke="black"
|
|
106
|
+
></verben-svg>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
<hr />
|
|
110
|
+
|
|
111
|
+
<!-- Operation Section -->
|
|
112
|
+
<div class="bottom">
|
|
113
|
+
<div class="savedWrapper">
|
|
114
|
+
<h3 [style.font-size]="'13px'">Operation</h3>
|
|
115
|
+
<div [ngStyle]="{'position':'relative'}">
|
|
116
|
+
|
|
117
|
+
<verben-tooltip
|
|
118
|
+
[tooltipContent]="tooltipTemplate"
|
|
119
|
+
[backgroundColor]="'grey'"
|
|
120
|
+
width="200px"
|
|
121
|
+
[top]="'20px'"
|
|
122
|
+
[right]="'0px'"
|
|
123
|
+
>
|
|
124
|
+
<verben-svg
|
|
125
|
+
icon="info"
|
|
126
|
+
[width]="15"
|
|
127
|
+
[height]="15"
|
|
128
|
+
*ngIf="isDuplicateFilter"
|
|
129
|
+
fill="red"
|
|
130
|
+
>
|
|
131
|
+
</verben-svg>
|
|
132
|
+
</verben-tooltip>
|
|
133
|
+
|
|
134
|
+
<ng-template #tooltipTemplate>
|
|
135
|
+
{{duplicateMessage}}
|
|
136
|
+
</ng-template>
|
|
137
|
+
<!-- <verben-tooltip
|
|
138
|
+
[backgroundColor]="'grey'"
|
|
139
|
+
[textColor]="'white'"
|
|
140
|
+
[padding]="'10px'"
|
|
141
|
+
[borderRadius]="'8px'"
|
|
142
|
+
[top]="'20px'"
|
|
143
|
+
[right]="'0px'"
|
|
144
|
+
width="250px"
|
|
145
|
+
#tooltip
|
|
146
|
+
*ngIf="tooltip"
|
|
147
|
+
>
|
|
148
|
+
<h3>{{duplicateMessage}}</h3>
|
|
149
|
+
</verben-tooltip> -->
|
|
150
|
+
</div>
|
|
151
|
+
<verben-svg
|
|
152
|
+
icon="info"
|
|
153
|
+
[width]="15"
|
|
154
|
+
[height]="15"
|
|
155
|
+
fill="grey"
|
|
156
|
+
*ngIf="!isDuplicateFilter"
|
|
157
|
+
></verben-svg>
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
<div class="inputsWrapper">
|
|
161
|
+
<verben-drop-down
|
|
162
|
+
width="7rem"
|
|
163
|
+
placeholder="Select value"
|
|
164
|
+
[options]="filterArray"
|
|
165
|
+
[(ngModel)]="selectedFilterValue"
|
|
166
|
+
(ngModelChange)="onFilterNameChange(selectedFilterValue)"
|
|
167
|
+
>
|
|
168
|
+
</verben-drop-down>
|
|
169
|
+
<verben-drop-down
|
|
170
|
+
width="7rem"
|
|
171
|
+
placeholder="Select value"
|
|
172
|
+
placeholder="Select value"
|
|
173
|
+
[options]="conditionOptions"
|
|
174
|
+
(onChange)="checkDuplicateFilter()"
|
|
175
|
+
[(ngModel)]="selectedCondition"
|
|
176
|
+
>
|
|
177
|
+
</verben-drop-down>
|
|
178
|
+
|
|
179
|
+
<verbena-input
|
|
180
|
+
*ngIf="selectedFilterType === 'Date'"
|
|
181
|
+
border="1px solid #ccc"
|
|
182
|
+
borderRadius="5px"
|
|
183
|
+
textColor="black"
|
|
184
|
+
width="80px"
|
|
185
|
+
height="25px"
|
|
186
|
+
pd="6px"
|
|
187
|
+
[showBorder]="true"
|
|
188
|
+
[showErrorMessage]="true"
|
|
189
|
+
[errorPosition]="'bottom'"
|
|
190
|
+
[type]="'date'"
|
|
191
|
+
[(ngModel)]="inputValue"
|
|
192
|
+
></verbena-input>
|
|
193
|
+
|
|
194
|
+
<verbena-input
|
|
195
|
+
*ngIf="selectedFilterType === 'Credit' || selectedFilterType === 'Integer'"
|
|
196
|
+
border="1px solid #ccc"
|
|
197
|
+
borderRadius="5px"
|
|
198
|
+
textColor="black"
|
|
199
|
+
width="100px"
|
|
200
|
+
height="25px"
|
|
201
|
+
pd="6px"
|
|
202
|
+
placeHolder="input integer"
|
|
203
|
+
[showBorder]="true"
|
|
204
|
+
|
|
205
|
+
[showErrorMessage]="true"
|
|
206
|
+
[errorPosition]="'bottom'"
|
|
207
|
+
|
|
208
|
+
appValidate="integer"
|
|
209
|
+
[(ngModel)]="inputValue"
|
|
210
|
+
></verbena-input>
|
|
211
|
+
|
|
212
|
+
<verbena-input
|
|
213
|
+
*ngIf="selectedFilterType === 'Decimal'"
|
|
214
|
+
border="1px solid #ccc"
|
|
215
|
+
borderRadius="5px"
|
|
216
|
+
textColor="black"
|
|
217
|
+
width="100px"
|
|
218
|
+
height="25px"
|
|
219
|
+
pd="6px"
|
|
220
|
+
placeHolder="input a decimal"
|
|
221
|
+
[showBorder]="true"
|
|
222
|
+
[showErrorMessage]="false"
|
|
223
|
+
[errorPosition]="'bottom'"
|
|
224
|
+
appValidate="decimal"
|
|
225
|
+
[(ngModel)]="inputValue"
|
|
226
|
+
></verbena-input>
|
|
227
|
+
|
|
228
|
+
<verbena-input
|
|
229
|
+
*ngIf="selectedFilterType !== 'Credit' && selectedFilterType !== 'Date' && selectedFilterType !== 'Integer' && selectedFilterType !== 'Decimal'"
|
|
230
|
+
border="1px solid #ccc"
|
|
231
|
+
placeHolder="input value"
|
|
232
|
+
borderRadius="5px"
|
|
233
|
+
textColor="black"
|
|
234
|
+
width="100px"
|
|
235
|
+
height="25px"
|
|
236
|
+
pd="6px"
|
|
237
|
+
[showBorder]="true"
|
|
238
|
+
|
|
239
|
+
[showErrorMessage]="true"
|
|
240
|
+
[errorPosition]="'bottom'"
|
|
241
|
+
|
|
242
|
+
[(ngModel)]="inputValue"
|
|
243
|
+
></verbena-input>
|
|
244
|
+
|
|
245
|
+
</div>
|
|
246
|
+
|
|
247
|
+
<div class="btnWrapper">
|
|
248
|
+
<button
|
|
249
|
+
[style.margin-top]="'0.5rem'"
|
|
250
|
+
[style.outline]="'none'"
|
|
251
|
+
[style.border]="'none'"
|
|
252
|
+
[style.border-radius]="borderRadius"
|
|
253
|
+
[style.background-color]="'transparent'"
|
|
254
|
+
[style.color]="secondaryColor"
|
|
255
|
+
[style.font-size]="'12px'"
|
|
256
|
+
[style.font-weight]="'500'"
|
|
257
|
+
[disabled]="disableAddFilterBtn"
|
|
258
|
+
[ngClass]="{
|
|
259
|
+
disablebtn: disableAddFilterBtn,
|
|
260
|
+
enableBtn: !disableAddFilterBtn
|
|
261
|
+
}"
|
|
262
|
+
(click)="addFilter()"
|
|
263
|
+
>
|
|
264
|
+
+ Add
|
|
265
|
+
</button>
|
|
266
|
+
</div>
|
|
267
|
+
<hr />
|
|
268
|
+
|
|
269
|
+
<div class="btnWrapper">
|
|
270
|
+
<button
|
|
271
|
+
[style.margin-top]="'0.5rem'"
|
|
272
|
+
[style.outline]="'none'"
|
|
273
|
+
[style.border]="'none'"
|
|
274
|
+
[style.padding]="'0.2rem 1.6rem'"
|
|
275
|
+
[style.background-color]="primaryColor"
|
|
276
|
+
[style.color]="tertiaryColor"
|
|
277
|
+
[style.font-size]="'12px'"
|
|
278
|
+
[style.font-weight]="'600'"
|
|
279
|
+
(click)="applyFilters()"
|
|
280
|
+
[disabled]="disableApplyFilterBtn"
|
|
281
|
+
[ngClass]="{
|
|
282
|
+
disablebtn: disableApplyFilterBtn,
|
|
283
|
+
enableBtn: !disableApplyFilterBtn
|
|
284
|
+
}"
|
|
285
|
+
>
|
|
286
|
+
Filter
|
|
287
|
+
</button>
|
|
288
|
+
</div>
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
</div>
|
|
292
|
+
|
|
293
|
+
</section>
|