@unipin/angular-applet 18.9.5 → 18.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -11
- package/esm2022/graphql/generated.mjs +938 -0
- package/esm2022/lib/components/approval/detail/approval-detail.component.mjs +78 -0
- package/esm2022/lib/components/approval/form/approval-form.component.mjs +128 -0
- package/esm2022/lib/components/approval/index.mjs +5 -0
- package/esm2022/lib/components/approval/list/approval-list.component.mjs +114 -0
- package/esm2022/lib/components/approval/list/provide-approval-entities.util.mjs +9 -0
- package/esm2022/lib/components/approval/services/approval.service.mjs +46 -0
- package/esm2022/lib/components/audit/detail/audit-detail.component.mjs +123 -0
- package/esm2022/lib/components/audit/index.mjs +3 -0
- package/esm2022/lib/components/audit/list/audit-list.component.mjs +81 -0
- package/esm2022/lib/components/audit/service/audit.service.mjs +49 -0
- package/esm2022/lib/components/audit/types/audit-detail-form.type.mjs +2 -0
- package/esm2022/lib/components/buttons/group/btn-group.component.mjs +43 -0
- package/esm2022/lib/components/buttons/group/interfaces/btn-group-config.interface.mjs +2 -0
- package/esm2022/lib/components/buttons/index.mjs +3 -0
- package/esm2022/lib/components/buttons/loading/btn-loading.component.mjs +48 -0
- package/esm2022/lib/components/containers/applet-container/applet-container.component.mjs +55 -0
- package/esm2022/lib/components/containers/applet-container/provide-applet-config.util.mjs +9 -0
- package/esm2022/lib/components/containers/colum-header-container/column-header-container.component.mjs +23 -0
- package/esm2022/lib/components/containers/column-container/column-container.component.mjs +79 -0
- package/esm2022/lib/components/containers/column-container/directives/lazy-route.directive.mjs +57 -0
- package/esm2022/lib/components/containers/index.mjs +7 -0
- package/esm2022/lib/components/containers/list-container/index.mjs +3 -0
- package/esm2022/lib/components/containers/list-container/interfaces/list-container-config.interface.mjs +2 -0
- package/esm2022/lib/components/containers/list-container/list-pagination-container/list-pagination-container.component.mjs +58 -0
- package/esm2022/lib/components/containers/list-container/list-snapshot-container/list-snapshot-container.component.mjs +57 -0
- package/esm2022/lib/components/containers/modal-container/modal-container.component.mjs +40 -0
- package/esm2022/lib/components/filter/filter.component.mjs +222 -0
- package/esm2022/lib/components/filter/index.mjs +2 -0
- package/esm2022/lib/components/filter/interfaces/filter-config.interface.mjs +2 -0
- package/esm2022/lib/components/filter/interfaces/filter-field.interface.mjs +2 -0
- package/esm2022/lib/components/filter/interfaces/filter-search-event.interface.mjs +2 -0
- package/esm2022/lib/components/forms/country-input/form-country-input.component.mjs +122 -0
- package/esm2022/lib/components/forms/currency-input/form-currency-input.component.mjs +157 -0
- package/esm2022/lib/components/forms/date/form-date.component.mjs +117 -0
- package/esm2022/lib/components/forms/image-picker/directives/drag-n-drop.directive.mjs +49 -0
- package/esm2022/lib/components/forms/image-picker/form-image-picker.component.mjs +68 -0
- package/esm2022/lib/components/forms/index.mjs +12 -0
- package/esm2022/lib/components/forms/input/form-input.component.mjs +98 -0
- package/esm2022/lib/components/forms/number/form-number.component.mjs +97 -0
- package/esm2022/lib/components/forms/number/pipes/locale-number.pipe.mjs +33 -0
- package/esm2022/lib/components/forms/password/form-password.component.mjs +100 -0
- package/esm2022/lib/components/forms/rate-group-code-input/form-rate-group-code-input.component.mjs +135 -0
- package/esm2022/lib/components/forms/searchable-select/form-searchable-select.component.mjs +138 -0
- package/esm2022/lib/components/forms/select/form-select.component.mjs +119 -0
- package/esm2022/lib/components/forms/textarea/form-textarea.component.mjs +88 -0
- package/esm2022/lib/components/grids/grid-pagination/grid-pagination.component.mjs +111 -0
- package/esm2022/lib/components/grids/grid-snapshot/grid-snapshot.component.mjs +109 -0
- package/esm2022/lib/components/grids/index.mjs +4 -0
- package/esm2022/lib/components/grids/interfaces/grid-config.interface.mjs +2 -0
- package/esm2022/lib/components/grids/services/grid.service.mjs +25 -0
- package/esm2022/lib/components/index.mjs +9 -0
- package/esm2022/lib/components/infinite-scroll/directive/infinite-scroll.directive.mjs +43 -0
- package/esm2022/lib/components/infinite-scroll/index.mjs +3 -0
- package/esm2022/lib/components/infinite-scroll/infinite-scroll.component.mjs +36 -0
- package/esm2022/lib/components/tabs/index.mjs +3 -0
- package/esm2022/lib/components/tabs/tab-content/tab-content.component.mjs +37 -0
- package/esm2022/lib/components/tabs/tab-group/tab-group.component.mjs +47 -0
- package/esm2022/lib/guards/auth/auth.guard.mjs +10 -0
- package/esm2022/lib/guards/index.mjs +2 -0
- package/esm2022/lib/interceptors/header/header.interceptor.mjs +29 -0
- package/esm2022/lib/interceptors/index.mjs +3 -0
- package/esm2022/lib/interceptors/refresh-token/refresh-token.interceptor.mjs +83 -0
- package/esm2022/lib/interfaces/index.mjs +2 -0
- package/esm2022/lib/interfaces/user/user.interface.mjs +2 -0
- package/esm2022/lib/modules/index.mjs +3 -0
- package/esm2022/lib/modules/micro-frontend/index.mjs +2 -0
- package/esm2022/lib/modules/micro-frontend/utils/mf-bootstrap.util.mjs +55 -0
- package/esm2022/lib/modules/micro-frontend/utils/mf-global-state.util.mjs +14 -0
- package/esm2022/lib/modules/permission/directive/permission.directive.mjs +41 -0
- package/esm2022/lib/modules/permission/guards/permission.guard.mjs +26 -0
- package/esm2022/lib/modules/permission/index.mjs +7 -0
- package/esm2022/lib/modules/permission/pages/401/unauthorized.page.mjs +15 -0
- package/esm2022/lib/modules/permission/pages/loading/loading.page.mjs +65 -0
- package/esm2022/lib/modules/permission/pages/loading/provide-loading-config.util.mjs +9 -0
- package/esm2022/lib/modules/permission/services/permission.service.mjs +50 -0
- package/esm2022/lib/resolvers/auth/auth.resolver.mjs +87 -0
- package/esm2022/lib/resolvers/index.mjs +2 -0
- package/esm2022/lib/services/auth/auth.service.mjs +171 -0
- package/esm2022/lib/services/country/country.service.mjs +43 -0
- package/esm2022/lib/services/currency/currency.service.mjs +40 -0
- package/esm2022/lib/services/index.mjs +6 -0
- package/esm2022/lib/services/profile/profile.service.mjs +82 -0
- package/esm2022/lib/services/rate-group-code/rate-group-code.service.mjs +31 -0
- package/esm2022/lib/utils/contrast-color-generator/contrast-color-generator.util.mjs +16 -0
- package/esm2022/lib/utils/form-error-message/form-error-message.util.mjs +21 -0
- package/esm2022/lib/utils/format-capitalize/format-capitalize.util.mjs +18 -0
- package/esm2022/lib/utils/index.mjs +5 -0
- package/esm2022/lib/utils/redirect-to-first-menu/redirect-to-first-menu.util.mjs +9 -0
- package/esm2022/public-api.mjs +10 -0
- package/esm2022/unipin-angular-applet.mjs +2 -0
- package/fesm2022/unipin-angular-applet.mjs +4620 -0
- package/fesm2022/unipin-angular-applet.mjs.map +1 -0
- package/graphql/generated.d.ts +16225 -0
- package/index.d.ts +2 -0
- package/lib/components/approval/detail/approval-detail.component.d.ts +26 -0
- package/lib/components/approval/form/approval-form.component.d.ts +33 -0
- package/{projects/unipin-angular/src/lib/components/approval/index.ts → lib/components/approval/index.d.ts} +0 -1
- package/lib/components/approval/list/approval-list.component.d.ts +33 -0
- package/lib/components/approval/list/provide-approval-entities.util.d.ts +3 -0
- package/lib/components/approval/services/approval.service.d.ts +18 -0
- package/lib/components/audit/detail/audit-detail.component.d.ts +33 -0
- package/lib/components/audit/list/audit-list.component.d.ts +31 -0
- package/lib/components/audit/service/audit.service.d.ts +15 -0
- package/lib/components/audit/types/audit-detail-form.type.d.ts +12 -0
- package/lib/components/buttons/group/btn-group.component.d.ts +18 -0
- package/lib/components/buttons/group/interfaces/btn-group-config.interface.d.ts +11 -0
- package/lib/components/buttons/loading/btn-loading.component.d.ts +19 -0
- package/lib/components/containers/applet-container/applet-container.component.d.ts +22 -0
- package/lib/components/containers/applet-container/provide-applet-config.util.d.ts +15 -0
- package/lib/components/containers/colum-header-container/column-header-container.component.d.ts +7 -0
- package/lib/components/containers/column-container/column-container.component.d.ts +26 -0
- package/lib/components/containers/column-container/directives/lazy-route.directive.d.ts +17 -0
- package/{projects/unipin-angular/src/lib/components/containers/index.ts → lib/components/containers/index.d.ts} +0 -1
- package/{projects/unipin-angular/src/lib/components/containers/list-container/interfaces/list-container-config.interface.ts → lib/components/containers/list-container/interfaces/list-container-config.interface.d.ts} +4 -5
- package/lib/components/containers/list-container/list-pagination-container/list-pagination-container.component.d.ts +23 -0
- package/lib/components/containers/list-container/list-snapshot-container/list-snapshot-container.component.d.ts +23 -0
- package/lib/components/containers/modal-container/modal-container.component.d.ts +16 -0
- package/lib/components/filter/filter.component.d.ts +44 -0
- package/{projects/unipin-angular/src/lib/components/filter/index.ts → lib/components/filter/index.d.ts} +1 -1
- package/lib/components/filter/interfaces/filter-config.interface.d.ts +5 -0
- package/lib/components/filter/interfaces/filter-field.interface.d.ts +24 -0
- package/lib/components/filter/interfaces/filter-search-event.interface.d.ts +4 -0
- package/lib/components/forms/country-input/form-country-input.component.d.ts +41 -0
- package/lib/components/forms/currency-input/form-currency-input.component.d.ts +52 -0
- package/lib/components/forms/date/form-date.component.d.ts +33 -0
- package/lib/components/forms/image-picker/directives/drag-n-drop.directive.d.ts +10 -0
- package/lib/components/forms/image-picker/form-image-picker.component.d.ts +21 -0
- package/lib/components/forms/input/form-input.component.d.ts +31 -0
- package/lib/components/forms/number/form-number.component.d.ts +27 -0
- package/lib/components/forms/number/pipes/locale-number.pipe.d.ts +8 -0
- package/lib/components/forms/password/form-password.component.d.ts +27 -0
- package/lib/components/forms/rate-group-code-input/form-rate-group-code-input.component.d.ts +41 -0
- package/lib/components/forms/searchable-select/form-searchable-select.component.d.ts +42 -0
- package/lib/components/forms/select/form-select.component.d.ts +34 -0
- package/lib/components/forms/textarea/form-textarea.component.d.ts +26 -0
- package/lib/components/grids/grid-pagination/grid-pagination.component.d.ts +33 -0
- package/lib/components/grids/grid-snapshot/grid-snapshot.component.d.ts +36 -0
- package/lib/components/grids/interfaces/grid-config.interface.d.ts +16 -0
- package/lib/components/grids/services/grid.service.d.ts +12 -0
- package/{projects/unipin-angular/src/lib/components/index.ts → lib/components/index.d.ts} +2 -14
- package/lib/components/infinite-scroll/directive/infinite-scroll.directive.d.ts +15 -0
- package/lib/components/infinite-scroll/infinite-scroll.component.d.ts +12 -0
- package/{projects/unipin-angular/src/lib/components/tabs/index.ts → lib/components/tabs/index.d.ts} +2 -3
- package/lib/components/tabs/tab-content/tab-content.component.d.ts +14 -0
- package/lib/components/tabs/tab-group/tab-group.component.d.ts +18 -0
- package/lib/guards/auth/auth.guard.d.ts +1 -0
- package/lib/interceptors/header/header.interceptor.d.ts +9 -0
- package/lib/interceptors/refresh-token/refresh-token.interceptor.d.ts +14 -0
- package/lib/interfaces/user/user.interface.d.ts +27 -0
- package/lib/modules/index.d.ts +2 -0
- package/lib/modules/micro-frontend/utils/mf-bootstrap.util.d.ts +9 -0
- package/lib/modules/micro-frontend/utils/mf-global-state.util.d.ts +4 -0
- package/lib/modules/permission/directive/permission.directive.d.ts +16 -0
- package/lib/modules/permission/guards/permission.guard.d.ts +2 -0
- package/{projects/unipin-angular/src/lib/modules/permission/index.ts → lib/modules/permission/index.d.ts} +0 -1
- package/lib/modules/permission/pages/401/unauthorized.page.d.ts +5 -0
- package/lib/modules/permission/pages/loading/loading.page.d.ts +18 -0
- package/lib/modules/permission/pages/loading/provide-loading-config.util.d.ts +10 -0
- package/lib/modules/permission/services/permission.service.d.ts +21 -0
- package/lib/resolvers/auth/auth.resolver.d.ts +14 -0
- package/lib/services/auth/auth.service.d.ts +39 -0
- package/lib/services/country/country.service.d.ts +16 -0
- package/lib/services/currency/currency.service.d.ts +16 -0
- package/lib/services/profile/profile.service.d.ts +12 -0
- package/lib/services/rate-group-code/rate-group-code.service.d.ts +14 -0
- package/lib/utils/contrast-color-generator/contrast-color-generator.util.d.ts +4 -0
- package/lib/utils/form-error-message/form-error-message.util.d.ts +2 -0
- package/lib/utils/format-capitalize/format-capitalize.util.d.ts +1 -0
- package/lib/utils/redirect-to-first-menu/redirect-to-first-menu.util.d.ts +2 -0
- package/package.json +38 -86
- package/public-api.d.ts +11 -0
- package/.editorconfig +0 -16
- package/.eslintrc.json +0 -72
- package/.github/ISSUE_TEMPLATE/bug_fix.yml +0 -60
- package/.github/ISSUE_TEMPLATE/dependency_update.yml +0 -20
- package/.github/ISSUE_TEMPLATE/documentation.yml +0 -13
- package/.github/ISSUE_TEMPLATE/engineering.yml +0 -22
- package/.github/ISSUE_TEMPLATE/feature_request.yml +0 -38
- package/.github/ISSUE_TEMPLATE/testing.yml +0 -38
- package/.github/dependabot.yml +0 -11
- package/.github/pull_request_template.md +0 -77
- package/.github/workflows/npm_publish.yml +0 -52
- package/.storybook/main.ts +0 -28
- package/.storybook/preview.ts +0 -19
- package/.storybook/test-runner.ts +0 -29
- package/.storybook/tsconfig.json +0 -14
- package/.storybook/typings.d.ts +0 -4
- package/.vscode/extensions.json +0 -7
- package/.vscode/launch.json +0 -20
- package/.vscode/settings.json +0 -16
- package/.vscode/tasks.json +0 -42
- package/angular.json +0 -102
- package/codegen.yml +0 -8
- package/projects/unipin-angular/README.md +0 -24
- package/projects/unipin-angular/documentation.json +0 -116258
- package/projects/unipin-angular/ng-package.json +0 -19
- package/projects/unipin-angular/package-lock.json +0 -23
- package/projects/unipin-angular/package.json +0 -32
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_accordion.scss +0 -149
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_alert.scss +0 -71
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_badge.scss +0 -38
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_breadcrumb.scss +0 -40
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_button-group.scss +0 -142
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_buttons.scss +0 -209
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_card.scss +0 -234
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_carousel.scss +0 -226
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_close.scss +0 -40
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_containers.scss +0 -41
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_dropdown.scss +0 -249
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_forms.scss +0 -9
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_functions.scss +0 -302
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_grid.scss +0 -33
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_helpers.scss +0 -10
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_images.scss +0 -42
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_list-group.scss +0 -192
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_maps.scss +0 -54
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_mixins.scss +0 -43
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_modal.scss +0 -237
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_nav.scss +0 -172
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_navbar.scss +0 -278
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_offcanvas.scss +0 -144
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_pagination.scss +0 -109
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_placeholders.scss +0 -51
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_popover.scss +0 -196
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_progress.scss +0 -59
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_reboot.scss +0 -610
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_root.scss +0 -73
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_spinners.scss +0 -85
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_tables.scss +0 -164
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_toasts.scss +0 -73
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_tooltip.scss +0 -120
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_transitions.scss +0 -27
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_type.scss +0 -106
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_utilities.scss +0 -647
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/_variables.scss +0 -1634
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/bootstrap-grid.scss +0 -64
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/bootstrap-reboot.scss +0 -9
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/bootstrap-utilities.scss +0 -18
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/bootstrap.scss +0 -24
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/forms/_floating-labels.scss +0 -75
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/forms/_form-check.scss +0 -175
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/forms/_form-control.scss +0 -195
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/forms/_form-range.scss +0 -91
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/forms/_form-select.scss +0 -71
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/forms/_form-text.scss +0 -11
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/forms/_input-group.scss +0 -132
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/forms/_labels.scss +0 -36
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/forms/_validation.scss +0 -12
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/helpers/_clearfix.scss +0 -3
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/helpers/_color-bg.scss +0 -10
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/helpers/_colored-links.scss +0 -12
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/helpers/_position.scss +0 -36
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/helpers/_ratio.scss +0 -26
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/helpers/_stacks.scss +0 -15
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/helpers/_stretched-link.scss +0 -15
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/helpers/_text-truncation.scss +0 -7
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/helpers/_visually-hidden.scss +0 -8
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/helpers/_vr.scss +0 -8
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_alert.scss +0 -15
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_backdrop.scss +0 -14
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_banner.scss +0 -9
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_border-radius.scss +0 -78
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_box-shadow.scss +0 -18
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_breakpoints.scss +0 -127
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_buttons.scss +0 -70
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_caret.scss +0 -64
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_clearfix.scss +0 -9
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_color-scheme.scss +0 -7
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_container.scss +0 -11
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_deprecate.scss +0 -10
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_forms.scss +0 -152
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_gradients.scss +0 -47
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_grid.scss +0 -151
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_image.scss +0 -16
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_list-group.scss +0 -24
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_lists.scss +0 -7
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_pagination.scss +0 -10
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_reset-text.scss +0 -17
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_resize.scss +0 -6
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_table-variants.scss +0 -24
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_text-truncate.scss +0 -8
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_transition.scss +0 -26
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_utilities.scss +0 -97
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/mixins/_visually-hidden.scss +0 -29
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/utilities/_api.scss +0 -47
- package/projects/unipin-angular/src/assets/private/scss/bootstrap/vendor/_rfs.scss +0 -354
- package/projects/unipin-angular/src/assets/private/scss/theme/variables.scss +0 -59
- package/projects/unipin-angular/src/graphql/generated.d.ts +0 -715
- package/projects/unipin-angular/src/graphql/generated.mjs +0 -49
- package/projects/unipin-angular/src/graphql/generated.ts +0 -19998
- package/projects/unipin-angular/src/lib/components/approval/detail/approval-detail.component.html +0 -14
- package/projects/unipin-angular/src/lib/components/approval/detail/approval-detail.component.scss +0 -0
- package/projects/unipin-angular/src/lib/components/approval/detail/approval-detail.component.ts +0 -90
- package/projects/unipin-angular/src/lib/components/approval/detail/approval-detail.stories.ts +0 -61
- package/projects/unipin-angular/src/lib/components/approval/form/approval-form.component.html +0 -41
- package/projects/unipin-angular/src/lib/components/approval/form/approval-form.component.scss +0 -0
- package/projects/unipin-angular/src/lib/components/approval/form/approval-form.component.ts +0 -152
- package/projects/unipin-angular/src/lib/components/approval/form/approval-form.stories.ts +0 -111
- package/projects/unipin-angular/src/lib/components/approval/list/approval-list.component.html +0 -15
- package/projects/unipin-angular/src/lib/components/approval/list/approval-list.component.scss +0 -0
- package/projects/unipin-angular/src/lib/components/approval/list/approval-list.component.ts +0 -136
- package/projects/unipin-angular/src/lib/components/approval/list/approval-list.stories.ts +0 -141
- package/projects/unipin-angular/src/lib/components/approval/list/provide-approval-entities.util.ts +0 -10
- package/projects/unipin-angular/src/lib/components/approval/services/approval.service.ts +0 -46
- package/projects/unipin-angular/src/lib/components/audit/detail/audit-detail.component.html +0 -50
- package/projects/unipin-angular/src/lib/components/audit/detail/audit-detail.component.scss +0 -4
- package/projects/unipin-angular/src/lib/components/audit/detail/audit-detail.component.spec.ts +0 -51
- package/projects/unipin-angular/src/lib/components/audit/detail/audit-detail.component.ts +0 -141
- package/projects/unipin-angular/src/lib/components/audit/detail/audit-detail.stories.ts +0 -126
- package/projects/unipin-angular/src/lib/components/audit/list/audit-list.component.html +0 -5
- package/projects/unipin-angular/src/lib/components/audit/list/audit-list.component.scss +0 -0
- package/projects/unipin-angular/src/lib/components/audit/list/audit-list.component.ts +0 -85
- package/projects/unipin-angular/src/lib/components/audit/list/audit-list.stories.ts +0 -170
- package/projects/unipin-angular/src/lib/components/audit/service/audit.service.ts +0 -48
- package/projects/unipin-angular/src/lib/components/audit/types/audit-detail-form.type.ts +0 -13
- package/projects/unipin-angular/src/lib/components/buttons/group/btn-group.component.html +0 -42
- package/projects/unipin-angular/src/lib/components/buttons/group/btn-group.component.scss +0 -19
- package/projects/unipin-angular/src/lib/components/buttons/group/btn-group.component.ts +0 -72
- package/projects/unipin-angular/src/lib/components/buttons/group/btn-group.stories.ts +0 -132
- package/projects/unipin-angular/src/lib/components/buttons/group/interfaces/btn-group-config.interface.ts +0 -63
- package/projects/unipin-angular/src/lib/components/buttons/loading/btn-loading.component.html +0 -9
- package/projects/unipin-angular/src/lib/components/buttons/loading/btn-loading.component.scss +0 -8
- package/projects/unipin-angular/src/lib/components/buttons/loading/btn-loading.component.ts +0 -87
- package/projects/unipin-angular/src/lib/components/buttons/loading/btn-loading.stories.ts +0 -188
- package/projects/unipin-angular/src/lib/components/containers/applet-container/applet-container.component.html +0 -39
- package/projects/unipin-angular/src/lib/components/containers/applet-container/applet-container.component.scss +0 -68
- package/projects/unipin-angular/src/lib/components/containers/applet-container/applet-container.component.ts +0 -98
- package/projects/unipin-angular/src/lib/components/containers/applet-container/provide-applet-config.util.ts +0 -23
- package/projects/unipin-angular/src/lib/components/containers/colum-header-container/column-header-container.component.html +0 -17
- package/projects/unipin-angular/src/lib/components/containers/colum-header-container/column-header-container.component.scss +0 -4
- package/projects/unipin-angular/src/lib/components/containers/colum-header-container/column-header-container.component.ts +0 -32
- package/projects/unipin-angular/src/lib/components/containers/colum-header-container/column-header.stories.ts +0 -77
- package/projects/unipin-angular/src/lib/components/containers/column-container/column-container.component.html +0 -17
- package/projects/unipin-angular/src/lib/components/containers/column-container/column-container.component.scss +0 -0
- package/projects/unipin-angular/src/lib/components/containers/column-container/column-container.component.ts +0 -139
- package/projects/unipin-angular/src/lib/components/containers/column-container/directives/lazy-route.directive.ts +0 -86
- package/projects/unipin-angular/src/lib/components/containers/list-container/list-pagination-container/list-pagination-container.component.html +0 -19
- package/projects/unipin-angular/src/lib/components/containers/list-container/list-pagination-container/list-pagination-container.component.scss +0 -7
- package/projects/unipin-angular/src/lib/components/containers/list-container/list-pagination-container/list-pagination-container.component.ts +0 -113
- package/projects/unipin-angular/src/lib/components/containers/list-container/list-pagination-container/list-pagination-container.stories.ts +0 -207
- package/projects/unipin-angular/src/lib/components/containers/list-container/list-snapshot-container/list-snapshot-container.component.html +0 -19
- package/projects/unipin-angular/src/lib/components/containers/list-container/list-snapshot-container/list-snapshot-container.component.scss +0 -7
- package/projects/unipin-angular/src/lib/components/containers/list-container/list-snapshot-container/list-snapshot-container.component.ts +0 -114
- package/projects/unipin-angular/src/lib/components/containers/list-container/list-snapshot-container/list-snapshot-container.stories.ts +0 -212
- package/projects/unipin-angular/src/lib/components/containers/modal-container/modal-container.component.html +0 -15
- package/projects/unipin-angular/src/lib/components/containers/modal-container/modal-container.component.scss +0 -2
- package/projects/unipin-angular/src/lib/components/containers/modal-container/modal-container.component.ts +0 -88
- package/projects/unipin-angular/src/lib/components/containers/modal-container/modal-container.stories.ts +0 -66
- package/projects/unipin-angular/src/lib/components/filter/filter.component.html +0 -113
- package/projects/unipin-angular/src/lib/components/filter/filter.component.scss +0 -28
- package/projects/unipin-angular/src/lib/components/filter/filter.component.ts +0 -329
- package/projects/unipin-angular/src/lib/components/filter/filter.stories.ts +0 -176
- package/projects/unipin-angular/src/lib/components/filter/interfaces/filter-config.interface.ts +0 -17
- package/projects/unipin-angular/src/lib/components/filter/interfaces/filter-field.interface.ts +0 -80
- package/projects/unipin-angular/src/lib/components/filter/interfaces/filter-search-event.interface.ts +0 -15
- package/projects/unipin-angular/src/lib/components/forms/country-input/form-country-input.component.html +0 -19
- package/projects/unipin-angular/src/lib/components/forms/country-input/form-country-input.component.scss +0 -0
- package/projects/unipin-angular/src/lib/components/forms/country-input/form-country-input.component.ts +0 -210
- package/projects/unipin-angular/src/lib/components/forms/country-input/form-country-input.stories.ts +0 -175
- package/projects/unipin-angular/src/lib/components/forms/currency-input/form-currency-input.component.html +0 -42
- package/projects/unipin-angular/src/lib/components/forms/currency-input/form-currency-input.component.scss +0 -4
- package/projects/unipin-angular/src/lib/components/forms/currency-input/form-currency-input.component.ts +0 -285
- package/projects/unipin-angular/src/lib/components/forms/currency-input/form-currency-input.spec.ts +0 -119
- package/projects/unipin-angular/src/lib/components/forms/currency-input/form-currency-input.stories.ts +0 -243
- package/projects/unipin-angular/src/lib/components/forms/date/form-date.component.html +0 -27
- package/projects/unipin-angular/src/lib/components/forms/date/form-date.component.scss +0 -7
- package/projects/unipin-angular/src/lib/components/forms/date/form-date.component.ts +0 -225
- package/projects/unipin-angular/src/lib/components/forms/date/form-date.stories.ts +0 -201
- package/projects/unipin-angular/src/lib/components/forms/image-picker/directives/drag-n-drop.directive.ts +0 -40
- package/projects/unipin-angular/src/lib/components/forms/image-picker/form-image-picker.component.html +0 -29
- package/projects/unipin-angular/src/lib/components/forms/image-picker/form-image-picker.component.scss +0 -40
- package/projects/unipin-angular/src/lib/components/forms/image-picker/form-image-picker.component.ts +0 -109
- package/projects/unipin-angular/src/lib/components/forms/image-picker/form-image-picker.stories.ts +0 -133
- package/projects/unipin-angular/src/lib/components/forms/input/form-input.component.html +0 -22
- package/projects/unipin-angular/src/lib/components/forms/input/form-input.component.scss +0 -0
- package/projects/unipin-angular/src/lib/components/forms/input/form-input.component.ts +0 -177
- package/projects/unipin-angular/src/lib/components/forms/input/form-input.stories.ts +0 -185
- package/projects/unipin-angular/src/lib/components/forms/number/form-number.component.html +0 -6
- package/projects/unipin-angular/src/lib/components/forms/number/form-number.component.scss +0 -0
- package/projects/unipin-angular/src/lib/components/forms/number/form-number.component.ts +0 -176
- package/projects/unipin-angular/src/lib/components/forms/number/form-number.spec.ts +0 -62
- package/projects/unipin-angular/src/lib/components/forms/number/form-number.stories.ts +0 -150
- package/projects/unipin-angular/src/lib/components/forms/number/pipes/locale-number.pipe.ts +0 -32
- package/projects/unipin-angular/src/lib/components/forms/password/form-password.component.html +0 -11
- package/projects/unipin-angular/src/lib/components/forms/password/form-password.component.scss +0 -5
- package/projects/unipin-angular/src/lib/components/forms/password/form-password.component.ts +0 -177
- package/projects/unipin-angular/src/lib/components/forms/password/form-password.stories.ts +0 -151
- package/projects/unipin-angular/src/lib/components/forms/rate-group-code-input/form-rate-group-code-input.component.html +0 -30
- package/projects/unipin-angular/src/lib/components/forms/rate-group-code-input/form-rate-group-code-input.component.scss +0 -0
- package/projects/unipin-angular/src/lib/components/forms/rate-group-code-input/form-rate-group-code-input.component.ts +0 -271
- package/projects/unipin-angular/src/lib/components/forms/rate-group-code-input/form-rate-group-code-input.stories.ts +0 -248
- package/projects/unipin-angular/src/lib/components/forms/searchable-select/form-searchable-select.component.html +0 -28
- package/projects/unipin-angular/src/lib/components/forms/searchable-select/form-searchable-select.component.scss +0 -0
- package/projects/unipin-angular/src/lib/components/forms/searchable-select/form-searchable-select.component.ts +0 -281
- package/projects/unipin-angular/src/lib/components/forms/searchable-select/form-searchable-select.stories.ts +0 -267
- package/projects/unipin-angular/src/lib/components/forms/select/form-select.component.html +0 -25
- package/projects/unipin-angular/src/lib/components/forms/select/form-select.component.scss +0 -1
- package/projects/unipin-angular/src/lib/components/forms/select/form-select.component.ts +0 -223
- package/projects/unipin-angular/src/lib/components/forms/select/form-select.stories.ts +0 -220
- package/projects/unipin-angular/src/lib/components/forms/textarea/form-textarea.component.html +0 -9
- package/projects/unipin-angular/src/lib/components/forms/textarea/form-textarea.component.scss +0 -0
- package/projects/unipin-angular/src/lib/components/forms/textarea/form-textarea.component.ts +0 -146
- package/projects/unipin-angular/src/lib/components/forms/textarea/form-textarea.stories.ts +0 -163
- package/projects/unipin-angular/src/lib/components/grids/grid-pagination/grid-pagination.component.html +0 -17
- package/projects/unipin-angular/src/lib/components/grids/grid-pagination/grid-pagination.component.scss +0 -8
- package/projects/unipin-angular/src/lib/components/grids/grid-pagination/grid-pagination.component.ts +0 -224
- package/projects/unipin-angular/src/lib/components/grids/grid-pagination/grid-pagination.stories.ts +0 -219
- package/projects/unipin-angular/src/lib/components/grids/grid-snapshot/grid-snapshot.component.html +0 -17
- package/projects/unipin-angular/src/lib/components/grids/grid-snapshot/grid-snapshot.component.scss +0 -8
- package/projects/unipin-angular/src/lib/components/grids/grid-snapshot/grid-snapshot.component.ts +0 -229
- package/projects/unipin-angular/src/lib/components/grids/grid-snapshot/grid-snapshot.stories.ts +0 -173
- package/projects/unipin-angular/src/lib/components/grids/interfaces/grid-config.interface.ts +0 -44
- package/projects/unipin-angular/src/lib/components/grids/services/grid.service.ts +0 -23
- package/projects/unipin-angular/src/lib/components/infinite-scroll/directive/infinite-scroll.directive.ts +0 -72
- package/projects/unipin-angular/src/lib/components/infinite-scroll/infinite-scroll.component.html +0 -13
- package/projects/unipin-angular/src/lib/components/infinite-scroll/infinite-scroll.component.scss +0 -10
- package/projects/unipin-angular/src/lib/components/infinite-scroll/infinite-scroll.component.ts +0 -61
- package/projects/unipin-angular/src/lib/components/infinite-scroll/infinite-scroll.stories.ts +0 -80
- package/projects/unipin-angular/src/lib/components/tabs/tab-content/tab-content.component.html +0 -3
- package/projects/unipin-angular/src/lib/components/tabs/tab-content/tab-content.component.scss +0 -6
- package/projects/unipin-angular/src/lib/components/tabs/tab-content/tab-content.component.ts +0 -56
- package/projects/unipin-angular/src/lib/components/tabs/tab-group/tab-group.component.html +0 -24
- package/projects/unipin-angular/src/lib/components/tabs/tab-group/tab-group.component.scss +0 -39
- package/projects/unipin-angular/src/lib/components/tabs/tab-group/tab-group.component.ts +0 -92
- package/projects/unipin-angular/src/lib/components/tabs/tab.stories.ts +0 -117
- package/projects/unipin-angular/src/lib/guards/auth/auth.guard.ts +0 -11
- package/projects/unipin-angular/src/lib/interceptors/header/header.interceptor.ts +0 -36
- package/projects/unipin-angular/src/lib/interceptors/refresh-token/refresh-token.interceptor.ts +0 -123
- package/projects/unipin-angular/src/lib/interfaces/user/user.interface.ts +0 -27
- package/projects/unipin-angular/src/lib/modules/index.ts +0 -11
- package/projects/unipin-angular/src/lib/modules/micro-frontend/utils/mf-bootstrap.util.ts +0 -74
- package/projects/unipin-angular/src/lib/modules/micro-frontend/utils/mf-global-state.util.ts +0 -20
- package/projects/unipin-angular/src/lib/modules/permission/directive/permission.directive.spec.ts +0 -50
- package/projects/unipin-angular/src/lib/modules/permission/directive/permission.directive.ts +0 -68
- package/projects/unipin-angular/src/lib/modules/permission/guards/permission.guard.spec.ts +0 -76
- package/projects/unipin-angular/src/lib/modules/permission/guards/permission.guard.ts +0 -30
- package/projects/unipin-angular/src/lib/modules/permission/pages/401/unauthorized.page.html +0 -3
- package/projects/unipin-angular/src/lib/modules/permission/pages/401/unauthorized.page.scss +0 -3
- package/projects/unipin-angular/src/lib/modules/permission/pages/401/unauthorized.page.ts +0 -14
- package/projects/unipin-angular/src/lib/modules/permission/pages/loading/loading.page.html +0 -2
- package/projects/unipin-angular/src/lib/modules/permission/pages/loading/loading.page.scss +0 -4
- package/projects/unipin-angular/src/lib/modules/permission/pages/loading/loading.page.ts +0 -76
- package/projects/unipin-angular/src/lib/modules/permission/pages/loading/provide-loading-config.util.ts +0 -18
- package/projects/unipin-angular/src/lib/modules/permission/services/permission.service.spec.ts +0 -62
- package/projects/unipin-angular/src/lib/modules/permission/services/permission.service.ts +0 -78
- package/projects/unipin-angular/src/lib/resolvers/auth/auth.resolver.spec.ts +0 -46
- package/projects/unipin-angular/src/lib/resolvers/auth/auth.resolver.ts +0 -144
- package/projects/unipin-angular/src/lib/services/auth/auth.service.ts +0 -243
- package/projects/unipin-angular/src/lib/services/country/country.service.ts +0 -47
- package/projects/unipin-angular/src/lib/services/currency/currency.service.ts +0 -44
- package/projects/unipin-angular/src/lib/services/profile/profile.service.ts +0 -86
- package/projects/unipin-angular/src/lib/services/rate-group-code/rate-group-code.service.ts +0 -29
- package/projects/unipin-angular/src/lib/utils/contrast-color-generator/contrast-color-generator.util.spec.ts +0 -19
- package/projects/unipin-angular/src/lib/utils/contrast-color-generator/contrast-color-generator.util.ts +0 -28
- package/projects/unipin-angular/src/lib/utils/form-error-message/form-error-message.util.spec.ts +0 -58
- package/projects/unipin-angular/src/lib/utils/form-error-message/form-error-message.util.ts +0 -30
- package/projects/unipin-angular/src/lib/utils/format-capitalize/format-capitalize.util.spec.ts +0 -30
- package/projects/unipin-angular/src/lib/utils/format-capitalize/format-capitalize.util.ts +0 -22
- package/projects/unipin-angular/src/lib/utils/redirect-to-first-menu/redirect-to-first-menu.util.ts +0 -15
- package/projects/unipin-angular/src/public-api.ts +0 -126
- package/projects/unipin-angular/tsconfig.lib.json +0 -14
- package/projects/unipin-angular/tsconfig.lib.prod.json +0 -10
- package/projects/unipin-angular/tsconfig.spec.json +0 -14
- package/snapshot-serializer.js +0 -12
- package/test-runner-jest.config.js +0 -13
- package/tsconfig.json +0 -51
- /package/{projects/unipin-angular/src/lib/components/audit/index.ts → lib/components/audit/index.d.ts} +0 -0
- /package/{projects/unipin-angular/src/lib/components/buttons/index.ts → lib/components/buttons/index.d.ts} +0 -0
- /package/{projects/unipin-angular/src/lib/components/containers/list-container/index.ts → lib/components/containers/list-container/index.d.ts} +0 -0
- /package/{projects/unipin-angular/src/lib/components/forms/index.ts → lib/components/forms/index.d.ts} +0 -0
- /package/{projects/unipin-angular/src/lib/components/grids/index.ts → lib/components/grids/index.d.ts} +0 -0
- /package/{projects/unipin-angular/src/lib/components/infinite-scroll/index.ts → lib/components/infinite-scroll/index.d.ts} +0 -0
- /package/{projects/unipin-angular/src/lib/guards/index.ts → lib/guards/index.d.ts} +0 -0
- /package/{projects/unipin-angular/src/lib/interceptors/index.ts → lib/interceptors/index.d.ts} +0 -0
- /package/{projects/unipin-angular/src/lib/interfaces/index.ts → lib/interfaces/index.d.ts} +0 -0
- /package/{projects/unipin-angular/src/lib/modules/micro-frontend/index.ts → lib/modules/micro-frontend/index.d.ts} +0 -0
- /package/{projects/unipin-angular/src/lib/resolvers/index.ts → lib/resolvers/index.d.ts} +0 -0
- /package/{projects/unipin-angular/src/lib/services/index.ts → lib/services/index.d.ts} +0 -0
- /package/{projects/unipin-angular/src/lib/utils/index.ts → lib/utils/index.d.ts} +0 -0
- /package/{projects/unipin-angular/src → src}/assets/scss/forms.scss +0 -0
- /package/{projects/unipin-angular/src → src}/assets/scss/grid.scss +0 -0
- /package/{projects/unipin-angular/src → src}/assets/scss/select.scss +0 -0
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { ApplicationConfig, enableProdMode, Injector, NgZone, Type } from '@angular/core';
|
|
2
|
-
import { Location } from '@angular/common';
|
|
3
|
-
import { Router } from '@angular/router';
|
|
4
|
-
import { bootstrapApplication, createApplication } from '@angular/platform-browser';
|
|
5
|
-
import { getGlobalStateSlice, setGlobalStateSlice } from './mf-global-state.util';
|
|
6
|
-
import { createCustomElement } from '@angular/elements';
|
|
7
|
-
|
|
8
|
-
export type AppType = 'shell' | 'microfrontend';
|
|
9
|
-
|
|
10
|
-
export type Options = {
|
|
11
|
-
production: boolean;
|
|
12
|
-
appType: AppType;
|
|
13
|
-
elementName?: string;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
function getNgZone(): NgZone{
|
|
17
|
-
return (getGlobalStateSlice((state: { ngZone: NgZone }) => state.ngZone));
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function shareNgZone(zone: NgZone): void{
|
|
21
|
-
setGlobalStateSlice({ ngZone: zone });
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function bootstrap<M>(component: Type<M>, options: Options, config: ApplicationConfig): void{
|
|
25
|
-
options.production && enableProdMode();
|
|
26
|
-
|
|
27
|
-
if (options.appType === 'shell') {
|
|
28
|
-
bootstrapApplication(component, config).then((ref) => {
|
|
29
|
-
shareShellZone(ref.injector);
|
|
30
|
-
});
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (!getNgZone() && isLocalhost()) {
|
|
35
|
-
bootstrapApplication(component, config).then((ref) => {
|
|
36
|
-
connectMicroFrontendRouter(ref.injector);
|
|
37
|
-
});
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
(async () => {
|
|
42
|
-
config.providers.push({ provide: NgZone, useValue: getNgZone() });
|
|
43
|
-
|
|
44
|
-
const app = await createApplication(config);
|
|
45
|
-
customElements.define(<string> options.elementName, createCustomElement(component, { injector: app.injector }));
|
|
46
|
-
|
|
47
|
-
connectMicroFrontendRouter(app.injector);
|
|
48
|
-
})();
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function shareShellZone(injector: Injector): void{
|
|
52
|
-
const ngZone = injector.get(NgZone, null);
|
|
53
|
-
if (!ngZone) {
|
|
54
|
-
console.warn('No NgZone to share found');
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
shareNgZone(ngZone);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function connectMicroFrontendRouter(injector: Injector): void{
|
|
61
|
-
const router = injector.get(Router);
|
|
62
|
-
const location = injector.get(Location);
|
|
63
|
-
|
|
64
|
-
if (!router) {
|
|
65
|
-
console.warn('No router to connect found');
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
router.navigateByUrl(location.path() + window.location.hash);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function isLocalhost(): boolean{
|
|
72
|
-
const hostname = window.location.hostname;
|
|
73
|
-
return hostname === 'localhost' || hostname === '127.0.0.1';
|
|
74
|
-
}
|
package/projects/unipin-angular/src/lib/modules/micro-frontend/utils/mf-global-state.util.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export const packageNamespace = '@angular-architects/module-federation-tools';
|
|
2
|
-
|
|
3
|
-
function getGlobalState<T>(): T {
|
|
4
|
-
const globalState = window as unknown as { [packageNamespace]: T };
|
|
5
|
-
globalState[packageNamespace] = globalState[packageNamespace] || ({} as unknown as T);
|
|
6
|
-
|
|
7
|
-
return globalState[packageNamespace];
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function getGlobalStateSlice<T>(): T;
|
|
11
|
-
export function getGlobalStateSlice<T, R>(selector: (globalState: T) => R): R;
|
|
12
|
-
|
|
13
|
-
export function getGlobalStateSlice<T, R>(selector?: (globalState: T) => R): R | T {
|
|
14
|
-
const globalState = getGlobalState<T>();
|
|
15
|
-
return selector? selector(globalState) : globalState;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function setGlobalStateSlice<T extends object>(slice: T): T {
|
|
19
|
-
return Object.assign(getGlobalState<T>(), slice);
|
|
20
|
-
}
|
package/projects/unipin-angular/src/lib/modules/permission/directive/permission.directive.spec.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { Component } from '@angular/core';
|
|
2
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
3
|
-
import { By } from '@angular/platform-browser';
|
|
4
|
-
import { Apollo } from 'apollo-angular';
|
|
5
|
-
import { PermissionDirective } from './permission.directive';
|
|
6
|
-
import { PermissionService } from '../services/permission.service';
|
|
7
|
-
|
|
8
|
-
@Component({
|
|
9
|
-
template: `
|
|
10
|
-
<div *hasPermission="'MEMBER'; scope: 'GLOBAL'; type: 'ADMIN'">Content</div>
|
|
11
|
-
<span *hasPermission="'JOB'; scope: 'GLOBAL'; type: 'ADMIN'">Content</span>
|
|
12
|
-
`,
|
|
13
|
-
imports: [PermissionDirective]
|
|
14
|
-
})
|
|
15
|
-
class TestComponent {}
|
|
16
|
-
|
|
17
|
-
describe('PermissionDirective', () => {
|
|
18
|
-
let fixture: ComponentFixture<TestComponent>;
|
|
19
|
-
let component: TestComponent;
|
|
20
|
-
let permissionService: PermissionService;
|
|
21
|
-
|
|
22
|
-
beforeEach(() => {
|
|
23
|
-
TestBed.configureTestingModule({
|
|
24
|
-
declarations: [PermissionDirective, TestComponent],
|
|
25
|
-
providers: [
|
|
26
|
-
PermissionService,
|
|
27
|
-
{ provide: Apollo },
|
|
28
|
-
],
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
permissionService = TestBed.inject(PermissionService);
|
|
32
|
-
fixture = TestBed.createComponent(TestComponent);
|
|
33
|
-
component = fixture.componentInstance;
|
|
34
|
-
|
|
35
|
-
permissionService.setPermission([ 'GLOBAL.MEMBER.ADMIN' ], [ 'MEMBER' ])
|
|
36
|
-
fixture.detectChanges();
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('should create the component', () => expect(component).toBeTruthy());
|
|
40
|
-
|
|
41
|
-
it('should display content when permission is granted', () => {
|
|
42
|
-
const dynamicViewElement = fixture.debugElement.query(By.css('div'));
|
|
43
|
-
expect(dynamicViewElement).toBeDefined();
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it('should not display content when permission is denied', () => {
|
|
47
|
-
const dynamicViewElement = fixture.debugElement.query(By.css('span'));
|
|
48
|
-
expect(dynamicViewElement).toBeNull();
|
|
49
|
-
});
|
|
50
|
-
});
|
package/projects/unipin-angular/src/lib/modules/permission/directive/permission.directive.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { Directive, Input, TemplateRef, ViewContainerRef } from '@angular/core';
|
|
2
|
-
import { PermissionService } from '../services/permission.service';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* The `PermissionDirective` is a directive that conditionally renders content based on user permissions.
|
|
6
|
-
* `Scope` param is default to `GLOBAL`
|
|
7
|
-
* @selector '[hasPermission]'
|
|
8
|
-
* @example
|
|
9
|
-
* ```html
|
|
10
|
-
* <div *hasPermission="'POST_AUDIT'; type: 'READ'; scope: 'MERCHANT'"></div>
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
13
|
-
@Directive({
|
|
14
|
-
standalone: true,
|
|
15
|
-
selector: '[hasPermission]'
|
|
16
|
-
})
|
|
17
|
-
export class PermissionDirective {
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* The module name for which permissions are being checked.
|
|
21
|
-
* @type {string}
|
|
22
|
-
* @default {null}
|
|
23
|
-
*/
|
|
24
|
-
protected module!: string;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* The permission scope.
|
|
28
|
-
* @type {string}
|
|
29
|
-
* @default {'GLOBAL'}
|
|
30
|
-
*/
|
|
31
|
-
protected scope: string = 'GLOBAL';
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Sets the module name for which permissions are being checked.
|
|
35
|
-
* @example 'POST_AUDIT'.
|
|
36
|
-
* @param {string} m - The module name.
|
|
37
|
-
*/
|
|
38
|
-
@Input() set hasPermission(m: string) {
|
|
39
|
-
this.module = m;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Sets the permission scope. Default is 'GLOBAL'.
|
|
44
|
-
* @param {string} s - The permission scope.
|
|
45
|
-
*/
|
|
46
|
-
@Input() set hasPermissionScope(s: string) {
|
|
47
|
-
this.scope = s;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Sets the permission type and conditionally renders content based on user permissions.
|
|
52
|
-
* @param {string} t - The permission type, e.g., 'READ', 'WRITE'.
|
|
53
|
-
*/
|
|
54
|
-
@Input() set hasPermissionType(t: string) {;
|
|
55
|
-
if (this.permissionService.checkPermission(this.scope, this.module, t)) {
|
|
56
|
-
this.viewContainer.createEmbeddedView(this.templateRef);
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
this.viewContainer.clear();
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
constructor(
|
|
64
|
-
protected readonly templateRef: TemplateRef<any>,
|
|
65
|
-
protected readonly viewContainer: ViewContainerRef,
|
|
66
|
-
protected readonly permissionService: PermissionService
|
|
67
|
-
) { }
|
|
68
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
// import { ActivatedRouteSnapshot, Router } from '@angular/router';
|
|
2
|
-
// import { Location } from '@angular/common';
|
|
3
|
-
// import { PermissionService } from '../services/permission.service';
|
|
4
|
-
// import { canActivate } from './permission.guard';
|
|
5
|
-
|
|
6
|
-
describe('PermissionGuard', () => {
|
|
7
|
-
// let routerSpy: jasmine.SpyObj<Router>;
|
|
8
|
-
// let locationSpy: jasmine.SpyObj<Location>;
|
|
9
|
-
// let permissionServiceSpy: jasmine.SpyObj<PermissionService>;
|
|
10
|
-
|
|
11
|
-
// beforeEach(() => {
|
|
12
|
-
// routerSpy = jasmine.createSpyObj('Router', ['navigate']);
|
|
13
|
-
// locationSpy = jasmine.createSpyObj('Location', ['path']);
|
|
14
|
-
// permissionServiceSpy = jasmine.createSpyObj('PermissionService', ['isInitiated', 'checkPermission']);
|
|
15
|
-
// });
|
|
16
|
-
|
|
17
|
-
// it('should return true when permission is granted', () => {
|
|
18
|
-
// permissionServiceSpy.isInitiated = true;
|
|
19
|
-
// permissionServiceSpy.checkPermission.and.returnValue(true);
|
|
20
|
-
|
|
21
|
-
// const result = canActivate(createActivatedRouteSnapshot('s', 'm', 't'), routerSpy, locationSpy, permissionServiceSpy);
|
|
22
|
-
|
|
23
|
-
// expect(result).toBe(true);
|
|
24
|
-
// expect(routerSpy.navigate).not.toHaveBeenCalled();
|
|
25
|
-
// });
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
// it('should return false and navigate to loading when not initiated', () => {
|
|
29
|
-
// permissionServiceSpy.isInitiated = false;
|
|
30
|
-
|
|
31
|
-
// const result = canActivate(createActivatedRouteSnapshot('s', 'm', 't'), routerSpy, locationSpy, permissionServiceSpy);
|
|
32
|
-
|
|
33
|
-
// expect(result).toBe(false);
|
|
34
|
-
// expect(routerSpy.navigate).toHaveBeenCalledWith(['loading'], { queryParams: { url: jasmine.any(String) } });
|
|
35
|
-
// });
|
|
36
|
-
|
|
37
|
-
// it('should return false and navigate to 401 when permission is not granted', () => {
|
|
38
|
-
// permissionServiceSpy.isInitiated = true;
|
|
39
|
-
// permissionServiceSpy.checkPermission.and.returnValue(false);
|
|
40
|
-
|
|
41
|
-
// const result = canActivate(createActivatedRouteSnapshot('s', 'm', 't'), routerSpy, locationSpy, permissionServiceSpy);
|
|
42
|
-
|
|
43
|
-
// expect(result).toBe(false);
|
|
44
|
-
// expect(routerSpy.navigate).toHaveBeenCalledWith(['401']);
|
|
45
|
-
// });
|
|
46
|
-
|
|
47
|
-
// function createActivatedRouteSnapshot(scope: string, module: string, type: string): ActivatedRouteSnapshot {
|
|
48
|
-
// return {
|
|
49
|
-
// data: { requiredPermission: { scope, module, type } },
|
|
50
|
-
// url: [],
|
|
51
|
-
// params: {},
|
|
52
|
-
// queryParams: {},
|
|
53
|
-
// fragment: null,
|
|
54
|
-
// outlet: '',
|
|
55
|
-
// component: null,
|
|
56
|
-
// routeConfig: null,
|
|
57
|
-
// title: undefined,
|
|
58
|
-
// root: new ActivatedRouteSnapshot,
|
|
59
|
-
// parent: null,
|
|
60
|
-
// firstChild: null,
|
|
61
|
-
// children: [],
|
|
62
|
-
// pathFromRoot: [],
|
|
63
|
-
// paramMap: createParamMap(),
|
|
64
|
-
// queryParamMap: createParamMap()
|
|
65
|
-
// } as ActivatedRouteSnapshot;
|
|
66
|
-
// }
|
|
67
|
-
|
|
68
|
-
// function createParamMap(): any {
|
|
69
|
-
// return {
|
|
70
|
-
// has: () => false,
|
|
71
|
-
// get: () => null,
|
|
72
|
-
// getAll: () => [],
|
|
73
|
-
// keys: []
|
|
74
|
-
// };
|
|
75
|
-
// }
|
|
76
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { inject } from '@angular/core';
|
|
2
|
-
import { Location } from '@angular/common';
|
|
3
|
-
import { ActivatedRouteSnapshot, CanActivateFn, Router } from '@angular/router';
|
|
4
|
-
import { PermissionService } from '../services/permission.service';
|
|
5
|
-
|
|
6
|
-
export const PermissionGuard: CanActivateFn = (route: ActivatedRouteSnapshot): boolean => {
|
|
7
|
-
|
|
8
|
-
const router: Router = inject(Router);
|
|
9
|
-
const location: Location = inject(Location);
|
|
10
|
-
const permissionService: PermissionService = inject(PermissionService);
|
|
11
|
-
|
|
12
|
-
const permissions: { scope: string, module: string, type: string }[] = route.data['requiredPermissions'];
|
|
13
|
-
|
|
14
|
-
if (!permissions || permissions.length === 0) throw new Error('Invalid config: requiredPermissions is a required parameter in route data for PermissionGuard');
|
|
15
|
-
|
|
16
|
-
if (!permissionService.isInitiated) {
|
|
17
|
-
router.navigate([ 'loading' ], { queryParams: { url: `${ location.path() + window.location.hash }` } });
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (permissions) {
|
|
22
|
-
for (let i = 0; i < permissions.length; i++) {
|
|
23
|
-
const { scope, module, type } = permissions[i];
|
|
24
|
-
if (permissionService.checkPermission(scope, module, type)) return true;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
router.navigate([ '401' ]);
|
|
29
|
-
return false;
|
|
30
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Component } from '@angular/core';
|
|
2
|
-
import { IonicModule } from '@ionic/angular';
|
|
3
|
-
|
|
4
|
-
@Component({
|
|
5
|
-
standalone: true,
|
|
6
|
-
selector: 'up-unauthorized',
|
|
7
|
-
templateUrl: './unauthorized.page.html',
|
|
8
|
-
styleUrls: ['./unauthorized.page.scss'],
|
|
9
|
-
host: {
|
|
10
|
-
class: 'd-flex flex-column align-items-center justify-content-center h-100 w-75 mx-auto'
|
|
11
|
-
},
|
|
12
|
-
imports: [ IonicModule ]
|
|
13
|
-
})
|
|
14
|
-
export class UnauthorizedPage { }
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, Component, Inject, OnDestroy, OnInit } from '@angular/core';
|
|
2
|
-
import { ActivatedRoute, Router } from '@angular/router';
|
|
3
|
-
import { Subscription } from 'rxjs';
|
|
4
|
-
import { IonicModule } from '@ionic/angular';
|
|
5
|
-
import { PermissionService } from '../../services/permission.service';
|
|
6
|
-
import { LOADING_CONFIG, LoadingConfig } from './provide-loading-config.util';
|
|
7
|
-
|
|
8
|
-
@Component({
|
|
9
|
-
standalone: true,
|
|
10
|
-
selector: 'up-loading',
|
|
11
|
-
styleUrl: './loading.page.scss',
|
|
12
|
-
templateUrl: './loading.page.html',
|
|
13
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
14
|
-
host: {
|
|
15
|
-
class: 'd-flex flex-column align-items-center justify-content-center h-100 w-75 mx-auto'
|
|
16
|
-
},
|
|
17
|
-
imports: [
|
|
18
|
-
IonicModule
|
|
19
|
-
]
|
|
20
|
-
})
|
|
21
|
-
export class LoadingPage implements OnInit, OnDestroy {
|
|
22
|
-
|
|
23
|
-
protected sub?: Subscription;
|
|
24
|
-
|
|
25
|
-
constructor(
|
|
26
|
-
@Inject(LOADING_CONFIG) public readonly config: LoadingConfig,
|
|
27
|
-
protected readonly router: Router,
|
|
28
|
-
protected readonly route: ActivatedRoute,
|
|
29
|
-
protected readonly permissionService: PermissionService
|
|
30
|
-
) { }
|
|
31
|
-
|
|
32
|
-
public ngOnInit(): void{
|
|
33
|
-
const subjectGuid = localStorage.getItem(this.config.subjectGuidStorageKey || 'userGuid');
|
|
34
|
-
if (!subjectGuid) {
|
|
35
|
-
this.router.navigate([ '401' ]);
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const permCodeList: string[] = [];
|
|
40
|
-
const permModuleList: Map<string, boolean> = new Map();;
|
|
41
|
-
|
|
42
|
-
this.sub = this.permissionService.getPermissions({
|
|
43
|
-
subjectGuid,
|
|
44
|
-
pageSize: 1000,
|
|
45
|
-
permType: this.config.permTypes,
|
|
46
|
-
permModule: this.config.permModules,
|
|
47
|
-
}, this.config.fetchPolicy).subscribe({
|
|
48
|
-
error: () => {
|
|
49
|
-
this.router.navigate([ '401' ]);
|
|
50
|
-
},
|
|
51
|
-
next: ({ data: { authMsPermission: { data }}}) => {
|
|
52
|
-
data.forEach(({ permCode, permModule }) => {
|
|
53
|
-
if (!permCode || !permModule) return;
|
|
54
|
-
|
|
55
|
-
permCodeList.push(permCode);
|
|
56
|
-
if (!permModuleList.has(permModule)) {
|
|
57
|
-
permModuleList.set(permModule, true);
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
this.permissionService.isInitiated = true;
|
|
62
|
-
this.permissionService.setPermission(
|
|
63
|
-
permCodeList,
|
|
64
|
-
Array.from(
|
|
65
|
-
permModuleList.keys()
|
|
66
|
-
)
|
|
67
|
-
);
|
|
68
|
-
this.router.navigateByUrl(this.route.snapshot.queryParamMap.get('url')?? '');
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
public ngOnDestroy(): void{
|
|
74
|
-
this.sub?.unsubscribe();
|
|
75
|
-
}
|
|
76
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { InjectionToken, Provider } from '@angular/core';
|
|
2
|
-
import { FetchPolicy } from '@apollo/client/core';
|
|
3
|
-
|
|
4
|
-
export const LOADING_CONFIG = new InjectionToken<LoadingConfig>('LOADING_CONFIG');
|
|
5
|
-
|
|
6
|
-
export interface LoadingConfig {
|
|
7
|
-
permTypes: string[];
|
|
8
|
-
permModules: string[];
|
|
9
|
-
fetchPolicy?: FetchPolicy;
|
|
10
|
-
subjectGuidStorageKey?: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function provideLoadingConfig(config: LoadingConfig): Provider{
|
|
14
|
-
return {
|
|
15
|
-
provide: LOADING_CONFIG,
|
|
16
|
-
useValue: config
|
|
17
|
-
};
|
|
18
|
-
}
|
package/projects/unipin-angular/src/lib/modules/permission/services/permission.service.spec.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { TestBed, inject } from '@angular/core/testing';
|
|
2
|
-
import { ApolloQueryResult } from '@apollo/client/core';
|
|
3
|
-
import { ApolloTestingModule, ApolloTestingController } from 'apollo-angular/testing';
|
|
4
|
-
import { AppPermDfn } from '../../../../graphql/generated';
|
|
5
|
-
import { PermissionService } from './permission.service';
|
|
6
|
-
|
|
7
|
-
describe('PermissionService', () => {
|
|
8
|
-
let service: PermissionService;
|
|
9
|
-
let apolloController: ApolloTestingController;
|
|
10
|
-
|
|
11
|
-
beforeEach(() => {
|
|
12
|
-
TestBed.configureTestingModule({
|
|
13
|
-
imports: [
|
|
14
|
-
ApolloTestingModule
|
|
15
|
-
],
|
|
16
|
-
providers: [PermissionService],
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
service = TestBed.inject(PermissionService);
|
|
20
|
-
apolloController = TestBed.inject(ApolloTestingController);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('should be created', () => expect(service).toBeTruthy());
|
|
24
|
-
|
|
25
|
-
it('should set permissions correctly', () => {
|
|
26
|
-
const permCodes = ['SCOPE1.MODULE1.ADMIN', 'SCOPE1.MODULE2.READ'];
|
|
27
|
-
const permModules = ['MODULE1', 'MODULE2'];
|
|
28
|
-
|
|
29
|
-
service.setPermission(permCodes, permModules);
|
|
30
|
-
expect(service.checkPermission('SCOPE1', 'MODULE1', 'ADMIN')).toBe(true);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('should check permission correctly', () => {
|
|
34
|
-
const permCodes = ['SCOPE1.MODULE1.ADMIN', 'SCOPE1.MODULE2.READ'];
|
|
35
|
-
service.setPermission(permCodes);
|
|
36
|
-
|
|
37
|
-
expect(service.checkPermission('SCOPE1', 'MODULE1', 'ADMIN')).toBe(true);
|
|
38
|
-
expect(service.checkPermission('SCOPE1', 'MODULE2', 'READ')).toBe(true);
|
|
39
|
-
expect(service.checkPermission('SCOPE1', 'MODULE3', 'WRITE')).toBe(false);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it('should get permissions from Apollo', inject([PermissionService], (permissionService: PermissionService) => {
|
|
43
|
-
const mockPermissions = {
|
|
44
|
-
data: {
|
|
45
|
-
authMsPermission: {
|
|
46
|
-
data: [{ permCode: 'PERM1' }, { permCode: 'PERM2' }]
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
permissionService.getPermissions({ page: 0, pageSize: 2 }).subscribe((result) => {
|
|
52
|
-
expect(result).toEqual(mockPermissions as ApolloQueryResult<{ authMsPermission: { data: AppPermDfn[] } }>);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
const op = apolloController.expectOne((operation) => operation.operationName === 'QueryPermission');
|
|
56
|
-
op.flush({ data: mockPermissions });
|
|
57
|
-
|
|
58
|
-
apolloController.verify();
|
|
59
|
-
}));
|
|
60
|
-
|
|
61
|
-
afterEach(() => apolloController.verify());
|
|
62
|
-
});
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import { BehaviorSubject, Observable } from 'rxjs';
|
|
3
|
-
import { ApolloQueryResult, FetchPolicy } from '@apollo/client/core';
|
|
4
|
-
import { Apollo, gql } from 'apollo-angular';
|
|
5
|
-
import { AppPermDfn, PermissionFilter } from '../../../../graphql/generated';
|
|
6
|
-
|
|
7
|
-
@Injectable({
|
|
8
|
-
providedIn: 'root'
|
|
9
|
-
})
|
|
10
|
-
export class PermissionService {
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* A readonly variable that used to store permission modules in an applet then check if the user
|
|
14
|
-
* has the permission or not. This variable controls menu's icon visibility on the sidebar. The
|
|
15
|
-
* icon will appear if the user has the permission that menu's needed and it will disappear if
|
|
16
|
-
* the user don't have the permission.
|
|
17
|
-
* @type {BehaviorSubject<string[]>}
|
|
18
|
-
*/
|
|
19
|
-
public readonly permModules: BehaviorSubject<string[]> = new BehaviorSubject<string[]>([]);
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* A flag variable that used to know if the applet already initiated or not. Default value is
|
|
23
|
-
* false.
|
|
24
|
-
* @type {boolean}
|
|
25
|
-
*/
|
|
26
|
-
public isInitiated: boolean = false;
|
|
27
|
-
protected permissions: Map<string, boolean> = new Map();
|
|
28
|
-
|
|
29
|
-
constructor(
|
|
30
|
-
protected readonly apollo: Apollo
|
|
31
|
-
) { }
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* A method that set the permissions and permission modules.
|
|
35
|
-
* @param {string[]} permCodes - Contain list of permission codes.
|
|
36
|
-
* @param {string[]} permModules - Contain list of permission modules. Default value [].
|
|
37
|
-
*/
|
|
38
|
-
public setPermission(permCodes: string[], permModules: string[] = []): void{
|
|
39
|
-
for (let i = 0; i < permCodes.length; i++) this.permissions.set(permCodes[i], true);
|
|
40
|
-
this.permModules.next(permModules);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* A method that checking if the user has the permission or not based on the params value.
|
|
45
|
-
* @param {string} scope - Contain scope of the user's permission.
|
|
46
|
-
* @param {string} module - Contain module of the user's permission.
|
|
47
|
-
* @param {string} type - Contain type of the user's permission.
|
|
48
|
-
* @returns {boolean} Contain boolean value that tells the user has the permission or not.
|
|
49
|
-
*/
|
|
50
|
-
public checkPermission(scope: string, module: string, type: string): boolean{
|
|
51
|
-
if (this.permissions.has(`${ scope }.${ module }.ADMIN`)) return true;
|
|
52
|
-
if (this.permissions.has(`${ scope }.${ module }.${ type }`)) return true;
|
|
53
|
-
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* A method that get the query value with authMsPermission as the object.
|
|
59
|
-
* @param {PermissionFilter} filter - Contain filter as a conditions for the query.
|
|
60
|
-
* @returns {Observable<ApolloQueryResult<{ authMsPermission: { data: AppPermDfn[] }}>>} Contain query value.
|
|
61
|
-
*/
|
|
62
|
-
public getPermissions(filter: PermissionFilter, fetchPolicy?: FetchPolicy): Observable<ApolloQueryResult<{ authMsPermission: { data: AppPermDfn[] }}>>{
|
|
63
|
-
return this.apollo.query({
|
|
64
|
-
fetchPolicy,
|
|
65
|
-
variables: { filter },
|
|
66
|
-
query: gql`
|
|
67
|
-
query QueryPermission($filter: PermissionFilter!) {
|
|
68
|
-
authMsPermission(filter: $filter) {
|
|
69
|
-
data {
|
|
70
|
-
permCode
|
|
71
|
-
permModule
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
`
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { TestBed } from '@angular/core/testing';
|
|
2
|
-
import { AuthResolver } from './auth.resolver';
|
|
3
|
-
import { AuthService } from '../../services';
|
|
4
|
-
|
|
5
|
-
describe('AuthResolver', () => {
|
|
6
|
-
let authResolver: AuthResolver;
|
|
7
|
-
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
TestBed.configureTestingModule({
|
|
10
|
-
providers: [AuthResolver]
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
authResolver = TestBed.inject(AuthResolver);
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it('should be created', () => expect(authResolver).toBeTruthy());
|
|
17
|
-
|
|
18
|
-
it('should return false if the user is not logged in', () => {
|
|
19
|
-
AuthService.authToken = '';
|
|
20
|
-
expect(authResolver.isUserLoggedIn()).toBe(false);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('should return true if the user is logged in', () => {
|
|
24
|
-
AuthService.authToken = 'fakeAuthToken';
|
|
25
|
-
expect(authResolver.isUserLoggedIn()).toBe(true);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('should return null if the user is not have token', () => {
|
|
29
|
-
AuthService.authToken = '';
|
|
30
|
-
expect(authResolver.getAuthToken()).toBeNull();
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('should return the auth token if the user is logged in and the token is not expired', () => {
|
|
34
|
-
spyOn(authResolver, 'isUserLoggedIn').and.returnValue(true);
|
|
35
|
-
AuthService.authToken = 'eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiIxZmU5NTJkYS1kZjViLTQxZDQtOTgxYy1kNmQ1YzAxZDAxNDIiLCJleHAiOjE3MDgzMDE0MTgsImlhdCI6MTcwODI5NzgxOH0.g_STuNb-GRlawePsUqAKFoJ2yTwqiUGpd_5ldiII0T2OiIuPAHFjIWuIuErD7_pCHK9bwx0ZHGx2QtbFdavP4u2sZcNVItGq6fHaAp5PF1DQX1WkpRl9gihSVFvJfgrnr0AgnJm6DtL3PnDqSAETDQOSq7kPH-ZVuV6hU5otz6IrdLExj5Iv3BqxE8gRxpIGfTc-a58soloDDA_LWf7BfRNELUljpo73dHG2-kGhVs7nYR_8CIIOl0Vs6fqRctYX8ZGkGpL4ZY3oXvJfbFhflcN-0ux-xAhKDjzTHshTS1Tt6ihfJOPfwONBIhpNsvaifAlcacuk5LjlgrQ7S-ePla0tIIasTEJGNXJD48BEfX--_s2t_F4Y9PqAwqSYyoCk8Gy48aKvNZy2QGHRCs_4ftU_3JIU0c3adxNsFGaufJrUXp2Cso5_zaul0UYYyvVgJ4Whu4UFIKKrF_E4ypsDjUBr9QvNLPpjzafyeLrNF9QHWHBMnUCw5EN60MJy04cVpVi36dwjuk5w_uOMu-3-M_SK_nsvJWgNaUHMK9aexrGusdGfDx6w6s0nF3Z8WXAbP7BCqMbXYvzbxYenvTS6BGPzArhYPU-Lc2pJLAIFHuVv84Eaett-ca8O5us4rdYSep5LOogQe3LREwuyKZKE_lQkLHiwgVu3kdv430MSobE';
|
|
36
|
-
|
|
37
|
-
expect(authResolver.getAuthToken()).toBe('eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiIxZmU5NTJkYS1kZjViLTQxZDQtOTgxYy1kNmQ1YzAxZDAxNDIiLCJleHAiOjE3MDgzMDE0MTgsImlhdCI6MTcwODI5NzgxOH0.g_STuNb-GRlawePsUqAKFoJ2yTwqiUGpd_5ldiII0T2OiIuPAHFjIWuIuErD7_pCHK9bwx0ZHGx2QtbFdavP4u2sZcNVItGq6fHaAp5PF1DQX1WkpRl9gihSVFvJfgrnr0AgnJm6DtL3PnDqSAETDQOSq7kPH-ZVuV6hU5otz6IrdLExj5Iv3BqxE8gRxpIGfTc-a58soloDDA_LWf7BfRNELUljpo73dHG2-kGhVs7nYR_8CIIOl0Vs6fqRctYX8ZGkGpL4ZY3oXvJfbFhflcN-0ux-xAhKDjzTHshTS1Tt6ihfJOPfwONBIhpNsvaifAlcacuk5LjlgrQ7S-ePla0tIIasTEJGNXJD48BEfX--_s2t_F4Y9PqAwqSYyoCk8Gy48aKvNZy2QGHRCs_4ftU_3JIU0c3adxNsFGaufJrUXp2Cso5_zaul0UYYyvVgJ4Whu4UFIKKrF_E4ypsDjUBr9QvNLPpjzafyeLrNF9QHWHBMnUCw5EN60MJy04cVpVi36dwjuk5w_uOMu-3-M_SK_nsvJWgNaUHMK9aexrGusdGfDx6w6s0nF3Z8WXAbP7BCqMbXYvzbxYenvTS6BGPzArhYPU-Lc2pJLAIFHuVv84Eaett-ca8O5us4rdYSep5LOogQe3LREwuyKZKE_lQkLHiwgVu3kdv430MSobE');
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('should return null if the user is logged in but the token is expired', () => {
|
|
41
|
-
spyOn(authResolver, 'isUserLoggedIn').and.returnValue(false);
|
|
42
|
-
AuthService.authToken = '';
|
|
43
|
-
|
|
44
|
-
expect(authResolver.getAuthToken()).toBeNull();
|
|
45
|
-
});
|
|
46
|
-
});
|