@one-paragon/angular-utilities 2.2.4 → 2.2.6
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/karma.conf.js +44 -0
- package/ng-package.json +7 -0
- package/package.json +15 -27
- package/src/action-state/action-state-spinner/action-state-spinner.component.css +16 -0
- package/src/action-state/action-state-spinner/action-state-spinner.component.html +7 -0
- package/src/action-state/action-state-spinner/action-state-spinner.component.spec.ts +25 -0
- package/src/action-state/action-state-spinner/action-state-spinner.component.ts +25 -0
- package/src/action-state/action-state-ui/action-state-ui.module.ts +13 -0
- package/{action-state/index.d.ts → src/action-state/index.ts} +8 -4
- package/src/action-state/ngrx-ext/ngrx-ext.module.ts +14 -0
- package/src/action-state/ngrx.ts +69 -0
- package/src/http-request-state/RequestStateFactory.ts +56 -0
- package/src/http-request-state/RequestStateStore.ts +284 -0
- package/{http-request-state/deprecated.d.ts → src/http-request-state/deprecated.ts} +20 -20
- package/src/http-request-state/directives/HttpStateDirectiveBase.ts +29 -0
- package/src/http-request-state/directives/http-error-state-directive.ts +21 -0
- package/src/http-request-state/directives/http-inProgress-state-directive.ts +19 -0
- package/src/http-request-state/directives/http-notStarted-state-directive.ts +19 -0
- package/src/http-request-state/directives/http-success-state-directive.ts +29 -0
- package/{http-request-state/directives/index.d.ts → src/http-request-state/directives/index.ts} +5 -5
- package/src/http-request-state/directives/request-state-directive.spec.ts +73 -0
- package/src/http-request-state/directives/request-state-directive.ts +78 -0
- package/src/http-request-state/helpers.ts +30 -0
- package/src/http-request-state/http-state-module.ts +23 -0
- package/{http-request-state/index.d.ts → src/http-request-state/index.ts} +7 -7
- package/src/http-request-state/models/view-context.ts +18 -0
- package/src/http-request-state/observable.spec.ts +43 -0
- package/src/http-request-state/request-state.ts +66 -0
- package/src/http-request-state/rxjs/getRequestorBody.ts +10 -0
- package/src/http-request-state/rxjs/getRequestorState.ts +8 -0
- package/{http-request-state/rxjs/index.d.ts → src/http-request-state/rxjs/index.ts} +4 -4
- package/src/http-request-state/rxjs/tapError.ts +16 -0
- package/src/http-request-state/rxjs/tapSuccess.ts +16 -0
- package/src/http-request-state/strategies.spec.ts +42 -0
- package/src/http-request-state/types.ts +54 -0
- package/src/ngrx/actionable-selector.ts +160 -0
- package/src/ngrx/index.ts +1 -0
- package/{public-api.d.ts → src/public-api.ts} +35 -16
- package/src/rxjs/defaultShareReplay.ts +8 -0
- package/{rxjs/index.d.ts → src/rxjs/index.ts} +5 -5
- package/src/rxjs/mapError.ts +8 -0
- package/src/rxjs/rxjs-operators.ts +130 -0
- package/src/rxjs/subjectifier.ts +17 -0
- package/src/rxjs/subscriber.directive.ts +57 -0
- package/src/specs/clickSubject.spec.ts +95 -0
- package/src/specs/dialog.spec.ts +101 -0
- package/src/specs/toggleGroupDirective.spec.ts +229 -0
- package/src/table-builder/classes/DefaultSettings.ts +11 -0
- package/src/table-builder/classes/MatTableObservableDataSource.ts +23 -0
- package/src/table-builder/classes/TableBuilderConfig.ts +50 -0
- package/src/table-builder/classes/TableBuilderDataSource.ts +64 -0
- package/src/table-builder/classes/TableState.ts +125 -0
- package/src/table-builder/classes/data-store.ts +10 -0
- package/{table-builder/classes/display-col.d.ts → src/table-builder/classes/display-col.ts} +5 -5
- package/src/table-builder/classes/filter-info.ts +125 -0
- package/src/table-builder/classes/table-builder-general-settings.ts +205 -0
- package/src/table-builder/classes/table-builder.ts +105 -0
- package/src/table-builder/classes/table-store.helpers.ts +104 -0
- package/src/table-builder/classes/table-store.ts +440 -0
- package/src/table-builder/components/array-column.component.ts +34 -0
- package/src/table-builder/components/column-builder/column-builder.component.html +87 -0
- package/src/table-builder/components/column-builder/column-builder.component.scss +43 -0
- package/src/table-builder/components/column-builder/column-builder.component.spec.ts +49 -0
- package/src/table-builder/components/column-builder/column-builder.component.ts +129 -0
- package/src/table-builder/components/column-builder/column-helpers.ts +54 -0
- package/src/table-builder/components/column-header-menu/column-header-menu.component.html +110 -0
- package/src/table-builder/components/column-header-menu/column-header-menu.component.scss +97 -0
- package/src/table-builder/components/column-header-menu/column-header-menu.component.ts +94 -0
- package/src/table-builder/components/date-filter/date-filter.component.html +25 -0
- package/src/table-builder/components/date-filter/date-filter.component.ts +22 -0
- package/src/table-builder/components/date-time-filter/date-time-filter.component.html +11 -0
- package/src/table-builder/components/date-time-filter/date-time-filter.component.ts +20 -0
- package/src/table-builder/components/filter/filter.component.html +109 -0
- package/src/table-builder/components/filter/filter.component.scss +60 -0
- package/src/table-builder/components/filter/filter.component.spec.ts +86 -0
- package/src/table-builder/components/filter/filter.component.ts +64 -0
- package/src/table-builder/components/filter/in-list/in-list-filter.component.ts +102 -0
- package/src/table-builder/components/gen-col-displayer/gen-col-displayer.component.html +60 -0
- package/src/table-builder/components/gen-col-displayer/gen-col-displayer.component.scss +57 -0
- package/src/table-builder/components/gen-col-displayer/gen-col-displayer.component.ts +44 -0
- package/src/table-builder/components/generic-table/generic-table.component.html +97 -0
- package/src/table-builder/components/generic-table/generic-table.component.scss +38 -0
- package/src/table-builder/components/generic-table/generic-table.component.ts +403 -0
- package/src/table-builder/components/generic-table/paginator.component.ts +112 -0
- package/src/table-builder/components/group-by-list/group-by-list.component.css +17 -0
- package/src/table-builder/components/group-by-list/group-by-list.component.html +14 -0
- package/src/table-builder/components/group-by-list/group-by-list.component.spec.ts +23 -0
- package/src/table-builder/components/group-by-list/group-by-list.component.ts +25 -0
- package/src/table-builder/components/in-filter/in-filter.component.css +3 -0
- package/src/table-builder/components/in-filter/in-filter.component.html +23 -0
- package/src/table-builder/components/in-filter/in-filter.component.ts +65 -0
- package/{table-builder/components/index.d.ts → src/table-builder/components/index.ts} +9 -9
- package/src/table-builder/components/initialization-component/initialization.component.html +78 -0
- package/src/table-builder/components/initialization-component/initialization.component.ts +27 -0
- package/src/table-builder/components/link-column.component.ts +42 -0
- package/src/table-builder/components/number-filter/number-filter.component.css +10 -0
- package/src/table-builder/components/number-filter/number-filter.component.html +25 -0
- package/src/table-builder/components/number-filter/number-filter.component.spec.ts +30 -0
- package/src/table-builder/components/number-filter/number-filter.component.ts +25 -0
- package/src/table-builder/components/profiles-menu/profiles-menu.component.html +77 -0
- package/src/table-builder/components/profiles-menu/profiles-menu.component.scss +126 -0
- package/src/table-builder/components/profiles-menu/profiles-menu.component.spec.ts +23 -0
- package/src/table-builder/components/profiles-menu/profiles-menu.component.ts +63 -0
- package/src/table-builder/components/reset-menu/reset-menu.component.css +3 -0
- package/src/table-builder/components/reset-menu/reset-menu.component.html +10 -0
- package/src/table-builder/components/reset-menu/reset-menu.component.ts +87 -0
- package/src/table-builder/components/scroll-strategy.ts +139 -0
- package/src/table-builder/components/sort-menu/sort-menu.component-store.ts +57 -0
- package/src/table-builder/components/sort-menu/sort-menu.component.html +115 -0
- package/src/table-builder/components/sort-menu/sort-menu.component.scss +119 -0
- package/src/table-builder/components/sort-menu/sort-menu.component.ts +88 -0
- package/src/table-builder/components/table-container/table-container.component.html +81 -0
- package/src/table-builder/components/table-container/table-container.component.ts +403 -0
- package/src/table-builder/components/table-container/table-container.helpers/data-state.helpers.ts +113 -0
- package/src/table-builder/components/table-container/table-container.helpers/filter-state.helpers.ts +125 -0
- package/src/table-builder/components/table-container/table-container.helpers/groupBy.helpers.ts +122 -0
- package/src/table-builder/components/table-container/table-container.helpers/meta-data.helpers.ts +16 -0
- package/src/table-builder/components/table-container/table-container.helpers/sort-state.helpers.ts +47 -0
- package/src/table-builder/components/table-container/table-container.scss +47 -0
- package/src/table-builder/components/table-container/tableProps.ts +18 -0
- package/src/table-builder/components/table-container/virtual-scroll-container.ts +216 -0
- package/src/table-builder/components/table-container-filter/filter-list/filter-list.component.html +35 -0
- package/src/table-builder/components/table-container-filter/filter-list/filter-list.component.ts +44 -0
- package/src/table-builder/components/table-container-filter/gen-filter-displayer/gen-filter-displayer.component.css +40 -0
- package/src/table-builder/components/table-container-filter/gen-filter-displayer/gen-filter-displayer.component.html +11 -0
- package/src/table-builder/components/table-container-filter/gen-filter-displayer/gen-filter-displayer.component.spec.ts +85 -0
- package/src/table-builder/components/table-container-filter/gen-filter-displayer/gen-filter-displayer.component.ts +36 -0
- package/src/table-builder/components/table-container-filter/table-wrapper-filter-store.ts +23 -0
- package/src/table-builder/components/table-header-menu/table-header-menu.component.css +21 -0
- package/src/table-builder/components/table-header-menu/table-header-menu.component.html +50 -0
- package/src/table-builder/components/table-header-menu/table-header-menu.component.ts +35 -0
- package/src/table-builder/directives/custom-cell-directive.ts +57 -0
- package/{table-builder/directives/index.d.ts → src/table-builder/directives/index.ts} +6 -5
- package/src/table-builder/directives/multi-sort.directive.spec.ts +124 -0
- package/src/table-builder/directives/multi-sort.directive.ts +50 -0
- package/src/table-builder/directives/resize-column.directive.ts +107 -0
- package/src/table-builder/directives/table-wrapper.directive.ts +13 -0
- package/src/table-builder/directives/tb-filter.directive.ts +376 -0
- package/src/table-builder/enums/filterTypes.ts +40 -0
- package/src/table-builder/functions/boolean-filter-function.ts +12 -0
- package/src/table-builder/functions/date-filter-function.ts +78 -0
- package/src/table-builder/functions/download-data.ts +11 -0
- package/src/table-builder/functions/null-filter-function.ts +9 -0
- package/src/table-builder/functions/number-filter-function.ts +41 -0
- package/src/table-builder/functions/sort-data-function.ts +80 -0
- package/src/table-builder/functions/string-filter-function.ts +53 -0
- package/{table-builder/interfaces/ColumnInfo.d.ts → src/table-builder/interfaces/ColumnInfo.ts} +7 -6
- package/{table-builder/interfaces/dictionary.d.ts → src/table-builder/interfaces/dictionary.ts} +3 -3
- package/src/table-builder/interfaces/report-def.ts +254 -0
- package/src/table-builder/ngrx/tableBuilderStateStore.ts +197 -0
- package/src/table-builder/pipes/column-total.pipe.ts +16 -0
- package/src/table-builder/pipes/format-filter-type.pipe.ts +12 -0
- package/src/table-builder/pipes/format-filter-value.pipe.ts +67 -0
- package/src/table-builder/pipes/key-display.ts +13 -0
- package/src/table-builder/services/export-to-csv.service.ts +113 -0
- package/src/table-builder/services/link-creator.service.ts +98 -0
- package/src/table-builder/services/table-template-service.ts +47 -0
- package/src/table-builder/services/transform-creator.ts +96 -0
- package/src/table-builder/specs/table-custom-filters.spec.ts +262 -0
- package/src/table-builder/styles/collapser.styles.scss +16 -0
- package/src/table-builder/table-builder.module.ts +38 -0
- package/src/test.ts +17 -0
- package/src/utilities/array-helpers.ts +13 -0
- package/src/utilities/directives/auto-focus.directive.ts +20 -0
- package/src/utilities/directives/clickEmitterDirective.ts +15 -0
- package/src/utilities/directives/clickSubject.ts +19 -0
- package/src/utilities/directives/conditional-classes.directive.ts +36 -0
- package/src/utilities/directives/dialog-service.ts +19 -0
- package/src/utilities/directives/dialog.ts +144 -0
- package/src/utilities/directives/mat-toggle-group-directive.ts +60 -0
- package/src/utilities/directives/prevent-enter.directive.ts +12 -0
- package/src/utilities/directives/stop-propagation.directive.ts +19 -0
- package/src/utilities/directives/styler.ts +44 -0
- package/src/utilities/directives/trim-whitespace.directive.ts +20 -0
- package/{utilities/index.d.ts → src/utilities/index.ts} +22 -15
- package/src/utilities/module.ts +53 -0
- package/src/utilities/pipes/function.pipe.ts +21 -0
- package/src/utilities/pipes/phone.pipe.ts +20 -0
- package/src/utilities/pipes/space-case.pipes.spec.ts +47 -0
- package/src/utilities/pipes/space-case.pipes.ts +26 -0
- package/tsconfig.lib.json +20 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +17 -0
- package/action-state/action-state-spinner/action-state-spinner.component.d.ts +0 -12
- package/action-state/action-state-ui/action-state-ui.module.d.ts +0 -7
- package/action-state/ngrx-ext/ngrx-ext.module.d.ts +0 -8
- package/action-state/ngrx.d.ts +0 -31
- package/fesm2022/one-paragon-angular-utilities.mjs +0 -6531
- package/fesm2022/one-paragon-angular-utilities.mjs.map +0 -1
- package/http-request-state/RequestStateFactory.d.ts +0 -17
- package/http-request-state/RequestStateStore.d.ts +0 -101
- package/http-request-state/directives/HttpStateDirectiveBase.d.ts +0 -14
- package/http-request-state/directives/http-error-state-directive.d.ts +0 -10
- package/http-request-state/directives/http-inProgress-state-directive.d.ts +0 -10
- package/http-request-state/directives/http-notStarted-state-directive.d.ts +0 -10
- package/http-request-state/directives/http-success-state-directive.d.ts +0 -17
- package/http-request-state/directives/request-state-directive.d.ts +0 -34
- package/http-request-state/helpers.d.ts +0 -9
- package/http-request-state/http-state-module.d.ts +0 -11
- package/http-request-state/request-state.d.ts +0 -12
- package/http-request-state/rxjs/getRequestorBody.d.ts +0 -3
- package/http-request-state/rxjs/getRequestorState.d.ts +0 -3
- package/http-request-state/rxjs/tapError.d.ts +0 -3
- package/http-request-state/rxjs/tapSuccess.d.ts +0 -3
- package/http-request-state/types.d.ts +0 -41
- package/index.d.ts +0 -5
- package/ngrx/actionable-selector.d.ts +0 -32
- package/ngrx/index.d.ts +0 -1
- package/rxjs/defaultShareReplay.d.ts +0 -2
- package/rxjs/mapError.d.ts +0 -2
- package/rxjs/rxjs-operators.d.ts +0 -13
- package/rxjs/subjectifier.d.ts +0 -10
- package/rxjs/subscriber.directive.d.ts +0 -14
- package/table-builder/classes/DefaultSettings.d.ts +0 -9
- package/table-builder/classes/MatTableObservableDataSource.d.ts +0 -9
- package/table-builder/classes/TableBuilderConfig.d.ts +0 -23
- package/table-builder/classes/TableBuilderDataSource.d.ts +0 -18
- package/table-builder/classes/TableState.d.ts +0 -81
- package/table-builder/classes/data-store.d.ts +0 -8
- package/table-builder/classes/filter-info.d.ts +0 -39
- package/table-builder/classes/table-builder-general-settings.d.ts +0 -119
- package/table-builder/classes/table-builder.d.ts +0 -22
- package/table-builder/classes/table-store.d.ts +0 -146
- package/table-builder/classes/table-store.helpers.d.ts +0 -31
- package/table-builder/components/array-column.component.d.ts +0 -15
- package/table-builder/components/column-builder/column-builder.component.d.ts +0 -41
- package/table-builder/components/column-builder/column-helpers.d.ts +0 -38
- package/table-builder/components/column-header-menu/column-header-menu.component.d.ts +0 -50
- package/table-builder/components/date-filter/date-filter.component.d.ts +0 -37
- package/table-builder/components/date-time-filter/date-time-filter.component.d.ts +0 -37
- package/table-builder/components/filter/filter.component.d.ts +0 -48
- package/table-builder/components/filter/in-list/in-list-filter.component.d.ts +0 -22
- package/table-builder/components/gen-col-displayer/gen-col-displayer.component.d.ts +0 -17
- package/table-builder/components/generic-table/generic-table.component.d.ts +0 -85
- package/table-builder/components/generic-table/paginator.component.d.ts +0 -26
- package/table-builder/components/group-by-list/group-by-list.component.d.ts +0 -11
- package/table-builder/components/in-filter/in-filter.component.d.ts +0 -20
- package/table-builder/components/initialization-component/initialization.component.d.ts +0 -15
- package/table-builder/components/link-column.component.d.ts +0 -23
- package/table-builder/components/number-filter/number-filter.component.d.ts +0 -39
- package/table-builder/components/profiles-menu/profiles-menu.component.d.ts +0 -33
- package/table-builder/components/reset-menu/reset-menu.component.d.ts +0 -25
- package/table-builder/components/scroll-strategy.d.ts +0 -45
- package/table-builder/components/sort-menu/sort-menu.component-store.d.ts +0 -24
- package/table-builder/components/sort-menu/sort-menu.component.d.ts +0 -19
- package/table-builder/components/table-container/table-container.component.d.ts +0 -104
- package/table-builder/components/table-container/table-container.helpers/data-state.helpers.d.ts +0 -7
- package/table-builder/components/table-container/table-container.helpers/filter-state.helpers.d.ts +0 -19
- package/table-builder/components/table-container/table-container.helpers/groupBy.helpers.d.ts +0 -19
- package/table-builder/components/table-container/table-container.helpers/meta-data.helpers.d.ts +0 -2
- package/table-builder/components/table-container/table-container.helpers/sort-state.helpers.d.ts +0 -12
- package/table-builder/components/table-container/tableProps.d.ts +0 -10
- package/table-builder/components/table-container/virtual-scroll-container.d.ts +0 -40
- package/table-builder/components/table-container-filter/filter-list/filter-list.component.d.ts +0 -15
- package/table-builder/components/table-container-filter/gen-filter-displayer/gen-filter-displayer.component.d.ts +0 -12
- package/table-builder/components/table-container-filter/table-wrapper-filter-store.d.ts +0 -14
- package/table-builder/components/table-header-menu/table-header-menu.component.d.ts +0 -15
- package/table-builder/directives/custom-cell-directive.d.ts +0 -34
- package/table-builder/directives/multi-sort.directive.d.ts +0 -10
- package/table-builder/directives/resize-column.directive.d.ts +0 -43
- package/table-builder/directives/table-wrapper.directive.d.ts +0 -8
- package/table-builder/directives/tb-filter.directive.d.ts +0 -116
- package/table-builder/enums/filterTypes.d.ts +0 -36
- package/table-builder/functions/boolean-filter-function.d.ts +0 -3
- package/table-builder/functions/date-filter-function.d.ts +0 -4
- package/table-builder/functions/download-data.d.ts +0 -1
- package/table-builder/functions/null-filter-function.d.ts +0 -2
- package/table-builder/functions/number-filter-function.d.ts +0 -4
- package/table-builder/functions/sort-data-function.d.ts +0 -6
- package/table-builder/functions/string-filter-function.d.ts +0 -5
- package/table-builder/interfaces/report-def.d.ts +0 -223
- package/table-builder/ngrx/tableBuilderStateStore.d.ts +0 -69
- package/table-builder/pipes/column-total.pipe.d.ts +0 -8
- package/table-builder/pipes/format-filter-type.pipe.d.ts +0 -8
- package/table-builder/pipes/format-filter-value.pipe.d.ts +0 -11
- package/table-builder/pipes/key-display.d.ts +0 -9
- package/table-builder/services/export-to-csv.service.d.ts +0 -14
- package/table-builder/services/link-creator.service.d.ts +0 -16
- package/table-builder/services/table-template-service.d.ts +0 -14
- package/table-builder/services/transform-creator.d.ts +0 -9
- package/table-builder/table-builder.module.d.ts +0 -14
- package/utilities/array-helpers.d.ts +0 -1
- package/utilities/directives/auto-focus.directive.d.ts +0 -9
- package/utilities/directives/clickEmitterDirective.d.ts +0 -7
- package/utilities/directives/clickSubject.d.ts +0 -9
- package/utilities/directives/conditional-classes.directive.d.ts +0 -12
- package/utilities/directives/dialog-service.d.ts +0 -10
- package/utilities/directives/dialog.d.ts +0 -45
- package/utilities/directives/mat-toggle-group-directive.d.ts +0 -21
- package/utilities/directives/prevent-enter.directive.d.ts +0 -6
- package/utilities/directives/stop-propagation.directive.d.ts +0 -7
- package/utilities/directives/styler.d.ts +0 -16
- package/utilities/directives/trim-whitespace.directive.d.ts +0 -7
- package/utilities/module.d.ts +0 -19
- package/utilities/pipes/function.pipe.d.ts +0 -11
- package/utilities/pipes/phone.pipe.d.ts +0 -8
- package/utilities/pipes/space-case.pipes.d.ts +0 -17
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
@let filter = $filter();
|
|
2
|
+
@let currentFilterType = $currentFilterType();
|
|
3
|
+
|
|
4
|
+
@if (filter)
|
|
5
|
+
{
|
|
6
|
+
<mat-card appearance="outlined" class="filter-card">
|
|
7
|
+
<mat-card-content>
|
|
8
|
+
<form #form="ngForm" (keydown.enter)="onEnter(form.value,$event)" (keydown.escape)="close.emit()">
|
|
9
|
+
<input type="hidden" name="filterId" [ngModel]="filter.filterId" />
|
|
10
|
+
<input type="hidden" name="key" [ngModel]="filter.key" />
|
|
11
|
+
<input type="hidden" name="fieldType" [ngModel]="filter.fieldType" />
|
|
12
|
+
<div class="head-row" >
|
|
13
|
+
<h4 class="filter-name">{{(filter.key | spaceCase)}} Filter</h4>
|
|
14
|
+
<button class="cancel-button small-button" color="primary" mat-icon-button type="button" [matTooltip]="'Close'"
|
|
15
|
+
(click)="close.emit();">
|
|
16
|
+
<mat-icon class="cancel-button" color="primary">close</mat-icon>
|
|
17
|
+
</button>
|
|
18
|
+
</div>
|
|
19
|
+
<div class="filter-row">
|
|
20
|
+
<div class="inline">
|
|
21
|
+
<mat-form-field class="my-filter" >
|
|
22
|
+
<mat-select placeholder="Select Filter Type" name="filterType" [ngModel]="$currentFilterType()" [panelWidth]="null" (ngModelChange)="$enteredFilterType.set($event)">
|
|
23
|
+
@for (kvp of filterTypes[filter.fieldType]; track kvp)
|
|
24
|
+
{
|
|
25
|
+
<mat-option [value]="kvp">
|
|
26
|
+
{{ kvp }}
|
|
27
|
+
</mat-option>
|
|
28
|
+
}
|
|
29
|
+
</mat-select>
|
|
30
|
+
</mat-form-field>
|
|
31
|
+
</div>
|
|
32
|
+
@if(
|
|
33
|
+
filter.fieldType === FieldType.String
|
|
34
|
+
|| filter.fieldType === FieldType.Array
|
|
35
|
+
|| filter.fieldType === FieldType.Link
|
|
36
|
+
|| filter.fieldType === FieldType.Unknown
|
|
37
|
+
|| filter.fieldType === FieldType.PhoneNumber)
|
|
38
|
+
{
|
|
39
|
+
<ng-container *ngTemplateOutlet="String" />
|
|
40
|
+
}
|
|
41
|
+
@else if(filter.fieldType === FieldType.Number || filter.fieldType === FieldType.Currency)
|
|
42
|
+
{
|
|
43
|
+
<tb-number-filter [info]="filter" [CurrentFilterType]="currentFilterType!" />
|
|
44
|
+
}
|
|
45
|
+
@else if(filter.fieldType === FieldType.Boolean)
|
|
46
|
+
{
|
|
47
|
+
<ng-container *ngTemplateOutlet="Boolean" />
|
|
48
|
+
}
|
|
49
|
+
@else if(filter.fieldType === FieldType.Date)
|
|
50
|
+
{
|
|
51
|
+
<tb-date-filter [info]="filter" [CurrentFilterType]="currentFilterType!" />
|
|
52
|
+
}
|
|
53
|
+
@else if(filter.fieldType === FieldType.DateTime)
|
|
54
|
+
{
|
|
55
|
+
<tb-date-time-filter [info]="filter" [CurrentFilterType]="currentFilterType!" />
|
|
56
|
+
}
|
|
57
|
+
@else if(filter.fieldType === FieldType.Enum)
|
|
58
|
+
{
|
|
59
|
+
<ng-container *ngTemplateOutlet="Enum" />
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@if(currentFilterType === FilterType.IsNull)
|
|
63
|
+
{
|
|
64
|
+
<mat-radio-group name="filterValue" [ngModel]="filter.filterValue">
|
|
65
|
+
<mat-radio-button [value]="true">True</mat-radio-button>
|
|
66
|
+
<mat-radio-button [value]="false">False</mat-radio-button>
|
|
67
|
+
</mat-radio-group>
|
|
68
|
+
}
|
|
69
|
+
</div>
|
|
70
|
+
<button mat-button disableRipple [disabled]="form.value.filterValue==undefined || !form.value.filterType" (click)="addFilter(form.value)">
|
|
71
|
+
Apply
|
|
72
|
+
</button>
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
<ng-template #String>
|
|
76
|
+
@if(currentFilterType !== FilterType.IsNull && currentFilterType !== FilterType.In)
|
|
77
|
+
{
|
|
78
|
+
<mat-form-field class="my-filter">
|
|
79
|
+
<input matInput name="filterValue" [ngModel]="filter.filterValue" />
|
|
80
|
+
</mat-form-field>
|
|
81
|
+
}
|
|
82
|
+
@else if(currentFilterType === FilterType.In)
|
|
83
|
+
{
|
|
84
|
+
<lib-in-filter name='filterValue' [type]="FieldType.String" [(ngModel)]="filter.filterValue" />
|
|
85
|
+
}
|
|
86
|
+
</ng-template>
|
|
87
|
+
|
|
88
|
+
<ng-template #Boolean >
|
|
89
|
+
@if(currentFilterType === FilterType.BooleanEquals)
|
|
90
|
+
{
|
|
91
|
+
<div class="switch">
|
|
92
|
+
<mat-radio-group name="filterValue" [ngModel]="filter.filterValue" >
|
|
93
|
+
<mat-radio-button preventEnter [value]="true">True</mat-radio-button>
|
|
94
|
+
<mat-radio-button preventEnter [value]="false">False</mat-radio-button>
|
|
95
|
+
</mat-radio-group>
|
|
96
|
+
</div>
|
|
97
|
+
}
|
|
98
|
+
</ng-template>
|
|
99
|
+
<ng-template #Enum>
|
|
100
|
+
@if(currentFilterType === FilterType.In)
|
|
101
|
+
{
|
|
102
|
+
<tb-in-list-filter name='filterValue' [key]='filter.key' [(ngModel)]='filter.filterValue' />
|
|
103
|
+
|
|
104
|
+
}
|
|
105
|
+
</ng-template>
|
|
106
|
+
</form>
|
|
107
|
+
</mat-card-content>
|
|
108
|
+
</mat-card>
|
|
109
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
.filter-name {
|
|
2
|
+
color: var(tb-filter-name);
|
|
3
|
+
margin: 10px 0;
|
|
4
|
+
font-weight: 600;
|
|
5
|
+
display: inline-block;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.switch {
|
|
9
|
+
display: inline-block;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.head-row {
|
|
13
|
+
display: flex;
|
|
14
|
+
width: 100%;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: space-between;
|
|
17
|
+
}
|
|
18
|
+
.filter-row{
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
gap: 1rem;
|
|
22
|
+
}
|
|
23
|
+
mat-card.filter-card{
|
|
24
|
+
&::ng-deep mat-form-field{
|
|
25
|
+
width: 150px;
|
|
26
|
+
}
|
|
27
|
+
&::ng-deep.mat-mdc-form-field-subscript-wrapper{
|
|
28
|
+
line-height: 0;
|
|
29
|
+
&::before{
|
|
30
|
+
height: 0;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
.inline{
|
|
35
|
+
display: inline-block;
|
|
36
|
+
}
|
|
37
|
+
.small-button {
|
|
38
|
+
height: 18px;
|
|
39
|
+
width: 18px;
|
|
40
|
+
font-size: 18px;
|
|
41
|
+
padding: 0;
|
|
42
|
+
margin: 0;
|
|
43
|
+
::ng-deep * {
|
|
44
|
+
line-height: initial;
|
|
45
|
+
font-size: initial;
|
|
46
|
+
height: 18px;
|
|
47
|
+
width: 18px;
|
|
48
|
+
font-size: 18px;
|
|
49
|
+
bottom: initial;
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
.cancel-button{
|
|
54
|
+
font-weight: 700;
|
|
55
|
+
}
|
|
56
|
+
.date-toggle ::ng-deep svg{
|
|
57
|
+
position: absolute;
|
|
58
|
+
left: 0;
|
|
59
|
+
top: 0;
|
|
60
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { TestBed, ComponentFixture } from '@angular/core/testing';
|
|
2
|
+
import { FilterComponent } from '../filter/filter.component';
|
|
3
|
+
import { CommonModule, DatePipe } from '@angular/common';
|
|
4
|
+
import { FormsModule } from '@angular/forms';
|
|
5
|
+
import { FieldType } from '../../interfaces/report-def';
|
|
6
|
+
import { By } from '@angular/platform-browser';
|
|
7
|
+
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
|
8
|
+
import { SpaceCasePipe } from '../../../utilities/pipes/space-case.pipes';
|
|
9
|
+
import { DateFilterComponent } from '../date-filter/date-filter.component';
|
|
10
|
+
import { FilterType } from '../../enums/filterTypes';
|
|
11
|
+
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
|
12
|
+
import { MatButtonHarness } from '@angular/material/button/testing';
|
|
13
|
+
import { MatSelectHarness } from '@angular/material/select/testing';
|
|
14
|
+
import { HarnessLoader } from '@angular/cdk/testing';
|
|
15
|
+
import { OptionHarnessFilters } from '@angular/material/core/testing';
|
|
16
|
+
import { TableBuilderConfigToken } from '../../classes/TableBuilderConfig';
|
|
17
|
+
import { provideMockStore } from '@ngrx/store/testing';
|
|
18
|
+
import { isObservable } from 'rxjs';
|
|
19
|
+
|
|
20
|
+
function fillInput<T>(fixture: ComponentFixture<T>, name: string, value: string) {
|
|
21
|
+
const input = fixture.debugElement.query(By.css('input[name=' + name + ']')).nativeElement as HTMLInputElement;
|
|
22
|
+
input.value = value;
|
|
23
|
+
input.dispatchEvent(new Event('input'));
|
|
24
|
+
fixture.detectChanges();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async function setSelect(loader: HarnessLoader, filter: Pick<OptionHarnessFilters, 'isSelected' | 'selector' | 'text'>) {
|
|
28
|
+
const select = await loader.getHarness<MatSelectHarness>(MatSelectHarness);
|
|
29
|
+
await select.open();
|
|
30
|
+
await select.clickOptions(filter);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
describe('filter component', () => {
|
|
34
|
+
|
|
35
|
+
beforeEach(() => {
|
|
36
|
+
|
|
37
|
+
TestBed.configureTestingModule({
|
|
38
|
+
declarations: [FilterComponent, DatePipe, SpaceCasePipe, DateFilterComponent],
|
|
39
|
+
providers: [
|
|
40
|
+
DatePipe,
|
|
41
|
+
{ provide: TableBuilderConfigToken, useValue: { defaultTableState: { } } },
|
|
42
|
+
provideMockStore({ initialState: {} }),
|
|
43
|
+
],
|
|
44
|
+
imports: [
|
|
45
|
+
NoopAnimationsModule,
|
|
46
|
+
CommonModule,
|
|
47
|
+
FormsModule,
|
|
48
|
+
]
|
|
49
|
+
})
|
|
50
|
+
.compileComponents();
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('filter info object should be populated', async () => {
|
|
54
|
+
const fixture = TestBed.createComponent(FilterComponent);
|
|
55
|
+
const component = fixture.componentInstance;
|
|
56
|
+
|
|
57
|
+
const originFunc = component.state.addFilter;
|
|
58
|
+
|
|
59
|
+
const spy = spyOn(component.state, 'addFilter');
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
spy.and.callFake( a => {
|
|
63
|
+
if(isObservable(a)) {
|
|
64
|
+
throw new Error('Observable not supported');
|
|
65
|
+
} else {
|
|
66
|
+
expect(a.filterType).toBe(FilterType.StringContains);
|
|
67
|
+
expect(a.filterValue).toBe('a');
|
|
68
|
+
}
|
|
69
|
+
return originFunc(a);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
component.filter = {
|
|
73
|
+
key: 'name',
|
|
74
|
+
fieldType: FieldType.String
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const loader = TestbedHarnessEnvironment.loader(fixture);
|
|
78
|
+
const button = await loader.getHarness<MatButtonHarness>(MatButtonHarness.with( { text: 'Apply' }));
|
|
79
|
+
|
|
80
|
+
await setSelect(loader, { text: 'Contains' });
|
|
81
|
+
fillInput(fixture, 'filterValue', 'a');
|
|
82
|
+
await button.click();
|
|
83
|
+
|
|
84
|
+
expect(spy).toHaveBeenCalled();
|
|
85
|
+
});
|
|
86
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Component, ChangeDetectionStrategy, inject, input, computed, output, signal } from '@angular/core';
|
|
2
|
+
import { filterTypeMap, FilterInfo, PartialFilter } from '../../classes/filter-info';
|
|
3
|
+
import { TableStore } from '../../classes/table-store';
|
|
4
|
+
import { FilterType } from '../../enums/filterTypes';
|
|
5
|
+
import { FieldType } from '../../interfaces/report-def';
|
|
6
|
+
import { MatCardModule } from '@angular/material/card';
|
|
7
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
8
|
+
import { FormsModule } from '@angular/forms';
|
|
9
|
+
import { SpaceCasePipe } from '../../../utilities';
|
|
10
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
11
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
12
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
13
|
+
import { MatInputModule } from '@angular/material/input';
|
|
14
|
+
import { MatSelectModule } from '@angular/material/select';
|
|
15
|
+
import { NumberFilterComponent } from '../number-filter/number-filter.component';
|
|
16
|
+
import { DateFilterComponent } from '../date-filter/date-filter.component';
|
|
17
|
+
import { DateTimeFilterComponent } from '../date-time-filter/date-time-filter.component';
|
|
18
|
+
import { MatRadioModule } from '@angular/material/radio';
|
|
19
|
+
import { InFilterComponent } from '../in-filter/in-filter.component';
|
|
20
|
+
import { InListFilterComponent } from './in-list/in-list-filter.component';
|
|
21
|
+
|
|
22
|
+
@Component({
|
|
23
|
+
selector: 'tb-filter',
|
|
24
|
+
templateUrl: './filter.component.html',
|
|
25
|
+
styleUrls: ['./filter.component.scss'],
|
|
26
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
27
|
+
imports: [
|
|
28
|
+
MatCardModule, FormsModule, SpaceCasePipe, MatButtonModule, MatTooltipModule, MatIconModule,
|
|
29
|
+
MatInputModule, MatSelectModule, NumberFilterComponent,
|
|
30
|
+
DateFilterComponent, DateTimeFilterComponent, MatRadioModule, InFilterComponent, InListFilterComponent,
|
|
31
|
+
NgTemplateOutlet
|
|
32
|
+
]
|
|
33
|
+
})
|
|
34
|
+
export class FilterComponent {
|
|
35
|
+
protected state = inject(TableStore);
|
|
36
|
+
|
|
37
|
+
filterTypes = filterTypeMap;
|
|
38
|
+
FilterType = FilterType;
|
|
39
|
+
FieldType = FieldType;
|
|
40
|
+
|
|
41
|
+
$filter = input.required<PartialFilter, PartialFilter>({
|
|
42
|
+
alias: 'filter',
|
|
43
|
+
transform: (f) => ({ ...f })
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
close = output();
|
|
47
|
+
|
|
48
|
+
$enteredFilterType = signal<FilterType | undefined>(undefined);
|
|
49
|
+
$currentFilterType = computed(() => this.$enteredFilterType() || this.$filter()?.filterType);
|
|
50
|
+
$availableFilterTypes = computed(() => this.filterTypes[this.$filter()?.fieldType]);
|
|
51
|
+
$filterBy = computed(() => this.$filter().filterBy)
|
|
52
|
+
|
|
53
|
+
onEnter(filter: FilterInfo, event: any) {
|
|
54
|
+
event.preventDefault();
|
|
55
|
+
if(filter.filterValue != null && filter.filterType) {
|
|
56
|
+
this.addFilter(filter);
|
|
57
|
+
this.close.emit();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
addFilter(filter: FilterInfo){
|
|
62
|
+
this.state.addFilter({ ...filter, filterBy: this.$filterBy() });
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, computed, inject, input, signal } from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
3
|
+
import { TableStore } from '../../../classes/table-store';
|
|
4
|
+
import { FieldType } from '../../../interfaces/report-def';
|
|
5
|
+
import { CurrencyPipe, DatePipe, KeyValue } from '@angular/common';
|
|
6
|
+
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
7
|
+
import { FunctionPipe, SpaceCasePipe, StopPropagationDirective } from '../../../../utilities';
|
|
8
|
+
|
|
9
|
+
@Component({
|
|
10
|
+
selector: 'tb-in-list-filter , [tb-in-list-filter]',
|
|
11
|
+
template: `
|
|
12
|
+
@for (item of $keyValues(); track item.key) {
|
|
13
|
+
<div>
|
|
14
|
+
<mat-checkbox [checked]="'includes' | func : $selectedKeys() : item.key" stop-propagation (change)='selectFilterChanged($event, item.value)' >
|
|
15
|
+
@switch ($metaData().fieldType)
|
|
16
|
+
{
|
|
17
|
+
@case (FieldType.Enum)
|
|
18
|
+
{
|
|
19
|
+
{{(item.key | spaceCase)}}
|
|
20
|
+
}
|
|
21
|
+
@case (FieldType.Date)
|
|
22
|
+
{
|
|
23
|
+
{{item.value | date: 'shortDate'}}
|
|
24
|
+
}
|
|
25
|
+
@case (FieldType.DateTime)
|
|
26
|
+
{
|
|
27
|
+
{{item.value | date: 'short'}}
|
|
28
|
+
}
|
|
29
|
+
@case (FieldType.Currency)
|
|
30
|
+
{
|
|
31
|
+
{{item.value | currency }}
|
|
32
|
+
}
|
|
33
|
+
@default
|
|
34
|
+
{
|
|
35
|
+
{{item.key}}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
</mat-checkbox>
|
|
39
|
+
</div>
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
`,
|
|
43
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
44
|
+
providers: [{
|
|
45
|
+
provide: NG_VALUE_ACCESSOR,
|
|
46
|
+
useExisting: InListFilterComponent,
|
|
47
|
+
multi: true
|
|
48
|
+
}],
|
|
49
|
+
imports: [
|
|
50
|
+
MatCheckboxModule, StopPropagationDirective, SpaceCasePipe, FunctionPipe, DatePipe, CurrencyPipe
|
|
51
|
+
]
|
|
52
|
+
})
|
|
53
|
+
export class InListFilterComponent implements ControlValueAccessor {
|
|
54
|
+
private ref = inject(ChangeDetectorRef);
|
|
55
|
+
private tableState = inject(TableStore);
|
|
56
|
+
|
|
57
|
+
value: (string | number)[] = [];
|
|
58
|
+
FieldType = FieldType;
|
|
59
|
+
writeValue(obj: string[]): void {
|
|
60
|
+
this.value = obj;
|
|
61
|
+
|
|
62
|
+
if(this.value) {
|
|
63
|
+
this.$selectedKeys.set(this.value.map( f => f ));
|
|
64
|
+
}
|
|
65
|
+
this.ref.markForCheck();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
onChange = (_: any) => { };
|
|
69
|
+
|
|
70
|
+
registerOnChange(fn: any): void {
|
|
71
|
+
this.onChange = fn;
|
|
72
|
+
}
|
|
73
|
+
onTouched = () => { };
|
|
74
|
+
registerOnTouched(fn: any): void {
|
|
75
|
+
this.onTouched = fn;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
$key = input.required<string>({ alias: 'key' });
|
|
79
|
+
$selectedKeys = signal<(string | number)[]>([]);
|
|
80
|
+
$metaData = computed(() => this.tableState.$getMetaData(this.$key())());
|
|
81
|
+
$keyValues = computed(():
|
|
82
|
+
KeyValue<string, any>[] => {
|
|
83
|
+
const metaData = this.$metaData();
|
|
84
|
+
if(metaData?.additional?.filterOptions?.filterableValues ) {
|
|
85
|
+
return metaData.additional.filterOptions.filterableValues.map(value => ({ key: value, value }));
|
|
86
|
+
} else if(metaData?.fieldType === FieldType.Enum ) {
|
|
87
|
+
return Object.entries(metaData.additional!.enumMap!).map(([key, value]) => ({ key: value, value: +key }));
|
|
88
|
+
}
|
|
89
|
+
return [];
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
selectFilterChanged($event, val: any) {
|
|
93
|
+
if($event.checked) {
|
|
94
|
+
this.$selectedKeys.update(keys => [...keys, val]);
|
|
95
|
+
} else {
|
|
96
|
+
this.$selectedKeys.update(keys => keys.filter( item => item !== val));
|
|
97
|
+
}
|
|
98
|
+
this.value = this.$selectedKeys();
|
|
99
|
+
this.onChange(this.value);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
@if($columns(); as displayCols)
|
|
2
|
+
{
|
|
3
|
+
<span matTooltip="Show/hide columns">
|
|
4
|
+
<button color="primary" mat-icon-button [matMenuTriggerFor]="menu">
|
|
5
|
+
<mat-icon color="primary">visibility_off</mat-icon>
|
|
6
|
+
</button>
|
|
7
|
+
</span>
|
|
8
|
+
<mat-menu #menu="matMenu" class="my-mat-menu">
|
|
9
|
+
|
|
10
|
+
<button mat-menu-item>
|
|
11
|
+
<span matTooltip="Close">
|
|
12
|
+
<button class="filter-button" mat-icon-button>
|
|
13
|
+
<mat-icon>close</mat-icon>
|
|
14
|
+
</button>
|
|
15
|
+
</span>
|
|
16
|
+
</button>
|
|
17
|
+
|
|
18
|
+
<button mat-menu-item stop-propagation>
|
|
19
|
+
<span matTooltip="Show all columns">
|
|
20
|
+
<button color="primary" mat-icon-button (click)="reset(displayCols)">
|
|
21
|
+
<mat-icon color="primary">done_all</mat-icon>
|
|
22
|
+
</button>
|
|
23
|
+
</span>
|
|
24
|
+
|
|
25
|
+
<span matTooltip="Hide all columns">
|
|
26
|
+
<button color="primary" mat-icon-button (click)="unset(displayCols)">
|
|
27
|
+
<mat-icon color="primary">cancel</mat-icon>
|
|
28
|
+
</button>
|
|
29
|
+
</span>
|
|
30
|
+
</button>
|
|
31
|
+
|
|
32
|
+
<div cdkDropList stop-propagation [cdkDropListLockAxis]="'y'" (cdkDropListDropped)="drop($event)">
|
|
33
|
+
@for (col of displayCols; track col.key)
|
|
34
|
+
{
|
|
35
|
+
<button stop-propagation mat-menu-item cdkDrag [class.isHidden]="!col.isVisible" [cdkDragData]="col">
|
|
36
|
+
<div style="display: flex; align-items: center;" (click)="col.isVisible = !col.isVisible; emit(displayCols)">
|
|
37
|
+
@if(col.isVisible)
|
|
38
|
+
{
|
|
39
|
+
<button color="primary" mat-icon-button matTooltip="Hide Column" class="show-hide">
|
|
40
|
+
<mat-icon color="primary">check_box</mat-icon>
|
|
41
|
+
</button>
|
|
42
|
+
}
|
|
43
|
+
@else
|
|
44
|
+
{
|
|
45
|
+
<button mat-icon-button matTooltip="Show Column" class="show-hide">
|
|
46
|
+
<mat-icon>indeterminate_check_box</mat-icon>
|
|
47
|
+
</button>
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
<p class="label">
|
|
51
|
+
{{col.displayName || (col.key | spaceCase) }}
|
|
52
|
+
</p>
|
|
53
|
+
|
|
54
|
+
</div>
|
|
55
|
+
</button>
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
</div>
|
|
59
|
+
</mat-menu>
|
|
60
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
.show-hide {
|
|
2
|
+
margin-right: 15px;
|
|
3
|
+
height: 24px;
|
|
4
|
+
width: 24px;
|
|
5
|
+
padding: 4px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.label {
|
|
9
|
+
color: var(tb-col-display-name);
|
|
10
|
+
text-overflow: ellipsis;
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
white-space: nowrap;
|
|
13
|
+
text-align: left;
|
|
14
|
+
margin: 0;
|
|
15
|
+
font-size: 17px;
|
|
16
|
+
font-weight: 700;
|
|
17
|
+
display: inline-block;
|
|
18
|
+
width: 66%;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.row {
|
|
22
|
+
margin: 0;
|
|
23
|
+
padding: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.isHidden {
|
|
27
|
+
background-color: lightgrey;
|
|
28
|
+
color: darkgray;
|
|
29
|
+
font-weight: 700;
|
|
30
|
+
font-size: 17px;
|
|
31
|
+
white-space: nowrap;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.filter-button {
|
|
35
|
+
margin-top: 10px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.cdk-drag-preview {
|
|
39
|
+
box-sizing: border-box;
|
|
40
|
+
border-radius: 4px;
|
|
41
|
+
box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2),
|
|
42
|
+
0 8px 10px 1px rgba(0, 0, 0, 0.14),
|
|
43
|
+
0 3px 14px 2px rgba(0, 0, 0, 0.12);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.cdk-drag-placeholder {
|
|
47
|
+
opacity: 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.cdk-drag-animating {
|
|
51
|
+
transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
|
|
52
|
+
}
|
|
53
|
+
.mdc-list-item__primary-text{
|
|
54
|
+
display: inline-block;
|
|
55
|
+
width: 100%;
|
|
56
|
+
}
|
|
57
|
+
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Component, ChangeDetectionStrategy, inject, computed } from '@angular/core';
|
|
2
|
+
import { DisplayCol } from '../../classes/display-col';
|
|
3
|
+
import { TableStore } from '../../classes/table-store';
|
|
4
|
+
import { CdkDragDrop, DragDropModule } from '@angular/cdk/drag-drop';
|
|
5
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
6
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
7
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
8
|
+
import { MatMenuModule } from '@angular/material/menu';
|
|
9
|
+
import { SpaceCasePipe, StopPropagationDirective } from '../../../utilities';
|
|
10
|
+
|
|
11
|
+
@Component({
|
|
12
|
+
selector: 'tb-col-displayer',
|
|
13
|
+
templateUrl: './gen-col-displayer.component.html',
|
|
14
|
+
styleUrls: ['./gen-col-displayer.component.scss'],
|
|
15
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
16
|
+
imports: [
|
|
17
|
+
MatTooltipModule, MatIconModule, MatButtonModule, MatMenuModule, StopPropagationDirective,
|
|
18
|
+
DragDropModule, SpaceCasePipe
|
|
19
|
+
]
|
|
20
|
+
})
|
|
21
|
+
export class GenColDisplayerComponent {
|
|
22
|
+
private tableState = inject(TableStore);
|
|
23
|
+
$columns = computed(() => this.tableState.$orderedCodeVisibleMetaDatas().map( md => ({
|
|
24
|
+
key: md.key,
|
|
25
|
+
displayName: md.displayName,
|
|
26
|
+
isVisible: !this.tableState.$hiddenKeys().includes(md.key)
|
|
27
|
+
})));
|
|
28
|
+
|
|
29
|
+
reset(displayCols: DisplayCol[]) {
|
|
30
|
+
displayCols.forEach(c => c.isVisible = true);
|
|
31
|
+
this.emit(displayCols);
|
|
32
|
+
}
|
|
33
|
+
drop(event: CdkDragDrop<string[]>) {
|
|
34
|
+
this.tableState.setUserDefinedOrder({ newOrder: event.currentIndex, oldOrder: event.previousIndex })
|
|
35
|
+
}
|
|
36
|
+
unset(displayCols: DisplayCol[]) {
|
|
37
|
+
displayCols.forEach(c => c.isVisible = false);
|
|
38
|
+
this.emit(displayCols);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
emit(displayCols: DisplayCol[]) {
|
|
42
|
+
this.tableState.setHiddenColumns(displayCols.map( c => ({ key: c.key, visible: c.isVisible })));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
<mat-table
|
|
2
|
+
#table
|
|
3
|
+
cdkDropList
|
|
4
|
+
cdkDropListLockAxis='x'
|
|
5
|
+
cdkDropListOrientation="horizontal"
|
|
6
|
+
class="table-drag-list"
|
|
7
|
+
[dataSource]="$dataSource()"
|
|
8
|
+
[trackBy]="$trackByFunction()"
|
|
9
|
+
[style]="$tableWidth()"
|
|
10
|
+
(cdkDropListDropped)="drop($event)"
|
|
11
|
+
>
|
|
12
|
+
|
|
13
|
+
<!-- select column -->
|
|
14
|
+
<ng-container matColumnDef="select">
|
|
15
|
+
@let selection = $selection();
|
|
16
|
+
<mat-header-cell *matHeaderCellDef class="select-column">
|
|
17
|
+
<mat-checkbox [checked]="!!($masterToggleChecked())"
|
|
18
|
+
[indeterminate]="$masterToggleIndeterminate()"
|
|
19
|
+
[matTooltip]="$selectAllMessage()"
|
|
20
|
+
(change)="$event ? masterToggle() : null" />
|
|
21
|
+
</mat-header-cell>
|
|
22
|
+
|
|
23
|
+
<mat-cell *matCellDef="let row" class="select-column">
|
|
24
|
+
<mat-checkbox
|
|
25
|
+
[checked]="selection.isSelected(row)"
|
|
26
|
+
(click)="$event.stopPropagation()"
|
|
27
|
+
(change)="$event ? selection.toggle(row) : null"/>
|
|
28
|
+
</mat-cell>
|
|
29
|
+
|
|
30
|
+
<mat-footer-cell *matFooterCellDef class="select-column">
|
|
31
|
+
{{ selection.selected.length }}
|
|
32
|
+
</mat-footer-cell>
|
|
33
|
+
</ng-container>
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
<!-- index column -->
|
|
37
|
+
<ng-container matColumnDef="index">
|
|
38
|
+
<mat-header-cell *matHeaderCellDef class="f-mat-header-cell" class="index-column">#
|
|
39
|
+
</mat-header-cell>
|
|
40
|
+
<mat-cell *matCellDef="let i = index; let t" class="index-column">
|
|
41
|
+
{{ 1 + i + $offsetIndex() }}
|
|
42
|
+
</mat-cell>
|
|
43
|
+
<mat-footer-cell *matFooterCellDef class="index-column" />
|
|
44
|
+
</ng-container>
|
|
45
|
+
|
|
46
|
+
<!-- Grouping -->
|
|
47
|
+
<ng-container matColumnDef="groupHeader">
|
|
48
|
+
<mat-cell *matCellDef="let row">
|
|
49
|
+
@let expanded = (state.$getIsExpanded | func : row.key : row.groupName );
|
|
50
|
+
<div [style.paddingLeft]="row.padding + 'px !important'">
|
|
51
|
+
@if($hasSelectColumn())
|
|
52
|
+
{
|
|
53
|
+
@let contains = (allOfGroupSelected | func : row.uniqueName)();
|
|
54
|
+
<mat-checkbox [checked]="!!contains.containsAll"
|
|
55
|
+
[indeterminate]="!!contains.containsSome && !contains.containsAll"
|
|
56
|
+
[matTooltip]="toggleGroupMessage | func : contains.length : contains.containsAll"
|
|
57
|
+
(change)="$event ? toggleGroup(row.uniqueName, contains.containsAll) : null" />
|
|
58
|
+
}
|
|
59
|
+
<button mat-icon-button (click)="setExpanded(row.key, row.groupName, !expanded());">
|
|
60
|
+
@if (!expanded())
|
|
61
|
+
{
|
|
62
|
+
<mat-icon>chevron_right</mat-icon>
|
|
63
|
+
}
|
|
64
|
+
@else
|
|
65
|
+
{
|
|
66
|
+
<mat-icon>expand_more</mat-icon>
|
|
67
|
+
}
|
|
68
|
+
</button>
|
|
69
|
+
{{ (getTransform | func : row.key : row.groupHeaderDisplay)() }} ({{ row.length }})
|
|
70
|
+
</div>
|
|
71
|
+
<div style="flex-grow: 1">
|
|
72
|
+
<ng-container *ngTemplateOutlet="state.$props().groupHeaderTemplate!; context: { element: row }" />
|
|
73
|
+
</div>
|
|
74
|
+
</mat-cell>
|
|
75
|
+
</ng-container>
|
|
76
|
+
|
|
77
|
+
<mat-row
|
|
78
|
+
*matRowDef="let row; columns: $keys(); let i = index"
|
|
79
|
+
[style.height]="$rowHeight()"
|
|
80
|
+
[style.min-height]="$rowHeight()"
|
|
81
|
+
[styler]="$rowStyles()"
|
|
82
|
+
[element]="row"
|
|
83
|
+
[conditionalClasses]="$rowClasses()"
|
|
84
|
+
(click)="rowClicked(row, $event)"
|
|
85
|
+
/>
|
|
86
|
+
|
|
87
|
+
<!-- group row -->
|
|
88
|
+
<mat-row *matRowDef="let row; columns: ['groupHeader']; when: isGroupHeader"
|
|
89
|
+
style="background-color: unset;"
|
|
90
|
+
[style.height]="state.$props().groupHeaderHeight ? state.$props().groupHeaderHeight + 'px' : $groupHeaderHeight()" [style.min-height]="state.$props().groupHeaderHeight ? state.$props().groupHeaderHeight + 'px' : $groupHeaderHeight()"/>
|
|
91
|
+
</mat-table>
|
|
92
|
+
|
|
93
|
+
<mat-header-row *matHeaderRowDef="$keys(); sticky: state.$props().isSticky" [style.height]="$headerHeight()"
|
|
94
|
+
[style.min-height]="$headerHeight()" [style.top.px]="($offset()! * -1)"/>
|
|
95
|
+
<mat-footer-row *matFooterRowDef="$keys(); sticky: $stickyFooter() " [style.height]="$footerHeight()"
|
|
96
|
+
[style.min-height]="$footerHeight()"
|
|
97
|
+
[style.bottom.px]="$stickyFooter() ? ($offset()) : undefined"/>
|