@unifylib/ui-lib 1.1.3 → 1.1.4
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/esm2022/iq-ui-lib.mjs +5 -0
- package/esm2022/lib/base-model/SearchStrConfig.mjs +11 -0
- package/esm2022/lib/base-model/api-response.mjs +2 -0
- package/esm2022/lib/base-model/audit-log-entry.mjs +3 -0
- package/esm2022/lib/base-model/button-action-settings.mjs +16 -0
- package/esm2022/lib/base-model/column-def.model.mjs +28 -0
- package/esm2022/lib/base-model/do-action-request.mjs +8 -0
- package/esm2022/lib/base-model/field-action.mjs +6 -0
- package/esm2022/lib/base-model/field-filter.model.mjs +3 -0
- package/esm2022/lib/base-model/field-info.mjs +57 -0
- package/esm2022/lib/base-model/field-predicate.model.mjs +10 -0
- package/esm2022/lib/base-model/filter-request.mjs +13 -0
- package/esm2022/lib/base-model/filter.model.mjs +25 -0
- package/esm2022/lib/base-model/get-items-list.mjs +10 -0
- package/esm2022/lib/base-model/index.mjs +12 -0
- package/esm2022/lib/base-model/items-total.model.mjs +8 -0
- package/esm2022/lib/base-model/line-item.model.mjs +11 -0
- package/esm2022/lib/base-model/lookupItem.mjs +16 -0
- package/esm2022/lib/base-model/page-info.mjs +17 -0
- package/esm2022/lib/base-model/report-request.model.mjs +17 -0
- package/esm2022/lib/base-model/response-envelop.model.mjs +10 -0
- package/esm2022/lib/base-model/snack-message.model.mjs +11 -0
- package/esm2022/lib/base-model/table-column.interface.mjs +2 -0
- package/esm2022/lib/base-model/table-page-user-action.interface.mjs +21 -0
- package/esm2022/lib/base-model/workflow/workflow-steps.model.mjs +9 -0
- package/esm2022/lib/base-model/workflow/workflow.model.mjs +42 -0
- package/esm2022/lib/components/action-comment/action-comment.component.mjs +101 -0
- package/esm2022/lib/components/action-confirmation/action-confirmation.component.mjs +55 -0
- package/esm2022/lib/components/activity-report-form/activity-report-form.component.mjs +499 -0
- package/esm2022/lib/components/advanced-filter/field-filter/field-filter.component.mjs +41 -0
- package/esm2022/lib/components/advanced-filter/filter-builder/filter-builder.component.mjs +162 -0
- package/esm2022/lib/components/audit-log-details-dialog/audit-log-details-dialog.component.mjs +70 -0
- package/esm2022/lib/components/audit-log-list/audit-log.component.mjs +99 -0
- package/esm2022/lib/components/auto-complete/auto-complete.component.mjs +292 -0
- package/esm2022/lib/components/base-form/base-form.component.mjs +297 -0
- package/esm2022/lib/components/base-form-canvas/base-form-canvas.component.mjs +591 -0
- package/esm2022/lib/components/base-input-dialog/base-input-dialog.component.mjs +72 -0
- package/esm2022/lib/components/base-table/base-table.component.mjs +514 -0
- package/esm2022/lib/components/button-actions/button-actions.component.mjs +70 -0
- package/esm2022/lib/components/editable-base-table/editable-base-table.component.mjs +496 -0
- package/esm2022/lib/components/equation-builder/equation-builder.component.mjs +112 -0
- package/esm2022/lib/components/item-line-editor/item-line-editor.component.mjs +299 -0
- package/esm2022/lib/components/multi-auto-complete/multi-auto-complete.component.mjs +278 -0
- package/esm2022/lib/components/paginator/paginator.component.mjs +91 -0
- package/esm2022/lib/components/report-details-dialog/report-details-dialog.component.mjs +102 -0
- package/esm2022/lib/components/report-form/report-form.component.mjs +498 -0
- package/esm2022/lib/components/search-bar/search-bar.component.mjs +62 -0
- package/esm2022/lib/components/section-form-canvas/section-form-canvas.component.mjs +81 -0
- package/esm2022/lib/components/shared/action-button/action-button.component.mjs +59 -0
- package/esm2022/lib/components/shared/action-card/action-card.component.mjs +93 -0
- package/esm2022/lib/components/shared/attachment-uploader/attachment-uploader.component.mjs +70 -0
- package/esm2022/lib/components/shared-list/shared-list.component.mjs +47 -0
- package/esm2022/lib/components/snackbar-static/snackbar-static.component.mjs +43 -0
- package/esm2022/lib/components/title-bar/title-bar.component.mjs +119 -0
- package/esm2022/lib/services/backend-service.mjs +240 -0
- package/esm2022/lib/services/index.mjs +4 -0
- package/esm2022/lib/services/top-panel.mjs +22 -0
- package/esm2022/lib/services/trigger-form.service.mjs +17 -0
- package/esm2022/lib/utils/base-utils.mjs +97 -0
- package/esm2022/lib/validators/date-range-validator.mjs +27 -0
- package/esm2022/lib/validators/index.mjs +4 -0
- package/esm2022/lib/validators/match-list.validator.mjs +9 -0
- package/esm2022/lib/validators/multi-email-validator.mjs +13 -0
- package/esm2022/public-api.mjs +29 -0
- package/esm2022/q-btech-ui-lib.mjs +5 -0
- package/esm2022/unifylib-ui-lib.mjs +5 -0
- package/fesm2022/iq-ui-lib.mjs +5625 -0
- package/fesm2022/iq-ui-lib.mjs.map +1 -0
- package/fesm2022/q-btech-ui-lib.mjs +5619 -0
- package/fesm2022/q-btech-ui-lib.mjs.map +1 -0
- package/fesm2022/unifylib-ui-lib.mjs +5625 -0
- package/fesm2022/unifylib-ui-lib.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/base-model/SearchStrConfig.d.ts +8 -0
- package/{src/lib/base-model/api-response.ts → lib/base-model/api-response.d.ts} +21 -23
- package/lib/base-model/audit-log-entry.d.ts +7 -0
- package/lib/base-model/button-action-settings.d.ts +15 -0
- package/lib/base-model/column-def.model.d.ts +11 -0
- package/lib/base-model/do-action-request.d.ts +10 -0
- package/lib/base-model/field-action.d.ts +6 -0
- package/lib/base-model/field-filter.model.d.ts +7 -0
- package/lib/base-model/field-info.d.ts +53 -0
- package/lib/base-model/field-predicate.model.d.ts +7 -0
- package/lib/base-model/filter-request.d.ts +15 -0
- package/lib/base-model/filter.model.d.ts +22 -0
- package/lib/base-model/get-items-list.d.ts +21 -0
- package/lib/base-model/index.d.ts +11 -0
- package/lib/base-model/items-total.model.d.ts +6 -0
- package/lib/base-model/line-item.model.d.ts +9 -0
- package/lib/base-model/lookupItem.d.ts +13 -0
- package/lib/base-model/page-info.d.ts +52 -0
- package/lib/base-model/report-request.model.d.ts +18 -0
- package/lib/base-model/response-envelop.model.d.ts +8 -0
- package/lib/base-model/snack-message.model.d.ts +7 -0
- package/lib/base-model/table-column.interface.d.ts +28 -0
- package/lib/base-model/table-page-user-action.interface.d.ts +14 -0
- package/lib/base-model/workflow/workflow-steps.model.d.ts +7 -0
- package/lib/base-model/workflow/workflow.model.d.ts +13 -0
- package/lib/components/action-comment/action-comment.component.d.ts +32 -0
- package/lib/components/action-confirmation/action-confirmation.component.d.ts +19 -0
- package/lib/components/activity-report-form/activity-report-form.component.d.ts +93 -0
- package/lib/components/advanced-filter/field-filter/field-filter.component.d.ts +20 -0
- package/lib/components/advanced-filter/filter-builder/filter-builder.component.d.ts +28 -0
- package/lib/components/audit-log-details-dialog/audit-log-details-dialog.component.d.ts +25 -0
- package/lib/components/audit-log-list/audit-log.component.d.ts +36 -0
- package/lib/components/auto-complete/auto-complete.component.d.ts +51 -0
- package/lib/components/base-form/base-form.component.d.ts +59 -0
- package/lib/components/base-form-canvas/base-form-canvas.component.d.ts +124 -0
- package/lib/components/base-input-dialog/base-input-dialog.component.d.ts +23 -0
- package/lib/components/base-table/base-table.component.d.ts +128 -0
- package/lib/components/button-actions/button-actions.component.d.ts +17 -0
- package/lib/components/editable-base-table/editable-base-table.component.d.ts +106 -0
- package/lib/components/equation-builder/equation-builder.component.d.ts +23 -0
- package/lib/components/item-line-editor/item-line-editor.component.d.ts +64 -0
- package/lib/components/multi-auto-complete/multi-auto-complete.component.d.ts +51 -0
- package/lib/components/paginator/paginator.component.d.ts +26 -0
- package/lib/components/report-details-dialog/report-details-dialog.component.d.ts +34 -0
- package/lib/components/report-form/report-form.component.d.ts +92 -0
- package/lib/components/search-bar/search-bar.component.d.ts +29 -0
- package/lib/components/section-form-canvas/section-form-canvas.component.d.ts +27 -0
- package/lib/components/shared/action-button/action-button.component.d.ts +17 -0
- package/lib/components/shared/action-card/action-card.component.d.ts +37 -0
- package/lib/components/shared/attachment-uploader/attachment-uploader.component.d.ts +16 -0
- package/lib/components/shared-list/shared-list.component.d.ts +21 -0
- package/lib/components/snackbar-static/snackbar-static.component.d.ts +15 -0
- package/lib/components/title-bar/title-bar.component.d.ts +42 -0
- package/lib/services/backend-service.d.ts +59 -0
- package/{src/lib/services/index.ts → lib/services/index.d.ts} +3 -3
- package/lib/services/top-panel.d.ts +8 -0
- package/lib/services/trigger-form.service.d.ts +7 -0
- package/lib/utils/base-utils.d.ts +13 -0
- package/lib/validators/date-range-validator.d.ts +2 -0
- package/{src/lib/validators/index.ts → lib/validators/index.d.ts} +3 -3
- package/lib/validators/match-list.validator.d.ts +4 -0
- package/lib/validators/multi-email-validator.d.ts +6 -0
- package/package.json +27 -14
- package/{src/public-api.ts → public-api.d.ts} +25 -29
- package/ng-package.json +0 -7
- package/src/lib/base-model/SearchStrConfig.ts +0 -12
- package/src/lib/base-model/audit-log-entry.ts +0 -7
- package/src/lib/base-model/button-action-settings.ts +0 -29
- package/src/lib/base-model/column-def.model.ts +0 -34
- package/src/lib/base-model/do-action-request.ts +0 -11
- package/src/lib/base-model/feature-item.ts +0 -9
- package/src/lib/base-model/field-action.ts +0 -7
- package/src/lib/base-model/field-filter.model.ts +0 -7
- package/src/lib/base-model/field-info.ts +0 -102
- package/src/lib/base-model/field-predicate.model.ts +0 -7
- package/src/lib/base-model/filter-request.ts +0 -27
- package/src/lib/base-model/filter.model.ts +0 -49
- package/src/lib/base-model/get-items-list.ts +0 -24
- package/src/lib/base-model/index.ts +0 -11
- package/src/lib/base-model/items-total.model.ts +0 -12
- package/src/lib/base-model/line-item.model.ts +0 -18
- package/src/lib/base-model/lookupItem.ts +0 -21
- package/src/lib/base-model/null-snackmessage.ts +0 -9
- package/src/lib/base-model/page-info.ts +0 -54
- package/src/lib/base-model/report-request.model.ts +0 -33
- package/src/lib/base-model/response-envelop.model.ts +0 -15
- package/src/lib/base-model/snack-message.model.ts +0 -14
- package/src/lib/base-model/snackmessage-interface.ts +0 -7
- package/src/lib/base-model/table-column.interface.ts +0 -29
- package/src/lib/base-model/table-page-user-action.interface.ts +0 -33
- package/src/lib/base-model/workflow/workflow-steps.model.ts +0 -9
- package/src/lib/base-model/workflow/workflow.model.ts +0 -52
- package/src/lib/components/action-comment/action-comment.component.css +0 -52
- package/src/lib/components/action-comment/action-comment.component.html +0 -47
- package/src/lib/components/action-comment/action-comment.component.spec.ts +0 -23
- package/src/lib/components/action-comment/action-comment.component.ts +0 -102
- package/src/lib/components/action-confirmation/action-confirmation.component.css +0 -46
- package/src/lib/components/action-confirmation/action-confirmation.component.html +0 -32
- package/src/lib/components/action-confirmation/action-confirmation.component.spec.ts +0 -23
- package/src/lib/components/action-confirmation/action-confirmation.component.ts +0 -58
- package/src/lib/components/activity-report-form/activity-report-form.component.html +0 -110
- package/src/lib/components/activity-report-form/activity-report-form.component.scss +0 -69
- package/src/lib/components/activity-report-form/activity-report-form.component.spec.ts +0 -25
- package/src/lib/components/activity-report-form/activity-report-form.component.ts +0 -616
- package/src/lib/components/advanced-filter/field-filter/field-filter.component.html +0 -8
- package/src/lib/components/advanced-filter/field-filter/field-filter.component.scss +0 -0
- package/src/lib/components/advanced-filter/field-filter/field-filter.component.spec.ts +0 -25
- package/src/lib/components/advanced-filter/field-filter/field-filter.component.ts +0 -55
- package/src/lib/components/advanced-filter/filter-builder/filter-builder.component.html +0 -36
- package/src/lib/components/advanced-filter/filter-builder/filter-builder.component.scss +0 -130
- package/src/lib/components/advanced-filter/filter-builder/filter-builder.component.spec.ts +0 -25
- package/src/lib/components/advanced-filter/filter-builder/filter-builder.component.ts +0 -186
- package/src/lib/components/audit-log-details-dialog/audit-log-details-dialog.component.css +0 -51
- package/src/lib/components/audit-log-details-dialog/audit-log-details-dialog.component.html +0 -23
- package/src/lib/components/audit-log-details-dialog/audit-log-details-dialog.component.spec.ts +0 -23
- package/src/lib/components/audit-log-details-dialog/audit-log-details-dialog.component.ts +0 -69
- package/src/lib/components/audit-log-list/audit-log.component.html +0 -26
- package/src/lib/components/audit-log-list/audit-log.component.scss +0 -50
- package/src/lib/components/audit-log-list/audit-log.component.spec.ts +0 -25
- package/src/lib/components/audit-log-list/audit-log.component.ts +0 -114
- package/src/lib/components/auto-complete/auto-complete.component.css +0 -55
- package/src/lib/components/auto-complete/auto-complete.component.html +0 -45
- package/src/lib/components/auto-complete/auto-complete.component.spec.ts +0 -23
- package/src/lib/components/auto-complete/auto-complete.component.ts +0 -331
- package/src/lib/components/base-form/base-form.component.html +0 -59
- package/src/lib/components/base-form/base-form.component.scss +0 -68
- package/src/lib/components/base-form/base-form.component.spec.ts +0 -25
- package/src/lib/components/base-form/base-form.component.ts +0 -323
- package/src/lib/components/base-form-canvas/base-form-canvas.component.css +0 -196
- package/src/lib/components/base-form-canvas/base-form-canvas.component.html +0 -1095
- package/src/lib/components/base-form-canvas/base-form-canvas.component.spec.ts +0 -23
- package/src/lib/components/base-form-canvas/base-form-canvas.component.ts +0 -680
- package/src/lib/components/base-input-dialog/base-input-dialog.component.css +0 -67
- package/src/lib/components/base-input-dialog/base-input-dialog.component.html +0 -47
- package/src/lib/components/base-input-dialog/base-input-dialog.component.spec.ts +0 -23
- package/src/lib/components/base-input-dialog/base-input-dialog.component.ts +0 -77
- package/src/lib/components/base-table/base-table.component.html +0 -268
- package/src/lib/components/base-table/base-table.component.scss +0 -140
- package/src/lib/components/base-table/base-table.component.spec.ts +0 -25
- package/src/lib/components/base-table/base-table.component.ts +0 -621
- package/src/lib/components/button-actions/button-actions.component.html +0 -27
- package/src/lib/components/button-actions/button-actions.component.scss +0 -101
- package/src/lib/components/button-actions/button-actions.component.spec.ts +0 -23
- package/src/lib/components/button-actions/button-actions.component.ts +0 -70
- package/src/lib/components/editable-base-table/editable-base-table.component.html +0 -337
- package/src/lib/components/editable-base-table/editable-base-table.component.scss +0 -126
- package/src/lib/components/editable-base-table/editable-base-table.component.spec.ts +0 -25
- package/src/lib/components/editable-base-table/editable-base-table.component.ts +0 -579
- package/src/lib/components/equation-builder/equation-builder.component.css +0 -39
- package/src/lib/components/equation-builder/equation-builder.component.html +0 -31
- package/src/lib/components/equation-builder/equation-builder.component.spec.ts +0 -23
- package/src/lib/components/equation-builder/equation-builder.component.ts +0 -119
- package/src/lib/components/item-line-editor/item-line-editor.component.html +0 -102
- package/src/lib/components/item-line-editor/item-line-editor.component.scss +0 -152
- package/src/lib/components/item-line-editor/item-line-editor.component.spec.ts +0 -23
- package/src/lib/components/item-line-editor/item-line-editor.component.ts +0 -306
- package/src/lib/components/multi-auto-complete/multi-auto-complete.component.css +0 -19
- package/src/lib/components/multi-auto-complete/multi-auto-complete.component.html +0 -38
- package/src/lib/components/multi-auto-complete/multi-auto-complete.component.spec.ts +0 -23
- package/src/lib/components/multi-auto-complete/multi-auto-complete.component.ts +0 -315
- package/src/lib/components/paginator/paginator.component.css +0 -65
- package/src/lib/components/paginator/paginator.component.html +0 -30
- package/src/lib/components/paginator/paginator.component.ts +0 -87
- package/src/lib/components/report-details-dialog/report-details-dialog.component.css +0 -17
- package/src/lib/components/report-details-dialog/report-details-dialog.component.html +0 -16
- package/src/lib/components/report-details-dialog/report-details-dialog.component.spec.ts +0 -23
- package/src/lib/components/report-details-dialog/report-details-dialog.component.ts +0 -111
- package/src/lib/components/report-form/report-form.component.html +0 -92
- package/src/lib/components/report-form/report-form.component.scss +0 -51
- package/src/lib/components/report-form/report-form.component.spec.ts +0 -25
- package/src/lib/components/report-form/report-form.component.ts +0 -599
- package/src/lib/components/search-bar/search-bar.component.html +0 -51
- package/src/lib/components/search-bar/search-bar.component.scss +0 -63
- package/src/lib/components/search-bar/search-bar.component.spec.ts +0 -25
- package/src/lib/components/search-bar/search-bar.component.ts +0 -68
- package/src/lib/components/section-form-canvas/section-form-canvas.component.html +0 -43
- package/src/lib/components/section-form-canvas/section-form-canvas.component.scss +0 -81
- package/src/lib/components/section-form-canvas/section-form-canvas.component.spec.ts +0 -23
- package/src/lib/components/section-form-canvas/section-form-canvas.component.ts +0 -67
- package/src/lib/components/shared/action-button/action-button.component.html +0 -12
- package/src/lib/components/shared/action-button/action-button.component.scss +0 -45
- package/src/lib/components/shared/action-button/action-button.component.ts +0 -51
- package/src/lib/components/shared/action-card/action-card.component.html +0 -78
- package/src/lib/components/shared/action-card/action-card.component.scss +0 -238
- package/src/lib/components/shared/action-card/action-card.component.ts +0 -56
- package/src/lib/components/shared/attachment-uploader/attachment-uploader.component.css +0 -135
- package/src/lib/components/shared/attachment-uploader/attachment-uploader.component.html +0 -36
- package/src/lib/components/shared/attachment-uploader/attachment-uploader.component.spec.ts +0 -23
- package/src/lib/components/shared/attachment-uploader/attachment-uploader.component.ts +0 -71
- package/src/lib/components/shared-list/shared-list.component.css +0 -0
- package/src/lib/components/shared-list/shared-list.component.html +0 -17
- package/src/lib/components/shared-list/shared-list.component.spec.ts +0 -23
- package/src/lib/components/shared-list/shared-list.component.ts +0 -53
- package/src/lib/components/snackbar-static/snackbar-static.component.html +0 -20
- package/src/lib/components/snackbar-static/snackbar-static.component.scss +0 -135
- package/src/lib/components/snackbar-static/snackbar-static.component.ts +0 -26
- package/src/lib/components/title-bar/title-bar.component.css +0 -0
- package/src/lib/components/title-bar/title-bar.component.css.map +0 -1
- package/src/lib/components/title-bar/title-bar.component.html +0 -35
- package/src/lib/components/title-bar/title-bar.component.scss +0 -126
- package/src/lib/components/title-bar/title-bar.component.spec.ts +0 -23
- package/src/lib/components/title-bar/title-bar.component.ts +0 -126
- package/src/lib/services/backend-service.ts +0 -287
- package/src/lib/services/top-panel.ts +0 -17
- package/src/lib/services/trigger-form.service.ts +0 -11
- package/src/lib/share-module/shared-module.ts +0 -10
- package/src/lib/utils/base-utils.ts +0 -102
- package/src/lib/validators/date-range-validator.ts +0 -31
- package/src/lib/validators/match-list.validator.ts +0 -10
- package/src/lib/validators/multi-email-validator.ts +0 -15
- package/tsconfig.lib.json +0 -15
- package/tsconfig.lib.prod.json +0 -11
- package/tsconfig.spec.json +0 -15
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
::ng-deep .main-multi-auto {
|
|
2
|
-
|
|
3
|
-
.matField {
|
|
4
|
-
margin-bottom: 24px !important;
|
|
5
|
-
.mat-form-field-wrapper {
|
|
6
|
-
padding: 0 !important;
|
|
7
|
-
margin-bottom: 0 !important;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
.full-width {
|
|
12
|
-
width: 100%;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.chip-input {
|
|
16
|
-
flex: 1 1 auto;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
<ng-container *ngIf="this.field" class="main-multi-auto">
|
|
2
|
-
<div class="matField" (click)="this.filterLookupItems('', autocompleteTrigger)">
|
|
3
|
-
<mat-form-field class="full-width" appearance="outline" floatLabel="always">
|
|
4
|
-
<mat-label>{{ getLabel() }}</mat-label>
|
|
5
|
-
<mat-chip-listbox #chipList [selectable]="true">
|
|
6
|
-
<mat-chip
|
|
7
|
-
*ngFor="let item of selectedItems"
|
|
8
|
-
[removable]="true"
|
|
9
|
-
(removed)="remove(item)">
|
|
10
|
-
{{ itemNameByLag(item) }}
|
|
11
|
-
<mat-icon matChipRemove>cancel</mat-icon>
|
|
12
|
-
</mat-chip>
|
|
13
|
-
<input class="chip-input" type="text"
|
|
14
|
-
[id]="getId()" #itemInput
|
|
15
|
-
[formControl]="multiControl"
|
|
16
|
-
[matAutocomplete]="auto" matInput
|
|
17
|
-
[readonly]="readonly"
|
|
18
|
-
[required]="isRequired"
|
|
19
|
-
(keydown)="onKeydown($event, autocompleteTrigger)"
|
|
20
|
-
[disabled]="field.readonly"
|
|
21
|
-
#autocompleteTrigger="matAutocompleteTrigger"
|
|
22
|
-
>
|
|
23
|
-
</mat-chip-listbox>
|
|
24
|
-
|
|
25
|
-
<mat-icon class="arrow_drop_down_autocomplete">arrow_drop_down</mat-icon>
|
|
26
|
-
<mat-autocomplete #auto="matAutocomplete" autoActiveFirstOption [displayWith]="displayFn"
|
|
27
|
-
(optionSelected)="selected($event.option.value)">
|
|
28
|
-
<ng-container *ngIf="!field.readonly">
|
|
29
|
-
<mat-option *ngFor="let item of lookupItems$ | async" [value]="item"
|
|
30
|
-
[disabled]="field.readonly || isSelected(item)"
|
|
31
|
-
(click)="$event.stopPropagation(); autocompleteTrigger.openPanel()">
|
|
32
|
-
{{ itemNameByLag(item) }}
|
|
33
|
-
</mat-option>
|
|
34
|
-
</ng-container>
|
|
35
|
-
</mat-autocomplete>
|
|
36
|
-
</mat-form-field>
|
|
37
|
-
</div>
|
|
38
|
-
</ng-container>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { MultiAutoCompleteComponent } from './multi-auto-complete.component';
|
|
4
|
-
|
|
5
|
-
describe('MultiAutoCompleteComponent', () => {
|
|
6
|
-
let component: MultiAutoCompleteComponent;
|
|
7
|
-
let fixture: ComponentFixture<MultiAutoCompleteComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
imports: [MultiAutoCompleteComponent]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
|
|
15
|
-
fixture = TestBed.createComponent(MultiAutoCompleteComponent);
|
|
16
|
-
component = fixture.componentInstance;
|
|
17
|
-
fixture.detectChanges();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('should create', () => {
|
|
21
|
-
expect(component).toBeTruthy();
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1,315 +0,0 @@
|
|
|
1
|
-
import {Component, ElementRef, EventEmitter, Input, Output, SimpleChanges, ViewChild} from '@angular/core';
|
|
2
|
-
import {ALL_ITEM, LookupItem} from "../../base-model";
|
|
3
|
-
import {MatAutocomplete, MatAutocompleteTrigger, MatOption} from "@angular/material/autocomplete";
|
|
4
|
-
import {Observable, of} from "rxjs";
|
|
5
|
-
import {FieldInfo} from "../../base-model";
|
|
6
|
-
import {FormControl, FormGroup, ReactiveFormsModule, Validators} from "@angular/forms";
|
|
7
|
-
import {BackendService} from "../../services";
|
|
8
|
-
import {TranslateService} from "@ngx-translate/core";
|
|
9
|
-
import {GetItemsList} from "../../base-model/get-items-list";
|
|
10
|
-
import {MatFormField} from "@angular/material/form-field";
|
|
11
|
-
import {MatChip, MatChipGrid, MatChipInput, MatChipListbox} from "@angular/material/chips";
|
|
12
|
-
import {AsyncPipe, NgForOf, NgIf} from "@angular/common";
|
|
13
|
-
import {MatIcon} from "@angular/material/icon";
|
|
14
|
-
import {MatInput} from "@angular/material/input";
|
|
15
|
-
import { MatLabel } from '@angular/material/form-field';
|
|
16
|
-
import {buildItemsList} from "../../utils/base-utils";
|
|
17
|
-
import {FilterRequest} from "../../base-model";
|
|
18
|
-
import {Filter} from "../../base-model";
|
|
19
|
-
import {RequireMatch} from "../../validators";
|
|
20
|
-
import { MatChipsModule } from '@angular/material/chips';
|
|
21
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
@Component({
|
|
25
|
-
selector: 'app-multi-auto-complete',
|
|
26
|
-
standalone: true,
|
|
27
|
-
imports: [
|
|
28
|
-
MatFormField,
|
|
29
|
-
MatChip,
|
|
30
|
-
MatIconModule,
|
|
31
|
-
MatChipsModule,
|
|
32
|
-
NgForOf,
|
|
33
|
-
MatIcon,
|
|
34
|
-
ReactiveFormsModule,
|
|
35
|
-
MatAutocompleteTrigger,
|
|
36
|
-
MatChipInput,
|
|
37
|
-
MatInput,
|
|
38
|
-
MatAutocomplete,
|
|
39
|
-
MatOption,
|
|
40
|
-
AsyncPipe,
|
|
41
|
-
NgIf,
|
|
42
|
-
MatChipGrid,
|
|
43
|
-
MatChipListbox,
|
|
44
|
-
MatLabel
|
|
45
|
-
],
|
|
46
|
-
templateUrl: './multi-auto-complete.component.html',
|
|
47
|
-
styleUrl: './multi-auto-complete.component.css'
|
|
48
|
-
})
|
|
49
|
-
export class MultiAutoCompleteComponent {
|
|
50
|
-
// @ts-ignore
|
|
51
|
-
@ViewChild('itemInput') itemInput: ElementRef<HTMLInputElement>;
|
|
52
|
-
@ViewChild('autocompleteTrigger') matACTrigger: MatAutocompleteTrigger;
|
|
53
|
-
|
|
54
|
-
lookupItems$: Observable<LookupItem[]> | undefined;
|
|
55
|
-
private lookupItems: LookupItem[] = [];
|
|
56
|
-
|
|
57
|
-
selectedItems: LookupItem[] = [];
|
|
58
|
-
cascadedIdz: number[] = [];
|
|
59
|
-
isRequired: boolean= false;
|
|
60
|
-
private timer: any;
|
|
61
|
-
|
|
62
|
-
@Input()// @ts-ignore
|
|
63
|
-
field: FieldInfo;
|
|
64
|
-
//
|
|
65
|
-
@Input()// @ts-ignore
|
|
66
|
-
form: FormGroup;
|
|
67
|
-
|
|
68
|
-
@Input()// @ts-ignore
|
|
69
|
-
defaultValue: any;
|
|
70
|
-
|
|
71
|
-
@Input()
|
|
72
|
-
pathParam: any;
|
|
73
|
-
|
|
74
|
-
@Input()
|
|
75
|
-
readonly : boolean=false;
|
|
76
|
-
|
|
77
|
-
@Output()
|
|
78
|
-
selectedValue: EventEmitter<LookupItem[]> = new EventEmitter();
|
|
79
|
-
|
|
80
|
-
question = 'Would you like to add ?"';
|
|
81
|
-
|
|
82
|
-
multiControl = new FormControl();
|
|
83
|
-
|
|
84
|
-
constructor(private backendService: BackendService, private translateService: TranslateService) {
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
ngOnInit(): void {
|
|
88
|
-
// this.form = this.rootFormGroup.control;
|
|
89
|
-
this.selectedItems = [];
|
|
90
|
-
this.multiControl = new FormControl(this.form?.controls[this.field?.property]);
|
|
91
|
-
|
|
92
|
-
this.multiControl.enable();
|
|
93
|
-
this.updateFieldAttributes();
|
|
94
|
-
|
|
95
|
-
if (!this.field.acceptNewItem){
|
|
96
|
-
// @ts-ignore
|
|
97
|
-
this.multiControl.setValidators([RequireMatch]);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
this.multiControl.setValue(this.form?.controls[this.field?.property]?.value);
|
|
101
|
-
|
|
102
|
-
this.multiControl.valueChanges.subscribe( v => {
|
|
103
|
-
if (typeof v === 'string') {
|
|
104
|
-
clearTimeout(this.timer);
|
|
105
|
-
this.timer = setTimeout(() => {
|
|
106
|
-
this.filterLookupItems(v, null);}, 700);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
// this.multiControl.valueChanges.subscribe(v => {
|
|
112
|
-
// if (typeof v === 'string') this.filterLookupItems(v, null);
|
|
113
|
-
// })
|
|
114
|
-
// this.filterAutoCompleteData(this.field.property);
|
|
115
|
-
|
|
116
|
-
this.getLookupData();
|
|
117
|
-
if (this.field.cascadedBy) {
|
|
118
|
-
this.form?.get(this.field.cascadedBy)?.valueChanges.subscribe(v => {
|
|
119
|
-
this.removeChildItemsIfCascadedByRemoved(v);
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
private updateFieldAttributes() {
|
|
126
|
-
if (this.field.readonly) {
|
|
127
|
-
this.multiControl.disable();
|
|
128
|
-
this.isRequired = false;
|
|
129
|
-
} else if (this.field.required) {
|
|
130
|
-
this.form?.controls[this.field?.property].setValidators([Validators.required]);
|
|
131
|
-
this.form?.controls[this.field?.property].updateValueAndValidity();
|
|
132
|
-
this.multiControl.setValidators([Validators.required]);
|
|
133
|
-
this.isRequired = true;
|
|
134
|
-
}
|
|
135
|
-
this.multiControl.updateValueAndValidity();
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
private removeChildItemsIfCascadedByRemoved(v) {
|
|
139
|
-
this.cascadedIdz = [];
|
|
140
|
-
v.forEach(a => {
|
|
141
|
-
this.cascadedIdz.push(a.id);
|
|
142
|
-
});
|
|
143
|
-
let toDeleteIdz = [];
|
|
144
|
-
this.selectedItems?.forEach(x => {
|
|
145
|
-
const del = this.cascadedIdz.findIndex(y => y === x[this.field.cascadedBy]?.id);
|
|
146
|
-
if (del < 0) {
|
|
147
|
-
toDeleteIdz.push(x['id']);
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
if (toDeleteIdz) {
|
|
152
|
-
this.selectedItems = this.selectedItems.filter(s => !toDeleteIdz.includes(s.id));
|
|
153
|
-
this.form.get(this.field.property).patchValue(this.selectedItems, {emitEvent: true});
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
ngOnChanges({defaultValue, field}: SimpleChanges): void {
|
|
158
|
-
this.patchLookupValue(defaultValue?.currentValue);
|
|
159
|
-
if (field?.currentValue) {
|
|
160
|
-
this.field = field.currentValue;
|
|
161
|
-
this.updateFieldAttributes();
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
private getLookupData() {
|
|
166
|
-
const listItems: GetItemsList = buildItemsList('', this.field.lookupApiPath);
|
|
167
|
-
|
|
168
|
-
const filterRequest: FilterRequest = new FilterRequest();
|
|
169
|
-
filterRequest.filters = [];
|
|
170
|
-
this.cascadedIdz = [];
|
|
171
|
-
if (this.field.cascadedBy) {
|
|
172
|
-
this.form.get(this.field.cascadedBy)?.value?.forEach(a => {
|
|
173
|
-
this.cascadedIdz.push(a.id);
|
|
174
|
-
})
|
|
175
|
-
}
|
|
176
|
-
if (this.field.cascadedBy && this.cascadedIdz?.length > 0) {
|
|
177
|
-
filterRequest.filters.push(new Filter({
|
|
178
|
-
key: 'id', fieldName: this.field.cascadedBy, label: '',
|
|
179
|
-
filterType: 'FILED_FILTER', operator: 'IN',
|
|
180
|
-
valueObject: this.cascadedIdz
|
|
181
|
-
}));
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
filterRequest.columns = ['id','code','englishName','arabicName'];
|
|
185
|
-
this.backendService.getLookupItemsByMultiFilter(listItems, filterRequest).subscribe((resp => {
|
|
186
|
-
if (resp.valid) {
|
|
187
|
-
this.lookupItems = this.field.includeAllOption ? [ALL_ITEM].concat(resp.body) : resp.body;
|
|
188
|
-
if (!this.form.get('id')?.value) {
|
|
189
|
-
this.patchLookupValue(this.lookupItems?.find(l => l.defaultValue));
|
|
190
|
-
}
|
|
191
|
-
this.patchLookupValue(this.multiControl.value);
|
|
192
|
-
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
}));
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
selected(value: any): void {
|
|
200
|
-
if (value.id !== -1 && this.selectedItems.findIndex(i => i.id === value.id) === -1) {
|
|
201
|
-
this.selectedItems?.push(value);
|
|
202
|
-
this.itemInput.nativeElement.value = '';
|
|
203
|
-
this.form.get(this.field.property)?.setValue(this.selectedItems);
|
|
204
|
-
// @ts-ignore
|
|
205
|
-
this.selectedValue.emit(this.selectedItems);
|
|
206
|
-
this.multiControl.setValue(null);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
displayFn(selected: any): string {
|
|
211
|
-
return selected ? selected.englishName : undefined;
|
|
212
|
-
|
|
213
|
-
}
|
|
214
|
-
isSelected(item: any): boolean {
|
|
215
|
-
return this.selectedItems?.some(selected => selected.id === item.id); // Use your unique identifier
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
_allowSelection(option: LookupItem): { [className: string]: boolean } {
|
|
219
|
-
return {
|
|
220
|
-
'prevent-selection': option.id === -1,
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
itemNameByLag(item: any): string {
|
|
225
|
-
// return item.arabicName;
|
|
226
|
-
return this.translateService.getDefaultLang() === 'en' ? item.englishName : item.arabicName
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
private readonly _columns = ['id','code','englishName','arabicName'];
|
|
230
|
-
|
|
231
|
-
filterLookupItems(name: any, trigger: MatAutocompleteTrigger) {
|
|
232
|
-
if (trigger) {
|
|
233
|
-
trigger.openPanel();
|
|
234
|
-
}
|
|
235
|
-
if (name === undefined) {
|
|
236
|
-
name = '';
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
const listItems: GetItemsList = buildItemsList(name, this.field.lookupApiPath);
|
|
240
|
-
|
|
241
|
-
const filterRequest: FilterRequest = new FilterRequest();
|
|
242
|
-
filterRequest.filters = this.field.lookupFilterList || [];
|
|
243
|
-
filterRequest.searchStr = name;
|
|
244
|
-
this.cascadedIdz = [];
|
|
245
|
-
if (this.field.cascadedBy) {
|
|
246
|
-
this.form.get(this.field.cascadedBy)?.value?.forEach(a => {
|
|
247
|
-
this.cascadedIdz.push(a.id);
|
|
248
|
-
})
|
|
249
|
-
}
|
|
250
|
-
if (this.field.cascadedBy && this.cascadedIdz?.length > 0) {
|
|
251
|
-
filterRequest.filters.push(new Filter({
|
|
252
|
-
key: 'id',joinObjectName: this.field.cascadedBy, fieldName: this.field.cascadedBy, label: '',
|
|
253
|
-
filterType: 'FILED_FILTER', operator: 'IN',
|
|
254
|
-
valueObject: this.cascadedIdz
|
|
255
|
-
}));
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
filterRequest.columns = [...this._columns, ...(this.field.extraLookupsColumns ?? [])];
|
|
259
|
-
|
|
260
|
-
this.backendService.getLookupItemsByMultiFilter(listItems, filterRequest).subscribe(resp => {
|
|
261
|
-
// console.log('result -->', resp);
|
|
262
|
-
let items: LookupItem[] = [];
|
|
263
|
-
if (resp.valid) {
|
|
264
|
-
// resp.body.forEach(r => items.push(r));
|
|
265
|
-
items = resp.body.filter(item =>
|
|
266
|
-
// (item.englishName.toLowerCase().includes(name.toLowerCase()) ||
|
|
267
|
-
// item.arabicName.toLowerCase().includes(name.toLowerCase())) &&
|
|
268
|
-
this.selectedItems?.findIndex( i=> i.id ===item.id ) ===-1 );
|
|
269
|
-
if (!items?.length) {
|
|
270
|
-
this.field.acceptNewItem ?
|
|
271
|
-
items?.push(new LookupItem({id: -2, englishName: this.question + name, arabicName: this.question + name})):
|
|
272
|
-
items?.push(new LookupItem({id: -1, englishName: 'No match ...', arabicName: 'غير موجود ... '})) ;
|
|
273
|
-
|
|
274
|
-
}
|
|
275
|
-
} else {
|
|
276
|
-
this.field.acceptNewItem ?
|
|
277
|
-
items?.push(new LookupItem({id: -2, englishName: this.question + name, arabicName: this.question + name})):
|
|
278
|
-
items?.push(new LookupItem({id: -1, englishName: 'No match ...', arabicName: 'غير موجود ... '})) ;
|
|
279
|
-
}
|
|
280
|
-
this.lookupItems$ = of(items);
|
|
281
|
-
});
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
private patchLookupValue(defaultValue: any) {
|
|
286
|
-
if (defaultValue) {
|
|
287
|
-
// this.form?.get(this.field.property)?.patchValue(defaultValue);
|
|
288
|
-
this.selectedItems = defaultValue;
|
|
289
|
-
this.multiControl.setValue(defaultValue);
|
|
290
|
-
this.multiControl.patchValue(defaultValue, {emitEvent: true});
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
remove(item: LookupItem) {
|
|
295
|
-
const index = this.selectedItems.indexOf(item);
|
|
296
|
-
if (index >= 0) {
|
|
297
|
-
this.selectedItems.splice(index, 1);
|
|
298
|
-
this.form.get(this.field.property).patchValue(this.selectedItems, {emitEvent: true});
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
getLabel() {
|
|
303
|
-
return this.translateService.instant(this.field.label);
|
|
304
|
-
}
|
|
305
|
-
onKeydown(event: KeyboardEvent, autocompleteTrigger: MatAutocompleteTrigger) {
|
|
306
|
-
if (event.key === 'Enter') {
|
|
307
|
-
this.filterLookupItems('', autocompleteTrigger);
|
|
308
|
-
autocompleteTrigger.openPanel();
|
|
309
|
-
event.preventDefault();
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
getId() {
|
|
313
|
-
return this.field.property;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
.custom-paginator {
|
|
2
|
-
display: flex;
|
|
3
|
-
justify-content: space-between;
|
|
4
|
-
align-items: center;
|
|
5
|
-
padding: 4px 8px;
|
|
6
|
-
border: 1px solid #f0f0f0;
|
|
7
|
-
border-radius: 6px;
|
|
8
|
-
background: #fff;
|
|
9
|
-
font-size: 14px;
|
|
10
|
-
color: #555 !important;
|
|
11
|
-
gap: 16px;
|
|
12
|
-
margin-top: 4px;
|
|
13
|
-
|
|
14
|
-
.range-label {
|
|
15
|
-
color: #6b7280;
|
|
16
|
-
font-size: 13px;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.right-section {
|
|
20
|
-
display: flex;
|
|
21
|
-
align-items: center;
|
|
22
|
-
gap: 16px;
|
|
23
|
-
|
|
24
|
-
.rows-per-page {
|
|
25
|
-
display: flex;
|
|
26
|
-
align-items: center;
|
|
27
|
-
gap: 4px;
|
|
28
|
-
|
|
29
|
-
mat-select {
|
|
30
|
-
width: 60px;
|
|
31
|
-
font-size: 13px;
|
|
32
|
-
color: #555;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.nav-buttons {
|
|
37
|
-
display: flex;
|
|
38
|
-
align-items: center;
|
|
39
|
-
gap: 8px;
|
|
40
|
-
|
|
41
|
-
span {
|
|
42
|
-
min-width: 40px;
|
|
43
|
-
text-align: center;
|
|
44
|
-
font-size: 13px;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
button {
|
|
50
|
-
border: 1px solid #dbdbdb;
|
|
51
|
-
border-radius: 5px !important;
|
|
52
|
-
width: 28px;
|
|
53
|
-
height: 28px;
|
|
54
|
-
padding: 0 !important;
|
|
55
|
-
font-size: 18px;
|
|
56
|
-
|
|
57
|
-
&.active-chevron mat-icon {
|
|
58
|
-
color: var(--primary-color) ;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
&.disabled-chevron mat-icon {
|
|
62
|
-
color: #555;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
<div class="custom-paginator" [dir]="currentDirection">
|
|
2
|
-
<span class="range-label">
|
|
3
|
-
{{ (currentPage - 1) * pageSize + 1 }} -
|
|
4
|
-
{{ Math.min(currentPage * pageSize, totalItems) }}
|
|
5
|
-
{{'PAGINATION.of' | translate}} {{ totalItems }}
|
|
6
|
-
</span>
|
|
7
|
-
|
|
8
|
-
<div class="right-section">
|
|
9
|
-
<div class="rows-per-page">
|
|
10
|
-
{{'PAGINATION.rowsPerPage' | translate}}:
|
|
11
|
-
<mat-select [(value)]="pageSize" (selectionChange)="onPageSizeChange($event.value)">
|
|
12
|
-
<mat-option *ngFor="let size of pageSizeOptions" [value]="size">{{ size }}</mat-option>
|
|
13
|
-
</mat-select>
|
|
14
|
-
</div>
|
|
15
|
-
|
|
16
|
-
<div class="nav-buttons">
|
|
17
|
-
<button mat-icon-button (click)="previousPage()" [disabled]="currentPage === 1" id="paginator-prev-btn">
|
|
18
|
-
<mat-icon>{{ currentDirection === 'rtl' ? 'chevron_right' : 'chevron_left' }}</mat-icon>
|
|
19
|
-
</button>
|
|
20
|
-
<span><span style="color: var(--primary-color)">{{ currentPage }}</span> / {{ totalPages }}</span>
|
|
21
|
-
<button mat-icon-button
|
|
22
|
-
(click)="nextPage()"
|
|
23
|
-
[disabled]="currentPage === totalPages"
|
|
24
|
-
[ngClass]="{'active-chevron': currentPage !== totalPages, 'disabled-chevron': currentPage === totalPages}"
|
|
25
|
-
id="paginator-next-btn">
|
|
26
|
-
<mat-icon>{{ currentDirection === 'rtl' ? 'chevron_left' : 'chevron_right' }}</mat-icon>
|
|
27
|
-
</button>
|
|
28
|
-
</div>
|
|
29
|
-
</div>
|
|
30
|
-
</div>
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { Component, Input, Output, EventEmitter, OnInit, OnChanges } from '@angular/core';
|
|
2
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
3
|
-
import { MatButtonModule } from '@angular/material/button';
|
|
4
|
-
import {NgIf, NgForOf, NgClass} from '@angular/common';
|
|
5
|
-
import { Directionality } from '@angular/cdk/bidi';
|
|
6
|
-
import { MatOption, MatSelect } from '@angular/material/select';
|
|
7
|
-
import {TranslateModule} from "@ngx-translate/core";
|
|
8
|
-
|
|
9
|
-
@Component({
|
|
10
|
-
selector: 'app-paginator',
|
|
11
|
-
templateUrl: './paginator.component.html',
|
|
12
|
-
styleUrls: ['./paginator.component.css'],
|
|
13
|
-
standalone: true,
|
|
14
|
-
imports: [MatIconModule, MatButtonModule, NgIf, NgForOf, MatSelect, MatOption, NgClass, TranslateModule],
|
|
15
|
-
})
|
|
16
|
-
export class PaginatorComponent implements OnInit, OnChanges {
|
|
17
|
-
@Input() currentPage = 1;
|
|
18
|
-
@Input() totalItems = 0;
|
|
19
|
-
@Input() pageSize = 10;
|
|
20
|
-
@Input() pageSizeOptions: number[] = [5, 10, 25, 50];
|
|
21
|
-
|
|
22
|
-
@Output() pageChange = new EventEmitter<number>();
|
|
23
|
-
@Output() pageSizeChange = new EventEmitter<number>();
|
|
24
|
-
|
|
25
|
-
currentDirection: 'ltr' | 'rtl' = 'ltr';
|
|
26
|
-
|
|
27
|
-
constructor(private directionality: Directionality) {}
|
|
28
|
-
|
|
29
|
-
ngOnInit() {
|
|
30
|
-
this.currentDirection = this.directionality.value;
|
|
31
|
-
this.directionality.change?.subscribe((value) => {
|
|
32
|
-
this.currentDirection = value;
|
|
33
|
-
});
|
|
34
|
-
if (!this.pageSizeOptions.includes(this.pageSize)) {
|
|
35
|
-
Promise.resolve().then(() => {
|
|
36
|
-
this.pageSize = this.pageSizeOptions[1];
|
|
37
|
-
this.pageSizeChange.emit(this.pageSize);
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
ngOnChanges() {
|
|
43
|
-
if (this.currentPage > this.totalPages) {
|
|
44
|
-
this.currentPage = this.totalPages || 1;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
get totalPages(): number {
|
|
49
|
-
return Math.ceil(this.totalItems / this.pageSize);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
get startIndex(): number {
|
|
53
|
-
return this.totalItems === 0 ? 0 : (this.currentPage - 1) * this.pageSize + 1;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
get endIndex(): number {
|
|
57
|
-
return Math.min(this.currentPage * this.pageSize, this.totalItems);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
goToPage(page: number) {
|
|
61
|
-
if (page >= 1 && page <= this.totalPages) {
|
|
62
|
-
this.currentPage = page;
|
|
63
|
-
this.pageChange.emit(this.currentPage);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
nextPage() {
|
|
68
|
-
if (this.currentPage < this.totalPages) {
|
|
69
|
-
this.goToPage(this.currentPage + 1);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
previousPage() {
|
|
74
|
-
if (this.currentPage > 1) {
|
|
75
|
-
this.goToPage(this.currentPage - 1);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
onPageSizeChange(size: number) {
|
|
80
|
-
this.pageSize = size;
|
|
81
|
-
this.currentPage = 1;
|
|
82
|
-
this.pageSizeChange.emit(this.pageSize);
|
|
83
|
-
this.pageChange.emit(this.currentPage);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
protected readonly Math = Math;
|
|
87
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
::ng-deep .mat-dialog-actions {
|
|
2
|
-
justify-content: flex-end !important;
|
|
3
|
-
}
|
|
4
|
-
.close-button {
|
|
5
|
-
position: absolute;
|
|
6
|
-
right: 8px;
|
|
7
|
-
top: 8px;
|
|
8
|
-
z-index: 10;
|
|
9
|
-
background-color: white;
|
|
10
|
-
border-radius: 50%;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
:host-context([dir="rtl"]) .close-button {
|
|
14
|
-
right: auto;
|
|
15
|
-
left: 8px;
|
|
16
|
-
}
|
|
17
|
-
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<mat-dialog-content style="max-height: 70vh; overflow: auto; position: relative;">
|
|
2
|
-
<button mat-icon-button class="close-button" (click)="cancel()" [attr.dir]="dialogDirection" id="report-details-close-btn">
|
|
3
|
-
<mat-icon>close</mat-icon>
|
|
4
|
-
</button>
|
|
5
|
-
|
|
6
|
-
<h1 mat-dialog-title [innerHTML]="getTitle()"></h1>
|
|
7
|
-
|
|
8
|
-
<app-base-table
|
|
9
|
-
[pageInfo]="pageInfo"
|
|
10
|
-
[columns]="columns"
|
|
11
|
-
id="junior"
|
|
12
|
-
[enforceRefresh]="true"
|
|
13
|
-
[reportRequest]="reportRequest">
|
|
14
|
-
</app-base-table>
|
|
15
|
-
</mat-dialog-content>
|
|
16
|
-
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { ReportDetailsDialogComponent } from './report-details-dialog.component';
|
|
4
|
-
|
|
5
|
-
describe('ActionCommentComponent', () => {
|
|
6
|
-
let component: ReportDetailsDialogComponent;
|
|
7
|
-
let fixture: ComponentFixture<ReportDetailsDialogComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
imports: [ReportDetailsDialogComponent]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
|
|
15
|
-
fixture = TestBed.createComponent(ReportDetailsDialogComponent);
|
|
16
|
-
component = fixture.componentInstance;
|
|
17
|
-
fixture.detectChanges();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('should create', () => {
|
|
21
|
-
expect(component).toBeTruthy();
|
|
22
|
-
});
|
|
23
|
-
});
|