@one-paragon/angular-utilities 2.8.4 → 2.8.5

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 (203) hide show
  1. package/fesm2022/one-paragon-angular-utilities.mjs +7350 -0
  2. package/fesm2022/one-paragon-angular-utilities.mjs.map +1 -0
  3. package/package.json +27 -15
  4. package/types/one-paragon-angular-utilities.d.ts +2211 -0
  5. package/karma.conf.js +0 -43
  6. package/ng-package.json +0 -7
  7. package/src/action-state/action-state-spinner/action-state-spinner.component.css +0 -16
  8. package/src/action-state/action-state-spinner/action-state-spinner.component.html +0 -7
  9. package/src/action-state/action-state-spinner/action-state-spinner.component.spec.ts +0 -25
  10. package/src/action-state/action-state-spinner/action-state-spinner.component.ts +0 -26
  11. package/src/action-state/action-state-ui/action-state-ui.module.ts +0 -13
  12. package/src/action-state/index.ts +0 -8
  13. package/src/action-state/ngrx-ext/ngrx-ext.module.ts +0 -14
  14. package/src/action-state/ngrx.ts +0 -69
  15. package/src/http-request-state/RequestStateFactory.ts +0 -56
  16. package/src/http-request-state/RequestStateStore.ts +0 -360
  17. package/src/http-request-state/deprecated.ts +0 -20
  18. package/src/http-request-state/directives/HttpStateDirectiveBase.ts +0 -29
  19. package/src/http-request-state/directives/http-error-state-directive.ts +0 -21
  20. package/src/http-request-state/directives/http-inProgress-state-directive.ts +0 -19
  21. package/src/http-request-state/directives/http-notStarted-state-directive.ts +0 -19
  22. package/src/http-request-state/directives/http-success-state-directive.ts +0 -29
  23. package/src/http-request-state/directives/index.ts +0 -5
  24. package/src/http-request-state/directives/request-state-directive.spec.ts +0 -73
  25. package/src/http-request-state/directives/request-state-directive.ts +0 -78
  26. package/src/http-request-state/documentation/CREATE-REQUESTOR.md +0 -667
  27. package/src/http-request-state/documentation/README.md +0 -191
  28. package/src/http-request-state/documentation/REQUEST-STATE-STORE-CONFIG.md +0 -648
  29. package/src/http-request-state/documentation/REQUESTOR.md +0 -616
  30. package/src/http-request-state/helpers.ts +0 -30
  31. package/src/http-request-state/http-state-module.ts +0 -23
  32. package/src/http-request-state/index.ts +0 -7
  33. package/src/http-request-state/models/view-context.ts +0 -18
  34. package/src/http-request-state/observable.spec.ts +0 -43
  35. package/src/http-request-state/request-state.ts +0 -66
  36. package/src/http-request-state/rxjs/getRequestorBody.ts +0 -10
  37. package/src/http-request-state/rxjs/getRequestorState.ts +0 -8
  38. package/src/http-request-state/rxjs/index.ts +0 -4
  39. package/src/http-request-state/rxjs/tapError.ts +0 -16
  40. package/src/http-request-state/rxjs/tapSuccess.ts +0 -16
  41. package/src/http-request-state/strategies.spec.ts +0 -42
  42. package/src/http-request-state/types.ts +0 -54
  43. package/src/ngrx/actionable-selector.ts +0 -189
  44. package/src/ngrx/index.ts +0 -1
  45. package/src/public-api.ts +0 -40
  46. package/src/rxjs/defaultShareReplay.ts +0 -8
  47. package/src/rxjs/index.ts +0 -5
  48. package/src/rxjs/mapError.ts +0 -8
  49. package/src/rxjs/rxjs-operators.ts +0 -130
  50. package/src/rxjs/subjectifier.ts +0 -17
  51. package/src/rxjs/subscriber.directive.ts +0 -57
  52. package/src/specs/clickSubject.spec.ts +0 -99
  53. package/src/specs/dialog.spec.ts +0 -101
  54. package/src/specs/toggleGroupDirective.spec.ts +0 -229
  55. package/src/table-builder/classes/DefaultSettings.ts +0 -11
  56. package/src/table-builder/classes/MatTableObservableDataSource.ts +0 -23
  57. package/src/table-builder/classes/TableBuilderConfig.ts +0 -49
  58. package/src/table-builder/classes/TableBuilderDataSource.ts +0 -64
  59. package/src/table-builder/classes/TableState.ts +0 -96
  60. package/src/table-builder/classes/data-store.ts +0 -10
  61. package/src/table-builder/classes/display-col.ts +0 -5
  62. package/src/table-builder/classes/filter-info.ts +0 -129
  63. package/src/table-builder/classes/table-builder-general-settings.ts +0 -233
  64. package/src/table-builder/classes/table-builder.ts +0 -105
  65. package/src/table-builder/classes/table-store.helpers.ts +0 -109
  66. package/src/table-builder/classes/table-store.ts +0 -540
  67. package/src/table-builder/components/array-column.component.ts +0 -34
  68. package/src/table-builder/components/column-builder/column-builder.component.html +0 -109
  69. package/src/table-builder/components/column-builder/column-builder.component.scss +0 -43
  70. package/src/table-builder/components/column-builder/column-builder.component.spec.ts +0 -49
  71. package/src/table-builder/components/column-builder/column-builder.component.ts +0 -130
  72. package/src/table-builder/components/column-builder/column-helpers.ts +0 -54
  73. package/src/table-builder/components/column-header-menu/column-header-menu.component.html +0 -128
  74. package/src/table-builder/components/column-header-menu/column-header-menu.component.scss +0 -97
  75. package/src/table-builder/components/column-header-menu/column-header-menu.component.ts +0 -113
  76. package/src/table-builder/components/date-filter/date-filter.component.html +0 -39
  77. package/src/table-builder/components/date-filter/date-filter.component.ts +0 -33
  78. package/src/table-builder/components/date-time-filter/date-time-filter.component.html +0 -25
  79. package/src/table-builder/components/date-time-filter/date-time-filter.component.ts +0 -33
  80. package/src/table-builder/components/filter/filter.component.html +0 -120
  81. package/src/table-builder/components/filter/filter.component.scss +0 -60
  82. package/src/table-builder/components/filter/filter.component.spec.ts +0 -86
  83. package/src/table-builder/components/filter/filter.component.ts +0 -73
  84. package/src/table-builder/components/filter/in-list/in-list-filter.component.ts +0 -171
  85. package/src/table-builder/components/gen-col-displayer/gen-col-displayer.component.html +0 -60
  86. package/src/table-builder/components/gen-col-displayer/gen-col-displayer.component.scss +0 -57
  87. package/src/table-builder/components/gen-col-displayer/gen-col-displayer.component.ts +0 -44
  88. package/src/table-builder/components/generic-table/generic-table.component.html +0 -140
  89. package/src/table-builder/components/generic-table/generic-table.component.scss +0 -45
  90. package/src/table-builder/components/generic-table/generic-table.component.ts +0 -531
  91. package/src/table-builder/components/generic-table/paginator.component.ts +0 -125
  92. package/src/table-builder/components/group-by-list/group-by-list.component.css +0 -24
  93. package/src/table-builder/components/group-by-list/group-by-list.component.html +0 -21
  94. package/src/table-builder/components/group-by-list/group-by-list.component.spec.ts +0 -23
  95. package/src/table-builder/components/group-by-list/group-by-list.component.ts +0 -26
  96. package/src/table-builder/components/in-filter/in-filter.component.css +0 -22
  97. package/src/table-builder/components/in-filter/in-filter.component.html +0 -38
  98. package/src/table-builder/components/in-filter/in-filter.component.ts +0 -66
  99. package/src/table-builder/components/index.ts +0 -9
  100. package/src/table-builder/components/initialization-component/initialization.component.html +0 -78
  101. package/src/table-builder/components/initialization-component/initialization.component.ts +0 -28
  102. package/src/table-builder/components/link-column.component.ts +0 -42
  103. package/src/table-builder/components/number-filter/number-filter.component.css +0 -10
  104. package/src/table-builder/components/number-filter/number-filter.component.html +0 -32
  105. package/src/table-builder/components/number-filter/number-filter.component.spec.ts +0 -30
  106. package/src/table-builder/components/number-filter/number-filter.component.ts +0 -34
  107. package/src/table-builder/components/profiles-menu/profiles-menu.component.html +0 -77
  108. package/src/table-builder/components/profiles-menu/profiles-menu.component.scss +0 -126
  109. package/src/table-builder/components/profiles-menu/profiles-menu.component.spec.ts +0 -23
  110. package/src/table-builder/components/profiles-menu/profiles-menu.component.ts +0 -64
  111. package/src/table-builder/components/reset-menu/reset-menu.component.css +0 -3
  112. package/src/table-builder/components/reset-menu/reset-menu.component.html +0 -10
  113. package/src/table-builder/components/reset-menu/reset-menu.component.ts +0 -87
  114. package/src/table-builder/components/scroll-strategy.ts +0 -139
  115. package/src/table-builder/components/sort-menu/sort-menu.component-store.ts +0 -57
  116. package/src/table-builder/components/sort-menu/sort-menu.component.html +0 -115
  117. package/src/table-builder/components/sort-menu/sort-menu.component.scss +0 -119
  118. package/src/table-builder/components/sort-menu/sort-menu.component.ts +0 -88
  119. package/src/table-builder/components/table-container/table-container.component.html +0 -94
  120. package/src/table-builder/components/table-container/table-container.component.scss +0 -60
  121. package/src/table-builder/components/table-container/table-container.component.ts +0 -467
  122. package/src/table-builder/components/table-container/table-container.helpers/data-state.helpers.ts +0 -113
  123. package/src/table-builder/components/table-container/table-container.helpers/filter-state.helpers.ts +0 -125
  124. package/src/table-builder/components/table-container/table-container.helpers/groupBy.helpers.ts +0 -172
  125. package/src/table-builder/components/table-container/table-container.helpers/meta-data.helpers.ts +0 -19
  126. package/src/table-builder/components/table-container/table-container.helpers/sort-state.helpers.ts +0 -47
  127. package/src/table-builder/components/table-container/tableProps.ts +0 -21
  128. package/src/table-builder/components/table-container/virtual-scroll-container.ts +0 -216
  129. package/src/table-builder/components/table-container-filter/filter-list/filter-list.component.html +0 -42
  130. package/src/table-builder/components/table-container-filter/filter-list/filter-list.component.ts +0 -47
  131. package/src/table-builder/components/table-container-filter/gen-filter-displayer/gen-filter-displayer.component.css +0 -40
  132. package/src/table-builder/components/table-container-filter/gen-filter-displayer/gen-filter-displayer.component.html +0 -11
  133. package/src/table-builder/components/table-container-filter/gen-filter-displayer/gen-filter-displayer.component.spec.ts +0 -85
  134. package/src/table-builder/components/table-container-filter/gen-filter-displayer/gen-filter-displayer.component.ts +0 -35
  135. package/src/table-builder/components/table-container-filter/table-wrapper-filter-store.ts +0 -13
  136. package/src/table-builder/components/table-header-menu/table-header-menu.component.css +0 -21
  137. package/src/table-builder/components/table-header-menu/table-header-menu.component.html +0 -48
  138. package/src/table-builder/components/table-header-menu/table-header-menu.component.ts +0 -36
  139. package/src/table-builder/directives/custom-cell-directive.ts +0 -63
  140. package/src/table-builder/directives/custom-header-directive.ts +0 -16
  141. package/src/table-builder/directives/group-row-directive.ts +0 -91
  142. package/src/table-builder/directives/index.ts +0 -8
  143. package/src/table-builder/directives/multi-sort.directive.spec.ts +0 -124
  144. package/src/table-builder/directives/multi-sort.directive.ts +0 -58
  145. package/src/table-builder/directives/resize-column.directive.ts +0 -107
  146. package/src/table-builder/directives/table-wrapper.directive.ts +0 -13
  147. package/src/table-builder/directives/tb-filter.directive.ts +0 -376
  148. package/src/table-builder/documentation/table-builder/CUSTOM-CELL.md +0 -568
  149. package/src/table-builder/documentation/table-builder/CUSTOM-GROUP-ROW.md +0 -356
  150. package/src/table-builder/documentation/table-builder/METADATA-DOCUMENTATION.md +0 -517
  151. package/src/table-builder/documentation/table-builder/STYLER-STYLE.md +0 -228
  152. package/src/table-builder/documentation/table-builder/TABLE-BUILDER-CONFIG.md +0 -325
  153. package/src/table-builder/documentation/table-builder/TABLE-BUILDER-SETTINGS.md +0 -515
  154. package/src/table-builder/documentation/table-builder/TABLE-BUILDER.md +0 -430
  155. package/src/table-builder/documentation/table-builder/TABLE-CONTAINER.md +0 -628
  156. package/src/table-builder/enums/filterTypes.ts +0 -39
  157. package/src/table-builder/functions/boolean-filter-function.ts +0 -12
  158. package/src/table-builder/functions/date-filter-function.ts +0 -85
  159. package/src/table-builder/functions/download-data.ts +0 -11
  160. package/src/table-builder/functions/null-filter-function.ts +0 -9
  161. package/src/table-builder/functions/number-filter-function.ts +0 -47
  162. package/src/table-builder/functions/sort-data-function.ts +0 -80
  163. package/src/table-builder/functions/string-filter-function.ts +0 -59
  164. package/src/table-builder/interfaces/ColumnInfo.ts +0 -9
  165. package/src/table-builder/interfaces/dictionary.ts +0 -3
  166. package/src/table-builder/interfaces/meta-data.ts +0 -279
  167. package/src/table-builder/ngrx/tableBuilderStateStore.ts +0 -203
  168. package/src/table-builder/pipes/column-total.pipe.ts +0 -16
  169. package/src/table-builder/pipes/format-filter-type.pipe.ts +0 -12
  170. package/src/table-builder/pipes/format-filter-value.pipe.ts +0 -71
  171. package/src/table-builder/pipes/key-display.ts +0 -13
  172. package/src/table-builder/services/all-values-filter-creator.service.ts +0 -92
  173. package/src/table-builder/services/export-to-csv.service.ts +0 -117
  174. package/src/table-builder/services/link-creator.service.ts +0 -98
  175. package/src/table-builder/services/table-template-service.ts +0 -47
  176. package/src/table-builder/services/transform-creator.ts +0 -90
  177. package/src/table-builder/specs/table-custom-filters.spec.ts +0 -262
  178. package/src/table-builder/styles/collapser.styles.scss +0 -16
  179. package/src/table-builder/table-builder.module.ts +0 -42
  180. package/src/table-builder/types/group-types.ts +0 -42
  181. package/src/table-builder/types/index.ts +0 -1
  182. package/src/test.ts +0 -17
  183. package/src/utilities/array-helpers.ts +0 -13
  184. package/src/utilities/directives/auto-focus.directive.ts +0 -20
  185. package/src/utilities/directives/clickEmitterDirective.ts +0 -15
  186. package/src/utilities/directives/clickSubject.ts +0 -19
  187. package/src/utilities/directives/conditional-classes.directive.ts +0 -36
  188. package/src/utilities/directives/dialog-service.ts +0 -19
  189. package/src/utilities/directives/dialog.ts +0 -174
  190. package/src/utilities/directives/mat-toggle-group-directive.ts +0 -60
  191. package/src/utilities/directives/prevent-enter.directive.ts +0 -12
  192. package/src/utilities/directives/stop-propagation.directive.ts +0 -19
  193. package/src/utilities/directives/styler.ts +0 -45
  194. package/src/utilities/directives/trim-whitespace.directive.ts +0 -20
  195. package/src/utilities/index.ts +0 -22
  196. package/src/utilities/module.ts +0 -53
  197. package/src/utilities/pipes/function.pipe.ts +0 -21
  198. package/src/utilities/pipes/phone.pipe.ts +0 -20
  199. package/src/utilities/pipes/space-case.pipes.spec.ts +0 -47
  200. package/src/utilities/pipes/space-case.pipes.ts +0 -29
  201. package/tsconfig.lib.json +0 -20
  202. package/tsconfig.lib.prod.json +0 -10
  203. package/tsconfig.spec.json +0 -17
