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,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { TableFilterComponent } from './table-filter.component';
|
|
4
|
+
|
|
5
|
+
describe('TableFilterComponent', () => {
|
|
6
|
+
let component: TableFilterComponent;
|
|
7
|
+
let fixture: ComponentFixture<TableFilterComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [TableFilterComponent]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(TableFilterComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core';
|
|
2
|
+
import { IDataFilter } from '../../models/table-filter';
|
|
3
|
+
import { Config } from '../../config';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'verben-table-filter',
|
|
8
|
+
templateUrl: './table-filter.component.html',
|
|
9
|
+
styleUrls: ['./table-filter.component.css']
|
|
10
|
+
})
|
|
11
|
+
export class TableFilterComponent implements OnInit {
|
|
12
|
+
@Input() filterOptions: IDataFilter[] = [];
|
|
13
|
+
@Input() pd?: string;
|
|
14
|
+
@Input() mg?: string;
|
|
15
|
+
@Input() height?: string;
|
|
16
|
+
@Input() width?: string;
|
|
17
|
+
@Input() bgColor?: string;
|
|
18
|
+
@Input() boxShadow?: string;
|
|
19
|
+
@Input() textColor?: string;
|
|
20
|
+
@Input() primaryColor?: string;
|
|
21
|
+
@Input() secondaryColor?: string;
|
|
22
|
+
@Input() tertiaryColor?: string;
|
|
23
|
+
@Input() border?: string;
|
|
24
|
+
@Input() borderRadius?: string;
|
|
25
|
+
@Input() selectWidth?: string;
|
|
26
|
+
@Input() maxFilterLength:number = 3
|
|
27
|
+
@Input() tooltip:boolean = false
|
|
28
|
+
@Output() filtersApplied = new EventEmitter<any>();
|
|
29
|
+
|
|
30
|
+
filterArray:string[] = [];
|
|
31
|
+
selectedFilterValue: string = '';
|
|
32
|
+
selectedFilterType?:any;
|
|
33
|
+
conditionOptions: string[] = [];
|
|
34
|
+
selectedCondition: string | undefined = '';
|
|
35
|
+
inputValue?: string | number
|
|
36
|
+
savedFilters: IDataFilter[] = [];
|
|
37
|
+
selectedFilters: IDataFilter[] = [];
|
|
38
|
+
showAllFilters: boolean = false;
|
|
39
|
+
editIndex: number | null = null;
|
|
40
|
+
checkAll: boolean = false;
|
|
41
|
+
isDuplicateFilter: boolean = false;
|
|
42
|
+
disableAddFilterBtn: boolean = false;
|
|
43
|
+
disableApplyFilterBtn: boolean = true;
|
|
44
|
+
duplicateMessage?:string = '';
|
|
45
|
+
configInstance: Config;
|
|
46
|
+
storageKey: string = 'savedFilters';
|
|
47
|
+
filterCount:number = 0
|
|
48
|
+
|
|
49
|
+
constructor(){
|
|
50
|
+
this.configInstance = new Config();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
ngOnInit(): void {
|
|
54
|
+
this.filterArray = this.filterOptions.map(item => item.name);
|
|
55
|
+
this.loadFiltersFromLocalStorage();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
loadFiltersFromLocalStorage() {
|
|
59
|
+
const savedFiltersFromStorage = localStorage.getItem(this.storageKey);
|
|
60
|
+
if (savedFiltersFromStorage) {
|
|
61
|
+
this.savedFilters = JSON.parse(savedFiltersFromStorage);
|
|
62
|
+
this.filterCount = this.savedFilters.filter(item => item.checked === true).length;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
saveFiltersToLocalStorage() {
|
|
67
|
+
localStorage.setItem(this.storageKey, JSON.stringify(this.savedFilters));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
onFilterNameChange(selectedFilterValue: string) {
|
|
71
|
+
const selectedFilter = this.filterOptions.find(option => option.name === selectedFilterValue);
|
|
72
|
+
|
|
73
|
+
if (selectedFilter) {
|
|
74
|
+
this.selectedFilterType = selectedFilter.type;
|
|
75
|
+
this.conditionOptions = this.configInstance.getConditionOptions(this.selectedFilterType) || [];
|
|
76
|
+
this.selectedCondition = '';
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
resetFilters() {
|
|
81
|
+
this.selectedFilterType = null;
|
|
82
|
+
this.selectedCondition = '';
|
|
83
|
+
this.inputValue = '';
|
|
84
|
+
this.savedFilters = [];
|
|
85
|
+
this.editIndex = null;
|
|
86
|
+
this.checkAll = false;
|
|
87
|
+
this.isDuplicateFilter = false;
|
|
88
|
+
this.disableApplyFilterBtn = true;
|
|
89
|
+
this.duplicateMessage = ''
|
|
90
|
+
localStorage.removeItem(this.storageKey);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
addFilter() {
|
|
94
|
+
if (!this.selectedFilterValue || !this.selectedCondition || !this.inputValue) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (this.editIndex === null && this.isDuplicateFilter) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const newFilter: IDataFilter = {
|
|
103
|
+
name: this.selectedFilterValue,
|
|
104
|
+
type: this.selectedFilterType,
|
|
105
|
+
condition: this.selectedCondition,
|
|
106
|
+
value: this.inputValue,
|
|
107
|
+
checked: true
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
if (this.editIndex !== null) {
|
|
111
|
+
const isDuplicate = this.savedFilters.some(
|
|
112
|
+
(filter, index) =>
|
|
113
|
+
filter.name === newFilter.name &&
|
|
114
|
+
filter.condition === newFilter.condition &&
|
|
115
|
+
index !== this.editIndex
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
if (isDuplicate) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
this.savedFilters[this.editIndex] = newFilter;
|
|
122
|
+
this.editIndex = null;
|
|
123
|
+
} else {
|
|
124
|
+
if (this.savedFilters.some(filter =>
|
|
125
|
+
filter.name === newFilter.name &&
|
|
126
|
+
filter.condition === newFilter.condition)) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
this.savedFilters.push(newFilter);
|
|
130
|
+
this.filterCount = this.savedFilters.filter(item => item.checked === true).length;
|
|
131
|
+
}
|
|
132
|
+
this.saveFiltersToLocalStorage();
|
|
133
|
+
this.clearOperationSection();
|
|
134
|
+
this.checkFilterButton();
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
toggleCheckbox(index: number) {
|
|
139
|
+
this.savedFilters[index].checked = !this.savedFilters[index].checked;
|
|
140
|
+
this.checkAll = this.savedFilters.every(item => item.checked);
|
|
141
|
+
this.filterCount = this.savedFilters.filter(item => item.checked === true).length;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
deleteFilter(index: number) {
|
|
145
|
+
this.savedFilters.splice(index, 1);
|
|
146
|
+
this.checkDuplicateFilter();
|
|
147
|
+
this.checkFilterButton();
|
|
148
|
+
this.saveFiltersToLocalStorage();
|
|
149
|
+
this.filterCount = this.savedFilters.filter(item => item.checked === true).length;
|
|
150
|
+
if (this.savedFilters.length === 0) {
|
|
151
|
+
this.checkAll = false;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
editFilter(index: number) {
|
|
156
|
+
const filter = this.savedFilters[index];
|
|
157
|
+
this.selectedFilterType = filter.type;
|
|
158
|
+
this.selectedFilterValue = filter.name;
|
|
159
|
+
this.onFilterNameChange(this.selectedFilterValue)
|
|
160
|
+
this.selectedCondition = filter.condition;
|
|
161
|
+
this.inputValue = filter.value;
|
|
162
|
+
this.editIndex = index;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
applyFilters() {
|
|
166
|
+
this.selectedFilters = this.savedFilters.filter(filter => filter.checked);
|
|
167
|
+
this.filtersApplied.emit(this.selectedFilters);
|
|
168
|
+
this.filtersApplied.emit(this.storageKey);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
toggleShowMore() {
|
|
172
|
+
this.showAllFilters = !this.showAllFilters;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
get visibleFilters() {
|
|
176
|
+
return this.showAllFilters
|
|
177
|
+
? this.savedFilters
|
|
178
|
+
: this.savedFilters.slice(0, this.maxFilterLength);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
clearOperationSection() {
|
|
182
|
+
this.selectedFilterValue = '';
|
|
183
|
+
this.selectedCondition = '';
|
|
184
|
+
this.inputValue = '';
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
checkFilterButton() {
|
|
188
|
+
this.disableApplyFilterBtn = this.savedFilters.length === 0;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
toggleSelectAll(): void {
|
|
192
|
+
this.checkAll = !this.checkAll;
|
|
193
|
+
this.savedFilters.forEach(filter => filter.checked = this.checkAll);
|
|
194
|
+
this.filterCount = this.savedFilters.filter(item => item.checked === true).length;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
checkDuplicateFilter(): void {
|
|
198
|
+
if (this.editIndex !== null) {
|
|
199
|
+
const exists = this.savedFilters.some(
|
|
200
|
+
(filter, index) =>
|
|
201
|
+
filter.name === this.selectedFilterValue &&
|
|
202
|
+
filter.condition === this.selectedCondition &&
|
|
203
|
+
index !== this.editIndex
|
|
204
|
+
);
|
|
205
|
+
this.disableAddFilterBtn = exists;
|
|
206
|
+
this.isDuplicateFilter = exists;
|
|
207
|
+
this.duplicateMessage = exists ? 'This entry is a duplicate and cannot be added.' : '';
|
|
208
|
+
} else {
|
|
209
|
+
|
|
210
|
+
const exists = this.savedFilters.some(
|
|
211
|
+
(filter) =>
|
|
212
|
+
filter.name === this.selectedFilterValue &&
|
|
213
|
+
filter.condition === this.selectedCondition
|
|
214
|
+
);
|
|
215
|
+
this.disableAddFilterBtn = exists;
|
|
216
|
+
this.isDuplicateFilter = exists;
|
|
217
|
+
this.duplicateMessage = exists ? 'This entry is a duplicate and cannot be added.' : '';
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { TableFilterComponent } from './table-filter.component';
|
|
4
|
+
import { FormsModule } from '@angular/forms';
|
|
5
|
+
import { DropDownModule } from '../drop-down/drop-down.module';
|
|
6
|
+
import { VerbenaInputModule } from '../../Verbena-input/verbena-input.module';
|
|
7
|
+
import { TooltipModule } from '../tooltip/tooltip.module';
|
|
8
|
+
import { ValidationModule } from '../../validate/validate.module';
|
|
9
|
+
import { SvgModule } from '../svg/svg.module';
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@NgModule({
|
|
13
|
+
declarations:[TableFilterComponent],
|
|
14
|
+
imports: [
|
|
15
|
+
CommonModule,
|
|
16
|
+
FormsModule,
|
|
17
|
+
DropDownModule,
|
|
18
|
+
VerbenaInputModule,
|
|
19
|
+
ValidationModule,
|
|
20
|
+
TooltipModule,
|
|
21
|
+
SvgModule
|
|
22
|
+
],
|
|
23
|
+
exports: [TableFilterComponent]
|
|
24
|
+
})
|
|
25
|
+
export class TableFilterModule {}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<span class="tooltip-container"
|
|
2
|
+
(mouseenter)="onMouseEnter($event)"
|
|
3
|
+
(mouseleave)="onMouseLeave()"
|
|
4
|
+
>
|
|
5
|
+
<ng-content></ng-content>
|
|
6
|
+
<div [ngStyle]="tooltipStyles" [ngClass]="customClass" *ngIf="visible">
|
|
7
|
+
<ng-container *ngIf="tooltipContent">
|
|
8
|
+
<ng-template [ngTemplateOutlet]="tooltipContent"></ng-template>
|
|
9
|
+
</ng-container>
|
|
10
|
+
</div>
|
|
11
|
+
</span>
|
|
12
|
+
|
|
13
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { TooltipComponent } from './tooltip.component';
|
|
4
|
+
|
|
5
|
+
describe('TooltipComponent', () => {
|
|
6
|
+
let component: TooltipComponent;
|
|
7
|
+
let fixture: ComponentFixture<TooltipComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [TooltipComponent]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(TooltipComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Component, Input, HostListener, TemplateRef, ElementRef, Renderer2 } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'verben-tooltip',
|
|
5
|
+
templateUrl: './tooltip.component.html',
|
|
6
|
+
styleUrls: ['./tooltip.component.css']
|
|
7
|
+
})
|
|
8
|
+
export class TooltipComponent {
|
|
9
|
+
@Input() tooltipContent!: TemplateRef<any>;
|
|
10
|
+
@Input() customClass: string = '';
|
|
11
|
+
@Input() backgroundColor: string = 'black';
|
|
12
|
+
@Input() textColor: string = 'white';
|
|
13
|
+
@Input() padding: string = '5px 10px';
|
|
14
|
+
@Input() borderRadius: string = '4px';
|
|
15
|
+
@Input() border: string = '';
|
|
16
|
+
@Input() width: string = '';
|
|
17
|
+
@Input() top?: string;
|
|
18
|
+
@Input() bottom?: string;
|
|
19
|
+
@Input() left?: string;
|
|
20
|
+
@Input() right?: string;
|
|
21
|
+
visible = false;
|
|
22
|
+
|
|
23
|
+
tooltipPosition = { top: '', left: '' };
|
|
24
|
+
|
|
25
|
+
constructor(private elementRef: ElementRef, private renderer: Renderer2) {}
|
|
26
|
+
|
|
27
|
+
onMouseEnter(event: MouseEvent) {
|
|
28
|
+
this.visible = true;
|
|
29
|
+
this.updateTooltipPosition(event);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
onMouseLeave() {
|
|
33
|
+
this.visible = false;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
private updateTooltipPosition(event: MouseEvent) {
|
|
37
|
+
const tooltipElement = this.elementRef.nativeElement.querySelector('.tooltip-box');
|
|
38
|
+
const triggerElement = event.target as HTMLElement;
|
|
39
|
+
|
|
40
|
+
if (tooltipElement && triggerElement) {
|
|
41
|
+
|
|
42
|
+
const triggerRect = triggerElement.getBoundingClientRect();
|
|
43
|
+
|
|
44
|
+
const tooltipRect = tooltipElement.getBoundingClientRect();
|
|
45
|
+
|
|
46
|
+
const availableSpaceAbove = triggerRect.top;
|
|
47
|
+
const availableSpaceBelow = window.innerHeight - triggerRect.bottom;
|
|
48
|
+
const availableSpaceLeft = triggerRect.left;
|
|
49
|
+
const availableSpaceRight = window.innerWidth - triggerRect.right;
|
|
50
|
+
|
|
51
|
+
let top = triggerRect.bottom + 'px';
|
|
52
|
+
let left = (triggerRect.left + triggerRect.width / 2 - tooltipRect.width / 2) + 'px';
|
|
53
|
+
|
|
54
|
+
if (availableSpaceBelow < tooltipRect.height && availableSpaceAbove >= tooltipRect.height) {
|
|
55
|
+
top = (triggerRect.top - tooltipRect.height) + 'px';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (availableSpaceRight < tooltipRect.width && availableSpaceLeft >= tooltipRect.width) {
|
|
59
|
+
left = (triggerRect.left - tooltipRect.width) + 'px';
|
|
60
|
+
} else if (availableSpaceLeft < tooltipRect.width && availableSpaceRight >= tooltipRect.width) {
|
|
61
|
+
left = (triggerRect.right) + 'px';
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
this.tooltipPosition = { top, left };
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
get tooltipStyles() {
|
|
69
|
+
return {
|
|
70
|
+
'background-color':this.backgroundColor,
|
|
71
|
+
'width': this.width,
|
|
72
|
+
'color': this.textColor,
|
|
73
|
+
'padding': this.padding,
|
|
74
|
+
'border-radius': this.borderRadius,
|
|
75
|
+
'border': this.border,
|
|
76
|
+
'position': 'absolute',
|
|
77
|
+
'z-index': '9999',
|
|
78
|
+
'top': this.tooltipPosition.top || this.top,
|
|
79
|
+
'left': this.tooltipPosition.left || this.left,
|
|
80
|
+
'right': this.right,
|
|
81
|
+
'bottom': this.bottom,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { TooltipComponent } from './tooltip.component';
|
|
3
|
+
import { SvgModule } from '../svg/svg.module';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
|
|
6
|
+
@NgModule({
|
|
7
|
+
declarations:[TooltipComponent],
|
|
8
|
+
imports: [SvgModule,CommonModule],
|
|
9
|
+
exports: [TooltipComponent]
|
|
10
|
+
})
|
|
11
|
+
export class TooltipModule {}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const QuillConfiguration = {
|
|
2
|
+
toolbar: [
|
|
3
|
+
['bold', 'italic', 'underline', 'strike'],
|
|
4
|
+
['blockquote', 'code-block'],
|
|
5
|
+
[{ list: 'ordered' }, { list: 'bullet' }],
|
|
6
|
+
[{ header: [1, 2, 3, 4, 5, 6, false] }],
|
|
7
|
+
[{ color: [] }, { background: [] }],
|
|
8
|
+
['link'],
|
|
9
|
+
['clean'],
|
|
10
|
+
],
|
|
11
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
.container{
|
|
2
|
+
background-color: #fff;
|
|
3
|
+
}
|
|
4
|
+
.verben-mail-container{
|
|
5
|
+
background-color: #80808013;
|
|
6
|
+
|
|
7
|
+
}
|
|
8
|
+
.verben-mail-form{
|
|
9
|
+
background-color: white;
|
|
10
|
+
}
|
|
11
|
+
.verben-mail-form label {
|
|
12
|
+
font-weight:500;
|
|
13
|
+
margin-right: 6px;
|
|
14
|
+
font-size: 14px;
|
|
15
|
+
}
|
|
16
|
+
#attachment{
|
|
17
|
+
display: none;
|
|
18
|
+
}
|
|
19
|
+
.verben-mail-form .form-element {
|
|
20
|
+
margin-bottom: 10px;
|
|
21
|
+
display: flex;
|
|
22
|
+
}
|
|
23
|
+
.verben-mail-form .form-element input{
|
|
24
|
+
padding: 0;
|
|
25
|
+
display:inline-block;
|
|
26
|
+
padding:2px 4px;
|
|
27
|
+
border: 1px solid #9A9FBF80;
|
|
28
|
+
outline: none;
|
|
29
|
+
min-width: 200px;
|
|
30
|
+
}
|
|
31
|
+
.verben-mail-form .form-element.subject input{
|
|
32
|
+
border-color: #0000003b;
|
|
33
|
+
min-width: 300px;
|
|
34
|
+
font-weight: 600;
|
|
35
|
+
}
|
|
36
|
+
.verben-mail-form .form-element textarea{
|
|
37
|
+
padding: 16px;
|
|
38
|
+
width: 100%;
|
|
39
|
+
height: 100%;
|
|
40
|
+
resize: none;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.button-container :nth-child(1){
|
|
44
|
+
border:1px solid #D4A007;
|
|
45
|
+
border-radius: 3px;
|
|
46
|
+
color: #D4A007;
|
|
47
|
+
padding: 4px 15px;
|
|
48
|
+
font-weight: 500;
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
.semibold{
|
|
52
|
+
font-weight: 500;
|
|
53
|
+
}
|
|
54
|
+
.flex-end{
|
|
55
|
+
justify-content: flex-end;
|
|
56
|
+
}
|
|
57
|
+
.flex{
|
|
58
|
+
display: flex;
|
|
59
|
+
}
|
|
60
|
+
.items-center{
|
|
61
|
+
align-items: center;
|
|
62
|
+
}
|
|
63
|
+
.gap{
|
|
64
|
+
gap:20px;
|
|
65
|
+
}
|
|
66
|
+
.enabled{
|
|
67
|
+
cursor: pointer;
|
|
68
|
+
}
|
|
69
|
+
.disabled{
|
|
70
|
+
cursor: not-allowed;
|
|
71
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
<form
|
|
2
|
+
[style.width]="containerWidth"
|
|
3
|
+
[formGroup]="mailForm"
|
|
4
|
+
(ngSubmit)="sendEmail()"
|
|
5
|
+
>
|
|
6
|
+
<div
|
|
7
|
+
class="button-container flex flex-end gap"
|
|
8
|
+
[style.margin-bottom]="'10px'"
|
|
9
|
+
>
|
|
10
|
+
<button class="button" type="button" (click)="toggleEditor()">
|
|
11
|
+
{{ isRichText ? "Switch to Plain" : "View Designer" }}
|
|
12
|
+
</button>
|
|
13
|
+
<button
|
|
14
|
+
type="submit"
|
|
15
|
+
[style.background-color]="primaryColor"
|
|
16
|
+
[style.padding]="'0px 10px'"
|
|
17
|
+
[ngClass]="{
|
|
18
|
+
disabled: mailForm.invalid,
|
|
19
|
+
enabled: !mailForm.invalid
|
|
20
|
+
}"
|
|
21
|
+
[disabled]="mailForm.invalid"
|
|
22
|
+
>
|
|
23
|
+
Send
|
|
24
|
+
</button>
|
|
25
|
+
</div>
|
|
26
|
+
<div
|
|
27
|
+
class="container"
|
|
28
|
+
[style.border-radius]="borderRadius"
|
|
29
|
+
[style.border]="border"
|
|
30
|
+
[style.padding]="pd"
|
|
31
|
+
>
|
|
32
|
+
<div class="verben-mail-container">
|
|
33
|
+
<div class="verben-mail-form">
|
|
34
|
+
<!-- Subject Field -->
|
|
35
|
+
<div class="form-element subject">
|
|
36
|
+
<label for="subject">Subject:</label>
|
|
37
|
+
<input id="subject" type="text" formControlName="subject" />
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<!-- To Field with verben-chip -->
|
|
41
|
+
<div class="form-element">
|
|
42
|
+
<label for="to">TO:</label>
|
|
43
|
+
<div class="email-tags-container">
|
|
44
|
+
<verben-chip
|
|
45
|
+
[required]="true"
|
|
46
|
+
[invalidMessage]="toEmailError || 'email must be provided'"
|
|
47
|
+
(onChange)="onToChange()"
|
|
48
|
+
formControlName="toEmails"
|
|
49
|
+
[max]="max"
|
|
50
|
+
[ngModel]="toEmails"
|
|
51
|
+
>
|
|
52
|
+
</verben-chip>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
<!-- CC Field with verben-chip -->
|
|
57
|
+
<div class="form-element">
|
|
58
|
+
<label for="cc">CC:</label>
|
|
59
|
+
<div class="email-tags-container">
|
|
60
|
+
<verben-chip
|
|
61
|
+
(onChange)="onCcChange()"
|
|
62
|
+
formControlName="ccEmails"
|
|
63
|
+
[ngModel]="ccEmails"
|
|
64
|
+
>
|
|
65
|
+
<ng-template let-item vTemplate="item">
|
|
66
|
+
{{ item }}
|
|
67
|
+
</ng-template>
|
|
68
|
+
</verben-chip>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
|
|
72
|
+
<!-- BCC Field with verben-chip -->
|
|
73
|
+
<div class="form-element">
|
|
74
|
+
<label for="bcc">BCC:</label>
|
|
75
|
+
<div class="email-tags-container">
|
|
76
|
+
<verben-chip
|
|
77
|
+
(onChange)="onBccChange()"
|
|
78
|
+
[ngModel]="bccEmails"
|
|
79
|
+
formControlName="bccEmails"
|
|
80
|
+
>
|
|
81
|
+
<ng-template let-item vTemplate="item">
|
|
82
|
+
{{ item }}
|
|
83
|
+
</ng-template>
|
|
84
|
+
</verben-chip>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
|
|
88
|
+
<!-- Attachments Section -->
|
|
89
|
+
<div class="form-element attachment">
|
|
90
|
+
<label
|
|
91
|
+
*ngIf="!uploadedFileName && !isUploading"
|
|
92
|
+
for="attachment"
|
|
93
|
+
class="flex items-center gap cursor-pointer"
|
|
94
|
+
>
|
|
95
|
+
<verben-svg [width]="20" fill="black" icon="attach"></verben-svg
|
|
96
|
+
>Attach file
|
|
97
|
+
</label>
|
|
98
|
+
<input
|
|
99
|
+
id="attachment"
|
|
100
|
+
type="file"
|
|
101
|
+
(change)="onFileSelected($event)"
|
|
102
|
+
class="none"
|
|
103
|
+
/>
|
|
104
|
+
<div *ngIf="isUploading" class="loader">Uploading...</div>
|
|
105
|
+
<div *ngIf="uploadedFileName" class="flex items-center gap">
|
|
106
|
+
<span>{{ uploadedFileName }}</span>
|
|
107
|
+
<button
|
|
108
|
+
[style.color]="'black'"
|
|
109
|
+
type="button"
|
|
110
|
+
(click)="removeFile()"
|
|
111
|
+
>
|
|
112
|
+
✕
|
|
113
|
+
</button>
|
|
114
|
+
</div>
|
|
115
|
+
<div *ngIf="fileUploadError" class="error">{{ fileUploadError }}</div>
|
|
116
|
+
</div>
|
|
117
|
+
|
|
118
|
+
<!-- Email Body -->
|
|
119
|
+
|
|
120
|
+
<hr [style.color]="'#00000066'" />
|
|
121
|
+
<div class="form-element quill" [style.margin-top]="'30px'">
|
|
122
|
+
<div *ngIf="isRichText; else textArea">
|
|
123
|
+
<ng-content select="[rich-text]">widget should appear here </ng-content>
|
|
124
|
+
</div>
|
|
125
|
+
<ng-template #textArea>
|
|
126
|
+
<ng-content select="[text-arae]">
|
|
127
|
+
<textarea
|
|
128
|
+
formControlName="body"
|
|
129
|
+
class="block"
|
|
130
|
+
rows="10"
|
|
131
|
+
cols="50"
|
|
132
|
+
></textarea>
|
|
133
|
+
</ng-content>
|
|
134
|
+
</ng-template>
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
</div>
|
|
139
|
+
</form>
|