@one-paragon/angular-utilities 1.2.11 → 1.2.12
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 +16 -30
- 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 +6 -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 +26 -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 +15 -0
- package/src/action-state/ngrx.ts +69 -0
- package/src/http-request-state/HttpRequestStateFactory.ts +66 -0
- package/src/http-request-state/HttpRequestStateStore.ts +173 -0
- 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 +72 -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-request-state.ts +69 -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} +6 -6
- package/src/http-request-state/observable.spec.ts +43 -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 +55 -0
- package/src/ngrx/actionable-selector.ts +95 -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 +132 -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 +35 -0
- package/src/table-builder/classes/TableBuilderDataSource.ts +80 -0
- package/src/table-builder/classes/TableState.ts +96 -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 +108 -0
- package/src/table-builder/classes/table-builder-general-settings.ts +129 -0
- package/src/table-builder/classes/table-builder.ts +94 -0
- package/src/table-builder/classes/table-store.ts +471 -0
- package/src/table-builder/components/array-column.component.ts +36 -0
- package/src/table-builder/components/column-builder/column-builder.component.html +61 -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 +135 -0
- package/src/table-builder/components/column-builder/column-helpers.ts +53 -0
- package/src/table-builder/components/date-filter/date-filter.component.html +23 -0
- package/src/table-builder/components/date-filter/date-filter.component.ts +24 -0
- package/src/table-builder/components/date-time-filter/date-time-filter.component.html +9 -0
- package/src/table-builder/components/date-time-filter/date-time-filter.component.ts +22 -0
- package/src/table-builder/components/filter/filter.component.html +91 -0
- package/src/table-builder/components/filter/filter.component.scss +64 -0
- package/src/table-builder/components/filter/filter.component.spec.ts +87 -0
- package/src/table-builder/components/filter/filter.component.ts +60 -0
- package/src/table-builder/components/filter/in-list/in-list-filter.component.ts +93 -0
- package/src/table-builder/components/gen-col-displayer/gen-col-displayer.component.html +55 -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 +59 -0
- package/src/table-builder/components/generic-table/generic-table.component.html +78 -0
- package/src/table-builder/components/generic-table/generic-table.component.scss +42 -0
- package/src/table-builder/components/generic-table/generic-table.component.ts +299 -0
- package/src/table-builder/components/generic-table/paginator.component.ts +99 -0
- package/src/table-builder/components/group-by-list/group-by-list.component.css +8 -0
- package/src/table-builder/components/group-by-list/group-by-list.component.html +12 -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 +21 -0
- package/src/table-builder/components/header-menu/header-menu.component.html +104 -0
- package/src/table-builder/components/header-menu/header-menu.component.scss +96 -0
- package/src/table-builder/components/header-menu/header-menu.component.ts +99 -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 +20 -0
- package/src/table-builder/components/in-filter/in-filter.component.ts +66 -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 +29 -0
- package/src/table-builder/components/initialization-component/initialization-component.ts +24 -0
- package/src/table-builder/components/link-column.component.ts +47 -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 +19 -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 +74 -0
- package/src/table-builder/components/profiles-menu/profiles-menu.component.scss +98 -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 +65 -0
- package/src/table-builder/components/scroll-strategy.ts +76 -0
- package/src/table-builder/components/sort-menu/sort-menu.component-store.ts +66 -0
- package/src/table-builder/components/sort-menu/sort-menu.component.html +111 -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 +98 -0
- package/{table-builder/components/table-container/table-container-imports.d.ts → src/table-builder/components/table-container/table-container-imports.ts} +32 -14
- package/src/table-builder/components/table-container/table-container.css +54 -0
- package/src/table-builder/components/table-container/table-container.helpers/data-state.helpers.ts +141 -0
- package/src/table-builder/components/table-container/table-container.helpers/filter-state.helpers.ts +106 -0
- package/src/table-builder/components/table-container/table-container.helpers/groupBy.helpers.ts +86 -0
- package/src/table-builder/components/table-container/table-container.helpers/sort-state.helpers.ts +45 -0
- package/src/table-builder/components/table-container/table-container.html +95 -0
- package/src/table-builder/components/table-container/table-container.spec.ts +154 -0
- package/src/table-builder/components/table-container/table-container.ts +356 -0
- package/src/table-builder/components/table-container/tableProps.ts +20 -0
- package/src/table-builder/components/table-container/virtual-scroll-container.ts +145 -0
- package/src/table-builder/components/table-container-filter/filter-list/filter-list.component.html +31 -0
- package/src/table-builder/components/table-container-filter/filter-list/filter-list.component.ts +46 -0
- package/src/table-builder/components/table-container-filter/gen-filter-displayer/gen-filter-displayer.component.css +42 -0
- package/src/table-builder/components/table-container-filter/gen-filter-displayer/gen-filter-displayer.component.html +10 -0
- package/src/table-builder/components/table-container-filter/gen-filter-displayer/gen-filter-displayer.component.spec.ts +86 -0
- package/src/table-builder/components/table-container-filter/gen-filter-displayer/gen-filter-displayer.component.ts +34 -0
- package/src/table-builder/components/table-container-filter/table-wrapper-filter-store.ts +23 -0
- package/src/table-builder/directives/custom-cell-directive.ts +58 -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 +51 -0
- package/src/table-builder/directives/resize-column.directive.ts +108 -0
- package/src/table-builder/directives/table-wrapper.directive.ts +14 -0
- package/src/table-builder/directives/tb-filter.directive.ts +396 -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 +68 -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 +23 -0
- package/src/table-builder/functions/string-filter-function.ts +51 -0
- package/{table-builder/interfaces/ColumnInfo.d.ts → src/table-builder/interfaces/ColumnInfo.ts} +7 -6
- package/src/table-builder/interfaces/column-template.ts +9 -0
- package/{table-builder/interfaces/dictionary.d.ts → src/table-builder/interfaces/dictionary.ts} +3 -3
- package/src/table-builder/interfaces/report-def.ts +155 -0
- package/src/table-builder/ngrx/tableBuilderStateStore.ts +199 -0
- package/src/table-builder/pipes/column-total.pipe.ts +17 -0
- package/src/table-builder/pipes/format-filter-type.pipe.ts +12 -0
- package/src/table-builder/pipes/format-filter-value.pipe.ts +42 -0
- package/src/table-builder/pipes/key-display.ts +16 -0
- package/src/table-builder/services/export-to-csv.service.ts +97 -0
- package/src/table-builder/services/link-creator.service.ts +67 -0
- package/src/table-builder/services/table-template-service.ts +59 -0
- package/src/table-builder/services/transform-creator.ts +95 -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 +73 -0
- package/src/test.ts +17 -0
- package/src/utilities/array-helpers.ts +13 -0
- package/src/utilities/directives/auto-focus.directive.ts +21 -0
- package/src/utilities/directives/clickEmitterDirective.ts +16 -0
- package/src/utilities/directives/clickSubject.ts +20 -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 +61 -0
- package/src/utilities/directives/prevent-enter.directive.ts +13 -0
- package/src/utilities/directives/stop-propagation.directive.ts +20 -0
- package/src/utilities/directives/styler.ts +40 -0
- package/src/utilities/directives/trim-whitespace.directive.ts +21 -0
- package/{utilities/index.d.ts → src/utilities/index.ts} +22 -15
- package/src/utilities/module.ts +55 -0
- package/src/utilities/pipes/function.pipe.ts +16 -0
- package/src/utilities/pipes/phone.pipe.ts +15 -0
- package/src/utilities/pipes/space-case.pipes.spec.ts +47 -0
- package/src/utilities/pipes/space-case.pipes.ts +23 -0
- package/tsconfig.lib.json +19 -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/esm2022/action-state/action-state-spinner/action-state-spinner.component.mjs +0 -24
- package/esm2022/action-state/action-state-ui/action-state-ui.module.mjs +0 -20
- package/esm2022/action-state/index.mjs +0 -8
- package/esm2022/action-state/ngrx-ext/ngrx-ext.module.mjs +0 -23
- package/esm2022/action-state/ngrx.mjs +0 -47
- package/esm2022/http-request-state/HttpRequestStateFactory.mjs +0 -51
- package/esm2022/http-request-state/HttpRequestStateStore.mjs +0 -121
- package/esm2022/http-request-state/directives/HttpStateDirectiveBase.mjs +0 -30
- package/esm2022/http-request-state/directives/http-error-state-directive.mjs +0 -23
- package/esm2022/http-request-state/directives/http-inProgress-state-directive.mjs +0 -23
- package/esm2022/http-request-state/directives/http-notStarted-state-directive.mjs +0 -23
- package/esm2022/http-request-state/directives/http-success-state-directive.mjs +0 -29
- package/esm2022/http-request-state/directives/index.mjs +0 -6
- package/esm2022/http-request-state/directives/request-state-directive.mjs +0 -61
- package/esm2022/http-request-state/helpers.mjs +0 -22
- package/esm2022/http-request-state/http-request-state.mjs +0 -39
- package/esm2022/http-request-state/http-state-module.mjs +0 -40
- package/esm2022/http-request-state/index.mjs +0 -7
- package/esm2022/http-request-state/rxjs/getRequestorBody.mjs +0 -4
- package/esm2022/http-request-state/rxjs/getRequestorState.mjs +0 -3
- package/esm2022/http-request-state/rxjs/index.mjs +0 -5
- package/esm2022/http-request-state/rxjs/tapError.mjs +0 -12
- package/esm2022/http-request-state/rxjs/tapSuccess.mjs +0 -12
- package/esm2022/http-request-state/types.mjs +0 -16
- package/esm2022/ngrx/actionable-selector.mjs +0 -71
- package/esm2022/ngrx/index.mjs +0 -2
- package/esm2022/one-paragon-angular-utilities.mjs +0 -5
- package/esm2022/public-api.mjs +0 -20
- package/esm2022/rxjs/defaultShareReplay.mjs +0 -7
- package/esm2022/rxjs/index.mjs +0 -6
- package/esm2022/rxjs/mapError.mjs +0 -8
- package/esm2022/rxjs/rxjs-operators.mjs +0 -92
- package/esm2022/rxjs/subjectifier.mjs +0 -15
- package/esm2022/rxjs/subscriber.directive.mjs +0 -50
- package/esm2022/table-builder/classes/DefaultSettings.mjs +0 -6
- package/esm2022/table-builder/classes/MatTableObservableDataSource.mjs +0 -23
- package/esm2022/table-builder/classes/TableBuilderConfig.mjs +0 -18
- package/esm2022/table-builder/classes/TableBuilderDataSource.mjs +0 -54
- package/esm2022/table-builder/classes/TableState.mjs +0 -49
- package/esm2022/table-builder/classes/data-store.mjs +0 -15
- package/esm2022/table-builder/classes/display-col.mjs +0 -2
- package/esm2022/table-builder/classes/filter-info.mjs +0 -61
- package/esm2022/table-builder/classes/table-builder-general-settings.mjs +0 -112
- package/esm2022/table-builder/classes/table-builder.mjs +0 -77
- package/esm2022/table-builder/classes/table-store.mjs +0 -387
- package/esm2022/table-builder/components/array-column.component.mjs +0 -53
- package/esm2022/table-builder/components/column-builder/column-builder.component.mjs +0 -134
- package/esm2022/table-builder/components/column-builder/column-helpers.mjs +0 -47
- package/esm2022/table-builder/components/date-filter/date-filter.component.mjs +0 -29
- package/esm2022/table-builder/components/date-time-filter/date-time-filter.component.mjs +0 -24
- package/esm2022/table-builder/components/filter/filter.component.mjs +0 -64
- package/esm2022/table-builder/components/filter/in-list/in-list-filter.component.mjs +0 -102
- package/esm2022/table-builder/components/gen-col-displayer/gen-col-displayer.component.mjs +0 -53
- package/esm2022/table-builder/components/generic-table/generic-table.component.mjs +0 -300
- package/esm2022/table-builder/components/generic-table/paginator.component.mjs +0 -98
- package/esm2022/table-builder/components/group-by-list/group-by-list.component.mjs +0 -21
- package/esm2022/table-builder/components/header-menu/header-menu.component.mjs +0 -103
- package/esm2022/table-builder/components/in-filter/in-filter.component.mjs +0 -65
- package/esm2022/table-builder/components/index.mjs +0 -10
- package/esm2022/table-builder/components/initialization-component/initialization-component.mjs +0 -47
- package/esm2022/table-builder/components/link-column.component.mjs +0 -74
- package/esm2022/table-builder/components/number-filter/number-filter.component.mjs +0 -29
- package/esm2022/table-builder/components/profiles-menu/profiles-menu.component.mjs +0 -64
- package/esm2022/table-builder/components/scroll-strategy.mjs +0 -60
- package/esm2022/table-builder/components/sort-menu/sort-menu.component-store.mjs +0 -46
- package/esm2022/table-builder/components/sort-menu/sort-menu.component.mjs +0 -82
- package/esm2022/table-builder/components/table-container/table-container-imports.mjs +0 -26
- package/esm2022/table-builder/components/table-container/table-container.helpers/data-state.helpers.mjs +0 -135
- package/esm2022/table-builder/components/table-container/table-container.helpers/filter-state.helpers.mjs +0 -83
- package/esm2022/table-builder/components/table-container/table-container.helpers/groupBy.helpers.mjs +0 -71
- package/esm2022/table-builder/components/table-container/table-container.helpers/sort-state.helpers.mjs +0 -36
- package/esm2022/table-builder/components/table-container/table-container.mjs +0 -323
- package/esm2022/table-builder/components/table-container/tableProps.mjs +0 -8
- package/esm2022/table-builder/components/table-container/virtual-scroll-container.mjs +0 -128
- package/esm2022/table-builder/components/table-container-filter/filter-list/filter-list.component.mjs +0 -44
- package/esm2022/table-builder/components/table-container-filter/gen-filter-displayer/gen-filter-displayer.component.mjs +0 -36
- package/esm2022/table-builder/components/table-container-filter/table-wrapper-filter-store.mjs +0 -25
- package/esm2022/table-builder/directives/custom-cell-directive.mjs +0 -73
- package/esm2022/table-builder/directives/index.mjs +0 -6
- package/esm2022/table-builder/directives/multi-sort.directive.mjs +0 -50
- package/esm2022/table-builder/directives/resize-column.directive.mjs +0 -87
- package/esm2022/table-builder/directives/table-wrapper.directive.mjs +0 -18
- package/esm2022/table-builder/directives/tb-filter.directive.mjs +0 -405
- package/esm2022/table-builder/enums/filterTypes.mjs +0 -29
- package/esm2022/table-builder/functions/boolean-filter-function.mjs +0 -10
- package/esm2022/table-builder/functions/date-filter-function.mjs +0 -58
- package/esm2022/table-builder/functions/download-data.mjs +0 -12
- package/esm2022/table-builder/functions/null-filter-function.mjs +0 -8
- package/esm2022/table-builder/functions/number-filter-function.mjs +0 -32
- package/esm2022/table-builder/functions/sort-data-function.mjs +0 -17
- package/esm2022/table-builder/functions/string-filter-function.mjs +0 -41
- package/esm2022/table-builder/interfaces/ColumnInfo.mjs +0 -2
- package/esm2022/table-builder/interfaces/dictionary.mjs +0 -2
- package/esm2022/table-builder/interfaces/report-def.mjs +0 -50
- package/esm2022/table-builder/ngrx/tableBuilderStateStore.mjs +0 -154
- package/esm2022/table-builder/pipes/column-total.pipe.mjs +0 -22
- package/esm2022/table-builder/pipes/format-filter-type.pipe.mjs +0 -18
- package/esm2022/table-builder/pipes/format-filter-value.pipe.mjs +0 -43
- package/esm2022/table-builder/pipes/key-display.mjs +0 -18
- package/esm2022/table-builder/services/export-to-csv.service.mjs +0 -85
- package/esm2022/table-builder/services/link-creator.service.mjs +0 -50
- package/esm2022/table-builder/services/table-template-service.mjs +0 -60
- package/esm2022/table-builder/services/transform-creator.mjs +0 -100
- package/esm2022/table-builder/table-builder.module.mjs +0 -124
- package/esm2022/utilities/array-helpers.mjs +0 -14
- package/esm2022/utilities/directives/auto-focus.directive.mjs +0 -25
- package/esm2022/utilities/directives/clickEmitterDirective.mjs +0 -22
- package/esm2022/utilities/directives/clickSubject.mjs +0 -29
- package/esm2022/utilities/directives/conditional-classes.directive.mjs +0 -36
- package/esm2022/utilities/directives/dialog-service.mjs +0 -21
- package/esm2022/utilities/directives/dialog.mjs +0 -145
- package/esm2022/utilities/directives/mat-toggle-group-directive.mjs +0 -59
- package/esm2022/utilities/directives/prevent-enter.directive.mjs +0 -20
- package/esm2022/utilities/directives/stop-propagation.directive.mjs +0 -26
- package/esm2022/utilities/directives/styler.mjs +0 -41
- package/esm2022/utilities/directives/trim-whitespace.directive.mjs +0 -28
- package/esm2022/utilities/index.mjs +0 -16
- package/esm2022/utilities/module.mjs +0 -90
- package/esm2022/utilities/pipes/function.pipe.mjs +0 -22
- package/esm2022/utilities/pipes/phone.pipe.mjs +0 -20
- package/esm2022/utilities/pipes/space-case.pipes.mjs +0 -28
- package/fesm2022/one-paragon-angular-utilities.mjs +0 -5673
- package/fesm2022/one-paragon-angular-utilities.mjs.map +0 -1
- package/http-request-state/HttpRequestStateFactory.d.ts +0 -17
- package/http-request-state/HttpRequestStateStore.d.ts +0 -54
- package/http-request-state/directives/HttpStateDirectiveBase.d.ts +0 -14
- package/http-request-state/directives/http-error-state-directive.d.ts +0 -9
- package/http-request-state/directives/http-inProgress-state-directive.d.ts +0 -9
- package/http-request-state/directives/http-notStarted-state-directive.d.ts +0 -9
- package/http-request-state/directives/http-success-state-directive.d.ts +0 -16
- 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-request-state.d.ts +0 -12
- package/http-request-state/http-state-module.d.ts +0 -11
- 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 -17
- 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 -8
- 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 -21
- package/table-builder/classes/TableBuilderDataSource.d.ts +0 -12
- package/table-builder/classes/TableState.d.ts +0 -67
- package/table-builder/classes/data-store.d.ts +0 -8
- package/table-builder/classes/filter-info.d.ts +0 -35
- package/table-builder/classes/table-builder-general-settings.d.ts +0 -78
- package/table-builder/classes/table-builder.d.ts +0 -18
- package/table-builder/classes/table-store.d.ts +0 -136
- package/table-builder/components/array-column.component.d.ts +0 -15
- package/table-builder/components/column-builder/column-builder.component.d.ts +0 -47
- package/table-builder/components/column-builder/column-helpers.d.ts +0 -36
- 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 -46
- package/table-builder/components/filter/in-list/in-list-filter.component.d.ts +0 -24
- package/table-builder/components/gen-col-displayer/gen-col-displayer.component.d.ts +0 -15
- package/table-builder/components/generic-table/generic-table.component.d.ts +0 -81
- package/table-builder/components/generic-table/paginator.component.d.ts +0 -29
- package/table-builder/components/group-by-list/group-by-list.component.d.ts +0 -7
- package/table-builder/components/header-menu/header-menu.component.d.ts +0 -51
- package/table-builder/components/in-filter/in-filter.component.d.ts +0 -20
- package/table-builder/components/initialization-component/initialization-component.d.ts +0 -13
- package/table-builder/components/link-column.component.d.ts +0 -25
- 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 -32
- package/table-builder/components/scroll-strategy.d.ts +0 -22
- 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 -24
- package/table-builder/components/table-container/table-container.d.ts +0 -80
- package/table-builder/components/table-container/table-container.helpers/data-state.helpers.d.ts +0 -6
- package/table-builder/components/table-container/table-container.helpers/filter-state.helpers.d.ts +0 -17
- package/table-builder/components/table-container/table-container.helpers/groupBy.helpers.d.ts +0 -17
- package/table-builder/components/table-container/table-container.helpers/sort-state.helpers.d.ts +0 -8
- package/table-builder/components/table-container/tableProps.d.ts +0 -12
- package/table-builder/components/table-container/virtual-scroll-container.d.ts +0 -22
- 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/directives/custom-cell-directive.d.ts +0 -33
- 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 -147
- package/table-builder/ngrx/tableBuilderStateStore.d.ts +0 -70
- 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 -12
- package/table-builder/pipes/key-display.d.ts +0 -10
- package/table-builder/services/export-to-csv.service.d.ts +0 -19
- 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 -16
- package/table-builder/table-builder.module.d.ts +0 -21
- 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 -13
- package/utilities/directives/dialog-service.d.ts +0 -10
- package/utilities/directives/dialog.d.ts +0 -44
- 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 -15
- 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 -7
- package/utilities/pipes/phone.pipe.d.ts +0 -7
- package/utilities/pipes/space-case.pipes.d.ts +0 -17
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
@if(columns$ | async; as displayCols){
|
|
2
|
+
<span matTooltip="Show/hide columns">
|
|
3
|
+
<button mat-icon-button [matMenuTriggerFor]="menu">
|
|
4
|
+
<mat-icon color="primary">visibility_off</mat-icon>
|
|
5
|
+
</button>
|
|
6
|
+
</span>
|
|
7
|
+
<mat-menu #menu="matMenu" class="my-mat-menu">
|
|
8
|
+
|
|
9
|
+
<button mat-menu-item>
|
|
10
|
+
<span matTooltip="Close">
|
|
11
|
+
<button class="filter-button" mat-icon-button>
|
|
12
|
+
<mat-icon>close</mat-icon>
|
|
13
|
+
</button>
|
|
14
|
+
</span>
|
|
15
|
+
</button>
|
|
16
|
+
|
|
17
|
+
<button mat-menu-item stop-propagation>
|
|
18
|
+
<span matTooltip="Show all columns">
|
|
19
|
+
<button mat-icon-button (click)="reset(displayCols)">
|
|
20
|
+
<mat-icon color="primary">done_all</mat-icon>
|
|
21
|
+
</button>
|
|
22
|
+
</span>
|
|
23
|
+
|
|
24
|
+
<span matTooltip="Hide all columns">
|
|
25
|
+
<button mat-icon-button (click)="unset(displayCols)">
|
|
26
|
+
<mat-icon color="primary">cancel</mat-icon>
|
|
27
|
+
</button>
|
|
28
|
+
</span>
|
|
29
|
+
</button>
|
|
30
|
+
|
|
31
|
+
<div cdkDropList (cdkDropListDropped)="drop($event)" stop-propagation [cdkDropListLockAxis]="'y'">
|
|
32
|
+
@for (col of displayCols; track col.key) {
|
|
33
|
+
<button [class.isHidden]="!col.isVisible" stop-propagation mat-menu-item cdkDrag [cdkDragData]="col">
|
|
34
|
+
<div (click)="col.isVisible = !col.isVisible; emit(displayCols)" style="display: flex; align-items: center;">
|
|
35
|
+
@if(col.isVisible){
|
|
36
|
+
<button mat-icon-button matTooltip="Hide Column" class="show-hide">
|
|
37
|
+
<mat-icon color="primary">check_box</mat-icon>
|
|
38
|
+
</button>
|
|
39
|
+
} @else {
|
|
40
|
+
<button mat-icon-button matTooltip="Show Column" class="show-hide">
|
|
41
|
+
<mat-icon>indeterminate_check_box</mat-icon>
|
|
42
|
+
</button>
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
<p class="label">
|
|
46
|
+
{{col.displayName || (col.key | spaceCase) }}
|
|
47
|
+
</p>
|
|
48
|
+
|
|
49
|
+
</div>
|
|
50
|
+
</button>
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
</mat-menu>
|
|
55
|
+
}
|
|
@@ -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: cornflowerblue;
|
|
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,59 @@
|
|
|
1
|
+
import { Component, ChangeDetectionStrategy, inject } from '@angular/core';
|
|
2
|
+
import { DisplayCol } from '../../classes/display-col';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { map } from 'rxjs/operators';
|
|
5
|
+
import { orderedCodeVisibleMetaData, TableStore } from '../../classes/table-store';
|
|
6
|
+
import {CdkDragDrop, DragDropModule} from '@angular/cdk/drag-drop';
|
|
7
|
+
import { AsyncPipe } from '@angular/common';
|
|
8
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
9
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
10
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
11
|
+
import { MatMenuModule } from '@angular/material/menu';
|
|
12
|
+
import { SpaceCasePipe, StopPropagationDirective } from '../../../utilities';
|
|
13
|
+
import { defaultShareReplay } from '../../../rxjs';
|
|
14
|
+
|
|
15
|
+
@Component({
|
|
16
|
+
selector: 'tb-col-displayer',
|
|
17
|
+
templateUrl: './gen-col-displayer.component.html',
|
|
18
|
+
styleUrls: ['./gen-col-displayer.component.scss'],
|
|
19
|
+
changeDetection: ChangeDetectionStrategy.OnPush ,
|
|
20
|
+
standalone: true,
|
|
21
|
+
imports: [
|
|
22
|
+
AsyncPipe, MatTooltipModule, MatIconModule, MatButtonModule, MatMenuModule, StopPropagationDirective,
|
|
23
|
+
DragDropModule, SpaceCasePipe
|
|
24
|
+
]
|
|
25
|
+
})
|
|
26
|
+
export class GenColDisplayerComponent {
|
|
27
|
+
private tableState = inject(TableStore);
|
|
28
|
+
|
|
29
|
+
columns$: Observable< DisplayCol[]>;
|
|
30
|
+
constructor() {
|
|
31
|
+
this.columns$ = this.tableState.state$.pipe(
|
|
32
|
+
map( state =>
|
|
33
|
+
orderedCodeVisibleMetaData(state)
|
|
34
|
+
.map( md => ({
|
|
35
|
+
key: md.key,
|
|
36
|
+
displayName: md.displayName,
|
|
37
|
+
isVisible: !state.hiddenKeys.includes(md.key)
|
|
38
|
+
}))
|
|
39
|
+
),
|
|
40
|
+
defaultShareReplay()
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
reset(displayCols: DisplayCol[]) {
|
|
45
|
+
displayCols.forEach(c => c.isVisible = true);
|
|
46
|
+
this.emit(displayCols);
|
|
47
|
+
}
|
|
48
|
+
drop(event: CdkDragDrop<string[]>) {
|
|
49
|
+
this.tableState.setUserDefinedOrder({ newOrder: event.currentIndex, oldOrder:event.previousIndex })
|
|
50
|
+
}
|
|
51
|
+
unset(displayCols: DisplayCol[]) {
|
|
52
|
+
displayCols.forEach(c => c.isVisible = false);
|
|
53
|
+
this.emit(displayCols);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
emit(displayCols: DisplayCol[]) {
|
|
57
|
+
this.tableState.setHiddenColumns(displayCols.map( c => ({key: c.key, visible: c.isVisible})));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<mat-table
|
|
2
|
+
cdkDropList
|
|
3
|
+
cdkDropListLockAxis='x'
|
|
4
|
+
cdkDropListOrientation="horizontal"
|
|
5
|
+
(cdkDropListDropped)="drop($event)"
|
|
6
|
+
class="table-drag-list"
|
|
7
|
+
[class]="($footerRowStyle())"
|
|
8
|
+
#table
|
|
9
|
+
[dataSource]="state.props().dataSource!"
|
|
10
|
+
[trackBy]="trackByFunction"
|
|
11
|
+
[style]="tableWidth | async "
|
|
12
|
+
>
|
|
13
|
+
|
|
14
|
+
<!-- select column -->
|
|
15
|
+
<ng-container matColumnDef="select">
|
|
16
|
+
|
|
17
|
+
<mat-header-cell *matHeaderCellDef class="select-column">
|
|
18
|
+
<mat-checkbox (change)="$event ? masterToggle() : null"
|
|
19
|
+
[checked]="!!(masterToggleChecked$ | async)"
|
|
20
|
+
[indeterminate]="masterToggleIndeterminate$ | async">
|
|
21
|
+
</mat-checkbox>
|
|
22
|
+
</mat-header-cell>
|
|
23
|
+
|
|
24
|
+
<mat-cell *matCellDef="let row" class="select-column">
|
|
25
|
+
<mat-checkbox
|
|
26
|
+
(click)="$event.stopPropagation()"
|
|
27
|
+
(change)="$event ? selection.toggle(row) : null"
|
|
28
|
+
[checked]="selection.isSelected(row)"/>
|
|
29
|
+
</mat-cell>
|
|
30
|
+
|
|
31
|
+
<mat-footer-cell *matFooterCellDef class="select-column">
|
|
32
|
+
{{ selection.selected.length }}
|
|
33
|
+
</mat-footer-cell>
|
|
34
|
+
</ng-container>
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
<!-- index column -->
|
|
38
|
+
<ng-container matColumnDef="index">
|
|
39
|
+
<mat-header-cell *matHeaderCellDef class="f-mat-header-cell" class="index-column">#
|
|
40
|
+
</mat-header-cell>
|
|
41
|
+
<mat-cell *matCellDef="let i = index;" class="index-column">
|
|
42
|
+
{{ 1 + i + offsetIndex }}
|
|
43
|
+
</mat-cell>
|
|
44
|
+
<mat-footer-cell *matFooterCellDef class="index-column"></mat-footer-cell>
|
|
45
|
+
</ng-container>
|
|
46
|
+
|
|
47
|
+
<!-- Grouping -->
|
|
48
|
+
<ng-container matColumnDef="groupHeader">
|
|
49
|
+
<mat-cell *matCellDef="let row">
|
|
50
|
+
@let expanded = (state.getIsExpanded | func : row.key : row.groupName );
|
|
51
|
+
<div [style.paddingLeft]="row.padding + 'px !important'">
|
|
52
|
+
<button mat-icon-button (click)="setExpanded(row.key, row.groupName, !expanded());">
|
|
53
|
+
@if (!expanded()) {
|
|
54
|
+
<mat-icon>chevron_right</mat-icon>
|
|
55
|
+
} @else {
|
|
56
|
+
<mat-icon>expand_more</mat-icon>
|
|
57
|
+
}
|
|
58
|
+
</button>
|
|
59
|
+
{{ getTransform | func : row.key : row.groupHeaderDisplay }} ({{ row.length }})
|
|
60
|
+
</div>
|
|
61
|
+
<div style="flex-grow: 1">
|
|
62
|
+
<ng-container *ngTemplateOutlet="state.props().groupHeaderTemplate!; context: { element: row }"></ng-container>
|
|
63
|
+
</div>
|
|
64
|
+
</mat-cell>
|
|
65
|
+
</ng-container>
|
|
66
|
+
|
|
67
|
+
<mat-row [style.height]="$rowHeight()" [style.min-height]="$rowHeight()"
|
|
68
|
+
*matRowDef="let row; columns: $keys(); let i = index"/>
|
|
69
|
+
<mat-row [style.height]="state.props().groupHeaderHeight ? state.props().groupHeaderHeight + 'px' : $groupHeaderHeight()"
|
|
70
|
+
[style.min-height]="state.props().groupHeaderHeight ? state.props().groupHeaderHeight + 'px' : $groupHeaderHeight()"
|
|
71
|
+
*matRowDef="let row; columns: ['groupHeader']; when: isGroupHeader" style="background-color: white;"/>
|
|
72
|
+
</mat-table>
|
|
73
|
+
|
|
74
|
+
<mat-header-row [style.height]="$headerHeight()" [style.min-height]="$headerHeight()"
|
|
75
|
+
*matHeaderRowDef="$keys(); sticky: state.props().isSticky" [style.top.px]="((offset$ | async)! * -1)"/>
|
|
76
|
+
<mat-footer-row [style.height]="$rowHeight()" [style.min-height]="$rowHeight()"
|
|
77
|
+
*matFooterRowDef="$keys(); sticky: $stickyFooter() "
|
|
78
|
+
[style.bottom.px]="$stickyFooter() ? (offset$ | async) : undefined"/>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
|
|
2
|
+
:host{
|
|
3
|
+
--mat-paginator-container-size: initial;
|
|
4
|
+
}
|
|
5
|
+
.select-column {
|
|
6
|
+
min-width: var(--tb-min-select-column-width, 42px)
|
|
7
|
+
}
|
|
8
|
+
.index-column {
|
|
9
|
+
min-width: var(--tb-min-index-column-width, 42px)
|
|
10
|
+
}
|
|
11
|
+
.mat-mdc-row:nth-child(odd) {
|
|
12
|
+
background-color: var(--tb-odd-row-background-color, #cdeefe);
|
|
13
|
+
}
|
|
14
|
+
.page-amounts{
|
|
15
|
+
color: rgba(0, 0, 0, 0.54);
|
|
16
|
+
font-family: Roboto, "Helvetica Neue", sans-serif;
|
|
17
|
+
font-size: 12px;
|
|
18
|
+
margin-right: .2rem;
|
|
19
|
+
}
|
|
20
|
+
:host::ng-deep .table-drag-list.cdk-drop-list-dragging .drag-header:not(.cdk-drag-placeholder) {
|
|
21
|
+
transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
|
|
22
|
+
}
|
|
23
|
+
:host::ng-deep{
|
|
24
|
+
& .mdc-data-table__cell, .mdc-data-table__header-cell, .mdc-data-table__cell, .mdc-data-table__header-cell{
|
|
25
|
+
padding: var(--tb-cell-padding, 0 0 0 .2rem);
|
|
26
|
+
line-height: var(--tb-cell-line-height, normal);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
::ng-deep .op-date-time-input{
|
|
30
|
+
line-height: 3rem;
|
|
31
|
+
font-size: .9rem;
|
|
32
|
+
font-family: Roboto, "Helvetica Neue", sans-serif;
|
|
33
|
+
padding-left: 0.2rem;
|
|
34
|
+
width: 12rem;
|
|
35
|
+
|
|
36
|
+
}
|
|
37
|
+
.small-footer{
|
|
38
|
+
mat-footer-row{
|
|
39
|
+
min-height: 1rem;
|
|
40
|
+
height: 1rem;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import { Component, ViewChild, Input, ChangeDetectionStrategy, Output, SimpleChanges, OnInit, QueryList, ViewContainerRef, Injector, EventEmitter, computed, inject, input, viewChild, effect, untracked, signal } from '@angular/core';
|
|
2
|
+
import { MatFooterRowDef, MatHeaderRowDef, MatRowDef, MatTable, MatTableModule } from '@angular/material/table';
|
|
3
|
+
import { Observable, combineLatest } from 'rxjs';
|
|
4
|
+
import { SelectionChange, SelectionModel } from '@angular/cdk/collections';
|
|
5
|
+
import { TableStore } from '../../classes/table-store';
|
|
6
|
+
import { map } from 'rxjs/operators';
|
|
7
|
+
import { ColumnBuilderComponent } from '../column-builder/column-builder.component';
|
|
8
|
+
import { Dictionary } from '../../interfaces/dictionary';
|
|
9
|
+
import { FieldType } from '../../interfaces/report-def';
|
|
10
|
+
import { previousAndCurrent } from '../../../rxjs/rxjs-operators';
|
|
11
|
+
import { ColumnInfo } from '../../interfaces/ColumnInfo';
|
|
12
|
+
import { CdkDragDrop, CdkDropList, DragDropModule } from '@angular/cdk/drag-drop';
|
|
13
|
+
import { FunctionPipe } from '../../../utilities';
|
|
14
|
+
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
15
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
16
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
17
|
+
import { AsyncPipe, NgTemplateOutlet } from '@angular/common';
|
|
18
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
19
|
+
import { TransformCreator } from '../../services/transform-creator';
|
|
20
|
+
import { initIndexSymbol } from '../table-container/table-container.helpers/sort-state.helpers';
|
|
21
|
+
import { VirtualScrollOptions } from '../../classes/table-builder-general-settings';
|
|
22
|
+
import { toObservable } from '@angular/core/rxjs-interop';
|
|
23
|
+
import { DataStore } from '../../classes/data-store';
|
|
24
|
+
|
|
25
|
+
@Component({
|
|
26
|
+
selector: 'tb-generic-table',
|
|
27
|
+
templateUrl: './generic-table.component.html',
|
|
28
|
+
styleUrls: ['./generic-table.component.scss'],
|
|
29
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
30
|
+
standalone: true,
|
|
31
|
+
imports: [
|
|
32
|
+
MatTableModule, DragDropModule, MatCheckboxModule, MatButtonModule, MatIconModule, NgTemplateOutlet,
|
|
33
|
+
MatTooltipModule, AsyncPipe, FunctionPipe,
|
|
34
|
+
],
|
|
35
|
+
})
|
|
36
|
+
export class GenericTableComponent implements OnInit {
|
|
37
|
+
protected state = inject(TableStore);
|
|
38
|
+
private dataStore = inject(DataStore);
|
|
39
|
+
private viewContainer = inject(ViewContainerRef);
|
|
40
|
+
private transformCreator = inject(TransformCreator);
|
|
41
|
+
|
|
42
|
+
$headerRow = viewChild(MatHeaderRowDef);
|
|
43
|
+
$footerRow = viewChild(MatFooterRowDef);
|
|
44
|
+
$table = viewChild(MatTable);
|
|
45
|
+
|
|
46
|
+
drop(event: CdkDragDrop<string[]>) {
|
|
47
|
+
this.state.setUserDefinedOrder({ newOrder:event.currentIndex, oldOrder:event.previousIndex })
|
|
48
|
+
}
|
|
49
|
+
_trackBy?: string;
|
|
50
|
+
@Input() set trackBy(trackBy: string){
|
|
51
|
+
if(trackBy){
|
|
52
|
+
this._trackBy = trackBy;
|
|
53
|
+
this.trackByFunction = (index:number, item: any) => item[trackBy];
|
|
54
|
+
}
|
|
55
|
+
this.setUpSelections(trackBy);
|
|
56
|
+
}
|
|
57
|
+
get trackBy(): string | undefined { return this._trackBy }
|
|
58
|
+
$displayData = input.required<any[]>({ alias: 'displayData' });
|
|
59
|
+
$displayDataLength = computed(() => this.$displayData()?.length || 0);
|
|
60
|
+
$hasFooterMeta = computed(() => this.state.$metaDataArray().some(md => !!md.additional?.footer))
|
|
61
|
+
$data = input.required<any[]>({ alias: 'data' })
|
|
62
|
+
data$ = toObservable(this.$data);
|
|
63
|
+
@Input() rows!: QueryList<MatRowDef<any>>;
|
|
64
|
+
@Input() columnBuilders!: ColumnBuilderComponent[];
|
|
65
|
+
$columnInfos = input.required<ColumnInfo[]>({ alias: 'columnInfos' });
|
|
66
|
+
$hasCustomFooter = computed(() => this.$columnInfos()?.some(ci => !!ci.customCell?.columnDef?.footerCell))
|
|
67
|
+
@ViewChild(CdkDropList, { static: true }) dropList!: CdkDropList;
|
|
68
|
+
$footerRowStyle = computed(() => {
|
|
69
|
+
const hasData = !!this.$displayDataLength();
|
|
70
|
+
const metaFooter = this.$hasFooterMeta();
|
|
71
|
+
const customFooter = this.$hasCustomFooter();
|
|
72
|
+
const hasSelectionColumn = this.state.props().selectionColumn;
|
|
73
|
+
return customFooter || (hasData && (metaFooter || hasSelectionColumn)) ? 'regular-footer' : hasData ? 'no-footer' : 'small-footer';
|
|
74
|
+
});
|
|
75
|
+
$showFooterRow = computed(() => this.$footerRowStyle() !== 'no-footer');
|
|
76
|
+
currentColumns!: string[];
|
|
77
|
+
_injector = inject(Injector);
|
|
78
|
+
injector = Injector.create({
|
|
79
|
+
providers: [
|
|
80
|
+
{provide: MatTable, useFactory: ()=> this.$table() },
|
|
81
|
+
{provide: CdkDropList, useFactory: ()=> this.dropList },
|
|
82
|
+
],
|
|
83
|
+
parent: this._injector
|
|
84
|
+
});
|
|
85
|
+
rowDefArr :MatRowDef<any>[] = [];
|
|
86
|
+
$hasSelectColumn = computed(() => this.state.selectSignal(state => state.props.selectionColumn)());
|
|
87
|
+
$hasIndexColumn = computed(() => this.state.selectSignal(state => state.props.indexColumn)());
|
|
88
|
+
myColumns = signal<Dictionary<ColumnBuilderComponent>>({});
|
|
89
|
+
$showHeader = computed(() => !this.state.tableSettings().hideColumnHeader)
|
|
90
|
+
offset$ = this.dataStore.select( s => s.virtualScrollOffset );
|
|
91
|
+
offsetIndex = 0;
|
|
92
|
+
dataView!: Observable<any[]>;
|
|
93
|
+
|
|
94
|
+
constructor() {
|
|
95
|
+
this.setUpSelections();
|
|
96
|
+
effect(() => {
|
|
97
|
+
const columnInfos = this.$columnInfos() || [];
|
|
98
|
+
untracked(() => {
|
|
99
|
+
Object.entries(this.myColumns()).forEach(([key, value]) => {
|
|
100
|
+
const columnInfo = columnInfos.find(ci => ci.metaData.key === key);
|
|
101
|
+
if(!columnInfo || columnInfo.customCell !== value.customCell) {
|
|
102
|
+
delete this.myColumns()[key];
|
|
103
|
+
this.$table()?.removeColumnDef(value.columnDef);
|
|
104
|
+
}
|
|
105
|
+
})
|
|
106
|
+
columnInfos.forEach(ci => this.addMetaData(ci))
|
|
107
|
+
})
|
|
108
|
+
});
|
|
109
|
+
effect(() => {
|
|
110
|
+
const headerRow = this.$headerRow();
|
|
111
|
+
const showHeader = this.$showHeader();
|
|
112
|
+
const table = this.$table();
|
|
113
|
+
untracked(() => {
|
|
114
|
+
if(headerRow && showHeader && table) table.addHeaderRowDef(headerRow);
|
|
115
|
+
else if(headerRow && table) table.removeHeaderRowDef(headerRow);
|
|
116
|
+
})
|
|
117
|
+
});
|
|
118
|
+
effect(() => {
|
|
119
|
+
const footerRow = this.$footerRow();
|
|
120
|
+
const showFooter = this.$showFooterRow();
|
|
121
|
+
const table = this.$table();
|
|
122
|
+
untracked(() => {
|
|
123
|
+
if(footerRow && showFooter && table) table.addFooterRowDef(footerRow);
|
|
124
|
+
else if(footerRow && table) table.removeFooterRowDef(footerRow);
|
|
125
|
+
})
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
defaultTrackBy = (index:number, item: any) => item[initIndexSymbol];
|
|
130
|
+
trackByFunction = this.defaultTrackBy;
|
|
131
|
+
ngOnChanges(changes: SimpleChanges) {
|
|
132
|
+
if (changes.rows && this.rows && this.myColumns().length) {
|
|
133
|
+
this.initializeRowDefs([...this.rows]);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
$keys = computed(() => {
|
|
137
|
+
const displayed = this.state.$orderedVisibleColumns();
|
|
138
|
+
const built = this.myColumns();
|
|
139
|
+
const keys = displayed.filter(d => !!built[d]);
|
|
140
|
+
if(this.$hasSelectColumn()){
|
|
141
|
+
keys.unshift('select');
|
|
142
|
+
}
|
|
143
|
+
if(this.$hasIndexColumn()) {
|
|
144
|
+
keys.unshift('index');
|
|
145
|
+
}
|
|
146
|
+
return keys;
|
|
147
|
+
})
|
|
148
|
+
keys$ = toObservable(this.$keys);
|
|
149
|
+
ngOnInit() {
|
|
150
|
+
this.initializeRowDefs([...this.rows]);
|
|
151
|
+
|
|
152
|
+
this.state.on(this.keys$, keys => {
|
|
153
|
+
this.rowDefArr?.forEach(row => row.columns = keys)
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
this.state.on(this.selectableData$, (data) => {
|
|
157
|
+
if(this.selection.selected.length){
|
|
158
|
+
const trackByFunction = this.trackBy ? (s) => data.every(d => d[this.trackBy!] !== s[this.trackBy!]) : s => !data.includes(s);
|
|
159
|
+
const removed = this.selection.selected.filter(trackByFunction);
|
|
160
|
+
this.selection.deselect(...removed);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
if(this.state.tableSettings().usePaginator || this.state.tableSettings().useVirtualScroll) {
|
|
165
|
+
this.state.on(combineLatest([this.state.state$, this.dataStore.state$]), ([state, data]) => {
|
|
166
|
+
this.offsetIndex = data.virtualEnds.start;
|
|
167
|
+
if(this.state.tableSettings().usePaginator) {
|
|
168
|
+
this.offsetIndex += (state.pageSize * state.currentPage);
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
isGroupHeader(_: number, row: { isGroupHeader: boolean }) {
|
|
176
|
+
return row.isGroupHeader;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
setExpanded(key: string, groupKey: string, isExpanded: boolean): void {
|
|
180
|
+
this.state.updateExpandedGroups({ key , isExpanded, groupKey });
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
addMetaData(column: ColumnInfo) {
|
|
184
|
+
const columnBuilder = this.myColumns()[column.metaData.key];
|
|
185
|
+
if(columnBuilder) {
|
|
186
|
+
columnBuilder.metaData = column.metaData;
|
|
187
|
+
} else {
|
|
188
|
+
const component = this.viewContainer.createComponent(ColumnBuilderComponent, {
|
|
189
|
+
index: 0,
|
|
190
|
+
injector: this.injector
|
|
191
|
+
});
|
|
192
|
+
component.instance.customCell = column.customCell;
|
|
193
|
+
component.instance.metaData = column.metaData;
|
|
194
|
+
component.instance.data$ = this.data$;
|
|
195
|
+
this.myColumns.update(mc => ({...mc, [column.metaData.key]: component.instance}));
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
initializeRowDefs = (defs:MatRowDef<any>[])=>{
|
|
200
|
+
const table = this.$table();
|
|
201
|
+
if(!table) return;
|
|
202
|
+
this.rowDefArr.forEach(r=> table.removeRowDef(r));
|
|
203
|
+
this.rowDefArr = defs;
|
|
204
|
+
defs.forEach(r => {
|
|
205
|
+
r.columns = this.$keys().concat(Object.values(this.myColumns()).filter(c => c.metaData.fieldType !== FieldType.Hidden).map(c => c.metaData.key));
|
|
206
|
+
table.addRowDef(r)
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
selection! : SelectionModel<any>;
|
|
211
|
+
@Output() selection$ = new EventEmitter<SelectionChange<any>>();
|
|
212
|
+
masterToggleChecked$ = this.selection$.pipe(map(()=>this.selection.hasValue() && this.isAllSelected()));
|
|
213
|
+
masterToggleIndeterminate$ = this.selection$.pipe(map(()=>this.selection.hasValue() && !this.isAllSelected()));
|
|
214
|
+
setUpSelections(trackBy?: string){
|
|
215
|
+
this.selection = trackBy ? new SelectionModel<any>(true, [], true, (a, b) => a[trackBy] === b[trackBy]) : new SelectionModel<any>(true, []);
|
|
216
|
+
this.state.on(this.selection.changed, c => this.selection$.emit(c));
|
|
217
|
+
}
|
|
218
|
+
$selectableData = computed(() => {
|
|
219
|
+
if(this.state.$viewType() === 'virtual paginator' || this.state.$viewType() === 'paginator'){
|
|
220
|
+
const previousPageRecords = this.state.state().currentPage * this.state.state().pageSize;
|
|
221
|
+
return this.$data().slice(previousPageRecords, previousPageRecords + this.state.state().pageSize);
|
|
222
|
+
}else if(this.state.$viewType() === 'all' || this.state.$viewType() === 'virtual all'){
|
|
223
|
+
return this.$data();
|
|
224
|
+
}
|
|
225
|
+
return [];
|
|
226
|
+
});
|
|
227
|
+
selectableData$ = toObservable(this.$selectableData);
|
|
228
|
+
isAllSelected() {
|
|
229
|
+
const numSelected = this.selection.selected.length;
|
|
230
|
+
const numRows = this.$selectableData()?.length || 0;
|
|
231
|
+
return numSelected === numRows;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/** Selects all rows if they are not all selected; otherwise clear selection. */
|
|
235
|
+
masterToggle() {
|
|
236
|
+
if(this.isAllSelected()){
|
|
237
|
+
this.selection.clear()
|
|
238
|
+
} else {
|
|
239
|
+
this.selection.select(...this.$selectableData());
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
tableWidth = this.state.getUserDefinedTableSize$.pipe(
|
|
244
|
+
previousAndCurrent<number | undefined>(0),
|
|
245
|
+
map(([previousUserDefinedWidth, currentUserDefinedWidth]) => {
|
|
246
|
+
if( currentUserDefinedWidth){
|
|
247
|
+
return ({width:`${currentUserDefinedWidth}px`});
|
|
248
|
+
} if( wasReset() ){
|
|
249
|
+
return ({width:'initial'});
|
|
250
|
+
}
|
|
251
|
+
return ({});
|
|
252
|
+
|
|
253
|
+
function wasReset(){
|
|
254
|
+
return (previousUserDefinedWidth ?? 0) >=0 && currentUserDefinedWidth == null;
|
|
255
|
+
}
|
|
256
|
+
})
|
|
257
|
+
);
|
|
258
|
+
|
|
259
|
+
getTransform = (key: string, val: string) => {
|
|
260
|
+
if(val == undefined || val === 'null') return '';
|
|
261
|
+
try {
|
|
262
|
+
return this.transformCreator.createTransformer(this.myColumns[key].metaData, true)({ [key]: val});
|
|
263
|
+
} catch (error) {
|
|
264
|
+
return val;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
$rowHeight = this.state.selectSignal(s => {
|
|
269
|
+
if(this.state.$isVirtual() && (s.notPersistedTableSettings.useVirtualScroll as VirtualScrollOptions)?.enforceRowHeight){
|
|
270
|
+
const height = (s.notPersistedTableSettings.useVirtualScroll as VirtualScrollOptions)!.rowHeight;
|
|
271
|
+
return height + 'px' ;
|
|
272
|
+
}
|
|
273
|
+
if(typeof s.notPersistedTableSettings.rowHeight === 'number'){
|
|
274
|
+
return s.notPersistedTableSettings.rowHeight + 'px';
|
|
275
|
+
}
|
|
276
|
+
return s.notPersistedTableSettings.rowHeight;
|
|
277
|
+
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
$headerHeight = this.state.selectSignal(s => {
|
|
281
|
+
if(this.state.$isVirtual() && (s.notPersistedTableSettings.useVirtualScroll as VirtualScrollOptions)?.enforceHeaderHeight){
|
|
282
|
+
const height = (s.notPersistedTableSettings.useVirtualScroll as VirtualScrollOptions)!.headerHeight;
|
|
283
|
+
return height + 'px';
|
|
284
|
+
}
|
|
285
|
+
if(typeof s.notPersistedTableSettings.headerHeight === 'number'){
|
|
286
|
+
return s.notPersistedTableSettings.headerHeight + 'px';
|
|
287
|
+
}
|
|
288
|
+
return s.notPersistedTableSettings.headerHeight;
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
$groupHeaderHeight = this.state.selectSignal(s => {
|
|
292
|
+
if(s.notPersistedTableSettings.groupHeaderHeight){
|
|
293
|
+
return s.notPersistedTableSettings.groupHeaderHeight + 'px';
|
|
294
|
+
}
|
|
295
|
+
return this.$rowHeight();
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
$stickyFooter = computed(() => this.state.props().stickyFooter || this.state.$isVirtual());
|
|
299
|
+
}
|