@@ -1,47 +0,0 @@
1
- import { ChangeDetectionStrategy, Component, computed, inject } from '@angular/core';
2
- import { TableStore } from '../../../classes/table-store';
3
- import { CustomFilter, FilterInfo, isCustomFilter, isFilterInfo } from '../../../classes/filter-info';
4
- import { WrapperFilterStore } from '../table-wrapper-filter-store';
5
- import { MatButtonModule } from '@angular/material/button';
6
- import { MatTooltipModule } from '@angular/material/tooltip';
7
- import { MatIconModule } from '@angular/material/icon';
8
- import { FilterComponent } from '../../filter/filter.component';
9
- import { MatChipsModule } from '@angular/material/chips';
10
- import { KeyDisplayPipe } from '../../../pipes/key-display';
11
- import { FormatFilterTypePipe } from '../../../pipes/format-filter-type.pipe';
12
- import { FormatFilterValuePipe } from '../../../pipes/format-filter-value.pipe';
13
-
14
- @Component({
15
- selector: 'lib-filter-list',
16
- templateUrl: './filter-list.component.html',
17
- styleUrls: ['../gen-filter-displayer/gen-filter-displayer.component.css'],
18
- changeDetection: ChangeDetectionStrategy.OnPush,
19
- imports: [
20
- MatButtonModule, MatTooltipModule, MatIconModule, FilterComponent,
21
- MatChipsModule, KeyDisplayPipe, FormatFilterTypePipe, FormatFilterValuePipe
22
- ]
23
- })
24
- export class FilterChipsComponent {
25
-
26
- tableState = inject(TableStore);
27
- filterStore = inject(WrapperFilterStore);
28
-
29
- $filters = computed(() =>
30
- this.tableState.$filtersArray().filter(f => isFilterInfo(f) && !f._isExternallyManaged) as FilterInfo[]);
31
- $certainCustomFilters = computed(() =>
32
- this.tableState.$filtersArray().filter(f => isCustomFilter(f) && f.chipLabel) as CustomFilter[]);
33
-
34
- deleteByIndex(index: number) {
35
- this.filterStore.deleteByIndex(index);
36
- }
37
-
38
- addFilter(filter:FilterInfo<any>){
39
- this.filterStore.addFilter(filter);
40
- }
41
-
42
- clearAll() {
43
- this.filterStore.clearAll();
44
- }
45
-
46
- $currentFilters = this.filterStore.$filters;
47
- }
@@ -1,40 +0,0 @@
1
- .filter {
2
- margin: 15px;
3
- display: inline-block;
4
- }
5
- .filter-button {
6
- font-size: 22px;
7
- font-weight: 700;
8
- }
9
-
10
- .cancel-button {
11
- margin-right: 30px;
12
- font-weight: 700;
13
- }
14
- .filter-wrapper{
15
- margin-top: 1em;
16
- margin-bottom: 1em;
17
- float: right;
18
- }
19
- .menu {
20
- margin-bottom: 10px;
21
- width: 109.1%;
22
- }
23
-
24
- .filter-labels {
25
- font-size: 17px;
26
- font-weight: 600;
27
- }
28
- .float{
29
- position: absolute;
30
- width: fit-content;
31
- z-index: 101;
32
- top: 10px;
33
- right: 180px;
34
- max-width: 90vw;
35
- }
36
- .d-w{
37
- display: flex;
38
- flex-direction: row;
39
- justify-content: flex-end;
40
- }
@@ -1,11 +0,0 @@
1
- <button color="primary" stop-propagation class="filter-button" mat-icon-button [matMenuTriggerFor]="menu" [matTooltip]="'Add Filter'">
2
- <mat-icon class="filter-icon" color="primary">filter_list</mat-icon>
3
- </button>
4
- <mat-menu #menu="matMenu">
5
- @for (md of $filterCols(); track md.key)
6
- {
7
- <button mat-menu-item (click)="addFilter(md)">
8
- <span class="filter-labels">{{md.displayName || (md.key | spaceCase)}}</span>
9
- </button>
10
- }
11
- </mat-menu>
@@ -1,85 +0,0 @@
1
- import { firstValueFrom, of } from 'rxjs';
2
- import { map } from 'rxjs/operators';
3
- import { TestBed, ComponentFixture, ComponentFixtureAutoDetect, tick, fakeAsync, flush } from '@angular/core/testing';
4
- import { GenFilterDisplayerComponent } from './gen-filter-displayer.component';
5
- import { SpaceCasePipe } from '../../../../utilities/pipes/space-case.pipes';
6
- import { FilterComponent } from '../../filter/filter.component';
7
- import { CommonModule } from '@angular/common';
8
- import { FormsModule } from '@angular/forms';
9
- import { FieldType } from '../../../interfaces/meta-data';
10
- import { By } from '@angular/platform-browser';
11
- import { NoopAnimationsModule } from '@angular/platform-browser/animations';
12
- import { DateFilterComponent } from '../../date-filter/date-filter.component';
13
- import { TableBuilderModule } from '../../../table-builder.module';
14
- import { StoreModule } from '@ngrx/store';
15
- import { EffectsModule } from '@ngrx/effects';
16
- import { TableStore } from '../../../classes/table-store';
17
- import { WrapperFilterStore } from '../table-wrapper-filter-store';
18
-
19
-
20
- function getMetaData() {
21
- return of([
22
- {
23
- key: 'name',
24
- displayName: 'first name',
25
- fieldType: FieldType.String,
26
- additional: {},
27
- order: 1
28
- },
29
- {
30
- key: 'last',
31
- displayName: 'last name',
32
- fieldType: FieldType.String,
33
- additional: {},
34
- order: 2
35
- }
36
- ]);
37
- }
38
-
39
- describe('generic filter displayer', () => {
40
- let fixture: ComponentFixture<GenFilterDisplayerComponent>;
41
- let component: GenFilterDisplayerComponent;
42
-
43
- const clickFilter = (idx: number) => {
44
- const btn = fixture.debugElement.query(By.css('.filter-button')).nativeElement;
45
-
46
- btn.click();
47
- const menu = fixture.debugElement.queryAll(By.css('.mat-menu-item'));
48
- menu[idx].nativeElement.click();
49
- };
50
- beforeEach(() => {
51
-
52
- TestBed.configureTestingModule({
53
- declarations: [
54
- GenFilterDisplayerComponent,
55
- SpaceCasePipe,
56
- FilterComponent,
57
- DateFilterComponent,
58
- ],
59
- providers: [TableStore, WrapperFilterStore,
60
- { provide: ComponentFixtureAutoDetect, useValue: true }
61
- ],
62
- imports: [
63
- NoopAnimationsModule,
64
- CommonModule,
65
- FormsModule,
66
- TableBuilderModule.forRoot({ defaultTableSettings: { } }),
67
- StoreModule.forRoot({}),
68
- EffectsModule.forRoot([])]
69
- })
70
- .compileComponents();
71
- fixture = TestBed.createComponent(GenFilterDisplayerComponent);
72
- component = fixture.componentInstance;
73
- });
74
-
75
- it('should get the generic filter displayer component', () => {
76
- expect(component).toBeDefined();
77
- });
78
-
79
- it('should be able to create a filter', async () => {
80
- clickFilter(0);
81
- const filter = await firstValueFrom(fixture.componentInstance.filterStore.state$.pipe(map(x => x.filterInfo)));
82
- expect(filter.length).toBe(1);
83
- });
84
-
85
- });
@@ -1,35 +0,0 @@
1
- import { Component, ChangeDetectionStrategy, inject, computed } from '@angular/core';
2
- import { MetaData, FieldType } from '../../../interfaces/meta-data';
3
- import { TableStore } from '../../../classes/table-store';
4
- import { WrapperFilterStore } from '../table-wrapper-filter-store';
5
- import { MatButtonModule } from '@angular/material/button';
6
- import { MatMenuModule } from '@angular/material/menu';
7
- import { MatTooltipModule } from '@angular/material/tooltip';
8
- import { SpaceCasePipe, StopPropagationDirective } from '../../../../utilities';
9
- import { MatIconModule } from '@angular/material/icon';
10
-
11
- @Component({
12
- selector: 'tb-filter-displayer',
13
- templateUrl: './gen-filter-displayer.component.html',
14
- styleUrls: ['./gen-filter-displayer.component.css'],
15
- changeDetection: ChangeDetectionStrategy.OnPush,
16
- imports: [
17
- MatButtonModule, MatMenuModule, MatTooltipModule, StopPropagationDirective, MatIconModule,
18
- SpaceCasePipe
19
- ]
20
- })
21
- export class GenFilterDisplayerComponent {
22
- protected tableState = inject(TableStore);
23
- protected filterStore = inject(WrapperFilterStore);
24
- $filterCols = computed(() => {
25
- const mds = this.tableState.$metaDataArray();
26
- return mds.filter(m => m.fieldType !== FieldType.Hidden && (m.fieldType !== FieldType.NotMapped || m.filterLogic?.filterBy) && !m.noFilter);
27
- });
28
-
29
- addFilter(metaData: MetaData) {
30
- this.filterStore.addFilter({
31
- key: metaData.key,
32
- fieldType: metaData.filterLogic?.filterType || metaData.fieldType,
33
- });
34
- }
35
- }
@@ -1,13 +0,0 @@
1
- import { Injectable, signal } from "@angular/core";
2
- import { PartialFilter } from "../../classes/filter-info";
3
- @Injectable()
4
- export class WrapperFilterStore {
5
- $filters = signal<PartialFilter[]>([]);
6
-
7
- clearAll = () => this.$filters.set([]);
8
- deleteByIndex = (index: number) => this.$filters.update(filters => filters.toSpliced(index, 1))
9
-
10
- addFilter = (filter: PartialFilter) => {
11
- this.$filters.update(filters => [...filters, filter]);
12
- }
13
- }
@@ -1,21 +0,0 @@
1
- .input {
2
- appearance: none;
3
- outline: none;
4
- background: none;
5
- box-shadow: none;
6
- padding: 0;
7
- margin: 0;
8
- font: inherit;
9
- color: inherit;
10
- border: 1px solid black;
11
- border-radius: 4px;
12
- width: 50px;
13
- padding-left: 4px;
14
- &::placeholder{
15
- font-size: 12px;
16
- }
17
- }
18
- .height-input-wrapper{
19
- display: flex;
20
- gap: 4px;
21
- }
@@ -1,48 +0,0 @@
1
- <span [matTooltip]="!r.$set().length ? 'Nothing To Reset' : ''">
2
- <button #d="matMenuItem" mat-menu-item [matMenuTriggerFor]="r.menu()" [disabled]="!r.$set().length">
3
- <mat-icon color="primary">autorenew</mat-icon>
4
- <span>Reset</span>
5
- </button>
6
- </span>
7
- @if (!tableContainer.state.$tableSettings().hideExport)
8
- {
9
- <button mat-menu-item (click)="exportToCsv()">
10
- <mat-icon color="primary">file_download</mat-icon>
11
- <span>Export Table</span>
12
- </button>
13
- }
14
- @if (tableContainer.$tableId(); as tableId)
15
- {
16
- <button stop-propagation mat-menu-item [matMenuTriggerFor]="pm.menu()">
17
- <mat-icon color="primary">people</mat-icon>
18
- <span>Profiles</span>
19
- </button>
20
- <tb-profiles-menu #pm class="profiles-menu" [tableId]="tableId" [isMatMenuChild]="true" />
21
- }
22
-
23
-
24
- <div mat-menu-item>
25
- <div class="height-input-wrapper">
26
- <span>Row Height</span>
27
- <input #i class="input" stop-propagation type="number"
28
- placeholder="Set Size"
29
- [value]="$rowHeightNum()"
30
- [min]="10"
31
- [max]="100" (change)="updateHeight('row', i)" />
32
- </div>
33
- </div>
34
- @if(!state.$tableSettings().hideHeader)
35
- {
36
- <div mat-menu-item>
37
- <div class="height-input-wrapper">
38
- <span>Header Height</span>
39
- <input #i2 class="input" stop-propagation type="number"
40
- placeholder="Set Size"
41
- [value]="$headerHeightNum()"
42
- [min]="10"
43
- [max]="100" (change)="updateHeight('header', i2)"/>
44
- </div>
45
- </div>
46
- }
47
- <lib-reset-menu #r/>
48
-
@@ -1,36 +0,0 @@
1
- import { Component, computed, inject, viewChild, ChangeDetectionStrategy } from '@angular/core';
2
- import { MatIcon } from '@angular/material/icon';
3
- import { MatMenu, MatMenuModule } from '@angular/material/menu';
4
- import { TableContainerComponent } from '../table-container/table-container.component';
5
- import { ExportToCsvService } from '../../services/export-to-csv.service';
6
- import { ProfilesMenuComponent } from "../profiles-menu/profiles-menu.component";
7
- import { ResetMenuComponent } from "../reset-menu/reset-menu.component";
8
- import { MatTooltip } from '@angular/material/tooltip';
9
- import { StopPropagationDirective } from '../../../utilities';
10
-
11
- @Component({
12
- selector: 'lib-table-header-menu',
13
- imports: [MatMenuModule, MatIcon, ProfilesMenuComponent, ResetMenuComponent, MatTooltip, StopPropagationDirective],
14
- templateUrl: './table-header-menu.component.html',
15
- styleUrl: './table-header-menu.component.css',
16
- changeDetection: ChangeDetectionStrategy.OnPush
17
- })
18
- export class TableHeaderMenuComponent {
19
- menu = viewChild.required(MatMenu);
20
- private exportToCsvService = inject(ExportToCsvService);
21
- protected tableContainer = inject(TableContainerComponent);
22
- state = this.tableContainer.state;
23
- $rowHeightNum = computed(() => +(this.tableContainer.$genericTable()?.$rowHeight()?.replace('px', '') || 0) || undefined);
24
- $headerHeightNum = computed(() => +(this.tableContainer.$genericTable()?.$headerHeight()?.replace('px', '') || 0) || undefined);
25
- protected exportToCsv(): void {
26
- this.exportToCsvService.exportToCsv(this.tableContainer.$data());
27
- }
28
-
29
- updateHeight(v: 'row' | 'header', element: HTMLInputElement){
30
- if(+element.value < 10) element.value = '10';
31
- if(+element.value > 100) element.value = '100';
32
- if(v === 'row') this.state.setUserDefinedRowHeight(+element.value);
33
- if(v === 'header') this.state.setUserDefinedHeaderHeight(+element.value);
34
- }
35
-
36
- }
@@ -1,63 +0,0 @@
1
- import { Directive, TemplateRef, inject, input, computed, signal, OnInit } from '@angular/core';
2
- import { CdkColumnDef } from '@angular/cdk/table';
3
- import { CustomCellMeta, FieldType, SortDef } from '../interfaces/meta-data';
4
- import { TableBuilder } from '../classes/table-builder';
5
- import { coerceBooleanProperty } from '@angular/cdk/coercion';
6
- import { StylerStyle } from '../../utilities/directives/styler';
7
-
8
- interface CustomCellContext<T> {
9
- $implicit: T,
10
- element: T,
11
- }
12
- // here is how to use it
13
- // <generic-table [report]="report">
14
- // <p *customCell="'column1'; let element = element" [class.makeMeRed]="element?.port">If Port, i will be red</p>
15
- // <p *customCell="'column2'">I am custom cell two </p>
16
- // </generic-table>
17
- @Directive({ selector: '[customCell]' })
18
- export class CustomCellDirective<T = any> implements OnInit {
19
- private templateRef = inject<TemplateRef<any>>(TemplateRef, { optional: true });
20
- public columnDef = inject(CdkColumnDef, { optional: true });
21
- $customCell = input.required<string>({ alias: 'customCell' });
22
- $displayName = input<string | undefined>(undefined, { alias: 'customCellDisplayName' });
23
- $preSort = input<SortDef | undefined>(undefined, { alias: 'preSort' });
24
- $templateRef = input<TemplateRef<any> | undefined>(this.templateRef || undefined, { alias: 'templateRef' });
25
- $customCellOrder = input<number | undefined>(undefined, { alias: 'customCellOrder' });
26
- $customCellWidth = input<string | undefined>(undefined, { alias: 'customCellWidth' });
27
- /**
28
- * for type safety, this is a reference to the table builder instance.
29
- */
30
- $customCellTableRef = input<TableBuilder<T> | undefined>(undefined, { alias: 'customCellTableRef' });
31
- /**
32
- * true if column not mapped to a property in the data source. Default is false.
33
- */
34
- $customCellNotMapped = input(false, { alias: 'customCellNotMapped', transform: coerceBooleanProperty });
35
- /**
36
- * Styles to apply to the cell element
37
- */
38
- $customCellCellStyles = input<StylerStyle<T>>(undefined, { alias: 'customCellCellStyles' });
39
- $metaData = computed((): CustomCellMeta | undefined => {
40
- const c = this.$customCell();
41
- if(!c) return;
42
- return ({
43
- key: this.$customCell(),
44
- displayName: this.$displayName(),
45
- preSort: this.$preSort(),
46
- fieldType: this.$customCellNotMapped() ? FieldType.NotMapped : FieldType.Unknown,
47
- order: this.$customCellOrder(),
48
- width: this.$customCellWidth(),
49
- customCell: true,
50
- noExport: true,
51
- additional: { styles: this.$customCellCellStyles() },
52
- })
53
- });
54
- $inited = signal(false);
55
-
56
- ngOnInit(){
57
- this.$inited.set(true);
58
- }
59
-
60
- static ngTemplateContextGuard<T>(dir: CustomCellDirective<T>, ctx: any): ctx is CustomCellContext<T> {
61
- return true;
62
- }
63
- }
@@ -1,16 +0,0 @@
1
- import { Directive, TemplateRef, inject, input, signal, OnInit } from '@angular/core';
2
-
3
- @Directive({ selector: '[customHeader]' })
4
- export class CustomHeaderDirective<T = any> implements OnInit {
5
- private templateRef = inject<TemplateRef<any>>(TemplateRef);
6
-
7
- $customHeader = input.required<string>({ alias: 'customHeader' });
8
-
9
- $inited = signal(false);
10
-
11
- template = () => this.templateRef;
12
-
13
- ngOnInit() {
14
- this.$inited.set(true);
15
- }
16
- }
@@ -1,91 +0,0 @@
1
- import { Directive, TemplateRef, inject, input, computed, signal, OnInit } from '@angular/core';
2
- import { TableBuilder } from '../classes/table-builder';
3
- import { Group } from '../types/group-types';
4
- import { Path } from '../interfaces/meta-data';
5
-
6
- interface CustomGroupRowContext<T> {
7
- $implicit: Group<T>;
8
- element: T;
9
- expanded: boolean;
10
- level: number;
11
- key: string;
12
- uniqueName: string;
13
- groupHeaderDisplay: string;
14
- length: number;
15
- padding: number;
16
- }
17
-
18
- // Usage examples:
19
- // <!-- Custom group row for all groupings -->
20
- // <div *customGroupRow="let group">
21
- // Custom template for: {{group.groupHeaderDisplay}} ({{group.length}} items)
22
- // </div>
23
- //
24
- // <!-- Custom group row only for specific grouping key -->
25
- // <div *customGroupRow="'category'; let group">
26
- // Category: {{group.groupHeaderDisplay}} - {{group.length}} products
27
- // </div>
28
- //
29
- // <!-- Custom group row for multiple grouping keys -->
30
- // <div *customGroupRow="['category', 'status']; let group">
31
- // Multi-key template: {{group.groupHeaderDisplay}} ({{group.length}} items)
32
- // </div>
33
- @Directive({ selector: '[customGroupRow]' })
34
- export class CustomGroupRowDirective<T = any> implements OnInit {
35
- private templateRef = inject<TemplateRef<any>>(TemplateRef);
36
-
37
- /**
38
- * Optional grouping key(s). If provided, this custom row will only apply when data is grouped by this key or keys.
39
- * If not provided (or null), this custom row will apply to all groupings.
40
- * Can be a single Path<T> or an array of Path<T> values.
41
- */
42
- $customGroupRow = input(null, { alias: 'customGroupRow', transform: (val: Path<T> | Path<T>[] | null | '') => val === '' ? null : val });
43
-
44
- /**
45
- * For type safety, this is a reference to the table builder instance.
46
- */
47
- $customGroupRowTableRef = input<TableBuilder<T> | undefined>(undefined, { alias: 'customGroupRowTableRef' });
48
-
49
- /**
50
- * Priority order for this custom group row. Higher numbers have higher priority.
51
- * Useful when multiple custom group rows could apply to the same grouping.
52
- */
53
- $priority = input<number>(0, { alias: 'customGroupRowPriority' });
54
-
55
- $inited = signal(false);
56
-
57
- /**
58
- * Gets the grouping key(s) this directive applies to, or null for all groupings
59
- */
60
- $groupingKey = computed(() => this.$customGroupRow());
61
-
62
- /**
63
- * Gets the template reference to use
64
- */
65
- template = () => this.templateRef;
66
-
67
- ngOnInit() {
68
- this.$inited.set(true);
69
- }
70
-
71
- /**
72
- * Type guard for template context
73
- */
74
- static ngTemplateContextGuard<T>(dir: CustomGroupRowDirective<T>, ctx: any): ctx is CustomGroupRowContext<T> {
75
- return true;
76
- }
77
-
78
- /**
79
- * Checks if this directive applies to the given grouping key
80
- */
81
- appliesTo(groupingKey: string): boolean {
82
- const targetKey = this.$groupingKey();
83
- if(targetKey === null) {
84
- return true; // Apply to all groupings
85
- }
86
- if(Array.isArray(targetKey)) {
87
- return targetKey.includes(groupingKey as Path<T>);
88
- }
89
- return targetKey === groupingKey;
90
- }
91
- }
@@ -1,8 +0,0 @@
1
- export * from './custom-cell-directive';
2
- export * from './custom-header-directive';
3
- export * from './group-row-directive';
4
- export * from './multi-sort.directive';
5
- export * from './resize-column.directive';
6
- export * from './table-wrapper.directive';
7
- export * from './tb-filter.directive';
8
-
@@ -1,124 +0,0 @@
1
- import { MultiSortDirective } from './multi-sort.directive';
2
- import { Sort, MatSortable } from '@angular/material/sort';
3
- import { FieldType } from '../interfaces/meta-data';
4
- import { TableBuilderConfigToken } from '../classes/TableBuilderConfig';
5
- import { DatePipe } from '@angular/common';
6
- import { TestBed } from '@angular/core/testing';
7
- import { StoreModule } from '@ngrx/store';
8
- import { storageStateReducer } from '../ngrx/reducer';
9
- import { TableStore } from '../classes/table-store';
10
-
11
- describe('MultiSortDirective', () => {
12
-
13
- let directive: MultiSortDirective;
14
- let rules: Sort[];
15
-
16
- const data = [
17
- {
18
- name: 'Joe',
19
- age: 10,
20
- balance: 25
21
- },
22
- {
23
- name: 'Jane',
24
- age: 20,
25
- balance: 35
26
- }
27
- ];
28
- const metaData = [
29
- {
30
- key: 'name',
31
- fieldType: FieldType.String,
32
- additional: {},
33
- order: 1
34
- },
35
- {
36
- key: 'age',
37
- fieldType: FieldType.Number,
38
- additional: {},
39
- order: 2
40
- },
41
- {
42
- key: 'balance',
43
- fieldType: FieldType.Number,
44
- additional: {},
45
- order: 3
46
- }
47
- ];
48
-
49
- const initialState = { fullTableState: {
50
- 'test-id': {
51
- metaData,
52
- hiddenKeys: [],
53
- pageSize: 10,
54
- initialized: true,
55
- filters: [],
56
- sorted: [],
57
- }
58
- } };
59
-
60
- beforeEach(() => {
61
- TestBed.resetTestingModule();
62
- rules = [];
63
- TestBed.configureTestingModule({
64
- declarations: [],
65
- providers: [
66
- { provide: TableBuilderConfigToken, useValue: { defaultTableState: { } } },
67
- DatePipe,
68
- TableStore
69
- ],
70
- imports: [
71
- StoreModule.forRoot({ 'fullTableState': storageStateReducer }),
72
- ],
73
- teardown: { destroyAfterEach: true }
74
- })
75
- .compileComponents();
76
-
77
- const store = TestBed.inject(TableStore);
78
- // stateManager.upda ..tableId = 'test-id';
79
- // stateManager.initializeState();
80
- directive = new MultiSortDirective(store);
81
-
82
- rules = [
83
- { active: 'a', direction: 'asc' },
84
- { active: 'b', direction: 'asc' },
85
- { active: 'c', direction: 'asc' },
86
- ];
87
-
88
- [...rules].reverse().forEach( rule => store.setSort( { key: rule.active, direction: rule.direction } ));
89
- directive.ngOnInit();
90
- });
91
-
92
- describe('Initializing Rules', () => {
93
-
94
- it('should inititialize the rules', () => {
95
- expect(directive.rules).toEqual(rules);
96
- });
97
- });
98
-
99
- describe('Updating the rules', () => {
100
- it('should add new rule to begining of rules array', () => {
101
- const originalLength = directive.rules.length;
102
- const sort: MatSortable = { id: 'd', start: 'asc', disableClear: false };
103
- directive.sort(sort);
104
- expect(directive.rules.length).toBe(originalLength + 1, 'updated rules length should be one larger than original');
105
- expect(directive.rules[0].active).toBe(sort.id);
106
- });
107
-
108
- it('should remove old rule for the column of new rule and replace it with new rule', () => {
109
- const originalLength = directive.rules.length;
110
- const sort: MatSortable = { id: 'a', start: 'asc', disableClear: false };
111
- directive.sort(sort);
112
- expect(directive.rules.length).toBe(originalLength, 'updated rules length should be same as original');
113
- expect(directive.rules[0].direction).toBe('desc');
114
- });
115
-
116
- it('should remove old rule without replacing it if new rule for that column has no direction', () => {
117
- const originalLength = directive.rules.length;
118
- const sort: MatSortable = { id: 'a', start: 'asc', disableClear: false };
119
- directive.sort({ ...sort });
120
- directive.sort({ ...sort });
121
- expect(directive.rules.length).toBe(originalLength - 1, 'updated rules length should be one smaller than original');
122
- });
123
- });
124
- });