@mediusinc/mng-commons 5.0.0-rc.0-c31d5206 → 5.0.0-rc.1
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 +1 -0
- package/core/README.md +8 -0
- package/core/action/action-data.model.d.ts +3 -0
- package/core/action/action-parameters.model.d.ts +17 -0
- package/core/components/pages/error/error.page.component.d.ts +8 -0
- package/core/components/pages/not-found/not-found.page.component.d.ts +8 -0
- package/core/data-list/data-list-params-helpers.d.ts +82 -0
- package/core/data-providers/base.data-provider.d.ts +32 -0
- package/core/data-providers/lookup.data-provider.d.ts +10 -0
- package/core/descriptors/action.descriptor.d.ts +12 -0
- package/core/descriptors/column.descriptor.d.ts +3 -0
- package/core/descriptors/editor.descriptor.d.ts +11 -0
- package/core/descriptors/enum.descriptor.d.ts +6 -0
- package/core/descriptors/filter.descriptor.d.ts +3 -0
- package/core/descriptors/lookup.descriptor.d.ts +12 -0
- package/core/descriptors/model.descriptor.d.ts +8 -0
- package/core/descriptors/table.descriptor.d.ts +9 -0
- package/core/descriptors/tableview.descriptor.d.ts +11 -0
- package/core/directives/component.directive.d.ts +20 -0
- package/core/directives/dialog-keydown-handler.directive.d.ts +12 -0
- package/core/directives/template.directive.d.ts +12 -0
- package/core/enum/enum-helpers.d.ts +49 -0
- package/core/enum/enum.model.d.ts +8 -0
- package/core/error/error-handler.d.ts +6 -0
- package/core/error/error-helpers.d.ts +114 -0
- package/core/error/error.model.d.ts +47 -0
- package/core/helpers/coercion.d.ts +9 -0
- package/core/helpers/date.d.ts +14 -0
- package/core/helpers/notification.d.ts +2 -0
- package/core/helpers/object.d.ts +27 -0
- package/core/helpers/route.d.ts +35 -0
- package/core/helpers/string.d.ts +7 -0
- package/core/helpers/templates.d.ts +3 -0
- package/core/helpers/type-helpers.d.ts +16 -0
- package/core/i18n/i18n-common.d.ts +6 -0
- package/core/i18n/i18n-error.d.ts +4 -0
- package/core/i18n/i18n-type.d.ts +20 -0
- package/core/index.d.ts +83 -0
- package/core/log/log-publisher-console.service.d.ts +4 -0
- package/core/log/log.model.d.ts +40 -0
- package/core/log/logger.service.d.ts +33 -0
- package/core/models/class-service.model.d.ts +7 -0
- package/core/models/getter.model.d.ts +2 -0
- package/core/models/i18n.model.d.ts +1 -0
- package/core/models/menu.model.d.ts +32 -0
- package/core/models/user.model.d.ts +8 -0
- package/core/pipes/boolean.pipe.d.ts +7 -0
- package/core/pipes/class-map.pipe.d.ts +7 -0
- package/core/pipes/enum.pipe.d.ts +8 -0
- package/core/pipes/enumerate-async.pipe.d.ts +9 -0
- package/core/pipes/enumerate.pipe.d.ts +16 -0
- package/core/pipes/getter.pipe.d.ts +8 -0
- package/core/pipes/i18n-property.pipe.d.ts +8 -0
- package/core/pipes/json-path.pipe.d.ts +13 -0
- package/core/pipes/parametrize.pipe.d.ts +12 -0
- package/core/pipes/template.pipe.d.ts +8 -0
- package/core/provide.d.ts +12 -0
- package/core/reflect/type-enum-metadata.d.ts +32 -0
- package/core/registry/registry.model.d.ts +8 -0
- package/core/registry/type-registry.d.ts +27 -0
- package/core/router/route-builder.d.ts +65 -0
- package/core/router/router.model.d.ts +13 -0
- package/core/router/routes-builder.d.ts +18 -0
- package/core/rxjs/map-data-list-result-operator.d.ts +9 -0
- package/core/security/permission-helpers.d.ts +3 -0
- package/core/security/permission.guard.d.ts +2 -0
- package/core/security/permission.service.d.ts +16 -0
- package/core/security/permissions.model.d.ts +55 -0
- package/core/services/commons-configuration.service.d.ts +69 -0
- package/core/services/commons-init.service.d.ts +30 -0
- package/core/services/commons-router.service.d.ts +37 -0
- package/core/services/commons.service.d.ts +66 -0
- package/core/services/local-storage-config.service.d.ts +11 -0
- package/core/services/providers/commons-init.provider.d.ts +4 -0
- package/core/services/tokens/browser-storage.token.d.ts +2 -0
- package/core/services/tokens/commons-init.token.d.ts +3 -0
- package/core/services/tokens/log-publisher.token.d.ts +3 -0
- package/core/services/tokens/module-config.token.d.ts +34 -0
- package/core/styles/style-constants.d.ts +10 -0
- package/core/styles/style.model.d.ts +17 -0
- package/dev-scripts/version-info.js +1 -1
- package/esm2022/core/action/action-data.model.mjs +2 -0
- package/esm2022/core/action/action-parameters.model.mjs +2 -0
- package/esm2022/core/components/notification/notification-wrapper.component.mjs +50 -0
- package/esm2022/core/components/pages/error/error.page.component.mjs +21 -0
- package/esm2022/core/components/pages/not-found/not-found.page.component.mjs +21 -0
- package/esm2022/core/data-list/data-list-params-helpers.mjs +415 -0
- package/esm2022/core/data-list/data-list.model.mjs +2 -0
- package/esm2022/core/data-list/filter-match.model.mjs +105 -0
- package/esm2022/core/data-providers/base.data-provider.mjs +48 -0
- package/esm2022/core/data-providers/lookup.data-provider.mjs +2 -0
- package/esm2022/core/descriptors/action.descriptor.mjs +2 -0
- package/esm2022/core/descriptors/column.descriptor.mjs +2 -0
- package/esm2022/core/descriptors/editor.descriptor.mjs +2 -0
- package/esm2022/core/descriptors/enum.descriptor.mjs +2 -0
- package/esm2022/core/descriptors/filter.descriptor.mjs +2 -0
- package/esm2022/core/descriptors/lookup.descriptor.mjs +2 -0
- package/esm2022/core/descriptors/model.descriptor.mjs +2 -0
- package/esm2022/core/descriptors/table.descriptor.mjs +2 -0
- package/esm2022/core/descriptors/tableview.descriptor.mjs +2 -0
- package/esm2022/core/directives/component.directive.mjs +72 -0
- package/esm2022/core/directives/dialog-keydown-handler.directive.mjs +49 -0
- package/esm2022/core/directives/template.directive.mjs +29 -0
- package/esm2022/core/enum/enum-helpers.mjs +81 -0
- package/esm2022/core/enum/enum.model.mjs +2 -0
- package/esm2022/core/error/error-handler.mjs +20 -0
- package/esm2022/core/error/error-helpers.mjs +247 -0
- package/esm2022/core/error/error.model.mjs +32 -0
- package/esm2022/core/helpers/coercion.mjs +52 -0
- package/esm2022/core/helpers/date.mjs +119 -0
- package/esm2022/core/helpers/notification.mjs +6 -0
- package/esm2022/core/helpers/object.mjs +145 -0
- package/esm2022/core/helpers/route.mjs +58 -0
- package/esm2022/core/helpers/string.mjs +57 -0
- package/esm2022/core/helpers/templates.mjs +4 -0
- package/esm2022/core/helpers/type-helpers.mjs +2 -0
- package/esm2022/core/i18n/i18n-common.mjs +24 -0
- package/esm2022/core/i18n/i18n-error.mjs +27 -0
- package/esm2022/core/i18n/i18n-type.mjs +79 -0
- package/esm2022/core/index.mjs +105 -0
- package/esm2022/core/log/log-publisher-console.service.mjs +40 -0
- package/esm2022/core/log/log.model.mjs +10 -0
- package/esm2022/core/log/logger.service.mjs +131 -0
- package/esm2022/core/mediusinc-mng-commons-core.mjs +5 -0
- package/esm2022/core/models/class-attribute.model.mjs +2 -0
- package/esm2022/core/models/class-service.model.mjs +2 -0
- package/esm2022/core/models/getter.model.mjs +2 -0
- package/esm2022/core/models/i18n.model.mjs +2 -0
- package/esm2022/core/models/menu.model.mjs +2 -0
- package/esm2022/core/models/user.model.mjs +2 -0
- package/esm2022/core/models/version.model.mjs +2 -0
- package/esm2022/core/pipes/boolean.pipe.mjs +28 -0
- package/esm2022/core/pipes/class-map.pipe.mjs +23 -0
- package/esm2022/core/pipes/enum.pipe.mjs +27 -0
- package/esm2022/core/pipes/enumerate-async.pipe.mjs +36 -0
- package/esm2022/core/pipes/enumerate.pipe.mjs +49 -0
- package/esm2022/core/pipes/getter.pipe.mjs +21 -0
- package/esm2022/core/pipes/i18n-property.pipe.mjs +19 -0
- package/esm2022/core/pipes/json-path.pipe.mjs +25 -0
- package/esm2022/core/pipes/parametrize.pipe.mjs +86 -0
- package/esm2022/core/pipes/template.pipe.mjs +25 -0
- package/esm2022/core/provide.mjs +78 -0
- package/esm2022/core/reflect/type-enum-decorator.mjs +12 -0
- package/esm2022/core/reflect/type-enum-metadata.mjs +62 -0
- package/esm2022/core/registry/registry.model.mjs +2 -0
- package/esm2022/core/registry/type-registry.mjs +106 -0
- package/esm2022/core/router/route-builder.mjs +320 -0
- package/esm2022/core/router/router.model.mjs +2 -0
- package/esm2022/core/router/routes-builder.mjs +54 -0
- package/esm2022/core/rxjs/map-data-list-result-operator.mjs +19 -0
- package/esm2022/core/security/permission-helpers.mjs +14 -0
- package/esm2022/core/security/permission.guard.mjs +15 -0
- package/esm2022/core/security/permission.service.mjs +49 -0
- package/esm2022/core/security/permissions.model.mjs +93 -0
- package/esm2022/core/services/commons-configuration.service.mjs +174 -0
- package/esm2022/core/services/commons-init.service.mjs +111 -0
- package/esm2022/core/services/commons-router.service.mjs +180 -0
- package/esm2022/core/services/commons.service.mjs +390 -0
- package/esm2022/core/services/local-storage-config.service.mjs +29 -0
- package/esm2022/core/services/providers/commons-init.provider.mjs +4 -0
- package/esm2022/core/services/tokens/browser-storage.token.mjs +3 -0
- package/esm2022/core/services/tokens/commons-init.token.mjs +3 -0
- package/esm2022/core/services/tokens/log-publisher.token.mjs +3 -0
- package/esm2022/core/services/tokens/module-config.token.mjs +3 -0
- package/esm2022/core/styles/style-constants.mjs +11 -0
- package/esm2022/core/styles/style.model.mjs +20 -0
- package/esm2022/filter/descriptors/filter-lookup.descriptor.mjs +185 -0
- package/esm2022/filter/descriptors/filter.descriptor.mjs +197 -0
- package/esm2022/filter/index.mjs +6 -0
- package/esm2022/filter/mediusinc-mng-commons-filter.mjs +5 -0
- package/esm2022/filter/models/filter.model.mjs +15 -0
- package/esm2022/form/api/data-providers/lookup.data-provider.mjs +45 -0
- package/esm2022/form/api/descriptors/action-button.descriptor.mjs +68 -0
- package/esm2022/form/api/descriptors/button-style.builder.mjs +174 -0
- package/esm2022/form/api/index.mjs +8 -0
- package/esm2022/form/api/mediusinc-mng-commons-form-api.mjs +5 -0
- package/esm2022/form/api/models/trim.model.mjs +2 -0
- package/esm2022/form/components/autocomplete/autocomplete.component.mjs +404 -0
- package/esm2022/form/components/date-range/date-range.component.mjs +110 -0
- package/esm2022/form/components/dropdown/dropdown.component.mjs +213 -0
- package/esm2022/form/directives/input-trim.directive.mjs +55 -0
- package/esm2022/form/index.mjs +7 -0
- package/esm2022/form/mediusinc-mng-commons-form.mjs +5 -0
- package/esm2022/index.mjs +2 -74
- package/esm2022/model/descriptors/enum.descriptor.mjs +31 -0
- package/esm2022/model/descriptors/model.descriptor.mjs +78 -0
- package/esm2022/model/descriptors/type.descriptor.mjs +21 -0
- package/esm2022/model/helpers/i18n.mjs +45 -0
- package/esm2022/model/helpers/model.mjs +71 -0
- package/esm2022/model/index.mjs +8 -0
- package/esm2022/model/mediusinc-mng-commons-model.mjs +5 -0
- package/esm2022/provide.mjs +6 -0
- package/esm2022/table/api/data-providers/table.data-provider.mjs +63 -0
- package/esm2022/table/api/descriptors/column.descriptor.mjs +359 -0
- package/esm2022/table/api/descriptors/sort.descriptor.mjs +45 -0
- package/esm2022/table/api/descriptors/table.descriptor.mjs +778 -0
- package/esm2022/table/api/helpers/class-attribute-converter.mjs +104 -0
- package/esm2022/table/api/index.mjs +16 -0
- package/esm2022/table/api/mediusinc-mng-commons-table-api.mjs +5 -0
- package/esm2022/table/api/models/class-table-attribute.model.mjs +2 -0
- package/esm2022/table/api/models/column-value.model.mjs +2 -0
- package/esm2022/table/api/models/column.model.mjs +21 -0
- package/esm2022/table/api/models/table-columns.model.mjs +2 -0
- package/esm2022/table/api/models/table-event.model.mjs +2 -0
- package/esm2022/table/api/models/table.model.mjs +22 -0
- package/esm2022/table/components/column-filter-full/column-filter-full.component.mjs +594 -0
- package/esm2022/table/components/column-value/column-value.component.mjs +86 -0
- package/esm2022/table/components/table/table.component.mjs +630 -0
- package/esm2022/table/helpers/notification.mjs +15 -0
- package/esm2022/table/helpers/table-layout-prefs.mjs +10 -0
- package/esm2022/table/index.mjs +13 -0
- package/esm2022/table/mediusinc-mng-commons-table.mjs +5 -0
- package/esm2022/table/models/column-preferences.model.mjs +2 -0
- package/esm2022/table/pipes/locale-default-row-class.pipe.mjs +27 -0
- package/esm2022/table/pipes/table-column-filter-class.pipe.mjs +25 -0
- package/esm2022/table/services/data-list.service.mjs +23 -0
- package/esm2022/tableview/action/components/action/action.component.mjs +323 -0
- package/esm2022/tableview/action/components/editor/action-editor.component.mjs +97 -0
- package/esm2022/tableview/action/components/editor/injector-context/action-editor-injector-context.component.mjs +398 -0
- package/esm2022/tableview/action/components/localization/data-language-dropdown.component.mjs +53 -0
- package/esm2022/tableview/action/components/route/action-route.component.mjs +152 -0
- package/esm2022/tableview/action/components/table/action-table.component.mjs +146 -0
- package/esm2022/tableview/action/guards/unsaved-changes.guard.mjs +4 -0
- package/esm2022/tableview/action/helpers/i18n.mjs +82 -0
- package/esm2022/tableview/action/helpers/notification.mjs +17 -0
- package/esm2022/tableview/action/helpers/styles.mjs +32 -0
- package/esm2022/tableview/action/models/action-editor-dialog-data.model.mjs +2 -0
- package/esm2022/tableview/action/models/can-component-deactivate.model.mjs +2 -0
- package/esm2022/tableview/action/models/execution/action-context.model.mjs +56 -0
- package/esm2022/tableview/action/models/execution/action-instance-state.model.mjs +32 -0
- package/esm2022/tableview/action/models/execution/action-instance.model.mjs +170 -0
- package/esm2022/tableview/action/services/action-error-mapper.service.mjs +20 -0
- package/esm2022/tableview/action/services/action-executor.service.mjs +767 -0
- package/esm2022/tableview/action/services/component-action-executor.service.mjs +19 -0
- package/esm2022/tableview/action/services/data-provider-executor.service.mjs +26 -0
- package/esm2022/tableview/action/services/navigation.service.mjs +52 -0
- package/esm2022/tableview/action/services/providers/provide-action-executor.mjs +9 -0
- package/esm2022/tableview/action/services/providers/provide-view-container.mjs +17 -0
- package/esm2022/tableview/action/services/root-action-executor.service.mjs +18 -0
- package/esm2022/tableview/action/services/tokens/action-editor.token.mjs +3 -0
- package/esm2022/tableview/action/services/view-container.service.mjs +56 -0
- package/esm2022/tableview/api/action/descriptors/action-confirmation.descriptor.mjs +76 -0
- package/esm2022/tableview/api/action/descriptors/action-editor.descriptor.mjs +264 -0
- package/esm2022/tableview/api/action/descriptors/action-link.descriptor.mjs +89 -0
- package/esm2022/tableview/api/action/descriptors/action.descriptor.mjs +385 -0
- package/esm2022/tableview/api/action/helpers/data-provider-executors.mjs +80 -0
- package/esm2022/tableview/api/action/models/action-component.model.mjs +2 -0
- package/esm2022/tableview/api/action/models/action-descriptor.types.mjs +2 -0
- package/esm2022/tableview/api/action/models/action-editor.model.mjs +2 -0
- package/esm2022/tableview/api/action/models/action-error.model.mjs +14 -0
- package/esm2022/tableview/api/action/models/action.type.mjs +26 -0
- package/esm2022/tableview/api/action/models/execution/action-context-validation.model.mjs +2 -0
- package/esm2022/tableview/api/action/models/execution/action-context.model.mjs +2 -0
- package/esm2022/tableview/api/action/models/execution/action-execution-error.model.mjs +2 -0
- package/esm2022/tableview/api/action/models/execution/action-instance-state.model.mjs +32 -0
- package/esm2022/tableview/api/action/models/execution/action-instance.model.mjs +2 -0
- package/esm2022/tableview/api/action/models/execution/view-container.model.mjs +2 -0
- package/esm2022/tableview/api/action/models/tableview-action-default-categories.model.mjs +11 -0
- package/esm2022/tableview/api/action/services/data-provider-executor.service.mjs +28 -0
- package/esm2022/tableview/api/action/services/tokens/data-language-dropdown.token.mjs +3 -0
- package/esm2022/tableview/api/editor/data-providers/editor.data-provider.mjs +104 -0
- package/esm2022/tableview/api/editor/descriptors/editor.descriptor.mjs +626 -0
- package/esm2022/tableview/api/editor/descriptors/field-action.descriptor.mjs +49 -0
- package/esm2022/tableview/api/editor/descriptors/field-base.descriptor.mjs +288 -0
- package/esm2022/tableview/api/editor/descriptors/field-group.descriptor.mjs +97 -0
- package/esm2022/tableview/api/editor/descriptors/field-lookup.descriptor.mjs +213 -0
- package/esm2022/tableview/api/editor/descriptors/field-many.descriptor.mjs +153 -0
- package/esm2022/tableview/api/editor/descriptors/field-validation.descriptor.mjs +25 -0
- package/esm2022/tableview/api/editor/descriptors/field.descriptor.mjs +343 -0
- package/esm2022/tableview/api/editor/helpers/class-attribute-converter.mjs +85 -0
- package/esm2022/tableview/api/editor/helpers/field-validators.mjs +33 -0
- package/esm2022/tableview/api/editor/models/class-tableview-attribute.model.mjs +2 -0
- package/esm2022/tableview/api/editor/models/editor-fields.model.mjs +2 -0
- package/esm2022/tableview/api/editor/models/editor.model.mjs +9 -0
- package/esm2022/tableview/api/editor/models/field-action-context.model.mjs +2 -0
- package/esm2022/tableview/api/editor/models/field.model.mjs +56 -0
- package/esm2022/tableview/api/editor/models/form-editor.event.mjs +27 -0
- package/esm2022/tableview/api/editor/models/form-editor.interface.mjs +2 -0
- package/esm2022/tableview/api/editor/models/formly-custom-field.model.mjs +69 -0
- package/esm2022/tableview/api/editor/models/formly-field.model.mjs +2 -0
- package/esm2022/tableview/api/editor/models/radio.model.mjs +2 -0
- package/esm2022/tableview/api/index.mjs +64 -0
- package/esm2022/tableview/api/mediusinc-mng-commons-tableview-api.mjs +5 -0
- package/esm2022/tableview/api/tableview/data-providers/tableview.data-provider.mjs +105 -0
- package/esm2022/tableview/api/tableview/descriptors/tableview.descriptor.mjs +672 -0
- package/esm2022/tableview/api/tableview/helpers/class-attribute-converter.mjs +34 -0
- package/esm2022/tableview/api/tableview/helpers/files-export.mjs +34 -0
- package/esm2022/tableview/api/tableview/helpers/tableview-create.mjs +24 -0
- package/esm2022/tableview/api/tableview/helpers/tableview-default-actions.mjs +240 -0
- package/esm2022/tableview/api/tableview/helpers/tableview-input-builder.mjs +162 -0
- package/esm2022/tableview/api/tableview/models/class-tableview-attribute.model.mjs +2 -0
- package/esm2022/tableview/api/tableview/models/tableview-input.model.mjs +2 -0
- package/esm2022/tableview/api/tableview/models/tableview-route.model.mjs +2 -0
- package/esm2022/tableview/editor/components/editor/form-editor.component.mjs +285 -0
- package/esm2022/tableview/editor/components/formly/fields/formly-field-action/formly-field-action.component.mjs +61 -0
- package/esm2022/tableview/editor/components/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.mjs +54 -0
- package/esm2022/tableview/editor/components/formly/fields/formly-field-custom/formly-field-custom.component.mjs +39 -0
- package/esm2022/tableview/editor/components/formly/fields/formly-field-dropdown/formly-field-dropdown.component.mjs +49 -0
- package/esm2022/tableview/editor/components/formly/fields/formly-field-fieldset/formly-field-fieldset.component.mjs +27 -0
- package/esm2022/tableview/editor/components/formly/fields/formly-field-input/formly-field-input.component.mjs +220 -0
- package/esm2022/tableview/editor/components/formly/fields/formly-field-label/formly-field-label.component.mjs +24 -0
- package/esm2022/tableview/editor/components/formly/fields/formly-field-lookup-dialog/formly-field-lookup-dialog.component.mjs +215 -0
- package/esm2022/tableview/editor/components/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +217 -0
- package/esm2022/tableview/editor/components/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.mjs +196 -0
- package/esm2022/tableview/editor/components/formly/fields/formly-field-tabs/formly-field-tabs.component.mjs +18 -0
- package/esm2022/tableview/editor/components/formly/wrappers/formly-field-no-label-wrapper/formly-field-no-label-wrapper.component.mjs +33 -0
- package/esm2022/tableview/editor/components/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.mjs +30 -0
- package/esm2022/tableview/editor/helpers/editor-formly.mjs +335 -0
- package/esm2022/tableview/editor/helpers/formly-config.mjs +260 -0
- package/esm2022/tableview/editor/helpers/notification.mjs +11 -0
- package/esm2022/tableview/editor/models/formly-config.model.mjs +2 -0
- package/esm2022/tableview/editor/services/formly-config.provider.mjs +31 -0
- package/esm2022/tableview/index.mjs +62 -0
- package/esm2022/tableview/mediusinc-mng-commons-tableview.mjs +5 -0
- package/esm2022/tableview/provide.mjs +62 -0
- package/esm2022/tableview/tableview/components/route/tableview-route.component.mjs +15 -0
- package/esm2022/tableview/tableview/components/tableview/tableview.component.mjs +75 -0
- package/esm2022/tableview/tableview/router/tableview-route-builder.mjs +201 -0
- package/esm2022/tableview/tableview/services/tableview-feature-config.token.mjs +3 -0
- package/fesm2022/mediusinc-mng-commons-core.mjs +3882 -0
- package/fesm2022/mediusinc-mng-commons-core.mjs.map +1 -0
- package/fesm2022/mediusinc-mng-commons-filter.mjs +402 -0
- package/fesm2022/mediusinc-mng-commons-filter.mjs.map +1 -0
- package/fesm2022/mediusinc-mng-commons-form-api.mjs +294 -0
- package/fesm2022/mediusinc-mng-commons-form-api.mjs.map +1 -0
- package/fesm2022/mediusinc-mng-commons-form.mjs +770 -0
- package/fesm2022/mediusinc-mng-commons-form.mjs.map +1 -0
- package/fesm2022/mediusinc-mng-commons-model.mjs +251 -0
- package/fesm2022/mediusinc-mng-commons-model.mjs.map +1 -0
- package/fesm2022/mediusinc-mng-commons-table-api.mjs +1391 -0
- package/fesm2022/mediusinc-mng-commons-table-api.mjs.map +1 -0
- package/fesm2022/mediusinc-mng-commons-table.mjs +1376 -0
- package/fesm2022/mediusinc-mng-commons-table.mjs.map +1 -0
- package/fesm2022/mediusinc-mng-commons-tableview-api.mjs +4372 -0
- package/fesm2022/mediusinc-mng-commons-tableview-api.mjs.map +1 -0
- package/fesm2022/mediusinc-mng-commons-tableview.mjs +4691 -0
- package/fesm2022/mediusinc-mng-commons-tableview.mjs.map +1 -0
- package/fesm2022/mediusinc-mng-commons.mjs +5 -18605
- package/fesm2022/mediusinc-mng-commons.mjs.map +1 -1
- package/filter/README.md +9 -0
- package/filter/descriptors/filter-lookup.descriptor.d.ts +67 -0
- package/filter/descriptors/filter.descriptor.d.ts +67 -0
- package/filter/index.d.ts +3 -0
- package/form/README.md +8 -0
- package/form/api/README.md +7 -0
- package/form/api/data-providers/lookup.data-provider.d.ts +19 -0
- package/form/api/descriptors/action-button.descriptor.d.ts +25 -0
- package/form/api/descriptors/button-style.builder.d.ts +68 -0
- package/form/api/index.d.ts +4 -0
- package/form/components/autocomplete/autocomplete.component.d.ts +82 -0
- package/form/components/date-range/date-range.component.d.ts +28 -0
- package/form/components/dropdown/dropdown.component.d.ts +55 -0
- package/form/directives/input-trim.directive.d.ts +14 -0
- package/form/index.d.ts +4 -0
- package/index.d.ts +1 -50
- package/model/README.md +7 -0
- package/model/descriptors/enum.descriptor.d.ts +14 -0
- package/model/descriptors/model.descriptor.d.ts +31 -0
- package/model/descriptors/type.descriptor.d.ts +10 -0
- package/model/helpers/i18n.d.ts +10 -0
- package/model/helpers/model.d.ts +5 -0
- package/model/index.d.ts +5 -0
- package/package.json +61 -25
- package/provide.d.ts +7 -0
- package/table/README.md +11 -0
- package/table/api/README.md +9 -0
- package/table/api/data-providers/table.data-provider.d.ts +38 -0
- package/table/api/descriptors/column.descriptor.d.ts +148 -0
- package/table/api/descriptors/table.descriptor.d.ts +281 -0
- package/table/api/helpers/class-attribute-converter.d.ts +22 -0
- package/table/api/index.d.ts +11 -0
- package/table/api/models/class-table-attribute.model.d.ts +8 -0
- package/table/api/models/column-value.model.d.ts +7 -0
- package/table/api/models/table-columns.model.d.ts +42 -0
- package/table/api/models/table-event.model.d.ts +17 -0
- package/table/api/models/table.model.d.ts +35 -0
- package/table/components/column-filter-full/column-filter-full.component.d.ts +100 -0
- package/table/components/column-value/column-value.component.d.ts +32 -0
- package/table/components/table/table.component.d.ts +114 -0
- package/table/helpers/notification.d.ts +4 -0
- package/table/helpers/table-layout-prefs.d.ts +7 -0
- package/table/index.d.ts +8 -0
- package/table/models/column-preferences.model.d.ts +12 -0
- package/table/pipes/locale-default-row-class.pipe.d.ts +10 -0
- package/table/pipes/table-column-filter-class.pipe.d.ts +8 -0
- package/table/services/data-list.service.d.ts +16 -0
- package/tableview/README.md +13 -0
- package/tableview/action/components/action/action.component.d.ts +73 -0
- package/tableview/action/components/editor/action-editor.component.d.ts +31 -0
- package/tableview/action/components/editor/injector-context/action-editor-injector-context.component.d.ts +76 -0
- package/tableview/action/components/localization/data-language-dropdown.component.d.ts +22 -0
- package/tableview/action/components/route/action-route.component.d.ts +31 -0
- package/tableview/action/components/table/action-table.component.d.ts +48 -0
- package/tableview/action/guards/unsaved-changes.guard.d.ts +3 -0
- package/tableview/action/helpers/i18n.d.ts +22 -0
- package/tableview/action/helpers/notification.d.ts +6 -0
- package/tableview/action/helpers/styles.d.ts +5 -0
- package/tableview/action/models/action-editor-dialog-data.model.d.ts +11 -0
- package/tableview/action/models/execution/action-context.model.d.ts +36 -0
- package/tableview/action/models/execution/action-instance-state.model.d.ts +30 -0
- package/tableview/action/models/execution/action-instance.model.d.ts +56 -0
- package/tableview/action/services/action-error-mapper.service.d.ts +18 -0
- package/tableview/action/services/action-executor.service.d.ts +175 -0
- package/tableview/action/services/component-action-executor.service.d.ts +9 -0
- package/tableview/action/services/data-provider-executor.service.d.ts +23 -0
- package/tableview/action/services/navigation.service.d.ts +15 -0
- package/tableview/action/services/root-action-executor.service.d.ts +9 -0
- package/tableview/action/services/tokens/action-editor.token.d.ts +2 -0
- package/tableview/action/services/view-container.service.d.ts +30 -0
- package/tableview/api/README.md +11 -0
- package/tableview/api/action/descriptors/action-confirmation.descriptor.d.ts +36 -0
- package/tableview/api/action/descriptors/action-editor.descriptor.d.ts +117 -0
- package/tableview/api/action/descriptors/action-link.descriptor.d.ts +34 -0
- package/tableview/api/action/descriptors/action.descriptor.d.ts +151 -0
- package/tableview/api/action/helpers/data-provider-executors.d.ts +18 -0
- package/tableview/api/action/models/action-component.model.d.ts +12 -0
- package/tableview/api/action/models/action-descriptor.types.d.ts +5 -0
- package/tableview/api/action/models/action-editor.model.d.ts +4 -0
- package/tableview/api/action/models/action-error.model.d.ts +14 -0
- package/tableview/api/action/models/action.type.d.ts +21 -0
- package/tableview/api/action/models/execution/action-context-validation.model.d.ts +11 -0
- package/tableview/api/action/models/execution/action-context.model.d.ts +24 -0
- package/tableview/api/action/models/execution/action-execution-error.model.d.ts +4 -0
- package/tableview/api/action/models/execution/action-instance-state.model.d.ts +30 -0
- package/tableview/api/action/models/execution/action-instance.model.d.ts +31 -0
- package/tableview/api/action/models/execution/view-container.model.d.ts +38 -0
- package/tableview/api/action/services/data-provider-executor.service.d.ts +38 -0
- package/tableview/api/action/services/tokens/data-language-dropdown.token.d.ts +2 -0
- package/tableview/api/editor/data-providers/editor.data-provider.d.ts +87 -0
- package/tableview/api/editor/descriptors/editor.descriptor.d.ts +366 -0
- package/tableview/api/editor/descriptors/field-action.descriptor.d.ts +22 -0
- package/tableview/api/editor/descriptors/field-base.descriptor.d.ts +120 -0
- package/tableview/api/editor/descriptors/field-group.descriptor.d.ts +41 -0
- package/tableview/api/editor/descriptors/field-lookup.descriptor.d.ts +80 -0
- package/tableview/api/editor/descriptors/field-many.descriptor.d.ts +61 -0
- package/tableview/api/editor/descriptors/field-validation.descriptor.d.ts +19 -0
- package/tableview/api/editor/descriptors/field.descriptor.d.ts +168 -0
- package/tableview/api/editor/helpers/class-attribute-converter.d.ts +21 -0
- package/tableview/api/editor/helpers/field-validators.d.ts +3 -0
- package/tableview/api/editor/models/class-tableview-attribute.model.d.ts +7 -0
- package/tableview/api/editor/models/editor-fields.model.d.ts +34 -0
- package/tableview/api/editor/models/editor.model.d.ts +7 -0
- package/tableview/api/editor/models/field-action-context.model.d.ts +24 -0
- package/tableview/api/editor/models/field.model.d.ts +66 -0
- package/tableview/api/editor/models/form-editor.event.d.ts +55 -0
- package/tableview/api/editor/models/formly-custom-field.model.d.ts +27 -0
- package/tableview/api/editor/models/formly-field.model.d.ts +18 -0
- package/tableview/api/index.d.ts +50 -0
- package/tableview/api/tableview/data-providers/tableview.data-provider.d.ts +43 -0
- package/tableview/api/tableview/descriptors/tableview.descriptor.d.ts +296 -0
- package/tableview/api/tableview/helpers/class-attribute-converter.d.ts +8 -0
- package/tableview/api/tableview/helpers/files-export.d.ts +4 -0
- package/tableview/api/tableview/helpers/tableview-create.d.ts +16 -0
- package/tableview/api/tableview/helpers/tableview-default-actions.d.ts +38 -0
- package/tableview/api/tableview/helpers/tableview-input-builder.d.ts +114 -0
- package/tableview/api/tableview/models/class-tableview-attribute.model.d.ts +3 -0
- package/tableview/api/tableview/models/tableview-input.model.d.ts +8 -0
- package/tableview/api/tableview/models/tableview-route.model.d.ts +20 -0
- package/tableview/editor/components/editor/form-editor.component.d.ts +50 -0
- package/tableview/editor/components/formly/fields/formly-field-action/formly-field-action.component.d.ts +14 -0
- package/tableview/editor/components/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.d.ts +15 -0
- package/tableview/editor/components/formly/fields/formly-field-custom/formly-field-custom.component.d.ts +11 -0
- package/tableview/editor/components/formly/fields/formly-field-dropdown/formly-field-dropdown.component.d.ts +14 -0
- package/tableview/editor/components/formly/fields/formly-field-fieldset/formly-field-fieldset.component.d.ts +12 -0
- package/tableview/editor/components/formly/fields/formly-field-input/formly-field-input.component.d.ts +37 -0
- package/tableview/editor/components/formly/fields/formly-field-label/formly-field-label.component.d.ts +11 -0
- package/tableview/editor/components/formly/fields/formly-field-lookup-dialog/formly-field-lookup-dialog.component.d.ts +43 -0
- package/tableview/editor/components/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.d.ts +23 -0
- package/tableview/editor/components/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.d.ts +41 -0
- package/tableview/editor/components/formly/fields/formly-field-tabs/formly-field-tabs.component.d.ts +7 -0
- package/tableview/editor/components/formly/wrappers/formly-field-no-label-wrapper/formly-field-no-label-wrapper.component.d.ts +11 -0
- package/tableview/editor/components/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.d.ts +9 -0
- package/tableview/editor/helpers/editor-formly.d.ts +10 -0
- package/tableview/editor/helpers/formly-config.d.ts +18 -0
- package/tableview/editor/helpers/notification.d.ts +4 -0
- package/tableview/editor/models/formly-config.model.d.ts +5 -0
- package/tableview/editor/services/formly-config.provider.d.ts +5 -0
- package/tableview/index.d.ts +48 -0
- package/tableview/provide.d.ts +8 -0
- package/tableview/tableview/components/route/tableview-route.component.d.ts +7 -0
- package/tableview/tableview/components/tableview/tableview.component.d.ts +26 -0
- package/tableview/tableview/router/tableview-route-builder.d.ts +42 -0
- package/tableview/tableview/services/tableview-feature-config.token.d.ts +18 -0
- package/assets/fonts/poppins-v20-latin-500.woff +0 -0
- package/assets/fonts/poppins-v20-latin-500.woff2 +0 -0
- package/assets/fonts/poppins-v20-latin-600.woff +0 -0
- package/assets/fonts/poppins-v20-latin-600.woff2 +0 -0
- package/assets/fonts/poppins-v20-latin-700.woff +0 -0
- package/assets/fonts/poppins-v20-latin-700.woff2 +0 -0
- package/assets/fonts/poppins-v20-latin-regular.woff +0 -0
- package/assets/fonts/poppins-v20-latin-regular.woff2 +0 -0
- package/assets/images/effect-ondark.png +0 -0
- package/assets/images/effect-ondark.svg +0 -38
- package/assets/images/effect-ondark@2x.png +0 -0
- package/assets/images/effect-onlight.png +0 -0
- package/assets/images/effect-onlight.svg +0 -38
- package/assets/images/effect-onlight@2x.png +0 -0
- package/assets/images/pages/exception-ondark.png +0 -0
- package/assets/images/pages/exception-onlight.png +0 -0
- package/assets/images/pages/login-ondark.png +0 -0
- package/assets/images/pages/login-onlight.png +0 -0
- package/data-api/README.md +0 -3
- package/data-api/class-dto/README.md +0 -3
- package/data-api/class-dto/helpers/tableview-crud-create.d.ts +0 -40
- package/data-api/class-dto/index.d.ts +0 -7
- package/data-api/class-dto/models/query-result.model.d.ts +0 -13
- package/data-api/class-dto/obsolete/README.md +0 -3
- package/data-api/class-dto/obsolete/helpers/query-param-convert.d.ts +0 -23
- package/data-api/class-dto/obsolete/helpers/tableview-crud-create.d.ts +0 -22
- package/data-api/class-dto/obsolete/index.d.ts +0 -14
- package/data-api/class-dto/obsolete/models/builders/query-param.builder.d.ts +0 -36
- package/data-api/class-dto/obsolete/models/filter-match-type.model.d.ts +0 -25
- package/data-api/class-dto/obsolete/models/filter-param.model.d.ts +0 -23
- package/data-api/class-dto/obsolete/models/query-mode.model.d.ts +0 -16
- package/data-api/class-dto/obsolete/models/query-param.model.d.ts +0 -31
- package/data-api/class-dto/obsolete/models/query-result.model.d.ts +0 -24
- package/data-api/class-dto/obsolete/provide.d.ts +0 -9
- package/data-api/class-dto/obsolete/services/api.abstract.service.d.ts +0 -36
- package/data-api/class-dto/obsolete/services/crud-api.abstract.service.d.ts +0 -37
- package/data-api/class-dto/obsolete/services/get-all-api.abstract.service.d.ts +0 -30
- package/data-api/class-dto/obsolete/tableview/tableview-crud.data-provider.d.ts +0 -28
- package/data-api/class-dto/obsolete/utils/query-param-map.util.d.ts +0 -22
- package/data-api/class-dto/serder/object-serializer.d.ts +0 -26
- package/data-api/class-dto/services/api.abstract.service.d.ts +0 -22
- package/data-api/class-dto/services/crud-api.abstract.service.d.ts +0 -25
- package/data-api/class-dto/services/get-all-api.abstract.service.d.ts +0 -14
- package/data-api/class-dto/tableview/tableview-crud.data-provider.d.ts +0 -17
- package/data-api/helpers/get-all-params.d.ts +0 -69
- package/data-api/helpers/tableview-get-all-params-create.d.ts +0 -14
- package/data-api/index.d.ts +0 -5
- package/data-api/models/request-params.model.d.ts +0 -61
- package/data-api/rxjs/map-to-data-list.operator.d.ts +0 -9
- package/data-api/types/extract-get-all-params.type.d.ts +0 -14
- package/esm2022/data-api/class-dto/helpers/tableview-crud-create.mjs +0 -40
- package/esm2022/data-api/class-dto/index.mjs +0 -13
- package/esm2022/data-api/class-dto/mediusinc-mng-commons-data-api-class-dto.mjs +0 -5
- package/esm2022/data-api/class-dto/models/query-result.model.mjs +0 -24
- package/esm2022/data-api/class-dto/obsolete/helpers/query-param-convert.mjs +0 -103
- package/esm2022/data-api/class-dto/obsolete/helpers/tableview-crud-create.mjs +0 -21
- package/esm2022/data-api/class-dto/obsolete/index.mjs +0 -21
- package/esm2022/data-api/class-dto/obsolete/mediusinc-mng-commons-data-api-class-dto-obsolete.mjs +0 -5
- package/esm2022/data-api/class-dto/obsolete/models/builders/query-param.builder.mjs +0 -83
- package/esm2022/data-api/class-dto/obsolete/models/filter-match-type.model.mjs +0 -27
- package/esm2022/data-api/class-dto/obsolete/models/filter-param.model.mjs +0 -33
- package/esm2022/data-api/class-dto/obsolete/models/query-mode.model.mjs +0 -18
- package/esm2022/data-api/class-dto/obsolete/models/query-param.model.mjs +0 -68
- package/esm2022/data-api/class-dto/obsolete/models/query-result.model.mjs +0 -24
- package/esm2022/data-api/class-dto/obsolete/provide.mjs +0 -40
- package/esm2022/data-api/class-dto/obsolete/services/api.abstract.service.mjs +0 -70
- package/esm2022/data-api/class-dto/obsolete/services/crud-api.abstract.service.mjs +0 -83
- package/esm2022/data-api/class-dto/obsolete/services/get-all-api.abstract.service.mjs +0 -38
- package/esm2022/data-api/class-dto/obsolete/tableview/tableview-crud.data-provider.mjs +0 -51
- package/esm2022/data-api/class-dto/obsolete/utils/query-param-map.util.mjs +0 -57
- package/esm2022/data-api/class-dto/serder/object-serializer.mjs +0 -184
- package/esm2022/data-api/class-dto/services/api.abstract.service.mjs +0 -55
- package/esm2022/data-api/class-dto/services/crud-api.abstract.service.mjs +0 -82
- package/esm2022/data-api/class-dto/services/get-all-api.abstract.service.mjs +0 -49
- package/esm2022/data-api/class-dto/tableview/tableview-crud.data-provider.mjs +0 -49
- package/esm2022/data-api/helpers/get-all-params.mjs +0 -180
- package/esm2022/data-api/helpers/tableview-get-all-params-create.mjs +0 -18
- package/esm2022/data-api/index.mjs +0 -10
- package/esm2022/data-api/mediusinc-mng-commons-data-api.mjs +0 -5
- package/esm2022/data-api/models/request-params.model.mjs +0 -2
- package/esm2022/data-api/rxjs/map-to-data-list.operator.mjs +0 -19
- package/esm2022/data-api/types/extract-get-all-params.type.mjs +0 -2
- package/esm2022/lib/components/action/action.component.mjs +0 -314
- package/esm2022/lib/components/action/editor/action-editor.component.mjs +0 -98
- package/esm2022/lib/components/action/editor/injector-context/action-editor-injector-context.component.mjs +0 -394
- package/esm2022/lib/components/action/index.mjs +0 -6
- package/esm2022/lib/components/action/localization/data-language-dropdown.component.mjs +0 -53
- package/esm2022/lib/components/action/models/action-component.model.mjs +0 -2
- package/esm2022/lib/components/action/models/action-execution.model.mjs +0 -323
- package/esm2022/lib/components/action/models/index.mjs +0 -4
- package/esm2022/lib/components/action/models/tableview-action-default-categories.model.mjs +0 -11
- package/esm2022/lib/components/action/route/action-route.component.mjs +0 -141
- package/esm2022/lib/components/action/table/action-table.component.mjs +0 -152
- package/esm2022/lib/components/form/autocomplete/autocomplete.component.mjs +0 -408
- package/esm2022/lib/components/form/date-range/date-range.component.mjs +0 -110
- package/esm2022/lib/components/form/dropdown/dropdown.component.mjs +0 -210
- package/esm2022/lib/components/form/editor/form-editor.component.mjs +0 -281
- package/esm2022/lib/components/form/formly/fields/formly-field-action/formly-field-action.component.mjs +0 -61
- package/esm2022/lib/components/form/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.mjs +0 -54
- package/esm2022/lib/components/form/formly/fields/formly-field-custom/formly-custom-field-base.model.mjs +0 -69
- package/esm2022/lib/components/form/formly/fields/formly-field-custom/formly-field-custom.component.mjs +0 -39
- package/esm2022/lib/components/form/formly/fields/formly-field-dropdown/formly-field-dropdown.component.mjs +0 -49
- package/esm2022/lib/components/form/formly/fields/formly-field-fieldset/formly-field-fieldset.component.mjs +0 -27
- package/esm2022/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.mjs +0 -220
- package/esm2022/lib/components/form/formly/fields/formly-field-label/formly-field-label.component.mjs +0 -24
- package/esm2022/lib/components/form/formly/fields/formly-field-lookup-dialog/formly-field-lookup-dialog.component.mjs +0 -219
- package/esm2022/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +0 -221
- package/esm2022/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.mjs +0 -212
- package/esm2022/lib/components/form/formly/fields/formly-field-tabs/formly-field-tabs.component.mjs +0 -18
- package/esm2022/lib/components/form/formly/fields/index.mjs +0 -13
- package/esm2022/lib/components/form/formly/formly.config.mjs +0 -250
- package/esm2022/lib/components/form/formly/index.mjs +0 -2
- package/esm2022/lib/components/form/formly/models/formly-config.model.mjs +0 -2
- package/esm2022/lib/components/form/formly/models/formly-field.model.mjs +0 -2
- package/esm2022/lib/components/form/formly/models/index.mjs +0 -3
- package/esm2022/lib/components/form/formly/wrappers/formly-field-no-label-wrapper/formly-field-no-label-wrapper.component.mjs +0 -33
- package/esm2022/lib/components/form/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.mjs +0 -31
- package/esm2022/lib/components/form/formly/wrappers/index.mjs +0 -3
- package/esm2022/lib/components/form/index.mjs +0 -5
- package/esm2022/lib/components/form/models/field-action-context.model.mjs +0 -2
- package/esm2022/lib/components/form/models/form-editor.event.mjs +0 -49
- package/esm2022/lib/components/form/models/form-editor.interface.mjs +0 -2
- package/esm2022/lib/components/form/models/index.mjs +0 -4
- package/esm2022/lib/components/layout/breadcrumb.component.mjs +0 -34
- package/esm2022/lib/components/layout/footer.component.mjs +0 -19
- package/esm2022/lib/components/layout/index.mjs +0 -9
- package/esm2022/lib/components/layout/main-layout.component.mjs +0 -53
- package/esm2022/lib/components/layout/menu-item.component.mjs +0 -296
- package/esm2022/lib/components/layout/menu.component.mjs +0 -34
- package/esm2022/lib/components/layout/services/index.mjs +0 -2
- package/esm2022/lib/components/layout/services/main-layout.component.service.mjs +0 -196
- package/esm2022/lib/components/layout/topbar-user.component.mjs +0 -46
- package/esm2022/lib/components/layout/topbar.component.mjs +0 -66
- package/esm2022/lib/components/layout/version.component.mjs +0 -60
- package/esm2022/lib/components/layoutV2/breadcrumb.component.mjs +0 -30
- package/esm2022/lib/components/layoutV2/footer.component.mjs +0 -29
- package/esm2022/lib/components/layoutV2/index.mjs +0 -8
- package/esm2022/lib/components/layoutV2/main-layout.component.mjs +0 -95
- package/esm2022/lib/components/layoutV2/menu-item.component.mjs +0 -275
- package/esm2022/lib/components/layoutV2/menu.component.mjs +0 -39
- package/esm2022/lib/components/layoutV2/model/index.mjs +0 -3
- package/esm2022/lib/components/layoutV2/model/layout-state.model.mjs +0 -2
- package/esm2022/lib/components/layoutV2/model/menu.model.mjs +0 -2
- package/esm2022/lib/components/layoutV2/services/index.mjs +0 -3
- package/esm2022/lib/components/layoutV2/services/main-layout.component.service.mjs +0 -71
- package/esm2022/lib/components/layoutV2/services/menu.service.mjs +0 -122
- package/esm2022/lib/components/layoutV2/sidebar.component.mjs +0 -62
- package/esm2022/lib/components/layoutV2/topbar-user.component.mjs +0 -40
- package/esm2022/lib/components/layoutV2/topbar.component.mjs +0 -69
- package/esm2022/lib/components/layoutV2/version.component.mjs +0 -63
- package/esm2022/lib/components/notification/notification-wrapper.component.mjs +0 -50
- package/esm2022/lib/components/pages/error/error.page.component.mjs +0 -21
- package/esm2022/lib/components/pages/index.mjs +0 -3
- package/esm2022/lib/components/pages/not-found/not-found.page.component.mjs +0 -21
- package/esm2022/lib/components/table/column-filter-full/column-filter-full.component.mjs +0 -597
- package/esm2022/lib/components/table/column-value/column-value.component.mjs +0 -90
- package/esm2022/lib/components/table/models/table.event.mjs +0 -16
- package/esm2022/lib/components/table/models/table.interface.mjs +0 -2
- package/esm2022/lib/components/table/table-column-filter-class/table-column-filter-class.pipe.mjs +0 -25
- package/esm2022/lib/components/table/table.component.mjs +0 -643
- package/esm2022/lib/components/tableview/actions/tableview-default-actions.mjs +0 -215
- package/esm2022/lib/components/tableview/builders/tableview-builder.mjs +0 -162
- package/esm2022/lib/components/tableview/helpers/tableview-create.mjs +0 -24
- package/esm2022/lib/components/tableview/index.mjs +0 -7
- package/esm2022/lib/components/tableview/models/tableview.model.mjs +0 -2
- package/esm2022/lib/components/tableview/route/tableview-route.component.mjs +0 -15
- package/esm2022/lib/components/tableview/tableview.component.mjs +0 -82
- package/esm2022/lib/data-providers/base.data-provider.mjs +0 -48
- package/esm2022/lib/data-providers/editor.data-provider.mjs +0 -105
- package/esm2022/lib/data-providers/index.mjs +0 -6
- package/esm2022/lib/data-providers/lookup.data-provider.mjs +0 -45
- package/esm2022/lib/data-providers/table.data-provider.mjs +0 -64
- package/esm2022/lib/data-providers/tableview.data-provider.mjs +0 -105
- package/esm2022/lib/descriptors/action/action-button.descriptor.mjs +0 -68
- package/esm2022/lib/descriptors/action/action-confirmation.descriptor.mjs +0 -77
- package/esm2022/lib/descriptors/action/action-editor.descriptor.mjs +0 -266
- package/esm2022/lib/descriptors/action/action-link.descriptor.mjs +0 -89
- package/esm2022/lib/descriptors/action/action.descriptor.mjs +0 -383
- package/esm2022/lib/descriptors/action/index.mjs +0 -6
- package/esm2022/lib/descriptors/editor/editor.descriptor.mjs +0 -510
- package/esm2022/lib/descriptors/editor/field-action.descriptor.mjs +0 -50
- package/esm2022/lib/descriptors/editor/field-base.descriptor.mjs +0 -285
- package/esm2022/lib/descriptors/editor/field-group.descriptor.mjs +0 -97
- package/esm2022/lib/descriptors/editor/field-lookup.descriptor.mjs +0 -212
- package/esm2022/lib/descriptors/editor/field-many.descriptor.mjs +0 -153
- package/esm2022/lib/descriptors/editor/field-validation.descriptor.mjs +0 -25
- package/esm2022/lib/descriptors/editor/field.descriptor.mjs +0 -343
- package/esm2022/lib/descriptors/editor/index.mjs +0 -9
- package/esm2022/lib/descriptors/editor/internal/editor-fields.model.mjs +0 -2
- package/esm2022/lib/descriptors/editor/internal/editor.model.mjs +0 -2
- package/esm2022/lib/descriptors/filter/filter-lookup.descriptor.mjs +0 -186
- package/esm2022/lib/descriptors/filter/filter.descriptor.mjs +0 -198
- package/esm2022/lib/descriptors/filter/index.mjs +0 -3
- package/esm2022/lib/descriptors/interfaces/field-config.interface.mjs +0 -2
- package/esm2022/lib/descriptors/interfaces/index.mjs +0 -3
- package/esm2022/lib/descriptors/interfaces/lookup-descriptor.interface.mjs +0 -2
- package/esm2022/lib/descriptors/model/enum.descriptor.mjs +0 -31
- package/esm2022/lib/descriptors/model/index.mjs +0 -4
- package/esm2022/lib/descriptors/model/model.descriptor.mjs +0 -79
- package/esm2022/lib/descriptors/model/type.descriptor.mjs +0 -11
- package/esm2022/lib/descriptors/table/column.descriptor.mjs +0 -359
- package/esm2022/lib/descriptors/table/index.mjs +0 -4
- package/esm2022/lib/descriptors/table/internal/table-columns.model.mjs +0 -2
- package/esm2022/lib/descriptors/table/internal/table.model.mjs +0 -2
- package/esm2022/lib/descriptors/table/sort.descriptor.mjs +0 -45
- package/esm2022/lib/descriptors/table/table.descriptor.mjs +0 -751
- package/esm2022/lib/descriptors/tableview/index.mjs +0 -2
- package/esm2022/lib/descriptors/tableview/internal/tableview.model.mjs +0 -2
- package/esm2022/lib/descriptors/tableview/tableview.descriptor.mjs +0 -558
- package/esm2022/lib/descriptors/types/action.type.mjs +0 -26
- package/esm2022/lib/descriptors/types/column.type.mjs +0 -21
- package/esm2022/lib/descriptors/types/editor.type.mjs +0 -8
- package/esm2022/lib/descriptors/types/field.type.mjs +0 -56
- package/esm2022/lib/descriptors/types/filter.type.mjs +0 -15
- package/esm2022/lib/descriptors/types/index.mjs +0 -8
- package/esm2022/lib/descriptors/types/table.type.mjs +0 -22
- package/esm2022/lib/descriptors/types/trim.type.mjs +0 -2
- package/esm2022/lib/directives/component.directive.mjs +0 -66
- package/esm2022/lib/directives/dialog-keydown-handler.directive.mjs +0 -49
- package/esm2022/lib/directives/index.mjs +0 -5
- package/esm2022/lib/directives/input-trim.directive.mjs +0 -55
- package/esm2022/lib/directives/template.directive.mjs +0 -29
- package/esm2022/lib/error/error.handler.mjs +0 -20
- package/esm2022/lib/error/index.mjs +0 -2
- package/esm2022/lib/guards/index.mjs +0 -2
- package/esm2022/lib/guards/unsaved-changes.guard.mjs +0 -4
- package/esm2022/lib/helpers/coercion.mjs +0 -52
- package/esm2022/lib/helpers/data-provider-executors.mjs +0 -80
- package/esm2022/lib/models/action-editor.model.mjs +0 -2
- package/esm2022/lib/models/can-component-deactivate.model.mjs +0 -2
- package/esm2022/lib/models/class.model.mjs +0 -2
- package/esm2022/lib/models/column-value.model.mjs +0 -2
- package/esm2022/lib/models/common-init-event-enum.model.mjs +0 -11
- package/esm2022/lib/models/config.model.mjs +0 -2
- package/esm2022/lib/models/data-list.model.mjs +0 -2
- package/esm2022/lib/models/enum.model.mjs +0 -2
- package/esm2022/lib/models/error.model.mjs +0 -44
- package/esm2022/lib/models/filter-match.model.mjs +0 -105
- package/esm2022/lib/models/index.mjs +0 -20
- package/esm2022/lib/models/layout-config.model.mjs +0 -2
- package/esm2022/lib/models/log.model.mjs +0 -10
- package/esm2022/lib/models/menu.model.mjs +0 -2
- package/esm2022/lib/models/radio.model.mjs +0 -2
- package/esm2022/lib/models/tableview-attr.model.mjs +0 -2
- package/esm2022/lib/models/type-registry.model.mjs +0 -2
- package/esm2022/lib/models/user.model.mjs +0 -2
- package/esm2022/lib/models/version.model.mjs +0 -2
- package/esm2022/lib/models/view-container.model.mjs +0 -2
- package/esm2022/lib/pipes/boolean.pipe.mjs +0 -28
- package/esm2022/lib/pipes/class-map.pipe.mjs +0 -23
- package/esm2022/lib/pipes/enum.pipe.mjs +0 -26
- package/esm2022/lib/pipes/enumerate-async.pipe.mjs +0 -41
- package/esm2022/lib/pipes/enumerate.pipe.mjs +0 -58
- package/esm2022/lib/pipes/getter.pipe.mjs +0 -21
- package/esm2022/lib/pipes/i18n-property.pipe.mjs +0 -19
- package/esm2022/lib/pipes/index.mjs +0 -12
- package/esm2022/lib/pipes/json-path.pipe.mjs +0 -25
- package/esm2022/lib/pipes/locale-default-row-class.pipe.mjs +0 -27
- package/esm2022/lib/pipes/models/internal/enumrate-pipe-i18n.model.mjs +0 -2
- package/esm2022/lib/pipes/models/internal/index.mjs +0 -2
- package/esm2022/lib/pipes/parametrize.pipe.mjs +0 -86
- package/esm2022/lib/pipes/template.pipe.mjs +0 -26
- package/esm2022/lib/provide.mjs +0 -101
- package/esm2022/lib/registry/type.registry.mjs +0 -106
- package/esm2022/lib/router/index.mjs +0 -4
- package/esm2022/lib/router/models/index.mjs +0 -2
- package/esm2022/lib/router/models/router.model.mjs +0 -2
- package/esm2022/lib/router/route-builder.mjs +0 -347
- package/esm2022/lib/router/routes-builder.mjs +0 -69
- package/esm2022/lib/router/tableview-route-builder.mjs +0 -201
- package/esm2022/lib/security/authorization.guard.mjs +0 -15
- package/esm2022/lib/security/authorization.service.mjs +0 -51
- package/esm2022/lib/security/authorization.util.mjs +0 -16
- package/esm2022/lib/security/index.mjs +0 -4
- package/esm2022/lib/security/model/authorization.type.mjs +0 -8
- package/esm2022/lib/security/model/index.mjs +0 -4
- package/esm2022/lib/security/model/permission-service.interface.mjs +0 -2
- package/esm2022/lib/security/model/permissions.model.mjs +0 -87
- package/esm2022/lib/services/action/action-executor.service.mjs +0 -747
- package/esm2022/lib/services/action/component-action-executor.service.mjs +0 -19
- package/esm2022/lib/services/action/index.mjs +0 -5
- package/esm2022/lib/services/action/provide-action-executor.mjs +0 -9
- package/esm2022/lib/services/action/root-action-executor.service.mjs +0 -18
- package/esm2022/lib/services/action-error-mapper.service.mjs +0 -20
- package/esm2022/lib/services/commons-init.service.mjs +0 -100
- package/esm2022/lib/services/commons.service.mjs +0 -459
- package/esm2022/lib/services/configuration.service.mjs +0 -174
- package/esm2022/lib/services/data-provider-executor.service.mjs +0 -52
- package/esm2022/lib/services/index.mjs +0 -12
- package/esm2022/lib/services/internal/commons-init.provider.mjs +0 -4
- package/esm2022/lib/services/internal/index.mjs +0 -2
- package/esm2022/lib/services/log-publisher-console.service.mjs +0 -40
- package/esm2022/lib/services/logger.service.mjs +0 -130
- package/esm2022/lib/services/mng-localstorage-config.service.mjs +0 -30
- package/esm2022/lib/services/navigation.service.mjs +0 -55
- package/esm2022/lib/services/providers/formly-config.provider.mjs +0 -31
- package/esm2022/lib/services/providers/index.mjs +0 -2
- package/esm2022/lib/services/router.service.mjs +0 -183
- package/esm2022/lib/services/tokens/browser-storage.token.mjs +0 -6
- package/esm2022/lib/services/tokens/commons-init.token.mjs +0 -3
- package/esm2022/lib/services/tokens/default-setting.token.mjs +0 -3
- package/esm2022/lib/services/tokens/index.mjs +0 -6
- package/esm2022/lib/services/tokens/log-publisher.token.mjs +0 -3
- package/esm2022/lib/services/tokens/module-config.token.mjs +0 -3
- package/esm2022/lib/services/version.service.mjs +0 -49
- package/esm2022/lib/services/view/index.mjs +0 -3
- package/esm2022/lib/services/view/provide-view-container.mjs +0 -17
- package/esm2022/lib/services/view/view-container.service.mjs +0 -59
- package/esm2022/lib/styles/button-style.builder.mjs +0 -174
- package/esm2022/lib/styles/index.mjs +0 -3
- package/esm2022/lib/styles/models/index.mjs +0 -3
- package/esm2022/lib/styles/models/style-level.enum.mjs +0 -12
- package/esm2022/lib/styles/models/style-size.enum.mjs +0 -9
- package/esm2022/lib/styles/styles.util.mjs +0 -42
- package/esm2022/lib/types/action-descriptor.types.mjs +0 -2
- package/esm2022/lib/types/data-provider.types.mjs +0 -2
- package/esm2022/lib/types/getter.type.mjs +0 -2
- package/esm2022/lib/types/i18n.type.mjs +0 -2
- package/esm2022/lib/types/index.mjs +0 -8
- package/esm2022/lib/types/localstorage-config-value.type.mjs +0 -2
- package/esm2022/lib/types/type.decorator.mjs +0 -12
- package/esm2022/lib/types/type.model.mjs +0 -2
- package/esm2022/lib/utils/data-list-params.util.mjs +0 -416
- package/esm2022/lib/utils/date.util.mjs +0 -136
- package/esm2022/lib/utils/decorator-metadata.util.mjs +0 -61
- package/esm2022/lib/utils/editor-formly.util.mjs +0 -339
- package/esm2022/lib/utils/enum.util.mjs +0 -83
- package/esm2022/lib/utils/error.util.mjs +0 -247
- package/esm2022/lib/utils/export.util.mjs +0 -21
- package/esm2022/lib/utils/file.util.mjs +0 -18
- package/esm2022/lib/utils/i18n.util.mjs +0 -274
- package/esm2022/lib/utils/index.mjs +0 -14
- package/esm2022/lib/utils/model.util.mjs +0 -73
- package/esm2022/lib/utils/notification.util.mjs +0 -45
- package/esm2022/lib/utils/object.util.mjs +0 -135
- package/esm2022/lib/utils/route.util.mjs +0 -60
- package/esm2022/lib/utils/string.util.mjs +0 -59
- package/esm2022/lib/utils/tableview.util.mjs +0 -193
- package/esm2022/lib/validators/field.validator.mjs +0 -33
- package/esm2022/lib/validators/index.mjs +0 -2
- package/fesm2022/mediusinc-mng-commons-data-api-class-dto-obsolete.mjs +0 -698
- package/fesm2022/mediusinc-mng-commons-data-api-class-dto-obsolete.mjs.map +0 -1
- package/fesm2022/mediusinc-mng-commons-data-api-class-dto.mjs +0 -480
- package/fesm2022/mediusinc-mng-commons-data-api-class-dto.mjs.map +0 -1
- package/fesm2022/mediusinc-mng-commons-data-api.mjs +0 -224
- package/fesm2022/mediusinc-mng-commons-data-api.mjs.map +0 -1
- package/lib/components/action/action.component.d.ts +0 -76
- package/lib/components/action/editor/action-editor.component.d.ts +0 -33
- package/lib/components/action/editor/injector-context/action-editor-injector-context.component.d.ts +0 -80
- package/lib/components/action/index.d.ts +0 -5
- package/lib/components/action/localization/data-language-dropdown.component.d.ts +0 -24
- package/lib/components/action/models/action-component.model.d.ts +0 -13
- package/lib/components/action/models/action-execution.model.d.ts +0 -169
- package/lib/components/action/models/index.d.ts +0 -3
- package/lib/components/action/route/action-route.component.d.ts +0 -31
- package/lib/components/action/table/action-table.component.d.ts +0 -49
- package/lib/components/form/autocomplete/autocomplete.component.d.ts +0 -83
- package/lib/components/form/date-range/date-range.component.d.ts +0 -28
- package/lib/components/form/dropdown/dropdown.component.d.ts +0 -54
- package/lib/components/form/editor/form-editor.component.d.ts +0 -51
- package/lib/components/form/formly/fields/formly-field-action/formly-field-action.component.d.ts +0 -16
- package/lib/components/form/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.d.ts +0 -16
- package/lib/components/form/formly/fields/formly-field-custom/formly-custom-field-base.model.d.ts +0 -27
- package/lib/components/form/formly/fields/formly-field-custom/formly-field-custom.component.d.ts +0 -12
- package/lib/components/form/formly/fields/formly-field-dropdown/formly-field-dropdown.component.d.ts +0 -15
- package/lib/components/form/formly/fields/formly-field-fieldset/formly-field-fieldset.component.d.ts +0 -14
- package/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.d.ts +0 -39
- package/lib/components/form/formly/fields/formly-field-label/formly-field-label.component.d.ts +0 -11
- package/lib/components/form/formly/fields/formly-field-lookup-dialog/formly-field-lookup-dialog.component.d.ts +0 -45
- package/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.d.ts +0 -25
- package/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.d.ts +0 -42
- package/lib/components/form/formly/fields/formly-field-tabs/formly-field-tabs.component.d.ts +0 -7
- package/lib/components/form/formly/fields/index.d.ts +0 -12
- package/lib/components/form/formly/formly.config.d.ts +0 -17
- package/lib/components/form/formly/index.d.ts +0 -1
- package/lib/components/form/formly/models/formly-config.model.d.ts +0 -11
- package/lib/components/form/formly/models/formly-field.model.d.ts +0 -17
- package/lib/components/form/formly/models/index.d.ts +0 -2
- package/lib/components/form/formly/wrappers/formly-field-no-label-wrapper/formly-field-no-label-wrapper.component.d.ts +0 -11
- package/lib/components/form/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.d.ts +0 -11
- package/lib/components/form/formly/wrappers/index.d.ts +0 -2
- package/lib/components/form/index.d.ts +0 -4
- package/lib/components/form/models/field-action-context.model.d.ts +0 -24
- package/lib/components/form/models/form-editor.event.d.ts +0 -58
- package/lib/components/form/models/index.d.ts +0 -3
- package/lib/components/layout/breadcrumb.component.d.ts +0 -13
- package/lib/components/layout/footer.component.d.ts +0 -9
- package/lib/components/layout/index.d.ts +0 -8
- package/lib/components/layout/main-layout.component.d.ts +0 -19
- package/lib/components/layout/menu-item.component.d.ts +0 -55
- package/lib/components/layout/menu.component.d.ts +0 -16
- package/lib/components/layout/services/index.d.ts +0 -1
- package/lib/components/layout/services/main-layout.component.service.d.ts +0 -65
- package/lib/components/layout/topbar-user.component.d.ts +0 -22
- package/lib/components/layout/topbar.component.d.ts +0 -26
- package/lib/components/layout/version.component.d.ts +0 -19
- package/lib/components/layoutV2/breadcrumb.component.d.ts +0 -10
- package/lib/components/layoutV2/footer.component.d.ts +0 -12
- package/lib/components/layoutV2/index.d.ts +0 -7
- package/lib/components/layoutV2/main-layout.component.d.ts +0 -24
- package/lib/components/layoutV2/menu-item.component.d.ts +0 -42
- package/lib/components/layoutV2/menu.component.d.ts +0 -14
- package/lib/components/layoutV2/model/index.d.ts +0 -2
- package/lib/components/layoutV2/model/layout-state.model.d.ts +0 -10
- package/lib/components/layoutV2/model/menu.model.d.ts +0 -4
- package/lib/components/layoutV2/services/index.d.ts +0 -2
- package/lib/components/layoutV2/services/main-layout.component.service.d.ts +0 -17
- package/lib/components/layoutV2/services/menu.service.d.ts +0 -22
- package/lib/components/layoutV2/sidebar.component.d.ts +0 -19
- package/lib/components/layoutV2/topbar-user.component.d.ts +0 -16
- package/lib/components/layoutV2/topbar.component.d.ts +0 -22
- package/lib/components/layoutV2/version.component.d.ts +0 -19
- package/lib/components/pages/error/error.page.component.d.ts +0 -8
- package/lib/components/pages/index.d.ts +0 -2
- package/lib/components/pages/not-found/not-found.page.component.d.ts +0 -8
- package/lib/components/table/column-filter-full/column-filter-full.component.d.ts +0 -101
- package/lib/components/table/column-value/column-value.component.d.ts +0 -35
- package/lib/components/table/models/table.event.d.ts +0 -17
- package/lib/components/table/models/table.interface.d.ts +0 -17
- package/lib/components/table/table-column-filter-class/table-column-filter-class.pipe.d.ts +0 -8
- package/lib/components/table/table.component.d.ts +0 -123
- package/lib/components/tableview/actions/tableview-default-actions.d.ts +0 -36
- package/lib/components/tableview/builders/tableview-builder.d.ts +0 -115
- package/lib/components/tableview/helpers/tableview-create.d.ts +0 -16
- package/lib/components/tableview/index.d.ts +0 -6
- package/lib/components/tableview/models/tableview.model.d.ts +0 -8
- package/lib/components/tableview/route/tableview-route.component.d.ts +0 -7
- package/lib/components/tableview/tableview.component.d.ts +0 -29
- package/lib/data-providers/base.data-provider.d.ts +0 -32
- package/lib/data-providers/editor.data-provider.d.ts +0 -88
- package/lib/data-providers/index.d.ts +0 -5
- package/lib/data-providers/lookup.data-provider.d.ts +0 -27
- package/lib/data-providers/table.data-provider.d.ts +0 -40
- package/lib/data-providers/tableview.data-provider.d.ts +0 -45
- package/lib/descriptors/action/action-button.descriptor.d.ts +0 -25
- package/lib/descriptors/action/action-confirmation.descriptor.d.ts +0 -36
- package/lib/descriptors/action/action-editor.descriptor.d.ts +0 -118
- package/lib/descriptors/action/action-link.descriptor.d.ts +0 -34
- package/lib/descriptors/action/action.descriptor.d.ts +0 -149
- package/lib/descriptors/action/index.d.ts +0 -5
- package/lib/descriptors/editor/editor.descriptor.d.ts +0 -270
- package/lib/descriptors/editor/field-action.descriptor.d.ts +0 -23
- package/lib/descriptors/editor/field-base.descriptor.d.ts +0 -122
- package/lib/descriptors/editor/field-group.descriptor.d.ts +0 -42
- package/lib/descriptors/editor/field-lookup.descriptor.d.ts +0 -83
- package/lib/descriptors/editor/field-many.descriptor.d.ts +0 -63
- package/lib/descriptors/editor/field-validation.descriptor.d.ts +0 -19
- package/lib/descriptors/editor/field.descriptor.d.ts +0 -167
- package/lib/descriptors/editor/index.d.ts +0 -8
- package/lib/descriptors/editor/internal/editor-fields.model.d.ts +0 -33
- package/lib/descriptors/editor/internal/editor.model.d.ts +0 -15
- package/lib/descriptors/filter/filter-lookup.descriptor.d.ts +0 -70
- package/lib/descriptors/filter/filter.descriptor.d.ts +0 -66
- package/lib/descriptors/filter/index.d.ts +0 -2
- package/lib/descriptors/interfaces/field-config.interface.d.ts +0 -9
- package/lib/descriptors/interfaces/index.d.ts +0 -2
- package/lib/descriptors/interfaces/lookup-descriptor.interface.d.ts +0 -12
- package/lib/descriptors/model/enum.descriptor.d.ts +0 -14
- package/lib/descriptors/model/index.d.ts +0 -3
- package/lib/descriptors/model/model.descriptor.d.ts +0 -31
- package/lib/descriptors/model/type.descriptor.d.ts +0 -5
- package/lib/descriptors/table/column.descriptor.d.ts +0 -148
- package/lib/descriptors/table/index.d.ts +0 -3
- package/lib/descriptors/table/internal/table-columns.model.d.ts +0 -42
- package/lib/descriptors/table/internal/table.model.d.ts +0 -12
- package/lib/descriptors/table/table.descriptor.d.ts +0 -272
- package/lib/descriptors/tableview/index.d.ts +0 -1
- package/lib/descriptors/tableview/internal/tableview.model.d.ts +0 -11
- package/lib/descriptors/tableview/tableview.descriptor.d.ts +0 -193
- package/lib/descriptors/types/action.type.d.ts +0 -21
- package/lib/descriptors/types/editor.type.d.ts +0 -6
- package/lib/descriptors/types/field.type.d.ts +0 -47
- package/lib/descriptors/types/index.d.ts +0 -7
- package/lib/descriptors/types/table.type.d.ts +0 -18
- package/lib/directives/component.directive.d.ts +0 -20
- package/lib/directives/dialog-keydown-handler.directive.d.ts +0 -12
- package/lib/directives/index.d.ts +0 -4
- package/lib/directives/input-trim.directive.d.ts +0 -14
- package/lib/directives/template.directive.d.ts +0 -12
- package/lib/error/error.handler.d.ts +0 -6
- package/lib/error/index.d.ts +0 -1
- package/lib/guards/index.d.ts +0 -1
- package/lib/guards/unsaved-changes.guard.d.ts +0 -3
- package/lib/helpers/coercion.d.ts +0 -9
- package/lib/helpers/data-provider-executors.d.ts +0 -19
- package/lib/models/action-editor.model.d.ts +0 -15
- package/lib/models/column-value.model.d.ts +0 -4
- package/lib/models/common-init-event-enum.model.d.ts +0 -9
- package/lib/models/config.model.d.ts +0 -53
- package/lib/models/enum.model.d.ts +0 -7
- package/lib/models/error.model.d.ts +0 -50
- package/lib/models/index.d.ts +0 -19
- package/lib/models/layout-config.model.d.ts +0 -34
- package/lib/models/log.model.d.ts +0 -40
- package/lib/models/menu.model.d.ts +0 -32
- package/lib/models/tableview-attr.model.d.ts +0 -10
- package/lib/models/type-registry.model.d.ts +0 -7
- package/lib/models/user.model.d.ts +0 -8
- package/lib/models/view-container.model.d.ts +0 -24
- package/lib/pipes/boolean.pipe.d.ts +0 -7
- package/lib/pipes/class-map.pipe.d.ts +0 -7
- package/lib/pipes/enum.pipe.d.ts +0 -8
- package/lib/pipes/enumerate-async.pipe.d.ts +0 -14
- package/lib/pipes/enumerate.pipe.d.ts +0 -21
- package/lib/pipes/getter.pipe.d.ts +0 -8
- package/lib/pipes/i18n-property.pipe.d.ts +0 -8
- package/lib/pipes/index.d.ts +0 -11
- package/lib/pipes/json-path.pipe.d.ts +0 -13
- package/lib/pipes/locale-default-row-class.pipe.d.ts +0 -10
- package/lib/pipes/models/internal/enumrate-pipe-i18n.model.d.ts +0 -5
- package/lib/pipes/models/internal/index.d.ts +0 -1
- package/lib/pipes/parametrize.pipe.d.ts +0 -13
- package/lib/pipes/template.pipe.d.ts +0 -10
- package/lib/provide.d.ts +0 -10
- package/lib/registry/type.registry.d.ts +0 -25
- package/lib/router/index.d.ts +0 -3
- package/lib/router/models/index.d.ts +0 -1
- package/lib/router/models/router.model.d.ts +0 -31
- package/lib/router/route-builder.d.ts +0 -75
- package/lib/router/routes-builder.d.ts +0 -28
- package/lib/router/tableview-route-builder.d.ts +0 -44
- package/lib/security/authorization.guard.d.ts +0 -2
- package/lib/security/authorization.service.d.ts +0 -17
- package/lib/security/authorization.util.d.ts +0 -5
- package/lib/security/index.d.ts +0 -3
- package/lib/security/model/authorization.type.d.ts +0 -6
- package/lib/security/model/index.d.ts +0 -3
- package/lib/security/model/permission-service.interface.d.ts +0 -6
- package/lib/security/model/permissions.model.d.ts +0 -37
- package/lib/services/action/action-executor.service.d.ts +0 -177
- package/lib/services/action/component-action-executor.service.d.ts +0 -9
- package/lib/services/action/index.d.ts +0 -4
- package/lib/services/action/root-action-executor.service.d.ts +0 -9
- package/lib/services/action-error-mapper.service.d.ts +0 -18
- package/lib/services/commons-init.service.d.ts +0 -22
- package/lib/services/commons.service.d.ts +0 -90
- package/lib/services/configuration.service.d.ts +0 -68
- package/lib/services/data-provider-executor.service.d.ts +0 -60
- package/lib/services/index.d.ts +0 -11
- package/lib/services/internal/commons-init.provider.d.ts +0 -4
- package/lib/services/internal/index.d.ts +0 -1
- package/lib/services/log-publisher-console.service.d.ts +0 -4
- package/lib/services/logger.service.d.ts +0 -33
- package/lib/services/mng-localstorage-config.service.d.ts +0 -11
- package/lib/services/navigation.service.d.ts +0 -15
- package/lib/services/providers/formly-config.provider.d.ts +0 -5
- package/lib/services/providers/index.d.ts +0 -1
- package/lib/services/router.service.d.ts +0 -37
- package/lib/services/tokens/browser-storage.token.d.ts +0 -2
- package/lib/services/tokens/commons-init.token.d.ts +0 -3
- package/lib/services/tokens/default-setting.token.d.ts +0 -2
- package/lib/services/tokens/index.d.ts +0 -5
- package/lib/services/tokens/log-publisher.token.d.ts +0 -3
- package/lib/services/tokens/module-config.token.d.ts +0 -3
- package/lib/services/version.service.d.ts +0 -14
- package/lib/services/view/index.d.ts +0 -2
- package/lib/services/view/view-container.service.d.ts +0 -32
- package/lib/styles/button-style.builder.d.ts +0 -68
- package/lib/styles/index.d.ts +0 -2
- package/lib/styles/models/index.d.ts +0 -2
- package/lib/styles/models/style-level.enum.d.ts +0 -10
- package/lib/styles/models/style-size.enum.d.ts +0 -7
- package/lib/styles/styles.util.d.ts +0 -15
- package/lib/types/action-descriptor.types.d.ts +0 -4
- package/lib/types/data-provider.types.d.ts +0 -3
- package/lib/types/getter.type.d.ts +0 -2
- package/lib/types/i18n.type.d.ts +0 -1
- package/lib/types/index.d.ts +0 -7
- package/lib/types/localstorage-config-value.type.d.ts +0 -1
- package/lib/types/type.model.d.ts +0 -31
- package/lib/utils/data-list-params.util.d.ts +0 -84
- package/lib/utils/date.util.d.ts +0 -20
- package/lib/utils/decorator-metadata.util.d.ts +0 -33
- package/lib/utils/editor-formly.util.d.ts +0 -13
- package/lib/utils/enum.util.d.ts +0 -51
- package/lib/utils/error.util.d.ts +0 -116
- package/lib/utils/export.util.d.ts +0 -5
- package/lib/utils/file.util.d.ts +0 -3
- package/lib/utils/i18n.util.d.ts +0 -85
- package/lib/utils/index.d.ts +0 -13
- package/lib/utils/model.util.d.ts +0 -10
- package/lib/utils/notification.util.d.ts +0 -13
- package/lib/utils/object.util.d.ts +0 -30
- package/lib/utils/route.util.d.ts +0 -37
- package/lib/utils/string.util.d.ts +0 -9
- package/lib/utils/tableview.util.d.ts +0 -53
- package/lib/validators/field.validator.d.ts +0 -3
- package/lib/validators/index.d.ts +0 -1
- package/openapi/angular/README.mustache +0 -226
- package/openapi/angular/api.module.mustache +0 -39
- package/openapi/angular/api.service.mustache +0 -253
- package/openapi/angular/apiInterface.mustache +0 -47
- package/openapi/angular/apis.mustache +0 -12
- package/openapi/angular/config.yaml +0 -23
- package/openapi/angular/configuration.mustache +0 -128
- package/openapi/angular/custom/base-api.service.mustache +0 -14
- package/openapi/angular/custom/helpers.mustache +0 -71
- package/openapi/angular/custom/modelSchema.mustache +0 -46
- package/openapi/angular/custom/schema.mustache +0 -18
- package/openapi/angular/encoder.mustache +0 -20
- package/openapi/angular/git_push.sh.mustache +0 -57
- package/openapi/angular/index.mustache +0 -0
- package/openapi/angular/licenseInfo.mustache +0 -11
- package/openapi/angular/model.mustache +0 -16
- package/openapi/angular/modelAlias.mustache +0 -1
- package/openapi/angular/modelEnum.mustache +0 -21
- package/openapi/angular/modelGeneric.mustache +0 -14
- package/openapi/angular/modelGenericAdditionalProperties.mustache +0 -5
- package/openapi/angular/modelGenericEnums.mustache +0 -30
- package/openapi/angular/modelOneOf.mustache +0 -14
- package/openapi/angular/modelTaggedUnion.mustache +0 -21
- package/openapi/angular/models.mustache +0 -5
- package/openapi/angular/ng-package.mustache +0 -6
- package/openapi/angular/package.mustache +0 -39
- package/openapi/angular/param.mustache +0 -69
- package/openapi/angular/tsconfig.mustache +0 -28
- package/openapi/angular/variables.mustache +0 -9
- package/openapi/node/model.mustache +0 -83
- package/openapi/node/models.mustache +0 -6
- package/scss/common/layout/_breadcrumb.scss +0 -99
- package/scss/common/layout/_config.scss +0 -100
- package/scss/common/layout/_dashboard.scss +0 -16
- package/scss/common/layout/_exception.scss +0 -133
- package/scss/common/layout/_footer.scss +0 -29
- package/scss/common/layout/_help.scss +0 -156
- package/scss/common/layout/_inlinemenu.scss +0 -68
- package/scss/common/layout/_invoice.scss +0 -176
- package/scss/common/layout/_landing.scss +0 -636
- package/scss/common/layout/_layout_dark.scss +0 -23
- package/scss/common/layout/_layout_light.scss +0 -23
- package/scss/common/layout/_loader.scss +0 -17
- package/scss/common/layout/_login.scss +0 -106
- package/scss/common/layout/_main.scss +0 -45
- package/scss/common/layout/_mixins.scss +0 -222
- package/scss/common/layout/_rightmenu.scss +0 -130
- package/scss/common/layout/_topbar.scss +0 -191
- package/scss/common/layout/_typography.scss +0 -68
- package/scss/common/layout/_utils.scss +0 -96
- package/scss/common/layout/_widgets.scss +0 -392
- package/scss/common/layout/menu/_menu.scss +0 -7
- package/scss/common/layout/menu/_menu_common.scss +0 -183
- package/scss/common/layout/menu/_menu_overlay.scss +0 -52
- package/scss/common/layout/menu/_menu_sidebar.scss +0 -233
- package/scss/common/layout/menu/_menu_slim.scss +0 -137
- package/scss/common/layout/menu/_menu_static.scss +0 -70
- package/scss/common/layout/menu/_menu_theme.scss +0 -364
- package/scss/common/theme/_theme_dark.scss +0 -5
- package/scss/common/theme/_theme_light.scss +0 -5
- package/scss/common/theme/designer/_colors.scss +0 -17
- package/scss/common/theme/designer/_common.scss +0 -41
- package/scss/common/theme/designer/_components.scss +0 -102
- package/scss/common/theme/designer/_mixins.scss +0 -203
- package/scss/common/theme/designer/components/button/_button.scss +0 -572
- package/scss/common/theme/designer/components/button/_speeddial.scss +0 -81
- package/scss/common/theme/designer/components/button/_splitbutton.scss +0 -2
- package/scss/common/theme/designer/components/data/_carousel.scss +0 -37
- package/scss/common/theme/designer/components/data/_datatable.scss +0 -266
- package/scss/common/theme/designer/components/data/_dataview.scss +0 -55
- package/scss/common/theme/designer/components/data/_filter.scss +0 -137
- package/scss/common/theme/designer/components/data/_fullcalendar.scss +0 -324
- package/scss/common/theme/designer/components/data/_orderlist.scss +0 -91
- package/scss/common/theme/designer/components/data/_organizationchart.scss +0 -50
- package/scss/common/theme/designer/components/data/_paginator.scss +0 -83
- package/scss/common/theme/designer/components/data/_picklist.scss +0 -91
- package/scss/common/theme/designer/components/data/_timeline.scss +0 -35
- package/scss/common/theme/designer/components/data/_tree.scss +0 -144
- package/scss/common/theme/designer/components/data/_treetable.scss +0 -241
- package/scss/common/theme/designer/components/data/_virtualscroller.scss +0 -28
- package/scss/common/theme/designer/components/file/_fileupload.scss +0 -58
- package/scss/common/theme/designer/components/input/_autocomplete.scss +0 -105
- package/scss/common/theme/designer/components/input/_calendar.scss +0 -212
- package/scss/common/theme/designer/components/input/_cascadeselect.scss +0 -98
- package/scss/common/theme/designer/components/input/_checkbox.scss +0 -85
- package/scss/common/theme/designer/components/input/_chips.scss +0 -43
- package/scss/common/theme/designer/components/input/_colorpicker.scss +0 -19
- package/scss/common/theme/designer/components/input/_dropdown.scss +0 -136
- package/scss/common/theme/designer/components/input/_editor.scss +0 -122
- package/scss/common/theme/designer/components/input/_inputgroup.scss +0 -69
- package/scss/common/theme/designer/components/input/_inputmask.scss +0 -3
- package/scss/common/theme/designer/components/input/_inputnumber.scss +0 -3
- package/scss/common/theme/designer/components/input/_inputswitch.scss +0 -60
- package/scss/common/theme/designer/components/input/_inputtext.scss +0 -97
- package/scss/common/theme/designer/components/input/_listbox.scss +0 -82
- package/scss/common/theme/designer/components/input/_multiselect.scss +0 -165
- package/scss/common/theme/designer/components/input/_password.scss +0 -33
- package/scss/common/theme/designer/components/input/_radiobutton.scss +0 -78
- package/scss/common/theme/designer/components/input/_rating.scss +0 -48
- package/scss/common/theme/designer/components/input/_selectbutton.scss +0 -50
- package/scss/common/theme/designer/components/input/_slider.scss +0 -71
- package/scss/common/theme/designer/components/input/_togglebutton.scss +0 -48
- package/scss/common/theme/designer/components/input/_treeselect.scss +0 -91
- package/scss/common/theme/designer/components/menu/_breadcrumb.scss +0 -42
- package/scss/common/theme/designer/components/menu/_contextmenu.scss +0 -51
- package/scss/common/theme/designer/components/menu/_dock.scss +0 -51
- package/scss/common/theme/designer/components/menu/_megamenu.scss +0 -103
- package/scss/common/theme/designer/components/menu/_menu.scss +0 -41
- package/scss/common/theme/designer/components/menu/_menubar.scss +0 -180
- package/scss/common/theme/designer/components/menu/_panelmenu.scss +0 -136
- package/scss/common/theme/designer/components/menu/_slidemenu.scss +0 -56
- package/scss/common/theme/designer/components/menu/_steps.scss +0 -56
- package/scss/common/theme/designer/components/menu/_tabmenu.scss +0 -49
- package/scss/common/theme/designer/components/menu/_tieredmenu.scss +0 -57
- package/scss/common/theme/designer/components/messages/_inlinemessage.scss +0 -64
- package/scss/common/theme/designer/components/messages/_message.scss +0 -102
- package/scss/common/theme/designer/components/messages/_toast.scss +0 -94
- package/scss/common/theme/designer/components/misc/_avatar.scss +0 -30
- package/scss/common/theme/designer/components/misc/_badge.scss +0 -48
- package/scss/common/theme/designer/components/misc/_blockui.scss +0 -3
- package/scss/common/theme/designer/components/misc/_chip.scss +0 -38
- package/scss/common/theme/designer/components/misc/_inplace.scss +0 -16
- package/scss/common/theme/designer/components/misc/_progressbar.scss +0 -17
- package/scss/common/theme/designer/components/misc/_scrolltop.scss +0 -20
- package/scss/common/theme/designer/components/misc/_skeleton.scss +0 -8
- package/scss/common/theme/designer/components/misc/_tag.scss +0 -35
- package/scss/common/theme/designer/components/misc/_terminal.scss +0 -11
- package/scss/common/theme/designer/components/multimedia/_galleria.scss +0 -141
- package/scss/common/theme/designer/components/multimedia/_image.scss +0 -44
- package/scss/common/theme/designer/components/overlay/_confirmpopup.scss +0 -65
- package/scss/common/theme/designer/components/overlay/_dialog.scss +0 -63
- package/scss/common/theme/designer/components/overlay/_overlaypanel.scss +0 -62
- package/scss/common/theme/designer/components/overlay/_sidebar.scss +0 -27
- package/scss/common/theme/designer/components/overlay/_tooltip.scss +0 -33
- package/scss/common/theme/designer/components/panel/_accordion.scss +0 -119
- package/scss/common/theme/designer/components/panel/_card.scss +0 -30
- package/scss/common/theme/designer/components/panel/_divider.scss +0 -31
- package/scss/common/theme/designer/components/panel/_fieldset.scss +0 -47
- package/scss/common/theme/designer/components/panel/_panel.scss +0 -42
- package/scss/common/theme/designer/components/panel/_scrollpanel.scss +0 -6
- package/scss/common/theme/designer/components/panel/_splitter.scss +0 -19
- package/scss/common/theme/designer/components/panel/_tabview.scss +0 -66
- package/scss/common/theme/designer/components/panel/_toolbar.scss +0 -10
- package/scss/common/theme/extensions/_button.scss +0 -111
- package/scss/common/theme/extensions/_calendar.scss +0 -18
- package/scss/common/theme/extensions/_card.scss +0 -6
- package/scss/common/theme/extensions/_carousel.scss +0 -13
- package/scss/common/theme/extensions/_checkbox.scss +0 -10
- package/scss/common/theme/extensions/_contextmenu.scss +0 -16
- package/scss/common/theme/extensions/_datatable.scss +0 -83
- package/scss/common/theme/extensions/_dialog.scss +0 -14
- package/scss/common/theme/extensions/_fieldset.scss +0 -6
- package/scss/common/theme/extensions/_galleria.scss +0 -25
- package/scss/common/theme/extensions/_megamenu.scss +0 -18
- package/scss/common/theme/extensions/_menu.scss +0 -14
- package/scss/common/theme/extensions/_menubar.scss +0 -14
- package/scss/common/theme/extensions/_orderlist.scss +0 -37
- package/scss/common/theme/extensions/_paginator.scss +0 -19
- package/scss/common/theme/extensions/_panelmenu.scss +0 -20
- package/scss/common/theme/extensions/_password.scss +0 -5
- package/scss/common/theme/extensions/_picklist.scss +0 -37
- package/scss/common/theme/extensions/_radiobutton.scss +0 -8
- package/scss/common/theme/extensions/_sidebar.scss +0 -19
- package/scss/common/theme/extensions/_slidemenu.scss +0 -10
- package/scss/common/theme/extensions/_slider.scss +0 -6
- package/scss/common/theme/extensions/_steps.scss +0 -50
- package/scss/common/theme/extensions/_tieredmenu.scss +0 -14
- package/scss/common/theme/extensions/_toast.scss +0 -6
- package/scss/common/theme/extensions/_tree.scss +0 -35
- package/scss/common/theme/extensions/_treetable.scss +0 -35
- package/scss/common/theme/extensions/_vendor_extensions.scss +0 -27
- package/scss/common/variables/layout/_common.scss +0 -12
- package/scss/common/variables/layout/_layout_dark.scss +0 -70
- package/scss/common/variables/layout/_layout_light.scss +0 -70
- package/scss/common/variables/theme/_theme_dark.scss +0 -937
- package/scss/common/variables/theme/_theme_light.scss +0 -936
- package/scss/layout/default/_mng-variables-layout-dark.scss +0 -2
- package/scss/layout/default/_mng-variables-layout-light.scss +0 -2
- package/scss/layout/default/layout-dark.scss +0 -2
- package/scss/layout/default/layout-light.scss +0 -2
- package/scss/mng-commons-dark-v2.scss +0 -9
- package/scss/mng-commons-dark.scss +0 -5
- package/scss/mng-commons-light-v2.scss +0 -9
- package/scss/mng-commons-light.scss +0 -8
- package/scss/mng-overrides/_layout_action.scss +0 -10
- package/scss/mng-overrides/_layout_dialog.scss +0 -91
- package/scss/mng-overrides/_layout_forms.scss +0 -38
- package/scss/mng-overrides/_layout_menu.scss +0 -10
- package/scss/mng-overrides/_layout_radio.scss +0 -3
- package/scss/mng-overrides/_layout_styles.scss +0 -35
- package/scss/mng-overrides/_layout_topbar.scss +0 -21
- package/scss/mng-overrides/_mixins.scss +0 -69
- package/scss/mng-overrides/_theme_autocomplete.scss +0 -29
- package/scss/mng-overrides/_theme_button.scss +0 -61
- package/scss/mng-overrides/_theme_datatable.scss +0 -160
- package/scss/mng-overrides/_theme_datepicker.scss +0 -21
- package/scss/mng-overrides/_theme_dialog.scss +0 -108
- package/scss/mng-overrides/_theme_dropdown.scss +0 -22
- package/scss/mng-overrides/_theme_fileupload.scss +0 -24
- package/scss/mng-overrides/_theme_forms.scss +0 -29
- package/scss/mng-overrides/_theme_image.scss +0 -27
- package/scss/mng-overrides/_theme_input.scss +0 -27
- package/scss/mng-overrides/_theme_menu.scss +0 -5
- package/scss/mng-overrides/_theme_multiselect.scss +0 -20
- package/scss/mng-overrides/_theme_styles.scss +0 -17
- package/scss/mng-overrides/_theme_tableview.scss +0 -79
- package/scss/mng-overrides/_theme_tabview.scss +0 -11
- package/scss/mng-overrides/_theme_toast.scss +0 -3
- package/scss/mng-overrides/_theme_toolbar.scss +0 -5
- package/scss/mng-overrides/_variables.scss +0 -15
- package/scss/theme/default/_mng-variables-theme-dark.scss +0 -11
- package/scss/theme/default/_mng-variables-theme-light.scss +0 -13
- package/scss/theme/default/theme-dark.scss +0 -2
- package/scss/theme/default/theme-light.scss +0 -2
- package/scss/v2/layout/_animation.scss +0 -53
- package/scss/v2/layout/_breadcrumb.scss +0 -97
- package/scss/v2/layout/_config.scss +0 -42
- package/scss/v2/layout/_content.scss +0 -3
- package/scss/v2/layout/_fonts.scss +0 -32
- package/scss/v2/layout/_layout_dark.scss +0 -12
- package/scss/v2/layout/_layout_light.scss +0 -12
- package/scss/v2/layout/_main.scss +0 -54
- package/scss/v2/layout/_profile.scss +0 -10
- package/scss/v2/layout/_responsive.scss +0 -131
- package/scss/v2/layout/_sidebar_drawer.scss +0 -283
- package/scss/v2/layout/_sidebar_horizontal.scss +0 -168
- package/scss/v2/layout/_sidebar_reveal.scss +0 -201
- package/scss/v2/layout/_sidebar_slim.scss +0 -157
- package/scss/v2/layout/_sidebar_slim_plus.scss +0 -167
- package/scss/v2/layout/_sidebar_vertical.scss +0 -176
- package/scss/v2/layout/_topbar.scss +0 -174
- package/scss/v2/layout/_typography.scss +0 -62
- package/scss/v2/layout/_utils.scss +0 -33
- package/scss/v2/layout/layout.scss +0 -24
- package/scss/v2/layout/mng/_mng_layout_footer.scss +0 -39
- package/scss/v2/layout/mng/_mng_layout_menu.scss +0 -10
- package/scss/v2/layout/mng/_mng_layout_styles.scss +0 -3
- package/scss/v2/layout/mng/_mng_layout_topbar.scss +0 -18
- package/scss/v2/layout/preloading.scss +0 -84
- package/scss/v2/theme/extensions/_fullcalendar.scss +0 -328
- package/scss/v2/theme/theme-base/_colors.scss +0 -17
- package/scss/v2/theme/theme-base/_common.scss +0 -76
- package/scss/v2/theme/theme-base/_components.scss +0 -110
- package/scss/v2/theme/theme-base/_mixins.scss +0 -337
- package/scss/v2/theme/theme-base/components/button/_button.scss +0 -576
- package/scss/v2/theme/theme-base/components/button/_speeddial.scss +0 -96
- package/scss/v2/theme/theme-base/components/button/_splitbutton.scss +0 -348
- package/scss/v2/theme/theme-base/components/data/_carousel.scss +0 -37
- package/scss/v2/theme/theme-base/components/data/_datatable.scss +0 -338
- package/scss/v2/theme/theme-base/components/data/_dataview.scss +0 -46
- package/scss/v2/theme/theme-base/components/data/_filter.scss +0 -137
- package/scss/v2/theme/theme-base/components/data/_orderlist.scss +0 -114
- package/scss/v2/theme/theme-base/components/data/_organizationchart.scss +0 -50
- package/scss/v2/theme/theme-base/components/data/_paginator.scss +0 -92
- package/scss/v2/theme/theme-base/components/data/_picklist.scss +0 -114
- package/scss/v2/theme/theme-base/components/data/_timeline.scss +0 -35
- package/scss/v2/theme/theme-base/components/data/_tree.scss +0 -150
- package/scss/v2/theme/theme-base/components/data/_treetable.scss +0 -255
- package/scss/v2/theme/theme-base/components/data/_virtualscroller.scss +0 -28
- package/scss/v2/theme/theme-base/components/file/_fileupload.scss +0 -64
- package/scss/v2/theme/theme-base/components/input/_autocomplete.scss +0 -136
- package/scss/v2/theme/theme-base/components/input/_calendar.scss +0 -267
- package/scss/v2/theme/theme-base/components/input/_cascadeselect.scss +0 -135
- package/scss/v2/theme/theme-base/components/input/_checkbox.scss +0 -94
- package/scss/v2/theme/theme-base/components/input/_chips.scss +0 -65
- package/scss/v2/theme/theme-base/components/input/_colorpicker.scss +0 -19
- package/scss/v2/theme/theme-base/components/input/_dropdown.scss +0 -151
- package/scss/v2/theme/theme-base/components/input/_editor.scss +0 -122
- package/scss/v2/theme/theme-base/components/input/_inputgroup.scss +0 -74
- package/scss/v2/theme/theme-base/components/input/_inputmask.scss +0 -16
- package/scss/v2/theme/theme-base/components/input/_inputnumber.scss +0 -28
- package/scss/v2/theme/theme-base/components/input/_inputswitch.scss +0 -60
- package/scss/v2/theme/theme-base/components/input/_inputtext.scss +0 -100
- package/scss/v2/theme/theme-base/components/input/_listbox.scss +0 -97
- package/scss/v2/theme/theme-base/components/input/_multiselect.scss +0 -177
- package/scss/v2/theme/theme-base/components/input/_password.scss +0 -52
- package/scss/v2/theme/theme-base/components/input/_radiobutton.scss +0 -78
- package/scss/v2/theme/theme-base/components/input/_rating.scss +0 -60
- package/scss/v2/theme/theme-base/components/input/_selectbutton.scss +0 -50
- package/scss/v2/theme/theme-base/components/input/_slider.scss +0 -71
- package/scss/v2/theme/theme-base/components/input/_togglebutton.scss +0 -48
- package/scss/v2/theme/theme-base/components/input/_treeselect.scss +0 -139
- package/scss/v2/theme/theme-base/components/menu/_breadcrumb.scss +0 -42
- package/scss/v2/theme/theme-base/components/menu/_contextmenu.scss +0 -39
- package/scss/v2/theme/theme-base/components/menu/_dock.scss +0 -95
- package/scss/v2/theme/theme-base/components/menu/_megamenu.scss +0 -55
- package/scss/v2/theme/theme-base/components/menu/_menu.scss +0 -37
- package/scss/v2/theme/theme-base/components/menu/_menubar.scss +0 -140
- package/scss/v2/theme/theme-base/components/menu/_panelmenu.scss +0 -153
- package/scss/v2/theme/theme-base/components/menu/_slidemenu.scss +0 -59
- package/scss/v2/theme/theme-base/components/menu/_steps.scss +0 -56
- package/scss/v2/theme/theme-base/components/menu/_tabmenu.scss +0 -73
- package/scss/v2/theme/theme-base/components/menu/_tieredmenu.scss +0 -43
- package/scss/v2/theme/theme-base/components/messages/_inlinemessage.scss +0 -69
- package/scss/v2/theme/theme-base/components/messages/_message.scss +0 -107
- package/scss/v2/theme/theme-base/components/messages/_toast.scss +0 -99
- package/scss/v2/theme/theme-base/components/misc/_avatar.scss +0 -30
- package/scss/v2/theme/theme-base/components/misc/_badge.scss +0 -48
- package/scss/v2/theme/theme-base/components/misc/_blockui.scss +0 -0
- package/scss/v2/theme/theme-base/components/misc/_chip.scss +0 -42
- package/scss/v2/theme/theme-base/components/misc/_inplace.scss +0 -16
- package/scss/v2/theme/theme-base/components/misc/_progressbar.scss +0 -17
- package/scss/v2/theme/theme-base/components/misc/_scrolltop.scss +0 -25
- package/scss/v2/theme/theme-base/components/misc/_skeleton.scss +0 -8
- package/scss/v2/theme/theme-base/components/misc/_tag.scss +0 -40
- package/scss/v2/theme/theme-base/components/misc/_terminal.scss +0 -12
- package/scss/v2/theme/theme-base/components/multimedia/_galleria.scss +0 -155
- package/scss/v2/theme/theme-base/components/multimedia/_image.scss +0 -49
- package/scss/v2/theme/theme-base/components/overlay/_confirmpopup.scss +0 -70
- package/scss/v2/theme/theme-base/components/overlay/_dialog.scss +0 -69
- package/scss/v2/theme/theme-base/components/overlay/_overlaypanel.scss +0 -64
- package/scss/v2/theme/theme-base/components/overlay/_sidebar.scss +0 -27
- package/scss/v2/theme/theme-base/components/overlay/_tooltip.scss +0 -33
- package/scss/v2/theme/theme-base/components/panel/_accordion.scss +0 -119
- package/scss/v2/theme/theme-base/components/panel/_card.scss +0 -30
- package/scss/v2/theme/theme-base/components/panel/_divider.scss +0 -31
- package/scss/v2/theme/theme-base/components/panel/_fieldset.scss +0 -47
- package/scss/v2/theme/theme-base/components/panel/_panel.scss +0 -63
- package/scss/v2/theme/theme-base/components/panel/_scrollpanel.scss +0 -6
- package/scss/v2/theme/theme-base/components/panel/_splitter.scss +0 -19
- package/scss/v2/theme/theme-base/components/panel/_tabview.scss +0 -82
- package/scss/v2/theme/theme-base/components/panel/_toolbar.scss +0 -11
- package/scss/v2/theme/theme-base/mng/_mng_mixins.scss +0 -69
- package/scss/v2/theme/theme-base/mng/_mng_theme_autocomplete.scss +0 -34
- package/scss/v2/theme/theme-base/mng/_mng_theme_button.scss +0 -68
- package/scss/v2/theme/theme-base/mng/_mng_theme_datatable.scss +0 -153
- package/scss/v2/theme/theme-base/mng/_mng_theme_datepicker.scss +0 -21
- package/scss/v2/theme/theme-base/mng/_mng_theme_dialog.scss +0 -206
- package/scss/v2/theme/theme-base/mng/_mng_theme_dropdown.scss +0 -32
- package/scss/v2/theme/theme-base/mng/_mng_theme_fileupload.scss +0 -24
- package/scss/v2/theme/theme-base/mng/_mng_theme_forms.scss +0 -66
- package/scss/v2/theme/theme-base/mng/_mng_theme_image.scss +0 -27
- package/scss/v2/theme/theme-base/mng/_mng_theme_input.scss +0 -31
- package/scss/v2/theme/theme-base/mng/_mng_theme_menu.scss +0 -5
- package/scss/v2/theme/theme-base/mng/_mng_theme_multiselect.scss +0 -20
- package/scss/v2/theme/theme-base/mng/_mng_theme_styles.scss +0 -17
- package/scss/v2/theme/theme-base/mng/_mng_theme_tableview.scss +0 -97
- package/scss/v2/theme/theme-base/mng/_mng_theme_tabview.scss +0 -11
- package/scss/v2/theme/theme-base/mng/_mng_theme_toast.scss +0 -3
- package/scss/v2/theme/theme-base/mng/_mng_theme_toolbar.scss +0 -5
- package/scss/v2/theme/theme-base/mng/_mng_variables.scss +0 -15
- package/scss/v2/theme/theme-dark/_extensions.scss +0 -100
- package/scss/v2/theme/theme-dark/_variables.scss +0 -940
- package/scss/v2/theme/theme-dark/blue/theme.scss +0 -14
- package/scss/v2/theme/theme-light/_extensions.scss +0 -100
- package/scss/v2/theme/theme-light/_variables.scss +0 -936
- package/scss/v2/theme/theme-light/blue/theme.scss +0 -14
- /package/{lib → core}/components/notification/notification-wrapper.component.d.ts +0 -0
- /package/{lib/models → core/data-list}/data-list.model.d.ts +0 -0
- /package/{lib/models → core/data-list}/filter-match.model.d.ts +0 -0
- /package/{lib/models/class.model.d.ts → core/models/class-attribute.model.d.ts} +0 -0
- /package/{lib → core}/models/version.model.d.ts +0 -0
- /package/{lib/types/type.decorator.d.ts → core/reflect/type-enum-decorator.d.ts} +0 -0
- /package/{lib/descriptors/types/filter.type.d.ts → filter/models/filter.model.d.ts} +0 -0
- /package/{lib/descriptors/types/trim.type.d.ts → form/api/models/trim.model.d.ts} +0 -0
- /package/{assets/i18n → i18n}/en.json +0 -0
- /package/{assets/i18n → i18n}/sl.json +0 -0
- /package/{lib/descriptors/table → table/api/descriptors}/sort.descriptor.d.ts +0 -0
- /package/{lib/descriptors/types/column.type.d.ts → table/api/models/column.model.d.ts} +0 -0
- /package/{lib → tableview/action}/models/can-component-deactivate.model.d.ts +0 -0
- /package/{lib/services/action → tableview/action/services/providers}/provide-action-executor.d.ts +0 -0
- /package/{lib/services/view → tableview/action/services/providers}/provide-view-container.d.ts +0 -0
- /package/{lib/components → tableview/api}/action/models/tableview-action-default-categories.model.d.ts +0 -0
- /package/{lib/components/form → tableview/api/editor}/models/form-editor.interface.d.ts +0 -0
- /package/{lib → tableview/api/editor}/models/radio.model.d.ts +0 -0
|
@@ -0,0 +1,3882 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, Directive, computed, signal, Component, ChangeDetectionStrategy, InjectionToken, Injectable, Injector, ElementRef, ApplicationRef, ViewContainerRef, EventEmitter, createComponent, Input, Output, TemplateRef, booleanAttribute, numberAttribute, Pipe, APP_INITIALIZER, ErrorHandler } from '@angular/core';
|
|
3
|
+
import * as i3$1 from '@ngx-translate/core';
|
|
4
|
+
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
|
5
|
+
import * as i3 from 'primeng/confirmdialog';
|
|
6
|
+
import { ConfirmDialogModule } from 'primeng/confirmdialog';
|
|
7
|
+
import * as i5 from 'primeng/dialog';
|
|
8
|
+
import { Dialog, DialogModule } from 'primeng/dialog';
|
|
9
|
+
import * as i1 from 'primeng/toast';
|
|
10
|
+
import { ToastModule } from 'primeng/toast';
|
|
11
|
+
import { DialogService, DynamicDialogComponent } from 'primeng/dynamicdialog';
|
|
12
|
+
import * as i2 from 'primeng/api';
|
|
13
|
+
import { PrimeNGConfig, FilterService, MessageService, ConfirmationService } from 'primeng/api';
|
|
14
|
+
import * as i1$1 from '@angular/router';
|
|
15
|
+
import { Router, NavigationEnd, RouterLink, NavigationStart, RouteConfigLoadStart, RouteConfigLoadEnd, NavigationCancel, NavigationError } from '@angular/router';
|
|
16
|
+
import * as i2$1 from 'primeng/button';
|
|
17
|
+
import { ButtonModule } from 'primeng/button';
|
|
18
|
+
import { Title } from '@angular/platform-browser';
|
|
19
|
+
import { BehaviorSubject, ReplaySubject, distinctUntilChanged, isObservable, of, mergeMap, combineLatest, Observable, tap, Subject, take, throwError } from 'rxjs';
|
|
20
|
+
import { filter, map, first, catchError } from 'rxjs/operators';
|
|
21
|
+
import { DatePipe } from '@angular/common';
|
|
22
|
+
import { HttpErrorResponse, HttpClient, HttpBackend } from '@angular/common/http';
|
|
23
|
+
import 'reflect-metadata';
|
|
24
|
+
|
|
25
|
+
class DialogKeydownHandlerDirective {
|
|
26
|
+
constructor() {
|
|
27
|
+
this.dialogService = inject(DialogService);
|
|
28
|
+
this.dynamicDialog = inject(DynamicDialogComponent, { optional: true });
|
|
29
|
+
this.dialog = inject(Dialog, { optional: true });
|
|
30
|
+
this.dialogsWithKeydownListener = [];
|
|
31
|
+
}
|
|
32
|
+
ngOnInit() {
|
|
33
|
+
if (!this.dialog && !this.dynamicDialog) {
|
|
34
|
+
// not a dialog, return
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
this.dialogService.dialogComponentRefMap.forEach(v => {
|
|
38
|
+
if ((this.dialog || v.instance !== this.dynamicDialog) && v.instance.documentKeydownListener) {
|
|
39
|
+
// exclude self dynamic dialog
|
|
40
|
+
this.dialogsWithKeydownListener.push(v.instance);
|
|
41
|
+
v.instance.unbindDocumentKeydownListener();
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
if (!this.dialog) {
|
|
45
|
+
// if dialog is present, then do not bind (because it will bind on unbind-ed dynamic dialog
|
|
46
|
+
this.dynamicDialog?.bindDocumentKeydownListener();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
ngOnDestroy() {
|
|
50
|
+
if (!this.dialog && !this.dynamicDialog) {
|
|
51
|
+
// not a dialog, return
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (!this.dialog) {
|
|
55
|
+
this.dynamicDialog?.unbindDocumentKeydownListener();
|
|
56
|
+
}
|
|
57
|
+
this.dialogsWithKeydownListener.forEach(c => c.bindDocumentKeydownListener());
|
|
58
|
+
}
|
|
59
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: DialogKeydownHandlerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
60
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.2", type: DialogKeydownHandlerDirective, isStandalone: true, selector: "[mngDialogKeydownHandler]", ngImport: i0 }); }
|
|
61
|
+
}
|
|
62
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: DialogKeydownHandlerDirective, decorators: [{
|
|
63
|
+
type: Directive,
|
|
64
|
+
args: [{
|
|
65
|
+
standalone: true,
|
|
66
|
+
selector: '[mngDialogKeydownHandler]'
|
|
67
|
+
}]
|
|
68
|
+
}] });
|
|
69
|
+
|
|
70
|
+
class NotificationWrapperComponent {
|
|
71
|
+
constructor() {
|
|
72
|
+
this.notificationCutoff = 70;
|
|
73
|
+
this.isDialogNotificationVisible = computed(() => this.dialogNotification() !== null);
|
|
74
|
+
this.dialogNotification = signal(null);
|
|
75
|
+
}
|
|
76
|
+
getNotificationIconClass(message) {
|
|
77
|
+
if (message?.icon)
|
|
78
|
+
return message.icon;
|
|
79
|
+
switch (message?.severity) {
|
|
80
|
+
case 'info':
|
|
81
|
+
return 'pi-info-circle';
|
|
82
|
+
case 'warning':
|
|
83
|
+
return 'pi-exclamation-triangle';
|
|
84
|
+
case 'error':
|
|
85
|
+
return 'pi-times-circle';
|
|
86
|
+
case 'success':
|
|
87
|
+
return 'pi-check';
|
|
88
|
+
default:
|
|
89
|
+
return '';
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
onShowNotificationInDialog(message) {
|
|
93
|
+
this.dialogNotification.set(message);
|
|
94
|
+
}
|
|
95
|
+
onDialogNotificationVisibilityChange(visible) {
|
|
96
|
+
if (!visible) {
|
|
97
|
+
this.dialogNotification.set(null);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: NotificationWrapperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
101
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.2", type: NotificationWrapperComponent, isStandalone: true, selector: "mng-notification-wrapper", ngImport: i0, template: "<ng-content></ng-content>\n<p-confirmDialog appendTo=\"body\" [baseZIndex]=\"50\"></p-confirmDialog>\n\n<p-toast [baseZIndex]=\"50\">\n <ng-template let-message pTemplate=\"message\">\n <span [class]=\"'p-toast-message-icon pi ' + getNotificationIconClass(message)\"></span>\n <div class=\"p-toast-message-text\">\n <div class=\"p-toast-summary\">{{ message.summary }}</div>\n <div class=\"p-toast-detail\">{{ message.detail.slice(0, notificationCutoff) + (message.detail.length > notificationCutoff ? '...' : '') }}</div>\n @if (message.detail.length > notificationCutoff) {\n <div (click)=\"onShowNotificationInDialog(message)\" class=\"p-link font-semibold text-sm mt-2 flex align-items-center\">\n <i class=\"pi pi-chevron-down mr-1\"></i>{{ 'notification.details' | translate }}\n </div>\n }\n </div>\n </ng-template>\n</p-toast>\n\n<p-dialog\n [visible]=\"isDialogNotificationVisible()\"\n (visibleChange)=\"onDialogNotificationVisibilityChange($event)\"\n [styleClass]=\"'p-fluid mng-dialog mng-dialog-xs ' + 'mng-message-detail-dialog mng-message-detail-dialog-' + (dialogNotification()?.severity ?? '')\">\n <ng-template pTemplate=\"header\" mngDialogKeydownHandler>\n <span class=\"p-dialog-title font-bold mng-dialog-success\">\n <span [class]=\"'mr-2 pi ' + getNotificationIconClass(dialogNotification())\"></span>\n {{ dialogNotification()?.summary ?? '' }}\n </span>\n </ng-template>\n <div>\n {{ dialogNotification()?.detail ?? '' }}\n </div>\n</p-dialog>\n", dependencies: [{ kind: "ngmodule", type: ToastModule }, { kind: "component", type: i1.Toast, selector: "p-toast", inputs: ["key", "autoZIndex", "baseZIndex", "life", "style", "styleClass", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "breakpoints"], outputs: ["onClose"] }, { kind: "directive", type: i2.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "ngmodule", type: ConfirmDialogModule }, { kind: "component", type: i3.ConfirmDialog, selector: "p-confirmDialog", inputs: ["header", "icon", "message", "style", "styleClass", "maskStyleClass", "acceptIcon", "acceptLabel", "closeAriaLabel", "acceptAriaLabel", "acceptVisible", "rejectIcon", "rejectLabel", "rejectAriaLabel", "rejectVisible", "acceptButtonStyleClass", "rejectButtonStyleClass", "closeOnEscape", "dismissableMask", "blockScroll", "rtl", "closable", "appendTo", "key", "autoZIndex", "baseZIndex", "transitionOptions", "focusTrap", "defaultFocus", "breakpoints", "visible", "position"], outputs: ["onHide"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i3$1.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: DialogModule }, { kind: "component", type: i5.Dialog, selector: "p-dialog", inputs: ["header", "draggable", "resizable", "positionLeft", "positionTop", "contentStyle", "contentStyleClass", "modal", "closeOnEscape", "dismissableMask", "rtl", "closable", "responsive", "appendTo", "breakpoints", "styleClass", "maskStyleClass", "maskStyle", "showHeader", "breakpoint", "blockScroll", "autoZIndex", "baseZIndex", "minX", "minY", "focusOnShow", "maximizable", "keepInViewport", "focusTrap", "transitionOptions", "closeIcon", "closeAriaLabel", "closeTabindex", "minimizeIcon", "maximizeIcon", "visible", "style", "position"], outputs: ["onShow", "onHide", "visibleChange", "onResizeInit", "onResizeEnd", "onDragEnd", "onMaximize"] }, { kind: "directive", type: DialogKeydownHandlerDirective, selector: "[mngDialogKeydownHandler]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
102
|
+
}
|
|
103
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: NotificationWrapperComponent, decorators: [{
|
|
104
|
+
type: Component,
|
|
105
|
+
args: [{ selector: 'mng-notification-wrapper', standalone: true, imports: [ToastModule, ConfirmDialogModule, TranslateModule, DialogModule, DialogKeydownHandlerDirective], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-content></ng-content>\n<p-confirmDialog appendTo=\"body\" [baseZIndex]=\"50\"></p-confirmDialog>\n\n<p-toast [baseZIndex]=\"50\">\n <ng-template let-message pTemplate=\"message\">\n <span [class]=\"'p-toast-message-icon pi ' + getNotificationIconClass(message)\"></span>\n <div class=\"p-toast-message-text\">\n <div class=\"p-toast-summary\">{{ message.summary }}</div>\n <div class=\"p-toast-detail\">{{ message.detail.slice(0, notificationCutoff) + (message.detail.length > notificationCutoff ? '...' : '') }}</div>\n @if (message.detail.length > notificationCutoff) {\n <div (click)=\"onShowNotificationInDialog(message)\" class=\"p-link font-semibold text-sm mt-2 flex align-items-center\">\n <i class=\"pi pi-chevron-down mr-1\"></i>{{ 'notification.details' | translate }}\n </div>\n }\n </div>\n </ng-template>\n</p-toast>\n\n<p-dialog\n [visible]=\"isDialogNotificationVisible()\"\n (visibleChange)=\"onDialogNotificationVisibilityChange($event)\"\n [styleClass]=\"'p-fluid mng-dialog mng-dialog-xs ' + 'mng-message-detail-dialog mng-message-detail-dialog-' + (dialogNotification()?.severity ?? '')\">\n <ng-template pTemplate=\"header\" mngDialogKeydownHandler>\n <span class=\"p-dialog-title font-bold mng-dialog-success\">\n <span [class]=\"'mr-2 pi ' + getNotificationIconClass(dialogNotification())\"></span>\n {{ dialogNotification()?.summary ?? '' }}\n </span>\n </ng-template>\n <div>\n {{ dialogNotification()?.detail ?? '' }}\n </div>\n</p-dialog>\n" }]
|
|
106
|
+
}] });
|
|
107
|
+
|
|
108
|
+
class ACommonsErrorBase extends Error {
|
|
109
|
+
constructor(message, options) {
|
|
110
|
+
super(message);
|
|
111
|
+
this.name = options?.name ?? 'MngError';
|
|
112
|
+
this.messageCode = options?.messageCode;
|
|
113
|
+
this.location = options?.location ?? window?.location?.href;
|
|
114
|
+
this.cause = options?.cause;
|
|
115
|
+
this.stack = options?.stack ?? (options?.cause ? options.cause.stack : new Error(message).stack);
|
|
116
|
+
this.details = options?.details;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
class CommonsInternalError extends ACommonsErrorBase {
|
|
120
|
+
constructor(message, options) {
|
|
121
|
+
super(message, {
|
|
122
|
+
name: 'CommonsInternalError',
|
|
123
|
+
...options
|
|
124
|
+
});
|
|
125
|
+
this.type = 'CommonsInternalError';
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
class CommonsHttpError extends ACommonsErrorBase {
|
|
129
|
+
constructor(message, httpError, options) {
|
|
130
|
+
super(message, {
|
|
131
|
+
name: 'CommonsHttpError_' + httpError.url,
|
|
132
|
+
cause: httpError,
|
|
133
|
+
...options
|
|
134
|
+
});
|
|
135
|
+
this.type = 'CommonsHttpError';
|
|
136
|
+
this.httpError = httpError;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const ngPrimerFormatSupported = [/d{1,2}/g, /E{1,5}/g, /c{1,5}/g, /M{1,5}/g, /L{1,5}/g, /y{1,4}/g, /Y{1,4}/g];
|
|
141
|
+
const ngPrimeFormatOther = [/G{1,5}/g, /w{1,2}/g, /W/g, /a{1,5}/g, /B{1,5}/g, /b{1,5}/g, /h{1,2}/g, /H{1,2}/g, /m{1,2}/g, /s{1,2}/g, /S{1,3}/g, /z{1,4}/g, /Z{1,5}/g, /O{1,4}/g];
|
|
142
|
+
const ngPrimerFormatMap = {
|
|
143
|
+
// days
|
|
144
|
+
d: 'd',
|
|
145
|
+
dd: 'dd',
|
|
146
|
+
E: 'D',
|
|
147
|
+
EE: 'D',
|
|
148
|
+
EEE: 'D',
|
|
149
|
+
EEEE: 'DD',
|
|
150
|
+
EEEEE: 'D',
|
|
151
|
+
EEEEEE: 'D',
|
|
152
|
+
c: 'd',
|
|
153
|
+
cc: 'dd',
|
|
154
|
+
ccc: 'D',
|
|
155
|
+
cccc: 'DD',
|
|
156
|
+
ccccc: 'D',
|
|
157
|
+
cccccc: 'D',
|
|
158
|
+
// months
|
|
159
|
+
M: 'm',
|
|
160
|
+
MM: 'mm',
|
|
161
|
+
MMM: 'M',
|
|
162
|
+
MMMM: 'MM',
|
|
163
|
+
MMMMM: 'M',
|
|
164
|
+
L: 'm',
|
|
165
|
+
LL: 'mm',
|
|
166
|
+
LLL: 'M',
|
|
167
|
+
LLLL: 'MM',
|
|
168
|
+
LLLLL: 'M',
|
|
169
|
+
// year
|
|
170
|
+
y: 'y',
|
|
171
|
+
yy: 'y',
|
|
172
|
+
yyy: 'yy',
|
|
173
|
+
yyyy: 'yy',
|
|
174
|
+
Y: 'y',
|
|
175
|
+
YY: 'y',
|
|
176
|
+
YYY: 'yy',
|
|
177
|
+
YYYY: 'yy'
|
|
178
|
+
};
|
|
179
|
+
function padNumber(num, size = 2) {
|
|
180
|
+
let str = String(num);
|
|
181
|
+
while (str.length < size) {
|
|
182
|
+
str = '0' + str;
|
|
183
|
+
}
|
|
184
|
+
return str;
|
|
185
|
+
}
|
|
186
|
+
function dateToIsoString(value, type = 'date-time', dateTimeOpts = {}) {
|
|
187
|
+
if (typeof value === 'string') {
|
|
188
|
+
value = new Date(value);
|
|
189
|
+
}
|
|
190
|
+
if (typeof value === 'number') {
|
|
191
|
+
value = new Date(value);
|
|
192
|
+
}
|
|
193
|
+
if (!(value instanceof Date)) {
|
|
194
|
+
return null;
|
|
195
|
+
}
|
|
196
|
+
if (type === 'date') {
|
|
197
|
+
// date only, no time part (and timezone, millis, utc does not matter ...)
|
|
198
|
+
return value.getFullYear() + '-' + padNumber(value.getMonth() + 1) + '-' + padNumber(value.getDate());
|
|
199
|
+
}
|
|
200
|
+
if (dateTimeOpts.utc) {
|
|
201
|
+
let str = value.toISOString();
|
|
202
|
+
if (dateTimeOpts.noMillis) {
|
|
203
|
+
const dotIdx = str.lastIndexOf('.');
|
|
204
|
+
str = str.substring(0, dotIdx) + str.substring(dotIdx + 4, str.length);
|
|
205
|
+
}
|
|
206
|
+
if (dateTimeOpts.noTimezone) {
|
|
207
|
+
str = str.substring(0, str.length - 1);
|
|
208
|
+
}
|
|
209
|
+
return str;
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
let base = value.getFullYear() +
|
|
213
|
+
'-' +
|
|
214
|
+
padNumber(value.getMonth() + 1) +
|
|
215
|
+
'-' +
|
|
216
|
+
padNumber(value.getDate()) +
|
|
217
|
+
'T' +
|
|
218
|
+
padNumber(value.getHours()) +
|
|
219
|
+
':' +
|
|
220
|
+
padNumber(value.getMinutes()) +
|
|
221
|
+
':' +
|
|
222
|
+
padNumber(value.getSeconds());
|
|
223
|
+
if (!dateTimeOpts.noMillis) {
|
|
224
|
+
base += '.' + padNumber(value.getMilliseconds());
|
|
225
|
+
}
|
|
226
|
+
if (!dateTimeOpts.noTimezone) {
|
|
227
|
+
const tzo = -value.getTimezoneOffset(), dif = tzo >= 0 ? '+' : '-';
|
|
228
|
+
base = base + (dif + padNumber(Math.floor(Math.abs(tzo) / 60)) + ':' + padNumber(Math.abs(tzo) % 60));
|
|
229
|
+
}
|
|
230
|
+
return base;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
function fromAngularDateFormatToPrime(ngDateFormat) {
|
|
234
|
+
let primeDateFormat = ngDateFormat;
|
|
235
|
+
for (const regex of ngPrimeFormatOther) {
|
|
236
|
+
primeDateFormat = primeDateFormat.replace(regex, ' ');
|
|
237
|
+
}
|
|
238
|
+
for (const regex of ngPrimerFormatSupported) {
|
|
239
|
+
const matches = [...primeDateFormat.matchAll(regex)].reverse();
|
|
240
|
+
for (const match of matches) {
|
|
241
|
+
if (match.index) {
|
|
242
|
+
const matchStr = match[0];
|
|
243
|
+
const replacement = ngPrimerFormatMap[matchStr] ?? match[0];
|
|
244
|
+
primeDateFormat = primeDateFormat.substring(0, match.index) + replacement + primeDateFormat.substring(match.index + matchStr.length);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
primeDateFormat = primeDateFormat.replace(/\s+\W\s+/g, ' ');
|
|
249
|
+
primeDateFormat = primeDateFormat.replace(/\s\s+/g, ' ');
|
|
250
|
+
return primeDateFormat.trim();
|
|
251
|
+
}
|
|
252
|
+
function angularDateFormatHasTime(ngDateFormat) {
|
|
253
|
+
return /[hHmsS]/.test(ngDateFormat);
|
|
254
|
+
}
|
|
255
|
+
function angularDateFormatHasSeconds(ngDateFormat) {
|
|
256
|
+
return /[sS]/.test(ngDateFormat);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
var LogLevelEnum;
|
|
260
|
+
(function (LogLevelEnum) {
|
|
261
|
+
LogLevelEnum[LogLevelEnum["Trace"] = 0] = "Trace";
|
|
262
|
+
LogLevelEnum[LogLevelEnum["Debug"] = 1] = "Debug";
|
|
263
|
+
LogLevelEnum[LogLevelEnum["Log"] = 2] = "Log";
|
|
264
|
+
LogLevelEnum[LogLevelEnum["Info"] = 3] = "Info";
|
|
265
|
+
LogLevelEnum[LogLevelEnum["Warning"] = 4] = "Warning";
|
|
266
|
+
LogLevelEnum[LogLevelEnum["Error"] = 5] = "Error";
|
|
267
|
+
})(LogLevelEnum || (LogLevelEnum = {}));
|
|
268
|
+
|
|
269
|
+
class LoggerService {
|
|
270
|
+
static { this._instance = new LoggerService(); }
|
|
271
|
+
static { this._isInit = false; }
|
|
272
|
+
static { this._publishers = []; }
|
|
273
|
+
static { this._entriesBuffer = []; }
|
|
274
|
+
static { this._categoryInstances = {}; }
|
|
275
|
+
static { this._timestampFormat = 'yyyy-MM-dd HH:mm:ss.SSS'; }
|
|
276
|
+
constructor() {
|
|
277
|
+
// Temporary settings that cover logging calls before initialisation
|
|
278
|
+
this.defaultLogLevel = LogLevelEnum.Info;
|
|
279
|
+
this.datePipe = new DatePipe('en-US');
|
|
280
|
+
// empty
|
|
281
|
+
}
|
|
282
|
+
static get() {
|
|
283
|
+
return LoggerService._instance;
|
|
284
|
+
}
|
|
285
|
+
static configure(config) {
|
|
286
|
+
if (config.timestampFormat) {
|
|
287
|
+
LoggerService._timestampFormat = config.timestampFormat;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
static init(configurationService, publishers) {
|
|
291
|
+
if (LoggerService._isInit) {
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
LoggerService._configurationService = configurationService;
|
|
295
|
+
LoggerService._publishers = publishers;
|
|
296
|
+
LoggerService._isInit = true;
|
|
297
|
+
LoggerService._flushBuffer();
|
|
298
|
+
}
|
|
299
|
+
static _flushBuffer() {
|
|
300
|
+
if (!LoggerService._isInit) {
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
LoggerService._entriesBuffer.forEach(e => this._instance._log(e));
|
|
304
|
+
LoggerService._entriesBuffer = [];
|
|
305
|
+
}
|
|
306
|
+
static create(category) {
|
|
307
|
+
return LoggerService._instance.create(category);
|
|
308
|
+
}
|
|
309
|
+
create(category) {
|
|
310
|
+
if (this.category) {
|
|
311
|
+
throw new CommonsInternalError(`Cannot create logger with category inside another category (${this.category}). Must create logger on root.`);
|
|
312
|
+
}
|
|
313
|
+
if (LoggerService._categoryInstances[category]) {
|
|
314
|
+
return LoggerService._categoryInstances[category];
|
|
315
|
+
}
|
|
316
|
+
const logger = new LoggerService();
|
|
317
|
+
logger.category = category;
|
|
318
|
+
LoggerService._categoryInstances[category] = logger;
|
|
319
|
+
return logger;
|
|
320
|
+
}
|
|
321
|
+
_processLog(msgOrError, logLevel, category = undefined, data) {
|
|
322
|
+
const [timestamp, timestampFormatted] = [...this._getTimestamps()];
|
|
323
|
+
const logEntry = {
|
|
324
|
+
level: logLevel,
|
|
325
|
+
message: typeof msgOrError === 'string' ? msgOrError : msgOrError.message,
|
|
326
|
+
data: data,
|
|
327
|
+
category: this.category ?? category,
|
|
328
|
+
timestamp: timestamp,
|
|
329
|
+
timestampFormatted: timestampFormatted ?? undefined
|
|
330
|
+
};
|
|
331
|
+
if (msgOrError instanceof Error) {
|
|
332
|
+
// set error from message param
|
|
333
|
+
logEntry.error = msgOrError;
|
|
334
|
+
}
|
|
335
|
+
else if (data?.length && data[0] instanceof Error) {
|
|
336
|
+
// if first data is error, also consider as error
|
|
337
|
+
logEntry.error = data[0];
|
|
338
|
+
logEntry.data = data.splice(1);
|
|
339
|
+
}
|
|
340
|
+
this._log(logEntry);
|
|
341
|
+
}
|
|
342
|
+
_getTimestamps() {
|
|
343
|
+
const timestamp = new Date();
|
|
344
|
+
const timestampFormatted = this.datePipe.transform(timestamp, LoggerService._timestampFormat) ?? dateToIsoString(timestamp);
|
|
345
|
+
return [timestamp, timestampFormatted];
|
|
346
|
+
}
|
|
347
|
+
_log(log) {
|
|
348
|
+
if (!LoggerService._isInit) {
|
|
349
|
+
// add to buffer
|
|
350
|
+
LoggerService._entriesBuffer.push(log);
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
const logConfig = (LoggerService._configurationService?.getConfigValue)?.('log');
|
|
354
|
+
if ((this.category && log.level < (logConfig?.category?.[this.category]?.level ?? logConfig?.level ?? this.defaultLogLevel)) ||
|
|
355
|
+
(!this.category && log.level < (logConfig?.level ?? this.defaultLogLevel))) {
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
if (logConfig?.timestampFormat) {
|
|
359
|
+
log.timestampFormatted = this.datePipe.transform(log.timestamp, logConfig.timestampFormat) ?? undefined;
|
|
360
|
+
}
|
|
361
|
+
LoggerService._publishers.forEach(p => p.addEntry(log));
|
|
362
|
+
}
|
|
363
|
+
trace(msgOrError, ...data) {
|
|
364
|
+
this._processLog(msgOrError, LogLevelEnum.Trace, undefined, data);
|
|
365
|
+
}
|
|
366
|
+
debug(msgOrError, ...data) {
|
|
367
|
+
this._processLog(msgOrError, LogLevelEnum.Debug, undefined, data);
|
|
368
|
+
}
|
|
369
|
+
log(msgOrError, logLevel = LogLevelEnum.Log, category = undefined, ...data) {
|
|
370
|
+
this._processLog(msgOrError, logLevel, category, data);
|
|
371
|
+
}
|
|
372
|
+
logEntry(logEntry) {
|
|
373
|
+
const [timestamp, timestampFormatted] = [...this._getTimestamps()];
|
|
374
|
+
const logEntryFinal = {
|
|
375
|
+
timestamp: timestamp,
|
|
376
|
+
timestampFormatted: timestampFormatted ?? undefined,
|
|
377
|
+
category: this.category ?? logEntry.category,
|
|
378
|
+
message: '',
|
|
379
|
+
messageDetails: logEntry.messageDetails,
|
|
380
|
+
level: LogLevelEnum.Log,
|
|
381
|
+
...logEntry
|
|
382
|
+
};
|
|
383
|
+
this._log(logEntryFinal);
|
|
384
|
+
}
|
|
385
|
+
info(msgOrError, ...data) {
|
|
386
|
+
this._processLog(msgOrError, LogLevelEnum.Info, undefined, data);
|
|
387
|
+
}
|
|
388
|
+
warn(msgOrError, ...data) {
|
|
389
|
+
this._processLog(msgOrError, LogLevelEnum.Warning, undefined, data);
|
|
390
|
+
}
|
|
391
|
+
error(msgOrError, ...data) {
|
|
392
|
+
this._processLog(msgOrError, LogLevelEnum.Error, undefined, data);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
const BROWSER_STORAGE_IT = new InjectionToken('BROWSER_STORAGE');
|
|
397
|
+
|
|
398
|
+
const COMMONS_MODULE_CONFIG_IT = new InjectionToken('COMMONS_MODULE_CONFIG');
|
|
399
|
+
|
|
400
|
+
class CommonsService {
|
|
401
|
+
constructor() {
|
|
402
|
+
// internal
|
|
403
|
+
this.logger = inject(LoggerService).create('CommonsService');
|
|
404
|
+
this.router = inject(Router);
|
|
405
|
+
this.primengConfig = inject(PrimeNGConfig);
|
|
406
|
+
this.translate = inject(TranslateService);
|
|
407
|
+
this.titleService = inject(Title);
|
|
408
|
+
this.filterService = inject(FilterService);
|
|
409
|
+
this.moduleConfig = inject(COMMONS_MODULE_CONFIG_IT, { optional: true });
|
|
410
|
+
this.localStorage = inject(BROWSER_STORAGE_IT);
|
|
411
|
+
// breadcrumbs
|
|
412
|
+
this.breadcrumbHomeSubject = new BehaviorSubject({
|
|
413
|
+
icon: 'pi pi-home',
|
|
414
|
+
routerLink: '/'
|
|
415
|
+
});
|
|
416
|
+
this.breadcrumbsSubject = new BehaviorSubject([]);
|
|
417
|
+
// visual
|
|
418
|
+
this._colorScheme = 'light';
|
|
419
|
+
this.userSubject = new ReplaySubject(1);
|
|
420
|
+
this._userRoles = [];
|
|
421
|
+
this.userRolesSubject = new BehaviorSubject([]);
|
|
422
|
+
// language
|
|
423
|
+
this.languageSubject = new ReplaySubject(1);
|
|
424
|
+
this.dataLanguageSubject = new ReplaySubject(1);
|
|
425
|
+
}
|
|
426
|
+
// APP section
|
|
427
|
+
get appName() {
|
|
428
|
+
return this.moduleConfig?.app?.name ?? 'app.name';
|
|
429
|
+
}
|
|
430
|
+
get appOwner() {
|
|
431
|
+
return this.moduleConfig?.app?.owner ?? 'app.owner';
|
|
432
|
+
}
|
|
433
|
+
get appLogoLight() {
|
|
434
|
+
return this.moduleConfig?.app?.logoPathLight ? this.moduleConfig.app.logoPathLight : this.moduleConfig?.app?.logoPath ?? 'assets/layout/images/logo.png';
|
|
435
|
+
}
|
|
436
|
+
get appLogoDark() {
|
|
437
|
+
return this.moduleConfig?.app?.logoPathDark ? this.moduleConfig.app.logoPathDark : this.moduleConfig?.app?.logoPath ?? 'assets/layout/images/logo.png';
|
|
438
|
+
}
|
|
439
|
+
get appLogoNameLight() {
|
|
440
|
+
return this.moduleConfig?.app?.logoNamePathLight
|
|
441
|
+
? this.moduleConfig.app.logoNamePathLight
|
|
442
|
+
: this.moduleConfig?.app?.logoNamePath ?? 'assets/layout/images/logo-appname.png';
|
|
443
|
+
}
|
|
444
|
+
get appLogoNameDark() {
|
|
445
|
+
return this.moduleConfig?.app?.logoNamePathDark ? this.moduleConfig.app.logoNamePathDark : this.moduleConfig?.app?.logoNamePath ?? 'assets/layout/images/logo-appname.png';
|
|
446
|
+
}
|
|
447
|
+
get appLanguages() {
|
|
448
|
+
return this.moduleConfig?.app?.languages ?? ['en'];
|
|
449
|
+
}
|
|
450
|
+
get appLanguage() {
|
|
451
|
+
const lsLang = this.localStorage.getItem('lang');
|
|
452
|
+
if (lsLang && this.appLanguages.some(l => l === lsLang)) {
|
|
453
|
+
return lsLang;
|
|
454
|
+
}
|
|
455
|
+
return null;
|
|
456
|
+
}
|
|
457
|
+
set appLanguage(language) {
|
|
458
|
+
if (language === null) {
|
|
459
|
+
this.localStorage.removeItem('lang');
|
|
460
|
+
this.languageSubject.next(language);
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
if (this.appLanguages.some(l => l === language)) {
|
|
464
|
+
this.localStorage.setItem('lang', language);
|
|
465
|
+
this.languageSubject.next(language);
|
|
466
|
+
this.translate.use(language);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
get appLanguage$() {
|
|
470
|
+
return this.languageSubject.asObservable().pipe(distinctUntilChanged());
|
|
471
|
+
}
|
|
472
|
+
initLanguage() {
|
|
473
|
+
const browserLang = this.translate.getBrowserLang();
|
|
474
|
+
if (browserLang && this.appLanguages.some(l => l === browserLang)) {
|
|
475
|
+
this.appLanguage = browserLang;
|
|
476
|
+
return browserLang;
|
|
477
|
+
}
|
|
478
|
+
const defaultLanguage = this.appLanguages?.length > 0 ? this.appLanguages[0] : 'en';
|
|
479
|
+
this.appLanguage = defaultLanguage;
|
|
480
|
+
return defaultLanguage;
|
|
481
|
+
}
|
|
482
|
+
getOrInitLanguage() {
|
|
483
|
+
return this.appLanguage || this.initLanguage();
|
|
484
|
+
}
|
|
485
|
+
get appDataLanguages() {
|
|
486
|
+
return this.moduleConfig?.app?.dataLanguages ?? ['en'];
|
|
487
|
+
}
|
|
488
|
+
get appDataLanguageDefault() {
|
|
489
|
+
return this.appDataLanguages[0];
|
|
490
|
+
}
|
|
491
|
+
get appDataLanguage() {
|
|
492
|
+
const dataLang = this.localStorage.getItem('dataLang');
|
|
493
|
+
if (dataLang && this.appDataLanguages.some(dl => dl === dataLang)) {
|
|
494
|
+
return dataLang;
|
|
495
|
+
}
|
|
496
|
+
return this.defaultDataLanguage;
|
|
497
|
+
}
|
|
498
|
+
set appDataLanguage(dataLanguage) {
|
|
499
|
+
if (dataLanguage === null) {
|
|
500
|
+
this.localStorage.removeItem('dataLang');
|
|
501
|
+
this.dataLanguageSubject.next(dataLanguage);
|
|
502
|
+
return;
|
|
503
|
+
}
|
|
504
|
+
if (this.appDataLanguages.some(dl => dl === dataLanguage)) {
|
|
505
|
+
this.localStorage.setItem('dataLang', dataLanguage);
|
|
506
|
+
this.dataLanguageSubject.next(dataLanguage);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
get appDataLanguage$() {
|
|
510
|
+
return this.dataLanguageSubject.asObservable().pipe(distinctUntilChanged());
|
|
511
|
+
}
|
|
512
|
+
// We assume, that default data language is the first one from the array of all available data languages
|
|
513
|
+
get defaultDataLanguage() {
|
|
514
|
+
return this.appDataLanguages[0];
|
|
515
|
+
}
|
|
516
|
+
get appVersion() {
|
|
517
|
+
return this.moduleConfig?.app?.version;
|
|
518
|
+
}
|
|
519
|
+
// BREADCRUMB section
|
|
520
|
+
get breadcrumbHome$() {
|
|
521
|
+
return this.breadcrumbHomeSubject.asObservable();
|
|
522
|
+
}
|
|
523
|
+
get breadcrumbs$() {
|
|
524
|
+
return this.breadcrumbsSubject.asObservable();
|
|
525
|
+
}
|
|
526
|
+
// VISUAL section
|
|
527
|
+
get colorSchemeIsLight() {
|
|
528
|
+
return this._colorScheme === 'light';
|
|
529
|
+
}
|
|
530
|
+
get colorSchemeIsDark() {
|
|
531
|
+
return this._colorScheme === 'dark';
|
|
532
|
+
}
|
|
533
|
+
// USER section
|
|
534
|
+
get user() {
|
|
535
|
+
return this._user;
|
|
536
|
+
}
|
|
537
|
+
set user(user) {
|
|
538
|
+
this._user = user;
|
|
539
|
+
this.userSubject.next(user);
|
|
540
|
+
}
|
|
541
|
+
get user$() {
|
|
542
|
+
return this.userSubject.asObservable();
|
|
543
|
+
}
|
|
544
|
+
get userRoles() {
|
|
545
|
+
return this._userRoles;
|
|
546
|
+
}
|
|
547
|
+
set userRoles(roles) {
|
|
548
|
+
this._userRoles = roles;
|
|
549
|
+
this.userRolesSubject.next(roles);
|
|
550
|
+
}
|
|
551
|
+
get userRoles$() {
|
|
552
|
+
return this.userRolesSubject.asObservable();
|
|
553
|
+
}
|
|
554
|
+
reset() {
|
|
555
|
+
// visual
|
|
556
|
+
this._colorScheme = this.moduleConfig?.app?.colorScheme ?? 'light';
|
|
557
|
+
// ripple
|
|
558
|
+
this.primengConfig.ripple = true;
|
|
559
|
+
// translate
|
|
560
|
+
this.translate.langs = this.appLanguages;
|
|
561
|
+
const lang = this.getOrInitLanguage();
|
|
562
|
+
this.languageSubject.next(lang);
|
|
563
|
+
this.dataLanguageSubject.next(this.appDataLanguage);
|
|
564
|
+
this.translate.use(lang);
|
|
565
|
+
this.translate.get('mngPrime').subscribe(value => this.primengConfig.setTranslation(value));
|
|
566
|
+
this.routerEventsSubscription?.unsubscribe();
|
|
567
|
+
this.routerEventsSubscription = this.router.events
|
|
568
|
+
.pipe(
|
|
569
|
+
// Filter the NavigationEnd events as the breadcrumb is updated only when the route reaches its end
|
|
570
|
+
filter(event => event instanceof NavigationEnd))
|
|
571
|
+
.subscribe(() => {
|
|
572
|
+
this.updateBreadcrumbs();
|
|
573
|
+
this.setPageTitle();
|
|
574
|
+
});
|
|
575
|
+
this.translateLangChangeSubscription?.unsubscribe();
|
|
576
|
+
this.translateLangChangeSubscription = this.translate.onLangChange.subscribe(() => {
|
|
577
|
+
this.updateBreadcrumbs();
|
|
578
|
+
this.setPageTitle();
|
|
579
|
+
});
|
|
580
|
+
this.logger.debug('Reset');
|
|
581
|
+
}
|
|
582
|
+
// BREADCRUMB actions
|
|
583
|
+
findBreadcrumbItem(item) {
|
|
584
|
+
const items = this.breadcrumbsSubject.value;
|
|
585
|
+
if (item.id) {
|
|
586
|
+
return items.find(i => i.id && i.id === item.id) ?? null;
|
|
587
|
+
}
|
|
588
|
+
else if (item.routerLink) {
|
|
589
|
+
const routerLinkStr = Array.isArray(item.routerLink) ? item.routerLink.join('/') : item.routerLink;
|
|
590
|
+
return items.find(i => i.routerLink && (Array.isArray(i.routerLink) ? i.routerLink.join('/') : i.routerLink) === routerLinkStr) ?? null;
|
|
591
|
+
}
|
|
592
|
+
else if (item.positionIndex) {
|
|
593
|
+
return items.find(i => i.positionIndex && i.positionIndex === i.positionIndex) ?? null;
|
|
594
|
+
}
|
|
595
|
+
else if (item.label) {
|
|
596
|
+
return items.find(i => i.label && i.label === i.label) ?? null;
|
|
597
|
+
}
|
|
598
|
+
else if (item.icon) {
|
|
599
|
+
return items.find(i => i.icon && i.icon === i.icon) ?? null;
|
|
600
|
+
}
|
|
601
|
+
return null;
|
|
602
|
+
}
|
|
603
|
+
updateBreadcrumbItem(item) {
|
|
604
|
+
const items = [...this.breadcrumbsSubject.value];
|
|
605
|
+
let posIdx = -1;
|
|
606
|
+
if (item.id) {
|
|
607
|
+
posIdx = items.findIndex(i => i.id && i.id === item.id);
|
|
608
|
+
}
|
|
609
|
+
else if (item.routerLink) {
|
|
610
|
+
const routerLinkStr = Array.isArray(item.routerLink) ? item.routerLink.join('/') : item.routerLink;
|
|
611
|
+
posIdx = items.findIndex(i => i.routerLink && (Array.isArray(i.routerLink) ? i.routerLink.join('/') : i.routerLink) === routerLinkStr);
|
|
612
|
+
}
|
|
613
|
+
else if (item.positionIndex) {
|
|
614
|
+
posIdx = items.findIndex(i => i.positionIndex && i.positionIndex === i.positionIndex);
|
|
615
|
+
}
|
|
616
|
+
else if (item.label) {
|
|
617
|
+
posIdx = items.findIndex(i => i.label && i.label === i.label);
|
|
618
|
+
}
|
|
619
|
+
else if (item.icon) {
|
|
620
|
+
posIdx = items.findIndex(i => i.icon && i.icon === i.icon);
|
|
621
|
+
}
|
|
622
|
+
if (posIdx < 0) {
|
|
623
|
+
return false;
|
|
624
|
+
}
|
|
625
|
+
items[posIdx] = {
|
|
626
|
+
...items[posIdx],
|
|
627
|
+
...item,
|
|
628
|
+
updated: true
|
|
629
|
+
};
|
|
630
|
+
this.breadcrumbsSubject.next(items);
|
|
631
|
+
return true;
|
|
632
|
+
}
|
|
633
|
+
updateBreadcrumbs() {
|
|
634
|
+
if (this.breadcrumbsTranslateSubscription) {
|
|
635
|
+
this.breadcrumbsTranslateSubscription.unsubscribe();
|
|
636
|
+
this.breadcrumbsTranslateSubscription = undefined;
|
|
637
|
+
}
|
|
638
|
+
if (this.breadcrumbHomeTranslateSubscription) {
|
|
639
|
+
this.breadcrumbHomeTranslateSubscription.unsubscribe();
|
|
640
|
+
this.breadcrumbHomeTranslateSubscription = undefined;
|
|
641
|
+
}
|
|
642
|
+
const rootRoute = this.router.routerState.snapshot.root;
|
|
643
|
+
const homeBreadcrumb = this.generateHomeBreadcrumb(rootRoute);
|
|
644
|
+
if (homeBreadcrumb) {
|
|
645
|
+
if (homeBreadcrumb.label) {
|
|
646
|
+
this.breadcrumbHomeTranslateSubscription = this.translate.get(homeBreadcrumb.label).subscribe(i18n => {
|
|
647
|
+
homeBreadcrumb.label = i18n;
|
|
648
|
+
this.breadcrumbHomeSubject.next(homeBreadcrumb);
|
|
649
|
+
});
|
|
650
|
+
}
|
|
651
|
+
else {
|
|
652
|
+
this.breadcrumbHomeSubject.next(homeBreadcrumb);
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
const breadcrumbs = [];
|
|
656
|
+
this.generateBreadcrumbs(rootRoute, [], breadcrumbs);
|
|
657
|
+
breadcrumbs.forEach((b, idx) => {
|
|
658
|
+
b.positionIndex = idx;
|
|
659
|
+
});
|
|
660
|
+
const i18nKeys = breadcrumbs.filter(b => typeof b.label === 'string').map(b => b.label);
|
|
661
|
+
if (i18nKeys.length > 0) {
|
|
662
|
+
this.breadcrumbsTranslateSubscription = this.translate.get(i18nKeys).subscribe(i18n => {
|
|
663
|
+
// Construct the breadcrumb hierarchy
|
|
664
|
+
breadcrumbs.forEach(b => {
|
|
665
|
+
if (b.label && i18n[b.label]) {
|
|
666
|
+
b.label = i18n[b.label];
|
|
667
|
+
}
|
|
668
|
+
});
|
|
669
|
+
// Emit the new breadcrumbs
|
|
670
|
+
this.breadcrumbsSubject.next(breadcrumbs);
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
else {
|
|
674
|
+
this.breadcrumbsSubject.next(breadcrumbs);
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
generateHomeBreadcrumb(route) {
|
|
678
|
+
if (!route) {
|
|
679
|
+
return null;
|
|
680
|
+
}
|
|
681
|
+
const routeData = route.data;
|
|
682
|
+
const breadcrumbRouteData = routeData?.breadcrumb;
|
|
683
|
+
if (breadcrumbRouteData && typeof breadcrumbRouteData === 'object' && 'isHome' in breadcrumbRouteData) {
|
|
684
|
+
if (breadcrumbRouteData.isHome === false) {
|
|
685
|
+
return null;
|
|
686
|
+
}
|
|
687
|
+
const breadcrumb = this.createBreadcrumb('/', breadcrumbRouteData, true);
|
|
688
|
+
if (breadcrumb) {
|
|
689
|
+
if (typeof breadcrumb.icon === 'undefined') {
|
|
690
|
+
breadcrumb.icon = 'pi pi-home';
|
|
691
|
+
}
|
|
692
|
+
return breadcrumb;
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
else {
|
|
696
|
+
return this.generateHomeBreadcrumb(route.firstChild);
|
|
697
|
+
}
|
|
698
|
+
return null;
|
|
699
|
+
}
|
|
700
|
+
generateBreadcrumbs(route, parentUrlSegments, breadcrumbs) {
|
|
701
|
+
if (!route) {
|
|
702
|
+
return;
|
|
703
|
+
}
|
|
704
|
+
const routeData = route.data;
|
|
705
|
+
const routeUrlSegments = parentUrlSegments.concat(route.url.map(url => url.path));
|
|
706
|
+
const routeUrl = `/${routeUrlSegments.join('/')}`;
|
|
707
|
+
if (routeData?.breadcrumb) {
|
|
708
|
+
const breadcrumbRouteData = routeData.breadcrumb;
|
|
709
|
+
if (Array.isArray(breadcrumbRouteData)) {
|
|
710
|
+
for (const breadcrumbRouteDataItem of breadcrumbRouteData) {
|
|
711
|
+
const breadcrumb = this.createBreadcrumb(routeUrl, breadcrumbRouteDataItem);
|
|
712
|
+
if (breadcrumb) {
|
|
713
|
+
breadcrumbs.push(breadcrumb);
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
else if (typeof breadcrumbRouteData === 'function') {
|
|
718
|
+
breadcrumbs.push(...breadcrumbRouteData(routeUrl, route));
|
|
719
|
+
}
|
|
720
|
+
else {
|
|
721
|
+
const breadcrumb = this.createBreadcrumb(routeUrl, breadcrumbRouteData);
|
|
722
|
+
if (breadcrumb) {
|
|
723
|
+
breadcrumbs.push(breadcrumb);
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
this.generateBreadcrumbs(route.firstChild, routeUrlSegments, breadcrumbs);
|
|
728
|
+
}
|
|
729
|
+
createBreadcrumb(routeUrl, routeBreadcrumb, includeHome = false) {
|
|
730
|
+
const existingBreadcrumb = this.findBreadcrumbItem({ routerLink: routeUrl });
|
|
731
|
+
if (existingBreadcrumb?.updated) {
|
|
732
|
+
return existingBreadcrumb;
|
|
733
|
+
}
|
|
734
|
+
if (typeof routeBreadcrumb === 'string') {
|
|
735
|
+
// check for updated existing breadcrumb
|
|
736
|
+
return {
|
|
737
|
+
id: routeUrl,
|
|
738
|
+
label: routeBreadcrumb,
|
|
739
|
+
routerLink: routeUrl
|
|
740
|
+
};
|
|
741
|
+
}
|
|
742
|
+
else {
|
|
743
|
+
if (!includeHome && typeof routeBreadcrumb.isHome !== 'undefined') {
|
|
744
|
+
// home should not be included
|
|
745
|
+
return null;
|
|
746
|
+
}
|
|
747
|
+
if (typeof routeBreadcrumb.routerLink === 'undefined') {
|
|
748
|
+
routeBreadcrumb.routerLink = routeUrl;
|
|
749
|
+
}
|
|
750
|
+
routeBreadcrumb.id = routeUrl;
|
|
751
|
+
return routeBreadcrumb;
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
// TITLE section
|
|
755
|
+
setPageTitle(title) {
|
|
756
|
+
let currentRoute = this.router.routerState.snapshot.root;
|
|
757
|
+
while (currentRoute.firstChild) {
|
|
758
|
+
currentRoute = currentRoute.firstChild;
|
|
759
|
+
}
|
|
760
|
+
const routeData = currentRoute.data;
|
|
761
|
+
const pageTitle = title ?? routeData.pageTitle;
|
|
762
|
+
this.titleService.setTitle(this.formatPageTitle(pageTitle));
|
|
763
|
+
}
|
|
764
|
+
formatPageTitle(titlePrefix) {
|
|
765
|
+
const titlePieces = [];
|
|
766
|
+
if (titlePrefix) {
|
|
767
|
+
titlePieces.push(this.translate.instant(titlePrefix));
|
|
768
|
+
}
|
|
769
|
+
titlePieces.push(this.translate.instant('app.name'));
|
|
770
|
+
return titlePieces.join(' - ');
|
|
771
|
+
}
|
|
772
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: CommonsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
773
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: CommonsService }); }
|
|
774
|
+
}
|
|
775
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: CommonsService, decorators: [{
|
|
776
|
+
type: Injectable
|
|
777
|
+
}] });
|
|
778
|
+
|
|
779
|
+
class ErrorPageComponent {
|
|
780
|
+
constructor(commons) {
|
|
781
|
+
this.commons = commons;
|
|
782
|
+
}
|
|
783
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: ErrorPageComponent, deps: [{ token: CommonsService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
784
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.2", type: ErrorPageComponent, isStandalone: true, selector: "mng-error-page", ngImport: i0, template: "<div [class]=\"'exception-body min-h-screen ' + (commons.colorSchemeIsLight ? 'layout-light' : 'layout-dark')\">\n <div class=\"exception-container min-h-screen flex align-items-center justify-content-center flex-column bg-auto md:bg-contain bg-no-repeat\">\n <div class=\"exception-panel text-center flex align-items-center justify-content-center flex-column\">\n <h1 class=\"text-red-400 mb-0\">{{ 'pages.notFound.title' | translate }}</h1>\n <h3 class=\"text-red-300\">{{ 'pages.notFound.subtitle' | translate }}</h3>\n <button type=\"button\" pButton [label]=\"'general.returnHome' | translate\" [routerLink]=\"['/']\"></button>\n </div>\n <div class=\"exception-footer align-items-center flex\">\n <img [src]=\"commons.colorSchemeIsLight ? commons.appLogoDark : commons.appLogoLight\" class=\"exception-logo\" alt=\"App logo\" />\n <img [src]=\"commons.colorSchemeIsLight ? commons.appLogoNameDark : commons.appLogoNameLight\" class=\"exception-appname ml-3\" alt=\"App name\" />\n </div>\n </div>\n</div>\n", styles: [".exception-body{background:var(--surface-ground)}.exception-body .exception-container{background:var(--exception-pages-image);background-repeat:no-repeat;background-size:contain;box-sizing:border-box}.exception-body .exception-container .exception-panel{box-sizing:border-box;flex-grow:1;margin-top:3rem;margin-bottom:3rem}.exception-body .exception-container .exception-panel h1{font-size:140px;font-weight:900;text-shadow:0 0 50px rgba(252,97,97,.2)}.exception-body .exception-container .exception-panel h3{font-size:80px;font-weight:900;margin-top:-90px;margin-bottom:50px}.exception-body .exception-container .exception-panel button{margin-top:50px}.exception-body .exception-container .exception-footer{margin-bottom:2rem}.exception-body .exception-container .exception-footer .exception-logo{width:34px}.exception-body .exception-container .exception-footer .exception-appname{width:72px}\n"], dependencies: [{ kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i2$1.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i3$1.TranslatePipe, name: "translate" }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
785
|
+
}
|
|
786
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: ErrorPageComponent, decorators: [{
|
|
787
|
+
type: Component,
|
|
788
|
+
args: [{ standalone: true, selector: 'mng-error-page', imports: [ButtonModule, TranslateModule, RouterLink], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [class]=\"'exception-body min-h-screen ' + (commons.colorSchemeIsLight ? 'layout-light' : 'layout-dark')\">\n <div class=\"exception-container min-h-screen flex align-items-center justify-content-center flex-column bg-auto md:bg-contain bg-no-repeat\">\n <div class=\"exception-panel text-center flex align-items-center justify-content-center flex-column\">\n <h1 class=\"text-red-400 mb-0\">{{ 'pages.notFound.title' | translate }}</h1>\n <h3 class=\"text-red-300\">{{ 'pages.notFound.subtitle' | translate }}</h3>\n <button type=\"button\" pButton [label]=\"'general.returnHome' | translate\" [routerLink]=\"['/']\"></button>\n </div>\n <div class=\"exception-footer align-items-center flex\">\n <img [src]=\"commons.colorSchemeIsLight ? commons.appLogoDark : commons.appLogoLight\" class=\"exception-logo\" alt=\"App logo\" />\n <img [src]=\"commons.colorSchemeIsLight ? commons.appLogoNameDark : commons.appLogoNameLight\" class=\"exception-appname ml-3\" alt=\"App name\" />\n </div>\n </div>\n</div>\n", styles: [".exception-body{background:var(--surface-ground)}.exception-body .exception-container{background:var(--exception-pages-image);background-repeat:no-repeat;background-size:contain;box-sizing:border-box}.exception-body .exception-container .exception-panel{box-sizing:border-box;flex-grow:1;margin-top:3rem;margin-bottom:3rem}.exception-body .exception-container .exception-panel h1{font-size:140px;font-weight:900;text-shadow:0 0 50px rgba(252,97,97,.2)}.exception-body .exception-container .exception-panel h3{font-size:80px;font-weight:900;margin-top:-90px;margin-bottom:50px}.exception-body .exception-container .exception-panel button{margin-top:50px}.exception-body .exception-container .exception-footer{margin-bottom:2rem}.exception-body .exception-container .exception-footer .exception-logo{width:34px}.exception-body .exception-container .exception-footer .exception-appname{width:72px}\n"] }]
|
|
789
|
+
}], ctorParameters: () => [{ type: CommonsService }] });
|
|
790
|
+
|
|
791
|
+
class NotFoundPageComponent {
|
|
792
|
+
constructor(commons) {
|
|
793
|
+
this.commons = commons;
|
|
794
|
+
}
|
|
795
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: NotFoundPageComponent, deps: [{ token: CommonsService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
796
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.2", type: NotFoundPageComponent, isStandalone: true, selector: "mng-not-found-page", ngImport: i0, template: "<div [class]=\"'exception-body min-h-screen ' + (commons.colorSchemeIsLight ? 'layout-light' : 'layout-dark')\">\n <div class=\"exception-container min-h-screen flex align-items-center justify-content-center flex-column bg-auto md:bg-contain bg-no-repeat\">\n <div class=\"exception-panel text-center flex align-items-center justify-content-center flex-column\">\n <h1 class=\"text-red-400 mb-0\">{{ 'pages.notFound.title' | translate }}</h1>\n <h3 class=\"text-red-300\">{{ 'pages.notFound.subtitle' | translate }}</h3>\n <p>{{ 'pages.notFound.message' | translate }}</p>\n <button type=\"button\" pButton [label]=\"'general.returnHome' | translate\" [routerLink]=\"['/']\"></button>\n </div>\n <div class=\"exception-footer align-items-center flex\">\n <img [src]=\"commons.colorSchemeIsLight ? commons.appLogoDark : commons.appLogoLight\" class=\"exception-logo\" alt=\"App logo\" />\n <img [src]=\"commons.colorSchemeIsLight ? commons.appLogoNameDark : commons.appLogoNameLight\" class=\"exception-appname ml-3\" alt=\"App name\" />\n </div>\n </div>\n</div>\n", styles: [".exception-body{background:var(--surface-ground)}.exception-body .exception-container{background:var(--exception-pages-image);background-repeat:no-repeat;background-size:contain;box-sizing:border-box}.exception-body .exception-container .exception-panel{box-sizing:border-box;flex-grow:1;margin-top:3rem;margin-bottom:3rem}.exception-body .exception-container .exception-panel h1{font-size:140px;font-weight:900;text-shadow:0 0 50px rgba(252,97,97,.2)}.exception-body .exception-container .exception-panel h3{font-size:80px;font-weight:900;margin-top:-90px;margin-bottom:50px}.exception-body .exception-container .exception-panel p{font-size:24px;font-weight:400;max-width:320px}.exception-body .exception-container .exception-panel button{margin-top:50px}.exception-body .exception-container .exception-footer{margin-bottom:2rem}.exception-body .exception-container .exception-footer .exception-logo{width:34px}.exception-body .exception-container .exception-footer .exception-appname{width:72px}\n"], dependencies: [{ kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i2$1.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i3$1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
797
|
+
}
|
|
798
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: NotFoundPageComponent, decorators: [{
|
|
799
|
+
type: Component,
|
|
800
|
+
args: [{ standalone: true, selector: 'mng-not-found-page', imports: [ButtonModule, RouterLink, TranslateModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [class]=\"'exception-body min-h-screen ' + (commons.colorSchemeIsLight ? 'layout-light' : 'layout-dark')\">\n <div class=\"exception-container min-h-screen flex align-items-center justify-content-center flex-column bg-auto md:bg-contain bg-no-repeat\">\n <div class=\"exception-panel text-center flex align-items-center justify-content-center flex-column\">\n <h1 class=\"text-red-400 mb-0\">{{ 'pages.notFound.title' | translate }}</h1>\n <h3 class=\"text-red-300\">{{ 'pages.notFound.subtitle' | translate }}</h3>\n <p>{{ 'pages.notFound.message' | translate }}</p>\n <button type=\"button\" pButton [label]=\"'general.returnHome' | translate\" [routerLink]=\"['/']\"></button>\n </div>\n <div class=\"exception-footer align-items-center flex\">\n <img [src]=\"commons.colorSchemeIsLight ? commons.appLogoDark : commons.appLogoLight\" class=\"exception-logo\" alt=\"App logo\" />\n <img [src]=\"commons.colorSchemeIsLight ? commons.appLogoNameDark : commons.appLogoNameLight\" class=\"exception-appname ml-3\" alt=\"App name\" />\n </div>\n </div>\n</div>\n", styles: [".exception-body{background:var(--surface-ground)}.exception-body .exception-container{background:var(--exception-pages-image);background-repeat:no-repeat;background-size:contain;box-sizing:border-box}.exception-body .exception-container .exception-panel{box-sizing:border-box;flex-grow:1;margin-top:3rem;margin-bottom:3rem}.exception-body .exception-container .exception-panel h1{font-size:140px;font-weight:900;text-shadow:0 0 50px rgba(252,97,97,.2)}.exception-body .exception-container .exception-panel h3{font-size:80px;font-weight:900;margin-top:-90px;margin-bottom:50px}.exception-body .exception-container .exception-panel p{font-size:24px;font-weight:400;max-width:320px}.exception-body .exception-container .exception-panel button{margin-top:50px}.exception-body .exception-container .exception-footer{margin-bottom:2rem}.exception-body .exception-container .exception-footer .exception-logo{width:34px}.exception-body .exception-container .exception-footer .exception-appname{width:72px}\n"] }]
|
|
801
|
+
}], ctorParameters: () => [{ type: CommonsService }] });
|
|
802
|
+
|
|
803
|
+
class FilterMatchMode {
|
|
804
|
+
static { this.Equals = 'equals'; }
|
|
805
|
+
static { this.EqualsAbbr = 'eq'; }
|
|
806
|
+
static { this.NotEquals = 'notEquals'; }
|
|
807
|
+
static { this.NotEqualsAbbr = 'ne'; }
|
|
808
|
+
static { this.Contains = 'contains'; }
|
|
809
|
+
static { this.ContainsAbbr = 'cn'; }
|
|
810
|
+
static { this.NotContains = 'notContains'; }
|
|
811
|
+
static { this.NotContainsAbbr = 'nc'; }
|
|
812
|
+
static { this.In = 'in'; }
|
|
813
|
+
static { this.InAbbr = 'in'; }
|
|
814
|
+
static { this.NotIn = 'notIn'; }
|
|
815
|
+
static { this.NotInAbbr = 'ni'; }
|
|
816
|
+
static { this.StartsWith = 'startsWith'; }
|
|
817
|
+
static { this.StartsWithAbbr = 'sw'; }
|
|
818
|
+
static { this.EndsWith = 'endsWith'; }
|
|
819
|
+
static { this.EndsWithAbbr = 'ew'; }
|
|
820
|
+
static { this.LessThan = 'lessThan'; }
|
|
821
|
+
static { this.LessThanAbbr = 'lt'; }
|
|
822
|
+
static { this.LessThanOrEqualTo = 'lessThanOrEqualTo'; }
|
|
823
|
+
static { this.LessThanOrEqualToAbbr = 'le'; }
|
|
824
|
+
static { this.GreaterThan = 'greaterThan'; }
|
|
825
|
+
static { this.GreaterThanAbbr = 'gt'; }
|
|
826
|
+
static { this.GreaterThanOrEqualTo = 'greaterThanOrEqualTo'; }
|
|
827
|
+
static { this.GreaterThanOrEqualToAbbr = 'ge'; }
|
|
828
|
+
static { this.Between = 'between'; }
|
|
829
|
+
static { this.BetweenAbbr = 'bt'; }
|
|
830
|
+
static { this.Exists = 'exists'; }
|
|
831
|
+
static { this.ExistsAbbr = 'ex'; }
|
|
832
|
+
static { this.DoesNotExist = 'doesNotExist'; }
|
|
833
|
+
static { this.DoesNotExistAbbr = 'nx'; }
|
|
834
|
+
static getAbbreviation(mode) {
|
|
835
|
+
switch (mode) {
|
|
836
|
+
case FilterMatchMode.Equals:
|
|
837
|
+
return FilterMatchMode.EqualsAbbr;
|
|
838
|
+
case FilterMatchMode.NotEquals:
|
|
839
|
+
return FilterMatchMode.NotEqualsAbbr;
|
|
840
|
+
case FilterMatchMode.Contains:
|
|
841
|
+
return FilterMatchMode.ContainsAbbr;
|
|
842
|
+
case FilterMatchMode.NotContains:
|
|
843
|
+
return FilterMatchMode.NotContainsAbbr;
|
|
844
|
+
case FilterMatchMode.In:
|
|
845
|
+
return FilterMatchMode.InAbbr;
|
|
846
|
+
case FilterMatchMode.NotIn:
|
|
847
|
+
return FilterMatchMode.NotInAbbr;
|
|
848
|
+
case FilterMatchMode.StartsWith:
|
|
849
|
+
return FilterMatchMode.StartsWithAbbr;
|
|
850
|
+
case FilterMatchMode.EndsWith:
|
|
851
|
+
return FilterMatchMode.EndsWithAbbr;
|
|
852
|
+
case FilterMatchMode.LessThan:
|
|
853
|
+
return FilterMatchMode.LessThanAbbr;
|
|
854
|
+
case FilterMatchMode.LessThanOrEqualTo:
|
|
855
|
+
return FilterMatchMode.LessThanOrEqualToAbbr;
|
|
856
|
+
case FilterMatchMode.GreaterThan:
|
|
857
|
+
return FilterMatchMode.GreaterThanAbbr;
|
|
858
|
+
case FilterMatchMode.GreaterThanOrEqualTo:
|
|
859
|
+
return FilterMatchMode.GreaterThanOrEqualToAbbr;
|
|
860
|
+
case FilterMatchMode.Between:
|
|
861
|
+
return FilterMatchMode.BetweenAbbr;
|
|
862
|
+
case FilterMatchMode.Exists:
|
|
863
|
+
return FilterMatchMode.ExistsAbbr;
|
|
864
|
+
case FilterMatchMode.DoesNotExist:
|
|
865
|
+
return FilterMatchMode.DoesNotExistAbbr;
|
|
866
|
+
default:
|
|
867
|
+
return null;
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
static fromAbbreviation(abbr) {
|
|
871
|
+
switch (abbr) {
|
|
872
|
+
case FilterMatchMode.EqualsAbbr:
|
|
873
|
+
return FilterMatchMode.Equals;
|
|
874
|
+
case FilterMatchMode.NotEqualsAbbr:
|
|
875
|
+
return FilterMatchMode.NotEquals;
|
|
876
|
+
case FilterMatchMode.ContainsAbbr:
|
|
877
|
+
return FilterMatchMode.Contains;
|
|
878
|
+
case FilterMatchMode.NotContainsAbbr:
|
|
879
|
+
return FilterMatchMode.NotContains;
|
|
880
|
+
case FilterMatchMode.InAbbr:
|
|
881
|
+
return FilterMatchMode.In;
|
|
882
|
+
case FilterMatchMode.NotInAbbr:
|
|
883
|
+
return FilterMatchMode.NotIn;
|
|
884
|
+
case FilterMatchMode.StartsWithAbbr:
|
|
885
|
+
return FilterMatchMode.StartsWith;
|
|
886
|
+
case FilterMatchMode.EndsWithAbbr:
|
|
887
|
+
return FilterMatchMode.EndsWith;
|
|
888
|
+
case FilterMatchMode.LessThanAbbr:
|
|
889
|
+
return FilterMatchMode.LessThan;
|
|
890
|
+
case FilterMatchMode.LessThanOrEqualToAbbr:
|
|
891
|
+
return FilterMatchMode.LessThanOrEqualTo;
|
|
892
|
+
case FilterMatchMode.GreaterThanAbbr:
|
|
893
|
+
return FilterMatchMode.GreaterThan;
|
|
894
|
+
case FilterMatchMode.GreaterThanOrEqualToAbbr:
|
|
895
|
+
return FilterMatchMode.GreaterThanOrEqualTo;
|
|
896
|
+
case FilterMatchMode.BetweenAbbr:
|
|
897
|
+
return FilterMatchMode.Between;
|
|
898
|
+
case FilterMatchMode.ExistsAbbr:
|
|
899
|
+
return FilterMatchMode.Exists;
|
|
900
|
+
case FilterMatchMode.DoesNotExistAbbr:
|
|
901
|
+
return FilterMatchMode.DoesNotExist;
|
|
902
|
+
default:
|
|
903
|
+
return null;
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
/**
|
|
909
|
+
* Converts a TableLazyLoadEvent to DataListParams.
|
|
910
|
+
*
|
|
911
|
+
* @param {TableLazyLoadEvent} event - The event containing the data to convert.
|
|
912
|
+
* @return {DataListParams} - The converted DataListParams object.
|
|
913
|
+
*/
|
|
914
|
+
function fromTableLoadToDataListParams(event) {
|
|
915
|
+
const params = {};
|
|
916
|
+
if (event.first != null) {
|
|
917
|
+
params.offset = event.first;
|
|
918
|
+
}
|
|
919
|
+
if (event.rows != null) {
|
|
920
|
+
params.limit = event.rows;
|
|
921
|
+
}
|
|
922
|
+
if (typeof event.globalFilter === 'string') {
|
|
923
|
+
params.search = event.globalFilter;
|
|
924
|
+
}
|
|
925
|
+
else if (Array.isArray(event.globalFilter) && event.globalFilter.length > 0) {
|
|
926
|
+
params.search = event.globalFilter.join(',');
|
|
927
|
+
}
|
|
928
|
+
if (Array.isArray(event.multiSortMeta) && event.multiSortMeta.length > 0) {
|
|
929
|
+
params.sort = event.multiSortMeta.map(m => ({ property: m.field, ascending: m.order >= 0 }));
|
|
930
|
+
}
|
|
931
|
+
if (event.filters) {
|
|
932
|
+
params.filters = Object.keys(event.filters).reduce((acc, key) => {
|
|
933
|
+
const filter = {};
|
|
934
|
+
const eventFilter = event.filters?.[key];
|
|
935
|
+
if (Array.isArray(eventFilter)) {
|
|
936
|
+
filter.value = eventFilter[0].value;
|
|
937
|
+
filter.matchMode = eventFilter[0].matchMode;
|
|
938
|
+
}
|
|
939
|
+
else if (eventFilter !== undefined) {
|
|
940
|
+
filter.value = eventFilter.value;
|
|
941
|
+
filter.matchMode = eventFilter.matchMode;
|
|
942
|
+
}
|
|
943
|
+
return { ...acc, [key]: filter };
|
|
944
|
+
}, {});
|
|
945
|
+
}
|
|
946
|
+
return params;
|
|
947
|
+
}
|
|
948
|
+
/**
|
|
949
|
+
* Converts the given parameters to URL query parameters.
|
|
950
|
+
* Sorts are formatted in Medius data API sort query language: `asc:prop1,desc:prop2`, ...
|
|
951
|
+
* Filter keys are "flattened" in the new object, values are formatted in Medius data API filter query language: `cs:eq:asd`, `in:asd,qwe`, `ex`, ...
|
|
952
|
+
*
|
|
953
|
+
* @param {DataListParams} params - The parameters to convert.
|
|
954
|
+
* @param {DataListParams|null} defaults - The default parameters used if no matching property in params is available. Defaults to { limit: 25, offset: 0 } if not provided.
|
|
955
|
+
* @returns {Params} - The URL query parameters object.
|
|
956
|
+
*/
|
|
957
|
+
function dataListParamsToUrlQuery(params, defaults = {
|
|
958
|
+
limit: 25,
|
|
959
|
+
offset: 0
|
|
960
|
+
}) {
|
|
961
|
+
const urlParams = {};
|
|
962
|
+
if (params.limit && params.limit !== defaults?.limit) {
|
|
963
|
+
urlParams['limit'] = params.limit;
|
|
964
|
+
}
|
|
965
|
+
if (params.offset && params.offset !== defaults?.offset) {
|
|
966
|
+
urlParams['offset'] = params.offset;
|
|
967
|
+
}
|
|
968
|
+
if (params.search && params.search !== defaults?.search) {
|
|
969
|
+
urlParams['q'] = params.search;
|
|
970
|
+
}
|
|
971
|
+
if (params.sort && Array.isArray(params.sort) && params.sort.length > 0) {
|
|
972
|
+
if (defaults?.sort == null ||
|
|
973
|
+
!Array.isArray(defaults.sort) ||
|
|
974
|
+
defaults.sort.length === 0 ||
|
|
975
|
+
params.sort.length !== defaults.sort.length ||
|
|
976
|
+
defaults.sort.some((ds, idx) => ds.property !== params.sort[idx].property || (ds.ascending ?? true) !== (params.sort[idx].ascending ?? true))) {
|
|
977
|
+
urlParams['sort'] = dataListParamsSortToUrlQuery(params);
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
if (params.filters) {
|
|
981
|
+
Object.keys(params.filters).forEach(k => {
|
|
982
|
+
const paramFilter = params.filters[k];
|
|
983
|
+
const defaultFilter = defaults?.filters?.[k];
|
|
984
|
+
if (defaultFilter &&
|
|
985
|
+
((Array.isArray(defaultFilter.value) &&
|
|
986
|
+
Array.isArray(paramFilter.value) &&
|
|
987
|
+
defaultFilter.value.length === paramFilter.value.length &&
|
|
988
|
+
defaultFilter.value.every((v, idx) => {
|
|
989
|
+
const value = paramFilter.value[idx];
|
|
990
|
+
if (value instanceof Date && v instanceof Date)
|
|
991
|
+
return value.getTime() === v.getTime();
|
|
992
|
+
else
|
|
993
|
+
return value === v;
|
|
994
|
+
})) || // handle arrays
|
|
995
|
+
defaultFilter.value === paramFilter.value) &&
|
|
996
|
+
defaultFilter.matchMode === paramFilter.matchMode &&
|
|
997
|
+
(defaultFilter.caseSensitive ?? false) === (paramFilter.caseSensitive ?? false)) {
|
|
998
|
+
return;
|
|
999
|
+
}
|
|
1000
|
+
if (paramFilter.value == null && defaultFilter?.value == null) {
|
|
1001
|
+
return;
|
|
1002
|
+
}
|
|
1003
|
+
urlParams[k] = dataListParamsFiltersToUrlQuery(params, k, true);
|
|
1004
|
+
});
|
|
1005
|
+
}
|
|
1006
|
+
if (defaults?.filters) {
|
|
1007
|
+
// add other defaults
|
|
1008
|
+
const paramFilterKeys = params.filters ? Object.keys(params.filters) : [];
|
|
1009
|
+
Object.keys(defaults.filters)
|
|
1010
|
+
.filter(k => paramFilterKeys.indexOf(k) < 0)
|
|
1011
|
+
.forEach(k => {
|
|
1012
|
+
urlParams[k] = dataListParamsFiltersToUrlQuery(defaults, k);
|
|
1013
|
+
});
|
|
1014
|
+
}
|
|
1015
|
+
return urlParams;
|
|
1016
|
+
}
|
|
1017
|
+
/**
|
|
1018
|
+
* Merges the provided parameters with default values and returns the merged object.
|
|
1019
|
+
*
|
|
1020
|
+
* @param {DataListParams} params - The parameters to merge with defaults.
|
|
1021
|
+
* @param {DataListParams} defaults - The default values to merge with params (optional, default is { limit: 25, offset: 0 }).
|
|
1022
|
+
* @returns {DataListParams} - The merged parameters object.
|
|
1023
|
+
*/
|
|
1024
|
+
function mergeDataListParamsWithDefaults(params, defaults = {
|
|
1025
|
+
limit: 25,
|
|
1026
|
+
offset: 0
|
|
1027
|
+
}) {
|
|
1028
|
+
const merged = {
|
|
1029
|
+
limit: params.limit ?? defaults.limit,
|
|
1030
|
+
offset: params.offset ?? defaults.offset,
|
|
1031
|
+
search: params.search ?? defaults.search,
|
|
1032
|
+
sort: (params.sort ?? defaults.sort)?.map(s => ({ ...s }))
|
|
1033
|
+
};
|
|
1034
|
+
if (params.filters) {
|
|
1035
|
+
merged.filters = {};
|
|
1036
|
+
Object.entries(params.filters).forEach(([key, value]) => (merged.filters[key] = { ...value }));
|
|
1037
|
+
}
|
|
1038
|
+
if (defaults.filters) {
|
|
1039
|
+
if (!merged.filters)
|
|
1040
|
+
merged.filters = {};
|
|
1041
|
+
Object.entries(defaults.filters).forEach(([key, value]) => {
|
|
1042
|
+
if (merged.filters[key] === undefined) {
|
|
1043
|
+
merged.filters[key] = { ...value };
|
|
1044
|
+
}
|
|
1045
|
+
});
|
|
1046
|
+
}
|
|
1047
|
+
return merged;
|
|
1048
|
+
}
|
|
1049
|
+
/**
|
|
1050
|
+
* Converts an object of parameters to a URL query string for sorting.
|
|
1051
|
+
* Sorts are formatted in Medius data API sort query language: `asc:prop1,desc:prop2`, ...
|
|
1052
|
+
*
|
|
1053
|
+
* @param {DataListParams} params - An optional object containing sort parameters.
|
|
1054
|
+
* @returns A string representing the URL query or undefined if no sort parameters are provided.
|
|
1055
|
+
*/
|
|
1056
|
+
function dataListParamsSortToUrlQuery(params) {
|
|
1057
|
+
return params && Array.isArray(params.sort)
|
|
1058
|
+
? params.sort.map(s => `${s.ascending === true || s.ascending === undefined ? 'asc' : 'desc'}:${String(s.property)}`).join(',')
|
|
1059
|
+
: undefined;
|
|
1060
|
+
}
|
|
1061
|
+
/**
|
|
1062
|
+
* Converts a specific filter parameter (by key) from DataListParams object to a URL query string.
|
|
1063
|
+
* Filter keys are "flattened" in the new object, values are formatted in Medius data API filter query language: `cs:eq:asd`, `in:asd,qwe`, `ex`, ...
|
|
1064
|
+
*
|
|
1065
|
+
* @param {DataListParams<any, Filters> | undefined} params - The DataListParams object containing the filters.
|
|
1066
|
+
* @param {Filters} key - The key of the filter to convert.
|
|
1067
|
+
* @param {boolean} [allowNull=false] - Indicates whether to allow null values in the query string.
|
|
1068
|
+
* @return {string | undefined} - The URL query string representing the specified filter, or undefined if the filter is not found.
|
|
1069
|
+
*/
|
|
1070
|
+
function dataListParamsFiltersToUrlQuery(params, key, allowNull = false) {
|
|
1071
|
+
const paramFilter = params?.filters?.[key];
|
|
1072
|
+
return dataListParamsFilterToUrlQuery(paramFilter, allowNull);
|
|
1073
|
+
}
|
|
1074
|
+
/**
|
|
1075
|
+
* Converts a filter to a URL query string.
|
|
1076
|
+
* Filter keys are "flattened" in the new object, values are formatted in Medius data API filter query language: `cs:eq:asd`, `in:asd,qwe`, `ex`, ...
|
|
1077
|
+
*
|
|
1078
|
+
* @param {DataListFilter} paramFilter - The filter object to be converted.
|
|
1079
|
+
* @param {boolean} [allowNull=false] - Indicates whether to allow null values in the filter.
|
|
1080
|
+
* @returns {string|undefined} - The filter converted to a URL query string, or undefined if no filter is provided or the filter has empty or invalid values.
|
|
1081
|
+
* @throws {CommonsInternalError} - If the filter has invalid values.
|
|
1082
|
+
*/
|
|
1083
|
+
function dataListParamsFilterToUrlQuery(paramFilter, allowNull = false) {
|
|
1084
|
+
const filterValueAsArray = Array.isArray(paramFilter?.value) ? paramFilter.value.filter(v => v !== undefined && (allowNull || v !== null)) : undefined;
|
|
1085
|
+
if (paramFilter === undefined ||
|
|
1086
|
+
(!allowNull && paramFilter.value == null) ||
|
|
1087
|
+
(typeof paramFilter.value === 'string' && paramFilter.value.length === 0) ||
|
|
1088
|
+
(Array.isArray(filterValueAsArray) && filterValueAsArray.length === 0)) {
|
|
1089
|
+
// no need to include filters for empty values
|
|
1090
|
+
return undefined;
|
|
1091
|
+
}
|
|
1092
|
+
const matchMode = paramFilter.matchMode ?? FilterMatchMode.Equals;
|
|
1093
|
+
if (matchMode === FilterMatchMode.Between && !(Array.isArray(filterValueAsArray) && filterValueAsArray.length === 2)) {
|
|
1094
|
+
throw new CommonsInternalError(`Filter match mode between requires exactly 2 values: ${paramFilter.value}`);
|
|
1095
|
+
}
|
|
1096
|
+
if ((matchMode === FilterMatchMode.In || matchMode === FilterMatchMode.NotIn) && (!Array.isArray(filterValueAsArray) || filterValueAsArray.length === 0)) {
|
|
1097
|
+
throw new CommonsInternalError(`Filter match mode ${matchMode} requires non-empty array: ${paramFilter.value}`);
|
|
1098
|
+
}
|
|
1099
|
+
if ([FilterMatchMode.In, FilterMatchMode.NotIn, FilterMatchMode.Between].indexOf(matchMode) === -1 && Array.isArray(filterValueAsArray)) {
|
|
1100
|
+
throw new CommonsInternalError(`Filter match mode ${matchMode} must not be array: ${paramFilter.value}`);
|
|
1101
|
+
}
|
|
1102
|
+
const noVal = paramFilter.matchMode === FilterMatchMode.Exists || paramFilter.matchMode === FilterMatchMode.DoesNotExist;
|
|
1103
|
+
const urlValuePart = noVal ? '' : `:${dataListParamsFilterValueToUrlString(filterValueAsArray ?? paramFilter.value, allowNull)}`;
|
|
1104
|
+
return `${paramFilter.caseSensitive ? 'cs:' : paramFilter.caseSensitive === false ? 'ci:' : ''}${FilterMatchMode.getAbbreviation(matchMode) ?? matchMode}${urlValuePart}`;
|
|
1105
|
+
}
|
|
1106
|
+
/**
|
|
1107
|
+
* Converts URL query parameters to a DataListParams object.
|
|
1108
|
+
* Sorts are formatted from Medius data API sort query language: `asc:prop1,desc:prop2`, ...
|
|
1109
|
+
* Filter keys are all keys in Params object that are not matched elsewhere, values are formatted from Medius data API filter query language: `cs:eq:asd`, `in:asd,qwe`, `ex`, ...
|
|
1110
|
+
*
|
|
1111
|
+
* @param {Params} urlParams - The URL query parameters.
|
|
1112
|
+
* @return {DataListParams} - The converted DataListParams object.
|
|
1113
|
+
*/
|
|
1114
|
+
function fromUrlQueryToDataListParams(urlParams) {
|
|
1115
|
+
const params = {};
|
|
1116
|
+
Object.entries(urlParams).forEach(([urlParamKey, urlParamValue]) => {
|
|
1117
|
+
if (urlParamKey === 'limit') {
|
|
1118
|
+
params.limit = +urlParamValue;
|
|
1119
|
+
if (isNaN(params.limit) || params.limit < 0) {
|
|
1120
|
+
delete params.limit;
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
else if (urlParamKey === 'offset') {
|
|
1124
|
+
params.offset = +urlParamValue;
|
|
1125
|
+
if (isNaN(params.offset) || params.offset < 0) {
|
|
1126
|
+
delete params.offset;
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
else if (urlParamKey === 'q') {
|
|
1130
|
+
params.search = urlParamValue;
|
|
1131
|
+
}
|
|
1132
|
+
else if (urlParamKey === 'sort') {
|
|
1133
|
+
if (typeof urlParamValue === 'string') {
|
|
1134
|
+
params.sort = urlParamValue.split(',').map(s => {
|
|
1135
|
+
const [direction, property] = s.split(':');
|
|
1136
|
+
return { property: (property ?? direction), ascending: direction !== 'desc' };
|
|
1137
|
+
});
|
|
1138
|
+
}
|
|
1139
|
+
else {
|
|
1140
|
+
throw new CommonsInternalError(`String is expected as value for '${urlParamKey}' when converting from urlParams`);
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
else if (typeof urlParamValue === 'string') {
|
|
1144
|
+
if (urlParamValue.length === 0) {
|
|
1145
|
+
// empty string should be ignored
|
|
1146
|
+
return;
|
|
1147
|
+
}
|
|
1148
|
+
const filterParts = urlParamValue.split(':');
|
|
1149
|
+
let partIdx = 0;
|
|
1150
|
+
// case sensitive
|
|
1151
|
+
let caseSensitive = undefined;
|
|
1152
|
+
if (filterParts[partIdx] === 'cs' || filterParts[partIdx] === 'ci') {
|
|
1153
|
+
caseSensitive = filterParts[partIdx++] === 'cs';
|
|
1154
|
+
}
|
|
1155
|
+
// match mode
|
|
1156
|
+
const matchMode = filterParts[partIdx] ? FilterMatchMode.fromAbbreviation(filterParts[partIdx]) ?? filterParts[partIdx] : FilterMatchMode.Equals;
|
|
1157
|
+
partIdx++;
|
|
1158
|
+
const noVal = matchMode === FilterMatchMode.Exists || matchMode === FilterMatchMode.DoesNotExist;
|
|
1159
|
+
// value
|
|
1160
|
+
let value = undefined;
|
|
1161
|
+
if (!noVal) {
|
|
1162
|
+
if (filterParts.length < 2) {
|
|
1163
|
+
return;
|
|
1164
|
+
}
|
|
1165
|
+
if (partIdx === filterParts.length - 1) {
|
|
1166
|
+
value = filterParts[partIdx];
|
|
1167
|
+
}
|
|
1168
|
+
else if (partIdx < filterParts.length) {
|
|
1169
|
+
// array that should not be array, so join back together
|
|
1170
|
+
value = filterParts.slice(partIdx, filterParts.length).join(':');
|
|
1171
|
+
}
|
|
1172
|
+
if (value === undefined && matchMode !== FilterMatchMode.Exists && matchMode !== FilterMatchMode.DoesNotExist) {
|
|
1173
|
+
// if value undefined and match mode expects value, then skip
|
|
1174
|
+
return;
|
|
1175
|
+
}
|
|
1176
|
+
if (value === 'null') {
|
|
1177
|
+
value = null;
|
|
1178
|
+
}
|
|
1179
|
+
if ((matchMode === FilterMatchMode.In || matchMode === FilterMatchMode.NotIn || matchMode === FilterMatchMode.Between) && typeof value === 'string') {
|
|
1180
|
+
let arrayVal = [];
|
|
1181
|
+
// these match modes expect array
|
|
1182
|
+
if (value.indexOf('"') >= 0) {
|
|
1183
|
+
const tokens = [];
|
|
1184
|
+
let currentToken = '';
|
|
1185
|
+
let explicitQuotes = false; //token is quoted, e.g. in:1,2,"22""",",123"""
|
|
1186
|
+
let quotesOpened = false; //token has started processing
|
|
1187
|
+
let quotesExplicitlyClosed = false; //token processing has finished, after single " in quoted mode, or before , in not quoted
|
|
1188
|
+
for (let i = 0; i < value.length; i++) {
|
|
1189
|
+
const c = value[i];
|
|
1190
|
+
// reset the tokenizer when seeing the token separator
|
|
1191
|
+
// only if either:
|
|
1192
|
+
// the quotes have not been opened yet (when there are no characters between separators),
|
|
1193
|
+
// the token has been explicitly closed (when we actually have explicit opening i.e., quotes as the first character)
|
|
1194
|
+
// or we have implicit quotes (i.e., quotes are not the first character)
|
|
1195
|
+
if (c === ',' && (!quotesOpened || quotesExplicitlyClosed || !explicitQuotes)) {
|
|
1196
|
+
tokens.push(currentToken);
|
|
1197
|
+
currentToken = '';
|
|
1198
|
+
quotesOpened = false;
|
|
1199
|
+
quotesExplicitlyClosed = false;
|
|
1200
|
+
explicitQuotes = false;
|
|
1201
|
+
}
|
|
1202
|
+
else if (c == '"') {
|
|
1203
|
+
// escaped double-quotes
|
|
1204
|
+
if (explicitQuotes && i + 1 < value.length && value[i + 1] === '"') {
|
|
1205
|
+
currentToken += c; // Append one double-quote to the current token
|
|
1206
|
+
i++; // Skip the next double-quote
|
|
1207
|
+
}
|
|
1208
|
+
// we encounter quotes again after they were the first character => we close the token
|
|
1209
|
+
else if (explicitQuotes) {
|
|
1210
|
+
quotesExplicitlyClosed = true;
|
|
1211
|
+
}
|
|
1212
|
+
// implicit quotes
|
|
1213
|
+
else if (quotesOpened) {
|
|
1214
|
+
currentToken += c;
|
|
1215
|
+
}
|
|
1216
|
+
// quotes are the first character => explicitly open the token
|
|
1217
|
+
else {
|
|
1218
|
+
currentToken = '';
|
|
1219
|
+
quotesOpened = true;
|
|
1220
|
+
explicitQuotes = true;
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
else {
|
|
1224
|
+
if (quotesExplicitlyClosed) {
|
|
1225
|
+
return;
|
|
1226
|
+
}
|
|
1227
|
+
quotesOpened = true;
|
|
1228
|
+
currentToken += c;
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
if (quotesOpened && !quotesExplicitlyClosed && explicitQuotes) {
|
|
1232
|
+
return;
|
|
1233
|
+
}
|
|
1234
|
+
// Append the last token after the loop ends
|
|
1235
|
+
tokens.push(currentToken.toString());
|
|
1236
|
+
arrayVal = tokens;
|
|
1237
|
+
}
|
|
1238
|
+
else {
|
|
1239
|
+
arrayVal = value.split(',');
|
|
1240
|
+
}
|
|
1241
|
+
if (matchMode === FilterMatchMode.Between && arrayVal.length !== 2) {
|
|
1242
|
+
return;
|
|
1243
|
+
}
|
|
1244
|
+
value = arrayVal;
|
|
1245
|
+
}
|
|
1246
|
+
if ((typeof value === 'string' && value.length === 0) || (Array.isArray(value) && value.length === 0)) {
|
|
1247
|
+
// filter with empty value is to be ignored
|
|
1248
|
+
return;
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
else {
|
|
1252
|
+
caseSensitive = undefined;
|
|
1253
|
+
}
|
|
1254
|
+
if (!params.filters) {
|
|
1255
|
+
params.filters = {};
|
|
1256
|
+
}
|
|
1257
|
+
params.filters[urlParamKey] = { value: value, matchMode: matchMode, caseSensitive: caseSensitive };
|
|
1258
|
+
}
|
|
1259
|
+
});
|
|
1260
|
+
return params;
|
|
1261
|
+
}
|
|
1262
|
+
/**
|
|
1263
|
+
* Makes a copy of the given DataListParams object.
|
|
1264
|
+
*
|
|
1265
|
+
* @param {DataListParams<Sorts, Filters>} params - The DataListParams object to be copied.
|
|
1266
|
+
* @returns {DataListParams<Sorts, Filters>} - Returns a new copy of the DataListParams object.
|
|
1267
|
+
*/
|
|
1268
|
+
function copyDataListParams(params) {
|
|
1269
|
+
const copy = {
|
|
1270
|
+
offset: params.offset,
|
|
1271
|
+
limit: params.limit,
|
|
1272
|
+
search: params.search
|
|
1273
|
+
};
|
|
1274
|
+
if (params.sort) {
|
|
1275
|
+
copy.sort = params.sort?.map(s => ({ ...s }));
|
|
1276
|
+
}
|
|
1277
|
+
if (params.filters) {
|
|
1278
|
+
copy.filters = Object.entries(params.filters).reduce((acc, [key, value]) => {
|
|
1279
|
+
const filterValue = value;
|
|
1280
|
+
return {
|
|
1281
|
+
...acc,
|
|
1282
|
+
[key]: {
|
|
1283
|
+
...filterValue,
|
|
1284
|
+
value: Array.isArray(filterValue.value) ? [...filterValue.value] : filterValue.value
|
|
1285
|
+
}
|
|
1286
|
+
};
|
|
1287
|
+
}, {});
|
|
1288
|
+
}
|
|
1289
|
+
return copy;
|
|
1290
|
+
}
|
|
1291
|
+
/**
|
|
1292
|
+
* Converts a value to a URL query param string representation.
|
|
1293
|
+
*
|
|
1294
|
+
* @param {unknown} value - The value to be converted.
|
|
1295
|
+
* @param {boolean} [allowNull=false] - Indicates whether null values are allowed.
|
|
1296
|
+
* @returns {string} The URL parameter representation of the value.
|
|
1297
|
+
* @throws {CommonsInternalError} If an undefined value is passed without allowNull set to true.
|
|
1298
|
+
* @throws {CommonsInternalError} If the value is an object (excluding Date).
|
|
1299
|
+
*/
|
|
1300
|
+
function dataListParamsFilterValueToUrlString(value, allowNull = false) {
|
|
1301
|
+
if (value === null && allowNull)
|
|
1302
|
+
return 'null';
|
|
1303
|
+
if (value == null)
|
|
1304
|
+
throw new CommonsInternalError('Undefined value cannot be converted to url param.'); // this should not happen, should be filtered out earlier
|
|
1305
|
+
if (Array.isArray(value))
|
|
1306
|
+
return value
|
|
1307
|
+
.map(v => dataListParamsFilterValueToUrlString(v, allowNull))
|
|
1308
|
+
.map(v => (v.indexOf(',') >= 0 || v.indexOf('"') >= 0 ? `"${v.replaceAll('"', '""')}"` : v))
|
|
1309
|
+
.join(',');
|
|
1310
|
+
if (typeof value === 'object') {
|
|
1311
|
+
if (value instanceof Date)
|
|
1312
|
+
return dateToIsoString(value, 'dateTime', { utc: true });
|
|
1313
|
+
else {
|
|
1314
|
+
throw new CommonsInternalError('Filter value cannot be object');
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
return String(value);
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
/**
|
|
1321
|
+
* A base data provider class used for handling data operations.
|
|
1322
|
+
*
|
|
1323
|
+
* @tparam Model - The type of data this data provider will handle.
|
|
1324
|
+
* @tparam Service - The type of service used by this data provider (optional).
|
|
1325
|
+
* @tparam ModelClass - The model type for the data provider (optional).
|
|
1326
|
+
* @tparam ServiceClass - The service type for the data provider (optional).
|
|
1327
|
+
*/
|
|
1328
|
+
class DataProviderInst {
|
|
1329
|
+
constructor(classType, serviceType) {
|
|
1330
|
+
this.classType = classType;
|
|
1331
|
+
this.serviceType = serviceType;
|
|
1332
|
+
}
|
|
1333
|
+
get isDataProvider() {
|
|
1334
|
+
return true;
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
class DataProvider extends DataProviderInst {
|
|
1338
|
+
constructor() {
|
|
1339
|
+
super(undefined, undefined);
|
|
1340
|
+
}
|
|
1341
|
+
static create() {
|
|
1342
|
+
return new DataProviderInst(undefined, undefined);
|
|
1343
|
+
}
|
|
1344
|
+
static fromClass(type) {
|
|
1345
|
+
return new DataProviderInst(type, undefined);
|
|
1346
|
+
}
|
|
1347
|
+
static fromClassWithService(type, serviceType) {
|
|
1348
|
+
return new DataProviderInst(type, serviceType);
|
|
1349
|
+
}
|
|
1350
|
+
static fromService(serviceType) {
|
|
1351
|
+
return new DataProviderInst(undefined, serviceType);
|
|
1352
|
+
}
|
|
1353
|
+
static fromAnyParam(type, serviceType) {
|
|
1354
|
+
if (typeof type !== 'undefined') {
|
|
1355
|
+
return typeof serviceType !== 'undefined'
|
|
1356
|
+
? DataProvider.fromClassWithService(type, serviceType)
|
|
1357
|
+
: DataProvider.fromClass(type);
|
|
1358
|
+
}
|
|
1359
|
+
else if (typeof serviceType !== 'undefined') {
|
|
1360
|
+
return DataProvider.fromService(serviceType);
|
|
1361
|
+
}
|
|
1362
|
+
else {
|
|
1363
|
+
return DataProvider.create();
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
class ComponentDirective {
|
|
1369
|
+
constructor() {
|
|
1370
|
+
this.injector = inject(Injector);
|
|
1371
|
+
this.elementRef = inject(ElementRef);
|
|
1372
|
+
this.applicationRef = inject(ApplicationRef);
|
|
1373
|
+
this.viewContainerRef = inject(ViewContainerRef);
|
|
1374
|
+
this.attachToHost = false;
|
|
1375
|
+
this.componentInstanceEventEmitter = new EventEmitter();
|
|
1376
|
+
}
|
|
1377
|
+
ngOnInit() {
|
|
1378
|
+
let component = null;
|
|
1379
|
+
if (this.component) {
|
|
1380
|
+
component = this.component;
|
|
1381
|
+
}
|
|
1382
|
+
else if (this.componentIt) {
|
|
1383
|
+
component = this.injector.get(this.componentIt, null, { optional: true });
|
|
1384
|
+
}
|
|
1385
|
+
if (!component) {
|
|
1386
|
+
throw new CommonsInternalError(`Component cannot be created, no component (${this.component}) or no or invalid injection token provided (${this.componentIt}).`);
|
|
1387
|
+
}
|
|
1388
|
+
if (this.attachToHost) {
|
|
1389
|
+
this.componentRef = createComponent(component, {
|
|
1390
|
+
hostElement: this.elementRef.nativeElement,
|
|
1391
|
+
environmentInjector: this.applicationRef.injector,
|
|
1392
|
+
elementInjector: this.nodeInjector ?? this.injector
|
|
1393
|
+
});
|
|
1394
|
+
}
|
|
1395
|
+
else {
|
|
1396
|
+
this.viewContainerRef.clear();
|
|
1397
|
+
this.componentRef = this.viewContainerRef.createComponent(component, {
|
|
1398
|
+
injector: this.nodeInjector ?? undefined
|
|
1399
|
+
});
|
|
1400
|
+
}
|
|
1401
|
+
if (this.inputs) {
|
|
1402
|
+
for (const input in this.inputs) {
|
|
1403
|
+
this.componentRef.setInput(input, this.inputs[input]);
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
if (this.attachToHost) {
|
|
1407
|
+
this.applicationRef.attachView(this.componentRef.hostView);
|
|
1408
|
+
}
|
|
1409
|
+
this.componentInstanceEventEmitter.next(this.componentRef.instance);
|
|
1410
|
+
}
|
|
1411
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: ComponentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1412
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.2", type: ComponentDirective, isStandalone: true, selector: "[mngComponent]", inputs: { component: ["mngComponent", "component"], componentIt: ["injectionToken", "componentIt"], inputs: "inputs", attachToHost: "attachToHost", nodeInjector: "nodeInjector" }, outputs: { componentInstanceEventEmitter: "instanceCreated" }, ngImport: i0 }); }
|
|
1413
|
+
}
|
|
1414
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: ComponentDirective, decorators: [{
|
|
1415
|
+
type: Directive,
|
|
1416
|
+
args: [{
|
|
1417
|
+
standalone: true,
|
|
1418
|
+
selector: '[mngComponent]'
|
|
1419
|
+
}]
|
|
1420
|
+
}], propDecorators: { component: [{
|
|
1421
|
+
type: Input,
|
|
1422
|
+
args: [{ alias: 'mngComponent' }]
|
|
1423
|
+
}], componentIt: [{
|
|
1424
|
+
type: Input,
|
|
1425
|
+
args: [{ alias: 'injectionToken' }]
|
|
1426
|
+
}], inputs: [{
|
|
1427
|
+
type: Input
|
|
1428
|
+
}], attachToHost: [{
|
|
1429
|
+
type: Input
|
|
1430
|
+
}], nodeInjector: [{
|
|
1431
|
+
type: Input
|
|
1432
|
+
}], componentInstanceEventEmitter: [{
|
|
1433
|
+
type: Output,
|
|
1434
|
+
args: ['instanceCreated']
|
|
1435
|
+
}] } });
|
|
1436
|
+
|
|
1437
|
+
class TemplateDirective {
|
|
1438
|
+
constructor() {
|
|
1439
|
+
this.template = inject((TemplateRef));
|
|
1440
|
+
this.viewContainerRef = inject(ViewContainerRef);
|
|
1441
|
+
}
|
|
1442
|
+
getType() {
|
|
1443
|
+
return this.name;
|
|
1444
|
+
}
|
|
1445
|
+
getViewContainerRef() {
|
|
1446
|
+
return this.viewContainerRef;
|
|
1447
|
+
}
|
|
1448
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: TemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1449
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.2", type: TemplateDirective, isStandalone: true, selector: "[mngTemplate]", inputs: { type: "type", name: ["mngTemplate", "name"] }, ngImport: i0 }); }
|
|
1450
|
+
}
|
|
1451
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: TemplateDirective, decorators: [{
|
|
1452
|
+
type: Directive,
|
|
1453
|
+
args: [{
|
|
1454
|
+
standalone: true,
|
|
1455
|
+
selector: '[mngTemplate]'
|
|
1456
|
+
}]
|
|
1457
|
+
}], propDecorators: { type: [{
|
|
1458
|
+
type: Input
|
|
1459
|
+
}], name: [{
|
|
1460
|
+
type: Input,
|
|
1461
|
+
args: [{ required: true, alias: 'mngTemplate' }]
|
|
1462
|
+
}] } });
|
|
1463
|
+
|
|
1464
|
+
/**
|
|
1465
|
+
* Returns array of names for constants in enum.
|
|
1466
|
+
* @param enumType Enum object.
|
|
1467
|
+
*/
|
|
1468
|
+
function getEnumConstantNames(enumType) {
|
|
1469
|
+
return getEnumConstantNamesFromObject(enumType);
|
|
1470
|
+
}
|
|
1471
|
+
/**
|
|
1472
|
+
* Returns array of names for constants in enum.
|
|
1473
|
+
* @param enumObj Enum object.
|
|
1474
|
+
*/
|
|
1475
|
+
function getEnumConstantNamesFromObject(enumObj) {
|
|
1476
|
+
// in number enum, the numbers are also represented in objects and should be filtered out
|
|
1477
|
+
return Object.keys(enumObj).filter(v => isNaN(+v));
|
|
1478
|
+
}
|
|
1479
|
+
/**
|
|
1480
|
+
* Returns array of string values for constants in enum.
|
|
1481
|
+
* @param enumType Enum object.
|
|
1482
|
+
*/
|
|
1483
|
+
function getEnumConstantValuesAsString(enumType) {
|
|
1484
|
+
return Object.keys(enumType).map(v => enumType[v]);
|
|
1485
|
+
}
|
|
1486
|
+
/**
|
|
1487
|
+
* Returns array of number values for constants in enum.
|
|
1488
|
+
* @param enumType Enum object.
|
|
1489
|
+
*/
|
|
1490
|
+
function getEnumConstantValuesAsNumber(enumType) {
|
|
1491
|
+
return Object.keys(enumType)
|
|
1492
|
+
.filter(v => !isNaN(+v))
|
|
1493
|
+
.map(v => +v);
|
|
1494
|
+
}
|
|
1495
|
+
/**
|
|
1496
|
+
* Returns array of type EnumValue for all constants in enum.
|
|
1497
|
+
* @param enumType Enum object.
|
|
1498
|
+
* @param nameAsValue If use name of constant as value (optional, default: false).
|
|
1499
|
+
* @param titlePath Base path for title to use as translation (optional).
|
|
1500
|
+
*/
|
|
1501
|
+
function fromEnumConstantsAsValueArray(enumType, nameAsValue = false, titlePath) {
|
|
1502
|
+
return getEnumConstantNames(enumType).map(n => ({ name: n, title: `${titlePath ? `${titlePath}.` : ''}${n}`, value: nameAsValue ? n : enumType[n] }));
|
|
1503
|
+
}
|
|
1504
|
+
/**
|
|
1505
|
+
* Returns array of type EnumValue for provided values in enum.
|
|
1506
|
+
* @param enumType Enum object.
|
|
1507
|
+
* @param values Enum values (constants).
|
|
1508
|
+
* @param nameAsValue If use name of constant as value (optional, default: false).
|
|
1509
|
+
* @param titlePath Base path for title to use as translation (optional).
|
|
1510
|
+
*/
|
|
1511
|
+
function fromEnumValuesAsValueArray(enumType, values, nameAsValue = false, titlePath) {
|
|
1512
|
+
return values.map(v => {
|
|
1513
|
+
const k = getEnumConstantName(enumType, v);
|
|
1514
|
+
return { name: k, title: `${titlePath ? `${titlePath}.` : ''}${k}`, value: nameAsValue ? k : v };
|
|
1515
|
+
});
|
|
1516
|
+
}
|
|
1517
|
+
/**
|
|
1518
|
+
* Gets constant name for value.
|
|
1519
|
+
* @param enumType Enum object.
|
|
1520
|
+
* @param value Value of enum constant.
|
|
1521
|
+
*/
|
|
1522
|
+
function getEnumConstantName(enumType, value) {
|
|
1523
|
+
if (typeof value === 'string') {
|
|
1524
|
+
return getEnumConstantNames(enumType).find(c => enumType[c] === value) ?? null;
|
|
1525
|
+
}
|
|
1526
|
+
else {
|
|
1527
|
+
return typeof enumType[value] !== 'undefined' ? enumType[value] : null;
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
/**
|
|
1531
|
+
* Gets constant name for value.
|
|
1532
|
+
* @param enumObj Enum object.
|
|
1533
|
+
* @param value Value of enum constant.
|
|
1534
|
+
*/
|
|
1535
|
+
function getEnumConstantNameFromObject(enumObj, value) {
|
|
1536
|
+
const enumObjAny = enumObj;
|
|
1537
|
+
if (typeof value === 'string') {
|
|
1538
|
+
return getEnumConstantNamesFromObject(enumObj).find(c => enumObjAny[c] === value) ?? null;
|
|
1539
|
+
}
|
|
1540
|
+
else {
|
|
1541
|
+
return typeof enumObjAny[value] !== 'undefined' ? enumObjAny[value] : null;
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
function objectDeepCopy(obj, options) {
|
|
1546
|
+
if (typeof obj !== 'object' || obj === null || Array.isArray(obj)) {
|
|
1547
|
+
return obj;
|
|
1548
|
+
}
|
|
1549
|
+
if (obj instanceof Date) {
|
|
1550
|
+
return new Date(+obj);
|
|
1551
|
+
}
|
|
1552
|
+
let copy;
|
|
1553
|
+
if (options?.mapGettersToProperties) {
|
|
1554
|
+
copy = {};
|
|
1555
|
+
}
|
|
1556
|
+
else {
|
|
1557
|
+
copy = options?.objectPrototype ? Object.create(options.objectPrototype['prototype']) : Object.create(Object.getPrototypeOf(obj));
|
|
1558
|
+
Object.assign(copy, obj);
|
|
1559
|
+
}
|
|
1560
|
+
for (const key of getObjectProperties(obj)) {
|
|
1561
|
+
const prop = obj[key];
|
|
1562
|
+
copy[key] = handleProp(prop, { mapGettersToProperties: options?.mapGettersToProperties });
|
|
1563
|
+
}
|
|
1564
|
+
if (options?.mapGettersToProperties) {
|
|
1565
|
+
for (const getterKey of getObjectGetters(obj)) {
|
|
1566
|
+
const prop = obj[getterKey];
|
|
1567
|
+
copy[getterKey] = handleProp(prop, { mapGettersToProperties: options?.mapGettersToProperties });
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
return copy;
|
|
1571
|
+
}
|
|
1572
|
+
function objectDeepMerge(target, source) {
|
|
1573
|
+
if (!isObject(source)) {
|
|
1574
|
+
return target;
|
|
1575
|
+
}
|
|
1576
|
+
for (const key of getObjectProperties(source)) {
|
|
1577
|
+
if (isObject(source[key])) {
|
|
1578
|
+
if (isObject(target[key])) {
|
|
1579
|
+
target[key] = objectDeepMerge(target[key], source[key]);
|
|
1580
|
+
}
|
|
1581
|
+
else {
|
|
1582
|
+
target[key] = objectDeepCopy(source[key]);
|
|
1583
|
+
}
|
|
1584
|
+
}
|
|
1585
|
+
else if (Array.isArray(source[key])) {
|
|
1586
|
+
if (!Array.isArray(target[key])) {
|
|
1587
|
+
target[key] = source[key].map(i => (isObject(i) ? objectDeepMerge({}, i) : i));
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
else if (typeof target[key] === 'undefined') {
|
|
1591
|
+
target[key] = source[key];
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
return target;
|
|
1595
|
+
}
|
|
1596
|
+
function isObject(obj) {
|
|
1597
|
+
return typeof obj === 'object' && obj !== null && !Array.isArray(obj);
|
|
1598
|
+
}
|
|
1599
|
+
function handleProp(prop, options) {
|
|
1600
|
+
if (Array.isArray(prop)) {
|
|
1601
|
+
return prop.map(i => objectDeepCopy(i, options));
|
|
1602
|
+
}
|
|
1603
|
+
else if (typeof prop === 'object' && prop !== null) {
|
|
1604
|
+
return objectDeepCopy(prop, options);
|
|
1605
|
+
}
|
|
1606
|
+
else {
|
|
1607
|
+
return prop;
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
function getObjectProperties(obj) {
|
|
1611
|
+
return Object.keys(obj);
|
|
1612
|
+
}
|
|
1613
|
+
function getObjectGetters(obj) {
|
|
1614
|
+
const getterSet = new Set();
|
|
1615
|
+
let currObj = obj;
|
|
1616
|
+
while (currObj) {
|
|
1617
|
+
const getters = Object.entries(Object.getOwnPropertyDescriptors(currObj))
|
|
1618
|
+
.filter(([, descriptor]) => typeof descriptor.get === 'function')
|
|
1619
|
+
.filter(([key]) => key !== '__proto__')
|
|
1620
|
+
.map(([key]) => key);
|
|
1621
|
+
for (const getter of getters) {
|
|
1622
|
+
getterSet.add(getter);
|
|
1623
|
+
}
|
|
1624
|
+
currObj = Object.getPrototypeOf(currObj);
|
|
1625
|
+
}
|
|
1626
|
+
return Array.from(getterSet);
|
|
1627
|
+
}
|
|
1628
|
+
function getObjectPropertyByPath(value, path) {
|
|
1629
|
+
if (path === '$') {
|
|
1630
|
+
// only return the root
|
|
1631
|
+
return value;
|
|
1632
|
+
}
|
|
1633
|
+
// Check for leading root object notation
|
|
1634
|
+
if (path.startsWith('$')) {
|
|
1635
|
+
path = path.substring(1);
|
|
1636
|
+
}
|
|
1637
|
+
// Check for leading .
|
|
1638
|
+
if (path.startsWith('.')) {
|
|
1639
|
+
path = path.substring(1);
|
|
1640
|
+
}
|
|
1641
|
+
if (path.indexOf('.') >= 0) {
|
|
1642
|
+
const pathSplit = path.split('.');
|
|
1643
|
+
let currValue = value;
|
|
1644
|
+
for (const p of pathSplit) {
|
|
1645
|
+
if (typeof currValue === 'undefined' || currValue === null) {
|
|
1646
|
+
return currValue;
|
|
1647
|
+
}
|
|
1648
|
+
if (!p.length) {
|
|
1649
|
+
// empty path, return current value
|
|
1650
|
+
return currValue;
|
|
1651
|
+
}
|
|
1652
|
+
const leftBracketIdx = p.indexOf('[');
|
|
1653
|
+
if (leftBracketIdx >= 0 && p.endsWith(']')) {
|
|
1654
|
+
// should be reference to array
|
|
1655
|
+
const arrayPath = p.substring(0, leftBracketIdx);
|
|
1656
|
+
const arrayIdx = +p.substring(leftBracketIdx + 1, p.length - 1);
|
|
1657
|
+
const array = currValue[arrayPath];
|
|
1658
|
+
if (Array.isArray(array)) {
|
|
1659
|
+
if (arrayIdx >= 0 && arrayIdx < array.length) {
|
|
1660
|
+
// valid index, continue on the path
|
|
1661
|
+
currValue = array[arrayIdx];
|
|
1662
|
+
continue;
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
return undefined;
|
|
1666
|
+
}
|
|
1667
|
+
else if (typeof currValue === 'object') {
|
|
1668
|
+
currValue = currValue[p];
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
return currValue;
|
|
1672
|
+
}
|
|
1673
|
+
else {
|
|
1674
|
+
return value[path];
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1677
|
+
function flattenObjectKeys(objectModel) {
|
|
1678
|
+
const flatten = (object, parent) => {
|
|
1679
|
+
let results = [];
|
|
1680
|
+
for (const key in object) {
|
|
1681
|
+
const value = object[key];
|
|
1682
|
+
const thisKey = parent ? `${parent}.${key}` : `${key}`;
|
|
1683
|
+
results = results.concat(isObject(value) ? flatten(value, thisKey) : [[`${thisKey}`, value]]);
|
|
1684
|
+
}
|
|
1685
|
+
return results;
|
|
1686
|
+
};
|
|
1687
|
+
return flatten(objectModel);
|
|
1688
|
+
}
|
|
1689
|
+
|
|
1690
|
+
function escapeHtml(value) {
|
|
1691
|
+
return value.replace(/</g, '<').replace(/>/g, '>');
|
|
1692
|
+
}
|
|
1693
|
+
function escapeHtmlAny(value) {
|
|
1694
|
+
if (typeof value === 'string') {
|
|
1695
|
+
return escapeHtml(value);
|
|
1696
|
+
}
|
|
1697
|
+
else if (typeof value === 'object') {
|
|
1698
|
+
const escapedValue = objectDeepCopy(value, { mapGettersToProperties: true });
|
|
1699
|
+
for (const key in value) {
|
|
1700
|
+
if (typeof value[key] === 'string') {
|
|
1701
|
+
escapedValue[key] = escapeHtml(value[key]);
|
|
1702
|
+
}
|
|
1703
|
+
else if (typeof value[key] === 'object') {
|
|
1704
|
+
escapedValue[key] = escapeHtmlAny(value[key]);
|
|
1705
|
+
}
|
|
1706
|
+
else {
|
|
1707
|
+
escapedValue[key] = value[key];
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
return escapedValue;
|
|
1711
|
+
}
|
|
1712
|
+
return value;
|
|
1713
|
+
}
|
|
1714
|
+
/**
|
|
1715
|
+
* Stringifies a value - primitives with toString, dates with dateUtil, objects with JSON.stringify.
|
|
1716
|
+
* @param value Any value.
|
|
1717
|
+
*/
|
|
1718
|
+
function stringify(value) {
|
|
1719
|
+
if (value === null) {
|
|
1720
|
+
return 'null';
|
|
1721
|
+
}
|
|
1722
|
+
if (typeof value === 'undefined') {
|
|
1723
|
+
return 'undefined';
|
|
1724
|
+
}
|
|
1725
|
+
// eliminate functions, cause they could fall into objects
|
|
1726
|
+
if (typeof value === 'function') {
|
|
1727
|
+
return `Function ${value.name ?? 'anonymous'}()`;
|
|
1728
|
+
}
|
|
1729
|
+
if (typeof value === 'object') {
|
|
1730
|
+
// date is object, but would like it in ISO string representation
|
|
1731
|
+
if (value instanceof Date) {
|
|
1732
|
+
return dateToIsoString(value) ?? 'null';
|
|
1733
|
+
}
|
|
1734
|
+
try {
|
|
1735
|
+
return JSON.stringify(value);
|
|
1736
|
+
}
|
|
1737
|
+
catch (e) {
|
|
1738
|
+
return value.toString();
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
// only primitives should be left to be printed like this (string, number, boolean)
|
|
1742
|
+
return value.toString();
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1745
|
+
/**
|
|
1746
|
+
* Converts RxJS subscription error to CommonsError.
|
|
1747
|
+
* @param error Error.
|
|
1748
|
+
* @param name Optional name to write in commons error.
|
|
1749
|
+
* @param details Optional details of error.
|
|
1750
|
+
*/
|
|
1751
|
+
function fromSubscribeError(error, name, details) {
|
|
1752
|
+
const opts = {
|
|
1753
|
+
name,
|
|
1754
|
+
details,
|
|
1755
|
+
location: window?.location?.href
|
|
1756
|
+
};
|
|
1757
|
+
if (error instanceof HttpErrorResponse) {
|
|
1758
|
+
return new CommonsHttpError(error.message ?? 'Http Error occurred', error, opts);
|
|
1759
|
+
}
|
|
1760
|
+
else {
|
|
1761
|
+
opts.cause = error;
|
|
1762
|
+
return new CommonsInternalError(error.message ?? 'Internal Error occurred', opts);
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
/**
|
|
1766
|
+
* Checks if error is Http error (Angular or Commons).
|
|
1767
|
+
* @param error
|
|
1768
|
+
*/
|
|
1769
|
+
function isHttpErrorResponse(error) {
|
|
1770
|
+
return error instanceof HttpErrorResponse || error instanceof CommonsHttpError || error?.httpError instanceof HttpErrorResponse;
|
|
1771
|
+
}
|
|
1772
|
+
/**
|
|
1773
|
+
* Gets HttpErrorResponse from error (Angular or Commons).
|
|
1774
|
+
* @param error Error.
|
|
1775
|
+
*/
|
|
1776
|
+
function getHttpErrorResponse(error) {
|
|
1777
|
+
if (error instanceof HttpErrorResponse) {
|
|
1778
|
+
return error;
|
|
1779
|
+
}
|
|
1780
|
+
else if (error instanceof CommonsHttpError) {
|
|
1781
|
+
return error.httpError;
|
|
1782
|
+
}
|
|
1783
|
+
else if (error?.httpError instanceof HttpErrorResponse) {
|
|
1784
|
+
return error.httpError;
|
|
1785
|
+
}
|
|
1786
|
+
else {
|
|
1787
|
+
return null;
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
/**
|
|
1791
|
+
* Gets HttpErrorResponse status from error (Angular or Commons).
|
|
1792
|
+
* @param error Error.
|
|
1793
|
+
*/
|
|
1794
|
+
function getHttpErrorResponseStatus(error) {
|
|
1795
|
+
return getHttpErrorResponse(error)?.status ?? null;
|
|
1796
|
+
}
|
|
1797
|
+
/**
|
|
1798
|
+
* Get error log level. All is error, except if error is http error with status >=400 and <500.
|
|
1799
|
+
* @param error Error.
|
|
1800
|
+
*/
|
|
1801
|
+
function getErrorLogLevel(error) {
|
|
1802
|
+
if (isHttpErrorResponse(error)) {
|
|
1803
|
+
const status = getHttpErrorResponseStatus(error);
|
|
1804
|
+
if (status && status >= 400 && status < 500) {
|
|
1805
|
+
return LogLevelEnum.Warning;
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
return LogLevelEnum.Error;
|
|
1809
|
+
}
|
|
1810
|
+
/**
|
|
1811
|
+
* Get error name (prototype name or type from commons error if name is not provided).
|
|
1812
|
+
* @param error Error.
|
|
1813
|
+
*/
|
|
1814
|
+
function getErrorName(error) {
|
|
1815
|
+
if (error instanceof ACommonsErrorBase) {
|
|
1816
|
+
return error.name ?? error.type;
|
|
1817
|
+
}
|
|
1818
|
+
else {
|
|
1819
|
+
return error.name;
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1822
|
+
/**
|
|
1823
|
+
* Writes http error to string with all headers and body.
|
|
1824
|
+
* @param error Http response error.
|
|
1825
|
+
* @param opts Options for hiding parts of error:
|
|
1826
|
+
* - hideMessage Hides message of error (message include url, status and status text!).
|
|
1827
|
+
* - hideHeaders Hides headers.
|
|
1828
|
+
* - hideBody Hides JSON representation of body.
|
|
1829
|
+
*/
|
|
1830
|
+
function httpErrorResponseToString(error, opts) {
|
|
1831
|
+
let str = opts?.hideMessage ? '' : `${error.message}\n`; // message should already include url, status, etc.
|
|
1832
|
+
if (!opts?.hideHeaders) {
|
|
1833
|
+
str += `Http Response Headers: ${error.headers.keys().reduce((acc, key) => `${acc}[${key}: ${error.headers.get(key)}]`, '')}`;
|
|
1834
|
+
}
|
|
1835
|
+
if (!opts?.hideBody) {
|
|
1836
|
+
str += `\nHttp Response Body: ${stringify(error.error)}`;
|
|
1837
|
+
}
|
|
1838
|
+
return str;
|
|
1839
|
+
}
|
|
1840
|
+
/**
|
|
1841
|
+
* Error to string.
|
|
1842
|
+
* @param error Error.
|
|
1843
|
+
* @param opts Options for hiding parts of error:
|
|
1844
|
+
* - hideMessage Hides message of error.
|
|
1845
|
+
* - hideName Hides error name.
|
|
1846
|
+
* - hideCause Hides cause of an error (if present, see @link(errorCauseToString) for other options).
|
|
1847
|
+
* - hideStack Hides stack of an error (if present).
|
|
1848
|
+
* - hideDetails Hides JSON detail's representation of error (if present).
|
|
1849
|
+
* - hideLocation Hides location (URL) where error was thrown.
|
|
1850
|
+
* - hideHttp Hides http error portion of error if http error response (see @link(httpErrorResponseToString) for other options).
|
|
1851
|
+
*/
|
|
1852
|
+
function errorToString(error, opts) {
|
|
1853
|
+
if (error instanceof ACommonsErrorBase) {
|
|
1854
|
+
return commonsErrorToString(error, opts);
|
|
1855
|
+
}
|
|
1856
|
+
else if (error instanceof HttpErrorResponse) {
|
|
1857
|
+
return httpErrorResponseToString(error, opts);
|
|
1858
|
+
}
|
|
1859
|
+
const strBlocks = [];
|
|
1860
|
+
if (!opts?.hideMessage) {
|
|
1861
|
+
strBlocks.push(error.message);
|
|
1862
|
+
}
|
|
1863
|
+
if (error.name) {
|
|
1864
|
+
strBlocks.push(`Error name: ${error.name}`);
|
|
1865
|
+
}
|
|
1866
|
+
if (!opts?.hideCause) {
|
|
1867
|
+
strBlocks.push(errorCauseToString(error, opts));
|
|
1868
|
+
}
|
|
1869
|
+
if (!opts?.hideStack && error.stack) {
|
|
1870
|
+
strBlocks.push(`Stack trace:\n${error.stack}`);
|
|
1871
|
+
}
|
|
1872
|
+
return strBlocks.filter(s => s.trim().length > 0).join('\n');
|
|
1873
|
+
}
|
|
1874
|
+
/**
|
|
1875
|
+
* Commons error to string.
|
|
1876
|
+
* @param error Commons error.
|
|
1877
|
+
* @param opts Options for hiding parts of error:
|
|
1878
|
+
* - hideMessage Hides message of error.
|
|
1879
|
+
* - hideName Hides error name.
|
|
1880
|
+
* - hideCause Hides cause of an error (if present, see @link(errorCauseToString) for other options).
|
|
1881
|
+
* - hideStack Hides stack of an error (if present).
|
|
1882
|
+
* - hideDetails Hides JSON detail's representation of error (if present).
|
|
1883
|
+
* - hideLocation Hides location (URL) where error was thrown.
|
|
1884
|
+
* - hideHttp Hides http error portion of error if http error response (see @link(httpErrorResponseToString) for other options).
|
|
1885
|
+
* - hideItems Hides all item information (http body, action context data).
|
|
1886
|
+
* - hideActionData See @link(commonsActionErrorContextToString) for additional info.
|
|
1887
|
+
* - hideQueryParams See @link(commonsActionErrorContextToString) for additional info.
|
|
1888
|
+
*/
|
|
1889
|
+
function commonsErrorToString(error, opts) {
|
|
1890
|
+
const strBlocks = [];
|
|
1891
|
+
if (!opts?.hideMessage) {
|
|
1892
|
+
strBlocks.push(`${error.message}${error.messageCode ? ` (code: ${error.messageCode})` : ''}`);
|
|
1893
|
+
}
|
|
1894
|
+
if (!opts?.hideName) {
|
|
1895
|
+
strBlocks.push(`Error name: ${error.name ?? error.type} ${error.name ? `(${error.type})` : ''}`);
|
|
1896
|
+
}
|
|
1897
|
+
if (!opts?.hideLocation && error.location) {
|
|
1898
|
+
strBlocks.push(`Location: ${error.location}`);
|
|
1899
|
+
}
|
|
1900
|
+
let isHttp = false;
|
|
1901
|
+
if (!opts?.hideHttp && error instanceof CommonsHttpError) {
|
|
1902
|
+
strBlocks.push(httpErrorResponseToString(error.httpError, {
|
|
1903
|
+
hideBody: opts?.hideItems || opts?.hideBody,
|
|
1904
|
+
hideHeaders: opts?.hideHeaders,
|
|
1905
|
+
hideMessage: error.message.indexOf(error.httpError.message) >= 0
|
|
1906
|
+
}));
|
|
1907
|
+
isHttp = true;
|
|
1908
|
+
}
|
|
1909
|
+
if (error.type === 'CommonsActionError') {
|
|
1910
|
+
const actionError = error;
|
|
1911
|
+
if (actionError.actionContext) {
|
|
1912
|
+
strBlocks.push(commonsActionErrorContextToString(actionError, opts));
|
|
1913
|
+
}
|
|
1914
|
+
if (!opts?.hideHttp && actionError.httpError instanceof HttpErrorResponse) {
|
|
1915
|
+
strBlocks.push(httpErrorResponseToString(actionError.httpError, {
|
|
1916
|
+
hideBody: opts?.hideItems || opts?.hideBody,
|
|
1917
|
+
hideHeaders: opts?.hideHeaders,
|
|
1918
|
+
hideMessage: error.message.indexOf(actionError.httpError.message) >= 0
|
|
1919
|
+
}));
|
|
1920
|
+
isHttp = true;
|
|
1921
|
+
}
|
|
1922
|
+
}
|
|
1923
|
+
if (!opts?.hideDetails && error.details) {
|
|
1924
|
+
strBlocks.push(`Details: ${stringify(error.details)}`);
|
|
1925
|
+
}
|
|
1926
|
+
if (!opts?.hideCause && (!isHttp || !(error.cause instanceof HttpErrorResponse))) {
|
|
1927
|
+
strBlocks.push(errorCauseToString(error, opts));
|
|
1928
|
+
}
|
|
1929
|
+
if (!opts?.hideStack && error.stack) {
|
|
1930
|
+
strBlocks.push(`Stack trace:\n${error.stack}`);
|
|
1931
|
+
}
|
|
1932
|
+
return strBlocks.filter(s => s.trim().length > 0).join('\n');
|
|
1933
|
+
}
|
|
1934
|
+
/**
|
|
1935
|
+
* Writes commons action error info from context as string.
|
|
1936
|
+
* @param error Commons action error.
|
|
1937
|
+
* @param opts Options for hiding parts of error:
|
|
1938
|
+
* - hideItems Hides all item related information (item, form item, submit item, ...).
|
|
1939
|
+
* - hideActionData Hides action data.
|
|
1940
|
+
* - hideQueryParams Hides query params.
|
|
1941
|
+
*/
|
|
1942
|
+
function commonsActionErrorContextToString(error, opts) {
|
|
1943
|
+
let paramsMessage = '';
|
|
1944
|
+
if (error.actionContext?.parameters) {
|
|
1945
|
+
if (error.actionContext?.parameters.itemId) {
|
|
1946
|
+
paramsMessage += `[itemId: ${error.actionContext.parameters.itemId}]`;
|
|
1947
|
+
}
|
|
1948
|
+
if (!opts?.hideItems && error.actionContext?.parameters.item) {
|
|
1949
|
+
paramsMessage += `[item: ${stringify(error.actionContext.parameters.item)}]`;
|
|
1950
|
+
}
|
|
1951
|
+
if (!opts?.hideActionData && error.actionContext?.parameters.actionData) {
|
|
1952
|
+
paramsMessage += Object.entries(error.actionContext?.parameters.actionData).reduce((acc, [key, value]) => `${acc}[actionData ${key}: ${stringify(value)}]`, '');
|
|
1953
|
+
}
|
|
1954
|
+
if (!opts?.hideQueryParams && error.actionContext?.parameters.dataListParams) {
|
|
1955
|
+
paramsMessage += `[dataListParams: ${stringify(error.actionContext.parameters.dataListParams)}]`;
|
|
1956
|
+
}
|
|
1957
|
+
if (!opts?.hideItems && error.actionContext?.parameters.formItem) {
|
|
1958
|
+
paramsMessage += `[formItem: ${stringify(error.actionContext.parameters.formItem)}]`;
|
|
1959
|
+
}
|
|
1960
|
+
if (!opts?.hideItems && error.actionContext?.parameters.submitResult) {
|
|
1961
|
+
paramsMessage += `[formItem: ${stringify(error.actionContext.parameters.submitResult)}]`;
|
|
1962
|
+
}
|
|
1963
|
+
if (error.actionContext?.parameters.locale) {
|
|
1964
|
+
paramsMessage += `[locale: ${stringify(error.actionContext.parameters.locale)}]`;
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
return paramsMessage;
|
|
1968
|
+
}
|
|
1969
|
+
/**
|
|
1970
|
+
* Writes cause of an error as string.
|
|
1971
|
+
* @param error Error.
|
|
1972
|
+
* @param opts Options for hiding parts of error:
|
|
1973
|
+
* - causeOnErrorOnly Prints only if cause is instance of error.
|
|
1974
|
+
* - causeAsJson Print error cause as a JSON (by default, if error only message and name will be printed).
|
|
1975
|
+
*/
|
|
1976
|
+
function errorCauseToString(error, opts) {
|
|
1977
|
+
// if already logged as http error, check that cause is not also http error (cause it is usually duplicated)
|
|
1978
|
+
if (error.cause && (!opts?.causeOnErrorOnly || error.cause instanceof Error)) {
|
|
1979
|
+
const needsStringify = opts?.causeAsJson || !(error.cause instanceof Error);
|
|
1980
|
+
if (!opts?.causeOnErrorOnly || error.cause instanceof Error) {
|
|
1981
|
+
return ('Caused by: ' +
|
|
1982
|
+
(needsStringify ? stringify(error.cause) : `${error.cause.message}${error.cause.name ? ` (${error.cause.name})` : ''}`));
|
|
1983
|
+
}
|
|
1984
|
+
}
|
|
1985
|
+
return '';
|
|
1986
|
+
}
|
|
1987
|
+
|
|
1988
|
+
class CommonsErrorHandler {
|
|
1989
|
+
constructor() {
|
|
1990
|
+
this.logger = LoggerService.get();
|
|
1991
|
+
}
|
|
1992
|
+
static { this.logCategory = 'ErrorHandler'; }
|
|
1993
|
+
handleError(error) {
|
|
1994
|
+
if (error instanceof ACommonsErrorBase || error instanceof HttpErrorResponse) {
|
|
1995
|
+
const logLevel = getErrorLogLevel(error);
|
|
1996
|
+
this.logger.log(error, logLevel);
|
|
1997
|
+
}
|
|
1998
|
+
else {
|
|
1999
|
+
this.logger.error('Unexpected error occurred', error);
|
|
2000
|
+
}
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
|
|
2004
|
+
function boolean$Attribute(value) {
|
|
2005
|
+
return isObservable(value) ? value : of(booleanAttribute(value));
|
|
2006
|
+
}
|
|
2007
|
+
function number$Attribute(value) {
|
|
2008
|
+
return isObservable(value) ? value : of(numberAttribute(value));
|
|
2009
|
+
}
|
|
2010
|
+
const toObservable = (value) => {
|
|
2011
|
+
return isObservable(value) ? value : of(value);
|
|
2012
|
+
};
|
|
2013
|
+
const itemIdToNumber = (value) => {
|
|
2014
|
+
if (typeof value === 'number') {
|
|
2015
|
+
return value;
|
|
2016
|
+
}
|
|
2017
|
+
else if (typeof value === 'string') {
|
|
2018
|
+
const num = +value;
|
|
2019
|
+
if (!isNaN(num)) {
|
|
2020
|
+
return num;
|
|
2021
|
+
}
|
|
2022
|
+
throw new CommonsInternalError(`ItemId is a string, but could not be transformed to number: ${value}`);
|
|
2023
|
+
}
|
|
2024
|
+
else {
|
|
2025
|
+
throw new CommonsInternalError(`ItemId is not a number: ${value}`);
|
|
2026
|
+
}
|
|
2027
|
+
};
|
|
2028
|
+
const itemIdToString = (value) => {
|
|
2029
|
+
if (typeof value === 'string') {
|
|
2030
|
+
return value;
|
|
2031
|
+
}
|
|
2032
|
+
else {
|
|
2033
|
+
throw new CommonsInternalError(`ItemId is not a string: ${value}`);
|
|
2034
|
+
}
|
|
2035
|
+
};
|
|
2036
|
+
const itemIdToDefined = (value) => {
|
|
2037
|
+
if (typeof value === 'undefined') {
|
|
2038
|
+
throw new CommonsInternalError(`ItemId is not defined: ${value}`);
|
|
2039
|
+
}
|
|
2040
|
+
else {
|
|
2041
|
+
return value;
|
|
2042
|
+
}
|
|
2043
|
+
};
|
|
2044
|
+
const valueToDefined = (value) => {
|
|
2045
|
+
if (typeof value === 'undefined' || value === null) {
|
|
2046
|
+
throw new CommonsInternalError(`Value is null or not defined: ${value}`);
|
|
2047
|
+
}
|
|
2048
|
+
else {
|
|
2049
|
+
return value;
|
|
2050
|
+
}
|
|
2051
|
+
};
|
|
2052
|
+
|
|
2053
|
+
function toastMessage(messageService, title, message, severity = 'success', icon) {
|
|
2054
|
+
const notification = { severity: severity, summary: title, detail: message, life: severity === 'error' ? 10000 : 5000, icon: icon };
|
|
2055
|
+
messageService.add(notification);
|
|
2056
|
+
return notification;
|
|
2057
|
+
}
|
|
2058
|
+
|
|
2059
|
+
function removeRouteEmptyPathSegments(path) {
|
|
2060
|
+
const filteredPath = path.filter(ps => typeof ps === 'string' && ps.length > 0);
|
|
2061
|
+
return filteredPath.length > 0 ? filteredPath : [''];
|
|
2062
|
+
}
|
|
2063
|
+
function appendRoutePathToBasePath(basePath, path) {
|
|
2064
|
+
if (path.length > 0) {
|
|
2065
|
+
if (path[0].startsWith('/')) {
|
|
2066
|
+
return path;
|
|
2067
|
+
}
|
|
2068
|
+
else if (path[0].startsWith('../')) {
|
|
2069
|
+
throw new CommonsInternalError('Not implemented', { name: 'RouteUtilsError' });
|
|
2070
|
+
}
|
|
2071
|
+
else {
|
|
2072
|
+
return removeRouteEmptyPathSegments([...basePath, ...path]);
|
|
2073
|
+
}
|
|
2074
|
+
}
|
|
2075
|
+
else {
|
|
2076
|
+
return basePath;
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2079
|
+
function doesUrlMatchRouterLink(link, url) {
|
|
2080
|
+
if (typeof url === 'string' && url.startsWith('/')) {
|
|
2081
|
+
url = url.substring(1);
|
|
2082
|
+
}
|
|
2083
|
+
else if (Array.isArray(url) && url.length > 0 && url[0].startsWith('/')) {
|
|
2084
|
+
url[0] = url[0].substring(1);
|
|
2085
|
+
}
|
|
2086
|
+
const routeSegments = Array.isArray(link) ? link : link.split('/');
|
|
2087
|
+
const urlSegments = Array.isArray(url) ? url : url.split('#')[0].split('?')[0].split('/');
|
|
2088
|
+
if (routeSegments.length > 0 && urlSegments.length > 0) {
|
|
2089
|
+
for (let i = 0; i < routeSegments.length; i++) {
|
|
2090
|
+
if (i < urlSegments.length) {
|
|
2091
|
+
if (routeSegments[i] !== urlSegments[i]) {
|
|
2092
|
+
return false;
|
|
2093
|
+
}
|
|
2094
|
+
}
|
|
2095
|
+
else {
|
|
2096
|
+
break;
|
|
2097
|
+
}
|
|
2098
|
+
}
|
|
2099
|
+
return true;
|
|
2100
|
+
}
|
|
2101
|
+
return false;
|
|
2102
|
+
}
|
|
2103
|
+
function adjustRouteMenuLazyChildrenRouterLinks(rootMenuItem, lazyChildren) {
|
|
2104
|
+
return lazyChildren.map(i => {
|
|
2105
|
+
const childMenuItem = { ...i };
|
|
2106
|
+
if (childMenuItem.routerLink) {
|
|
2107
|
+
childMenuItem.routerLink = appendRoutePathToBasePath(rootMenuItem.routerLink, typeof childMenuItem.routerLink === 'string' ? [childMenuItem.routerLink] : childMenuItem.routerLink);
|
|
2108
|
+
}
|
|
2109
|
+
if (Array.isArray(childMenuItem.items)) {
|
|
2110
|
+
childMenuItem.items = adjustRouteMenuLazyChildrenRouterLinks(rootMenuItem, childMenuItem.items);
|
|
2111
|
+
}
|
|
2112
|
+
return childMenuItem;
|
|
2113
|
+
});
|
|
2114
|
+
}
|
|
2115
|
+
|
|
2116
|
+
function findTemplateByName(templates, name) {
|
|
2117
|
+
return templates.find(t => t.getType() === name)?.template ?? null;
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
function getI18nAsync(translate, params, ...keys) {
|
|
2121
|
+
return translate.stream(keys, params).pipe(map(i18n => selectI18n(keys, i18n)));
|
|
2122
|
+
}
|
|
2123
|
+
function getI18n(translate, params, ...keys) {
|
|
2124
|
+
const i18n = translate.instant(keys, params);
|
|
2125
|
+
return selectI18n(keys, i18n);
|
|
2126
|
+
}
|
|
2127
|
+
function populateI18nParams(item, params = {}) {
|
|
2128
|
+
const paramsRes = { ...params };
|
|
2129
|
+
if (item) {
|
|
2130
|
+
paramsRes.item = item;
|
|
2131
|
+
}
|
|
2132
|
+
return paramsRes;
|
|
2133
|
+
}
|
|
2134
|
+
function selectI18n(keys, i18n) {
|
|
2135
|
+
for (const key of keys) {
|
|
2136
|
+
if (key !== i18n[key]) {
|
|
2137
|
+
return i18n[key];
|
|
2138
|
+
}
|
|
2139
|
+
}
|
|
2140
|
+
return null;
|
|
2141
|
+
}
|
|
2142
|
+
|
|
2143
|
+
function getI18nForError(translate, error, params = {}) {
|
|
2144
|
+
const i18nParams = getI18nErrorParams(error, params);
|
|
2145
|
+
if (error.messageCode) {
|
|
2146
|
+
const keys = [`errors.${error.messageCode}`, `messages.${error.messageCode}`];
|
|
2147
|
+
const i18n = getI18n(translate, i18nParams, ...keys);
|
|
2148
|
+
if (i18n) {
|
|
2149
|
+
return i18n;
|
|
2150
|
+
}
|
|
2151
|
+
}
|
|
2152
|
+
return getI18n(translate, i18nParams, error.message);
|
|
2153
|
+
}
|
|
2154
|
+
function getI18nErrorParams(error, params = {}) {
|
|
2155
|
+
const paramsRes = { ...params };
|
|
2156
|
+
paramsRes.errorStatus = '';
|
|
2157
|
+
paramsRes.errorMessage = '';
|
|
2158
|
+
if (isHttpErrorResponse(error)) {
|
|
2159
|
+
const httpError = getHttpErrorResponse(error);
|
|
2160
|
+
paramsRes.errorStatus = httpError?.status;
|
|
2161
|
+
paramsRes.errorMessage = httpError?.message;
|
|
2162
|
+
paramsRes.errorStatusDescription = httpError?.statusText;
|
|
2163
|
+
}
|
|
2164
|
+
paramsRes.error = error;
|
|
2165
|
+
return paramsRes;
|
|
2166
|
+
}
|
|
2167
|
+
|
|
2168
|
+
const reflectTypeNameKey = 'typeName';
|
|
2169
|
+
const reflectEnumNameKey = 'enumName';
|
|
2170
|
+
/**
|
|
2171
|
+
* Defines type name decorator.
|
|
2172
|
+
* @param targetType class.
|
|
2173
|
+
* @param typeName Name of the type.
|
|
2174
|
+
*/
|
|
2175
|
+
function defineReflectTypeName(targetType, typeName) {
|
|
2176
|
+
if (!Reflect.hasOwnMetadata(reflectTypeNameKey, targetType)) {
|
|
2177
|
+
Reflect.defineMetadata(reflectTypeNameKey, typeName, targetType);
|
|
2178
|
+
}
|
|
2179
|
+
}
|
|
2180
|
+
/**
|
|
2181
|
+
* Defines enum name decorator.
|
|
2182
|
+
* @param targetType enum object.
|
|
2183
|
+
* @param enumName Name of the enum.
|
|
2184
|
+
*/
|
|
2185
|
+
function defineReflectEnumName(targetType, enumName) {
|
|
2186
|
+
if (!Reflect.hasOwnMetadata(reflectEnumNameKey, targetType)) {
|
|
2187
|
+
Reflect.defineMetadata(reflectEnumNameKey, enumName, targetType);
|
|
2188
|
+
}
|
|
2189
|
+
}
|
|
2190
|
+
/**
|
|
2191
|
+
* Gets type name from reflect metadata.
|
|
2192
|
+
* @param type Class.
|
|
2193
|
+
*/
|
|
2194
|
+
function findReflectTypeName(type) {
|
|
2195
|
+
if (!type) {
|
|
2196
|
+
return null;
|
|
2197
|
+
}
|
|
2198
|
+
const typeName = Reflect.getMetadata(reflectTypeNameKey, type);
|
|
2199
|
+
if (typeName) {
|
|
2200
|
+
return typeName;
|
|
2201
|
+
}
|
|
2202
|
+
LoggerService.get().debug('WARNING: Reflect metadata could not be found for type, you might experience some issues in production build.', type?.name);
|
|
2203
|
+
return type.name;
|
|
2204
|
+
}
|
|
2205
|
+
/**
|
|
2206
|
+
* Gets type name from either decorator or reflect metadata.
|
|
2207
|
+
* @param type Class.
|
|
2208
|
+
*/
|
|
2209
|
+
function reflectTypeNameExists(type) {
|
|
2210
|
+
return Reflect.hasOwnMetadata(reflectTypeNameKey, type);
|
|
2211
|
+
}
|
|
2212
|
+
/**
|
|
2213
|
+
* Gets enum name from either decorator or reflect metadata.
|
|
2214
|
+
* @param enumType Class.
|
|
2215
|
+
*/
|
|
2216
|
+
function findReflectEnumName(enumType) {
|
|
2217
|
+
const enumName = Reflect.getMetadata(reflectEnumNameKey, enumType);
|
|
2218
|
+
if (enumName) {
|
|
2219
|
+
return enumName;
|
|
2220
|
+
}
|
|
2221
|
+
LoggerService.get().debug(`WARNING: Reflect metadata could not be found for enum ${typeof enumType === 'object' ? Object.keys(enumType) : enumType}`, {
|
|
2222
|
+
name: 'TypeUtilsError',
|
|
2223
|
+
enumType: enumType
|
|
2224
|
+
});
|
|
2225
|
+
return null;
|
|
2226
|
+
}
|
|
2227
|
+
|
|
2228
|
+
function getI18nClassNameAsync(translate, classType, singular) {
|
|
2229
|
+
const typeName = findReflectTypeName(classType);
|
|
2230
|
+
return getI18nTypeNameAsync(translate, typeName ?? '', singular);
|
|
2231
|
+
}
|
|
2232
|
+
function getI18nClassName(translate, classType, singular) {
|
|
2233
|
+
const typeName = findReflectTypeName(classType);
|
|
2234
|
+
return getI18nTypeName(translate, typeName ?? '', singular);
|
|
2235
|
+
}
|
|
2236
|
+
function getI18nTypeNameAsync(translate, typeName, singular) {
|
|
2237
|
+
const keys = getI18nTypeNameKeys(typeName, singular);
|
|
2238
|
+
return getI18nAsync(translate, undefined, ...keys);
|
|
2239
|
+
}
|
|
2240
|
+
function getI18nTypeName(translate, typeName, singular) {
|
|
2241
|
+
const keys = getI18nTypeNameKeys(typeName, singular);
|
|
2242
|
+
return getI18n(translate, undefined, ...keys);
|
|
2243
|
+
}
|
|
2244
|
+
function getI18nClassTabKey(classType, tab) {
|
|
2245
|
+
const typeName = findReflectTypeName(classType);
|
|
2246
|
+
return getI18nTypeTabKey(typeName ?? '', tab);
|
|
2247
|
+
}
|
|
2248
|
+
function getI18nTypeTabKey(typeName, tab) {
|
|
2249
|
+
return getI18nTypeKeyBasePath(typeName, 'tabs', tab);
|
|
2250
|
+
}
|
|
2251
|
+
function getI18nClassGroupKey(classType, group) {
|
|
2252
|
+
const typeName = findReflectTypeName(classType);
|
|
2253
|
+
return getI18nTypeGroupKey(typeName ?? '', group);
|
|
2254
|
+
}
|
|
2255
|
+
function getI18nTypeGroupKey(typeName, group) {
|
|
2256
|
+
return getI18nTypeKeyBasePath(typeName, 'groups', group);
|
|
2257
|
+
}
|
|
2258
|
+
function getI18nClassPropertyKey(classType, property) {
|
|
2259
|
+
const typeName = findReflectTypeName(classType);
|
|
2260
|
+
return getI18nTypePropertyKey(typeName ?? '', property);
|
|
2261
|
+
}
|
|
2262
|
+
function getI18nTypePropertyKey(typeName, property) {
|
|
2263
|
+
return getI18nTypeKeyBasePath(typeName, 'properties', property);
|
|
2264
|
+
}
|
|
2265
|
+
function getI18nClassKeyBasePath(classType, ...path) {
|
|
2266
|
+
const typeName = findReflectTypeName(classType);
|
|
2267
|
+
return getI18nTypeKeyBasePath(typeName ?? '', ...path);
|
|
2268
|
+
}
|
|
2269
|
+
function getI18nTypeKeyBasePath(typeName, ...path) {
|
|
2270
|
+
return `${typeName.length ? `${typeName}.` : ''}${path.join('.')}`;
|
|
2271
|
+
}
|
|
2272
|
+
function getI18nClassParams(translate, classType, item, params = {}) {
|
|
2273
|
+
const typeName = findReflectTypeName(classType);
|
|
2274
|
+
return getI18nTypeParams(translate, typeName ?? undefined, item, params);
|
|
2275
|
+
}
|
|
2276
|
+
function getI18nTypeParams(translate, typeName, item, params = {}) {
|
|
2277
|
+
const i18nTypeName = typeName ? getI18nTypeName(translate, typeName, true) : null;
|
|
2278
|
+
return populateI18nTypeParams(i18nTypeName ?? undefined, item, params);
|
|
2279
|
+
}
|
|
2280
|
+
function getI18nClassParamsAsync(translate, classType, item, params = {}) {
|
|
2281
|
+
const typeName = findReflectTypeName(classType);
|
|
2282
|
+
return getI18nTypeParamsAsync(translate, typeName ?? undefined, item, params);
|
|
2283
|
+
}
|
|
2284
|
+
function getI18nTypeParamsAsync(translate, typeName, item, params = {}) {
|
|
2285
|
+
return (typeName ? getI18nTypeNameAsync(translate, typeName, true) : of(null)).pipe(map(i18nTypeName => populateI18nTypeParams(i18nTypeName ?? undefined, item, params)));
|
|
2286
|
+
}
|
|
2287
|
+
function populateI18nTypeParams(i18nTypeName, item, params = {}) {
|
|
2288
|
+
const paramsRes = { ...params };
|
|
2289
|
+
if (i18nTypeName) {
|
|
2290
|
+
paramsRes.typeName = i18nTypeName;
|
|
2291
|
+
}
|
|
2292
|
+
return populateI18nParams(item, paramsRes);
|
|
2293
|
+
}
|
|
2294
|
+
function getI18nTypeNameKeys(typeName, singular) {
|
|
2295
|
+
const keys = [];
|
|
2296
|
+
if (typeof singular !== 'undefined') {
|
|
2297
|
+
keys.push(singular ? `${typeName}.nameSingular` : `${typeName}.namePlural`);
|
|
2298
|
+
}
|
|
2299
|
+
keys.push(`${typeName.length ? `${typeName}.` : ''}name`);
|
|
2300
|
+
return keys;
|
|
2301
|
+
}
|
|
2302
|
+
|
|
2303
|
+
/* eslint-disable no-console */
|
|
2304
|
+
class LogPublisherConsoleService {
|
|
2305
|
+
addEntry(entry) {
|
|
2306
|
+
let prefix = `${entry.timestampFormatted}`;
|
|
2307
|
+
if (entry.category)
|
|
2308
|
+
prefix += ` [${entry.category}]`;
|
|
2309
|
+
prefix += ':';
|
|
2310
|
+
const message = `${entry.message}${entry.messageDetails ? `\n${entry.messageDetails}` : ''}`;
|
|
2311
|
+
const logParams = [prefix, message];
|
|
2312
|
+
if (entry.error) {
|
|
2313
|
+
logParams.push(`\n${getErrorName(entry.error)}:`, entry.error);
|
|
2314
|
+
}
|
|
2315
|
+
if (entry.data?.length) {
|
|
2316
|
+
logParams.push(`\nData:\n`, ...entry.data);
|
|
2317
|
+
}
|
|
2318
|
+
switch (entry.level) {
|
|
2319
|
+
case LogLevelEnum.Trace:
|
|
2320
|
+
console.trace(...logParams);
|
|
2321
|
+
break;
|
|
2322
|
+
case LogLevelEnum.Debug:
|
|
2323
|
+
console.debug(...logParams);
|
|
2324
|
+
break;
|
|
2325
|
+
case LogLevelEnum.Log:
|
|
2326
|
+
console.log(...logParams);
|
|
2327
|
+
break;
|
|
2328
|
+
case LogLevelEnum.Info:
|
|
2329
|
+
console.info(...logParams);
|
|
2330
|
+
break;
|
|
2331
|
+
case LogLevelEnum.Warning:
|
|
2332
|
+
console.warn(...logParams);
|
|
2333
|
+
break;
|
|
2334
|
+
case LogLevelEnum.Error:
|
|
2335
|
+
console.error(...logParams);
|
|
2336
|
+
break;
|
|
2337
|
+
}
|
|
2338
|
+
}
|
|
2339
|
+
}
|
|
2340
|
+
|
|
2341
|
+
class BooleanPipe {
|
|
2342
|
+
transform(value, yes, no, icon = false) {
|
|
2343
|
+
if (typeof value === 'boolean') {
|
|
2344
|
+
if (icon) {
|
|
2345
|
+
return value ? yes ?? 'pi pi-check' : no ?? 'pi pi-times';
|
|
2346
|
+
}
|
|
2347
|
+
else {
|
|
2348
|
+
return value ? yes ?? 'general.yes' : no ?? 'general.no';
|
|
2349
|
+
}
|
|
2350
|
+
}
|
|
2351
|
+
else {
|
|
2352
|
+
return value;
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: BooleanPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
2356
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.3.2", ngImport: i0, type: BooleanPipe, isStandalone: true, name: "mngBoolean" }); }
|
|
2357
|
+
}
|
|
2358
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: BooleanPipe, decorators: [{
|
|
2359
|
+
type: Pipe,
|
|
2360
|
+
args: [{
|
|
2361
|
+
standalone: true,
|
|
2362
|
+
name: 'mngBoolean',
|
|
2363
|
+
pure: true
|
|
2364
|
+
}]
|
|
2365
|
+
}] });
|
|
2366
|
+
|
|
2367
|
+
class ClassMapPipe {
|
|
2368
|
+
transform(className, classNameMapFn, item) {
|
|
2369
|
+
if (classNameMapFn && typeof classNameMapFn === 'function') {
|
|
2370
|
+
return classNameMapFn(className, item);
|
|
2371
|
+
}
|
|
2372
|
+
else {
|
|
2373
|
+
return className ?? '';
|
|
2374
|
+
}
|
|
2375
|
+
}
|
|
2376
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: ClassMapPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
2377
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.3.2", ngImport: i0, type: ClassMapPipe, isStandalone: true, name: "mngClassMap" }); }
|
|
2378
|
+
}
|
|
2379
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: ClassMapPipe, decorators: [{
|
|
2380
|
+
type: Pipe,
|
|
2381
|
+
args: [{
|
|
2382
|
+
standalone: true,
|
|
2383
|
+
name: 'mngClassMap',
|
|
2384
|
+
pure: true
|
|
2385
|
+
}]
|
|
2386
|
+
}] });
|
|
2387
|
+
|
|
2388
|
+
class EnumPipe {
|
|
2389
|
+
transform(value, enumDesc, i18nPath) {
|
|
2390
|
+
if (!value || (typeof value !== 'number' && typeof value !== 'string')) {
|
|
2391
|
+
return value;
|
|
2392
|
+
}
|
|
2393
|
+
const enumConstantName = !enumDesc || enumDesc.nameAsValue ? value : getEnumConstantNameFromObject(enumDesc.type, value) ?? value;
|
|
2394
|
+
if (typeof i18nPath === 'undefined' && enumDesc) {
|
|
2395
|
+
i18nPath = enumDesc.i18nBaseKey === undefined ? findReflectEnumName(enumDesc.type) : null;
|
|
2396
|
+
}
|
|
2397
|
+
return i18nPath ? `${i18nPath}.${enumConstantName}` : enumConstantName;
|
|
2398
|
+
}
|
|
2399
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: EnumPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
2400
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.3.2", ngImport: i0, type: EnumPipe, isStandalone: true, name: "mngEnum" }); }
|
|
2401
|
+
}
|
|
2402
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: EnumPipe, decorators: [{
|
|
2403
|
+
type: Pipe,
|
|
2404
|
+
args: [{
|
|
2405
|
+
standalone: true,
|
|
2406
|
+
name: 'mngEnum',
|
|
2407
|
+
pure: true
|
|
2408
|
+
}]
|
|
2409
|
+
}] });
|
|
2410
|
+
|
|
2411
|
+
/**
|
|
2412
|
+
* Imitation of JSONPath Syntax. Supports:
|
|
2413
|
+
* - Root object notation with '$'
|
|
2414
|
+
* - Dot notation (e.g.: $.foo.bar), no bracket notation for properties
|
|
2415
|
+
* - Array notation (e.g.: [0])
|
|
2416
|
+
*/
|
|
2417
|
+
class JsonPathPipe {
|
|
2418
|
+
transform(value, path = '') {
|
|
2419
|
+
return getObjectPropertyByPath(value, path);
|
|
2420
|
+
}
|
|
2421
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: JsonPathPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
2422
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.3.2", ngImport: i0, type: JsonPathPipe, isStandalone: true, name: "mngJsonPath" }); }
|
|
2423
|
+
}
|
|
2424
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: JsonPathPipe, decorators: [{
|
|
2425
|
+
type: Pipe,
|
|
2426
|
+
args: [{
|
|
2427
|
+
standalone: true,
|
|
2428
|
+
name: 'mngJsonPath',
|
|
2429
|
+
pure: true
|
|
2430
|
+
}]
|
|
2431
|
+
}] });
|
|
2432
|
+
|
|
2433
|
+
class EnumeratePipe {
|
|
2434
|
+
constructor() {
|
|
2435
|
+
this.translate = inject(TranslateService);
|
|
2436
|
+
}
|
|
2437
|
+
transform(value, jsonPath = '$', valueSeparator = ', ', emptyValueReturn = '/', i18nBaseKey = '') {
|
|
2438
|
+
if (!value) {
|
|
2439
|
+
return emptyValueReturn;
|
|
2440
|
+
}
|
|
2441
|
+
i18nBaseKey = getEnumerationI18nBaseKey(i18nBaseKey);
|
|
2442
|
+
return Array.from(value)
|
|
2443
|
+
.map(i => {
|
|
2444
|
+
const itemEnumerate = toEnumerationI18nEnumerate(i, jsonPath, i18nBaseKey);
|
|
2445
|
+
itemEnumerate.i18n = this.translate.instant(itemEnumerate.i18nKey);
|
|
2446
|
+
// return i18n only if used and transl. was found
|
|
2447
|
+
return selectEnumerationI18n(itemEnumerate, i18nBaseKey);
|
|
2448
|
+
})
|
|
2449
|
+
.join(valueSeparator);
|
|
2450
|
+
}
|
|
2451
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: EnumeratePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
2452
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.3.2", ngImport: i0, type: EnumeratePipe, isStandalone: true, name: "mngEnumerate" }); }
|
|
2453
|
+
}
|
|
2454
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: EnumeratePipe, decorators: [{
|
|
2455
|
+
type: Pipe,
|
|
2456
|
+
args: [{
|
|
2457
|
+
standalone: true,
|
|
2458
|
+
name: 'mngEnumerate',
|
|
2459
|
+
pure: true
|
|
2460
|
+
}]
|
|
2461
|
+
}] });
|
|
2462
|
+
function getEnumerationI18nBaseKey(baseKey) {
|
|
2463
|
+
return baseKey.endsWith('.') ? baseKey?.substring(0, baseKey.length - 1) : baseKey;
|
|
2464
|
+
}
|
|
2465
|
+
function selectEnumerationI18n(value, baseKey) {
|
|
2466
|
+
return baseKey && value.i18nKey === value.i18n ? value.value : value.i18n;
|
|
2467
|
+
}
|
|
2468
|
+
function toEnumerationI18nEnumerate(value, jsonPath, baseKey) {
|
|
2469
|
+
const valueTrans = new JsonPathPipe().transform(value, jsonPath);
|
|
2470
|
+
const valueAsString = valueTrans.toString();
|
|
2471
|
+
return {
|
|
2472
|
+
value: valueAsString,
|
|
2473
|
+
i18nKey: baseKey ? `${baseKey}.${valueAsString}` : valueAsString,
|
|
2474
|
+
i18n: valueAsString
|
|
2475
|
+
};
|
|
2476
|
+
}
|
|
2477
|
+
|
|
2478
|
+
class EnumerateAsyncPipe {
|
|
2479
|
+
constructor() {
|
|
2480
|
+
this.translate = inject(TranslateService);
|
|
2481
|
+
}
|
|
2482
|
+
transform(value, jsonPath = '$', valueSeparator = ', ', emptyValueReturn = '/', i18nBaseKey = '') {
|
|
2483
|
+
i18nBaseKey = getEnumerationI18nBaseKey(i18nBaseKey);
|
|
2484
|
+
return value.pipe(mergeMap(v => {
|
|
2485
|
+
if (!v) {
|
|
2486
|
+
return of([emptyValueReturn]);
|
|
2487
|
+
}
|
|
2488
|
+
return combineLatest(Array.from(v)
|
|
2489
|
+
.map(ai => toEnumerationI18nEnumerate(ai, jsonPath, i18nBaseKey))
|
|
2490
|
+
.map(i => this.translate.stream(i.i18nKey).pipe(map((i18n) => {
|
|
2491
|
+
i.i18n = i18n;
|
|
2492
|
+
return selectEnumerationI18n(i, i18nBaseKey);
|
|
2493
|
+
}))));
|
|
2494
|
+
}), map(i => i.join(valueSeparator)));
|
|
2495
|
+
}
|
|
2496
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: EnumerateAsyncPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
2497
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.3.2", ngImport: i0, type: EnumerateAsyncPipe, isStandalone: true, name: "mngEnumerateAsync" }); }
|
|
2498
|
+
}
|
|
2499
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: EnumerateAsyncPipe, decorators: [{
|
|
2500
|
+
type: Pipe,
|
|
2501
|
+
args: [{
|
|
2502
|
+
standalone: true,
|
|
2503
|
+
name: 'mngEnumerateAsync',
|
|
2504
|
+
pure: true
|
|
2505
|
+
}]
|
|
2506
|
+
}] });
|
|
2507
|
+
|
|
2508
|
+
class GetterPipe {
|
|
2509
|
+
transform(value, getterFn, item) {
|
|
2510
|
+
if (typeof getterFn === 'function') {
|
|
2511
|
+
return getterFn(item, value);
|
|
2512
|
+
}
|
|
2513
|
+
return value;
|
|
2514
|
+
}
|
|
2515
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: GetterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
2516
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.3.2", ngImport: i0, type: GetterPipe, isStandalone: true, name: "mngGetter" }); }
|
|
2517
|
+
}
|
|
2518
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: GetterPipe, decorators: [{
|
|
2519
|
+
type: Pipe,
|
|
2520
|
+
args: [{
|
|
2521
|
+
standalone: true,
|
|
2522
|
+
name: 'mngGetter',
|
|
2523
|
+
pure: true
|
|
2524
|
+
}]
|
|
2525
|
+
}] });
|
|
2526
|
+
|
|
2527
|
+
class I18nPropertyPipe {
|
|
2528
|
+
transform(property, model) {
|
|
2529
|
+
return getI18nTypePropertyKey(model.i18nBaseKey, property);
|
|
2530
|
+
}
|
|
2531
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: I18nPropertyPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
2532
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.3.2", ngImport: i0, type: I18nPropertyPipe, isStandalone: true, name: "mngI18nProperty" }); }
|
|
2533
|
+
}
|
|
2534
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: I18nPropertyPipe, decorators: [{
|
|
2535
|
+
type: Pipe,
|
|
2536
|
+
args: [{
|
|
2537
|
+
standalone: true,
|
|
2538
|
+
name: 'mngI18nProperty',
|
|
2539
|
+
pure: true
|
|
2540
|
+
}]
|
|
2541
|
+
}] });
|
|
2542
|
+
|
|
2543
|
+
class ParametrizePipe {
|
|
2544
|
+
constructor() {
|
|
2545
|
+
this.jsonPath = new JsonPathPipe();
|
|
2546
|
+
}
|
|
2547
|
+
transform(value, itemId, item, data) {
|
|
2548
|
+
let params = {};
|
|
2549
|
+
if (data) {
|
|
2550
|
+
params = {
|
|
2551
|
+
...params,
|
|
2552
|
+
...data
|
|
2553
|
+
};
|
|
2554
|
+
}
|
|
2555
|
+
if (item) {
|
|
2556
|
+
params = {
|
|
2557
|
+
...params,
|
|
2558
|
+
item: escapeHtmlAny(item)
|
|
2559
|
+
};
|
|
2560
|
+
}
|
|
2561
|
+
if (itemId) {
|
|
2562
|
+
params = {
|
|
2563
|
+
...params,
|
|
2564
|
+
itemId: itemId
|
|
2565
|
+
};
|
|
2566
|
+
}
|
|
2567
|
+
if (typeof value === 'string') {
|
|
2568
|
+
return this.transformString(value, params);
|
|
2569
|
+
}
|
|
2570
|
+
else if (Array.isArray(value) && value.length > 0 && typeof value[0] === 'string') {
|
|
2571
|
+
return value.map((s) => this.transformString(s, params));
|
|
2572
|
+
}
|
|
2573
|
+
else if (typeof value === 'object') {
|
|
2574
|
+
// process only first level citizens
|
|
2575
|
+
const obj = { ...value };
|
|
2576
|
+
for (const key in obj) {
|
|
2577
|
+
const objProp = obj[key];
|
|
2578
|
+
if (typeof objProp === 'string') {
|
|
2579
|
+
obj[key] = this.transformString(objProp, params);
|
|
2580
|
+
}
|
|
2581
|
+
}
|
|
2582
|
+
return obj;
|
|
2583
|
+
}
|
|
2584
|
+
else {
|
|
2585
|
+
return value;
|
|
2586
|
+
}
|
|
2587
|
+
}
|
|
2588
|
+
transformString(s, params) {
|
|
2589
|
+
if ((s.indexOf('/') >= 0 && s.indexOf(':') >= 0 && !s.startsWith('http://') && !s.startsWith('https://')) || s.startsWith(':')) {
|
|
2590
|
+
// this is router link
|
|
2591
|
+
return s
|
|
2592
|
+
.split('/')
|
|
2593
|
+
.map(s => this.parametrizeStringAsRouterLink(s, params))
|
|
2594
|
+
.join('/');
|
|
2595
|
+
}
|
|
2596
|
+
else {
|
|
2597
|
+
// parametrize normally
|
|
2598
|
+
return this.parametrizeString(s, params);
|
|
2599
|
+
}
|
|
2600
|
+
}
|
|
2601
|
+
parametrizeStringAsRouterLink(s, params) {
|
|
2602
|
+
if (s.startsWith(':')) {
|
|
2603
|
+
const itemProperty = s.substring(1);
|
|
2604
|
+
return this.jsonPath.transform(params, itemProperty) ?? '';
|
|
2605
|
+
}
|
|
2606
|
+
else {
|
|
2607
|
+
return s;
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2610
|
+
parametrizeString(s, params) {
|
|
2611
|
+
return s.replace(/{{\s?([^{}\s]*)\s?}}/g, (subs, key) => this.jsonPath.transform(params, key) ?? subs);
|
|
2612
|
+
}
|
|
2613
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: ParametrizePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
2614
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.3.2", ngImport: i0, type: ParametrizePipe, isStandalone: true, name: "mngParametrize" }); }
|
|
2615
|
+
}
|
|
2616
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: ParametrizePipe, decorators: [{
|
|
2617
|
+
type: Pipe,
|
|
2618
|
+
args: [{
|
|
2619
|
+
standalone: true,
|
|
2620
|
+
name: 'mngParametrize',
|
|
2621
|
+
pure: true
|
|
2622
|
+
}]
|
|
2623
|
+
}] });
|
|
2624
|
+
|
|
2625
|
+
class TemplatePipe {
|
|
2626
|
+
constructor() {
|
|
2627
|
+
this.parametrizePipe = new ParametrizePipe();
|
|
2628
|
+
}
|
|
2629
|
+
transform(value, template) {
|
|
2630
|
+
if (typeof template === 'string') {
|
|
2631
|
+
return this.parametrizePipe.transform(template, undefined, value);
|
|
2632
|
+
}
|
|
2633
|
+
return value;
|
|
2634
|
+
}
|
|
2635
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: TemplatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
2636
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.3.2", ngImport: i0, type: TemplatePipe, isStandalone: true, name: "template" }); }
|
|
2637
|
+
}
|
|
2638
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: TemplatePipe, decorators: [{
|
|
2639
|
+
type: Pipe,
|
|
2640
|
+
args: [{
|
|
2641
|
+
standalone: true,
|
|
2642
|
+
name: 'template',
|
|
2643
|
+
pure: true
|
|
2644
|
+
}]
|
|
2645
|
+
}] });
|
|
2646
|
+
|
|
2647
|
+
function TypeName(typeName) {
|
|
2648
|
+
return function (target) {
|
|
2649
|
+
defineReflectTypeName(target, typeName);
|
|
2650
|
+
};
|
|
2651
|
+
}
|
|
2652
|
+
function EnumName(typeName) {
|
|
2653
|
+
return function (target) {
|
|
2654
|
+
defineReflectEnumName(target, typeName);
|
|
2655
|
+
};
|
|
2656
|
+
}
|
|
2657
|
+
|
|
2658
|
+
class TypeRegistry {
|
|
2659
|
+
constructor() {
|
|
2660
|
+
this._logCategory = 'TypeRegistry';
|
|
2661
|
+
this._typeMap = {};
|
|
2662
|
+
this._enumMap = {};
|
|
2663
|
+
}
|
|
2664
|
+
static { this._instance = new TypeRegistry(); }
|
|
2665
|
+
get typeMap() {
|
|
2666
|
+
return this._typeMap;
|
|
2667
|
+
}
|
|
2668
|
+
get enumMap() {
|
|
2669
|
+
return this._enumMap;
|
|
2670
|
+
}
|
|
2671
|
+
/**
|
|
2672
|
+
* Only use one instance of object (out of Angular context)
|
|
2673
|
+
*/
|
|
2674
|
+
static get() {
|
|
2675
|
+
return TypeRegistry._instance;
|
|
2676
|
+
}
|
|
2677
|
+
findAttributeDefinitionByClassType(type, attributeName) {
|
|
2678
|
+
const typeName = findReflectTypeName(type);
|
|
2679
|
+
return typeName ? this.findAttributeDefinition(typeName, attributeName) : null;
|
|
2680
|
+
}
|
|
2681
|
+
findAttributeDefinition(typeName, attributeName) {
|
|
2682
|
+
const attributeDefs = this.findAttributesDefinition(typeName);
|
|
2683
|
+
if (!attributeDefs) {
|
|
2684
|
+
return null;
|
|
2685
|
+
}
|
|
2686
|
+
for (const attribute of attributeDefs) {
|
|
2687
|
+
if (attribute.name === attributeName) {
|
|
2688
|
+
return attribute;
|
|
2689
|
+
}
|
|
2690
|
+
}
|
|
2691
|
+
return null;
|
|
2692
|
+
}
|
|
2693
|
+
findAttributesDefinitionByClassType(type) {
|
|
2694
|
+
const typeName = findReflectTypeName(type);
|
|
2695
|
+
return typeName ? this.findAttributesDefinition(typeName) : null;
|
|
2696
|
+
}
|
|
2697
|
+
findAttributesDefinition(typeName) {
|
|
2698
|
+
const typeDef = this.findType(typeName);
|
|
2699
|
+
if (!typeDef || typeof typeDef.getAttributeTypeMap !== 'function') {
|
|
2700
|
+
return null;
|
|
2701
|
+
}
|
|
2702
|
+
return typeDef.getAttributeTypeMap();
|
|
2703
|
+
}
|
|
2704
|
+
findByClassType(type) {
|
|
2705
|
+
const typeName = findReflectTypeName(type);
|
|
2706
|
+
return typeName ? this.findType(typeName) : null;
|
|
2707
|
+
}
|
|
2708
|
+
findType(typeName) {
|
|
2709
|
+
return this._typeMap[typeName];
|
|
2710
|
+
}
|
|
2711
|
+
findEnum(enumName) {
|
|
2712
|
+
return this._enumMap[enumName];
|
|
2713
|
+
}
|
|
2714
|
+
registerTypes(types) {
|
|
2715
|
+
for (const key in types) {
|
|
2716
|
+
this.registerType(types[key], key);
|
|
2717
|
+
}
|
|
2718
|
+
}
|
|
2719
|
+
registerType(type, optTypeName) {
|
|
2720
|
+
// try to find name from metadata
|
|
2721
|
+
let typeName;
|
|
2722
|
+
if (reflectTypeNameExists(type)) {
|
|
2723
|
+
// defined name from optional type name
|
|
2724
|
+
typeName = findReflectTypeName(type) ?? undefined;
|
|
2725
|
+
}
|
|
2726
|
+
else if (optTypeName) {
|
|
2727
|
+
typeName = optTypeName;
|
|
2728
|
+
// register metadata
|
|
2729
|
+
defineReflectTypeName(type, typeName);
|
|
2730
|
+
}
|
|
2731
|
+
if (!typeName) {
|
|
2732
|
+
// this._logger.debug(`WARNING: registering type ${type} failed, because typeName could not be determined and optional name was not provided.`);
|
|
2733
|
+
LoggerService.get().log(`WARNING: registering type ${type} failed, because typeName could not be determined and optional name was not provided.`, LogLevelEnum.Debug, this._logCategory);
|
|
2734
|
+
return;
|
|
2735
|
+
}
|
|
2736
|
+
if (typeof this._typeMap[typeName] !== 'undefined') {
|
|
2737
|
+
// this._logger.debug(`WARNING: registering type ${type} under key ${typeName} skipped, because type already exists for this key.`);
|
|
2738
|
+
LoggerService.get().log(`WARNING: registering type ${type} under key ${typeName} skipped, because type already exists for this key.`, LogLevelEnum.Debug, this._logCategory);
|
|
2739
|
+
}
|
|
2740
|
+
else {
|
|
2741
|
+
this._typeMap[typeName] = type;
|
|
2742
|
+
}
|
|
2743
|
+
}
|
|
2744
|
+
registerEnums(enums) {
|
|
2745
|
+
for (const key in enums) {
|
|
2746
|
+
this.registerEnum(enums[key], key);
|
|
2747
|
+
}
|
|
2748
|
+
}
|
|
2749
|
+
registerEnum(enumType, enumName) {
|
|
2750
|
+
// try to find name from decorator
|
|
2751
|
+
defineReflectEnumName(enumType, enumName);
|
|
2752
|
+
if (typeof this._enumMap[enumName] !== 'undefined') {
|
|
2753
|
+
LoggerService.get().log(`Registering enum ${enumName} skipped, because enum already exists.`, LogLevelEnum.Debug, this._logCategory);
|
|
2754
|
+
}
|
|
2755
|
+
else {
|
|
2756
|
+
this._enumMap[enumName] = enumType;
|
|
2757
|
+
}
|
|
2758
|
+
}
|
|
2759
|
+
}
|
|
2760
|
+
|
|
2761
|
+
var PermissionTypeEnum;
|
|
2762
|
+
(function (PermissionTypeEnum) {
|
|
2763
|
+
PermissionTypeEnum["All"] = "ALL";
|
|
2764
|
+
PermissionTypeEnum["Any"] = "ANY";
|
|
2765
|
+
PermissionTypeEnum["Rbac"] = "ROLE_BASED_ACCESS_CONTROL";
|
|
2766
|
+
PermissionTypeEnum["Service"] = "SERVICE";
|
|
2767
|
+
})(PermissionTypeEnum || (PermissionTypeEnum = {}));
|
|
2768
|
+
class APermissions {
|
|
2769
|
+
constructor(type) {
|
|
2770
|
+
this._authorizationType = type;
|
|
2771
|
+
}
|
|
2772
|
+
get authorizationType() {
|
|
2773
|
+
return this._authorizationType;
|
|
2774
|
+
}
|
|
2775
|
+
}
|
|
2776
|
+
var Permissions;
|
|
2777
|
+
(function (Permissions) {
|
|
2778
|
+
class All extends APermissions {
|
|
2779
|
+
constructor() {
|
|
2780
|
+
super(PermissionTypeEnum.All);
|
|
2781
|
+
this._permissions = [];
|
|
2782
|
+
}
|
|
2783
|
+
static of(...permissions) {
|
|
2784
|
+
const inst = new All();
|
|
2785
|
+
inst.and(...permissions);
|
|
2786
|
+
return inst;
|
|
2787
|
+
}
|
|
2788
|
+
get permissions() {
|
|
2789
|
+
return this._permissions;
|
|
2790
|
+
}
|
|
2791
|
+
and(...permissions) {
|
|
2792
|
+
this._permissions.push(...permissions);
|
|
2793
|
+
return this;
|
|
2794
|
+
}
|
|
2795
|
+
}
|
|
2796
|
+
Permissions.All = All;
|
|
2797
|
+
class Any extends APermissions {
|
|
2798
|
+
constructor() {
|
|
2799
|
+
super(PermissionTypeEnum.Any);
|
|
2800
|
+
this._permissions = [];
|
|
2801
|
+
}
|
|
2802
|
+
static of(...permissions) {
|
|
2803
|
+
const inst = new Any();
|
|
2804
|
+
inst.or(...permissions);
|
|
2805
|
+
return inst;
|
|
2806
|
+
}
|
|
2807
|
+
get permissions() {
|
|
2808
|
+
return this._permissions;
|
|
2809
|
+
}
|
|
2810
|
+
or(...permissions) {
|
|
2811
|
+
this._permissions.push(...permissions);
|
|
2812
|
+
return this;
|
|
2813
|
+
}
|
|
2814
|
+
}
|
|
2815
|
+
Permissions.Any = Any;
|
|
2816
|
+
class Roles extends APermissions {
|
|
2817
|
+
constructor() {
|
|
2818
|
+
super(PermissionTypeEnum.Rbac);
|
|
2819
|
+
this._roles = [];
|
|
2820
|
+
}
|
|
2821
|
+
static of(...roles) {
|
|
2822
|
+
const inst = new Roles();
|
|
2823
|
+
inst.or(...roles);
|
|
2824
|
+
return inst;
|
|
2825
|
+
}
|
|
2826
|
+
get roles() {
|
|
2827
|
+
return this._roles;
|
|
2828
|
+
}
|
|
2829
|
+
and(...roles) {
|
|
2830
|
+
if (this._roles.length === 0) {
|
|
2831
|
+
this._roles.push([]);
|
|
2832
|
+
}
|
|
2833
|
+
this._roles[this._roles.length - 1].push(...roles);
|
|
2834
|
+
return this;
|
|
2835
|
+
}
|
|
2836
|
+
or(...roles) {
|
|
2837
|
+
this._roles.push(...roles.map(s => [s]));
|
|
2838
|
+
return this;
|
|
2839
|
+
}
|
|
2840
|
+
}
|
|
2841
|
+
Permissions.Roles = Roles;
|
|
2842
|
+
class Service extends APermissions {
|
|
2843
|
+
constructor(service) {
|
|
2844
|
+
super(PermissionTypeEnum.Service);
|
|
2845
|
+
this.service = service;
|
|
2846
|
+
}
|
|
2847
|
+
static of(service) {
|
|
2848
|
+
return new Service(service);
|
|
2849
|
+
}
|
|
2850
|
+
}
|
|
2851
|
+
Permissions.Service = Service;
|
|
2852
|
+
})(Permissions || (Permissions = {}));
|
|
2853
|
+
|
|
2854
|
+
function isPermitted(permissions, userRoles) {
|
|
2855
|
+
switch (permissions.authorizationType) {
|
|
2856
|
+
case PermissionTypeEnum.Rbac:
|
|
2857
|
+
return isRbacPermitted(permissions, userRoles);
|
|
2858
|
+
default:
|
|
2859
|
+
throw new CommonsInternalError(`Permission type "${permissions.authorizationType}" not implemented`);
|
|
2860
|
+
}
|
|
2861
|
+
}
|
|
2862
|
+
function isRbacPermitted(permissions, userRoles) {
|
|
2863
|
+
return permissions.roles.some(prg => prg.every(pr => userRoles.indexOf(pr) > -1));
|
|
2864
|
+
}
|
|
2865
|
+
|
|
2866
|
+
class PermissionService {
|
|
2867
|
+
constructor() {
|
|
2868
|
+
this.router = inject(Router);
|
|
2869
|
+
this.injector = inject(Injector);
|
|
2870
|
+
this.commons = inject(CommonsService);
|
|
2871
|
+
this.logger = inject(LoggerService).create('AuthorizationService');
|
|
2872
|
+
}
|
|
2873
|
+
isPermitted(permissions, route, actionCtx) {
|
|
2874
|
+
switch (permissions.authorizationType) {
|
|
2875
|
+
case PermissionTypeEnum.All:
|
|
2876
|
+
return this.isPermittedAll(permissions, route, actionCtx);
|
|
2877
|
+
case PermissionTypeEnum.Any:
|
|
2878
|
+
return this.isPermittedAny(permissions, route, actionCtx);
|
|
2879
|
+
case PermissionTypeEnum.Service:
|
|
2880
|
+
return this.isPermittedService(permissions, route, actionCtx);
|
|
2881
|
+
default:
|
|
2882
|
+
return this.commons.userRoles$.pipe(map(ur => isPermitted(permissions, ur)));
|
|
2883
|
+
}
|
|
2884
|
+
}
|
|
2885
|
+
isPermittedAll(permission, route, actionCtx) {
|
|
2886
|
+
return combineLatest(permission.permissions.map(p => this.isPermitted(p, route, actionCtx))).pipe(map(res => res.every(ip => ip === true)));
|
|
2887
|
+
}
|
|
2888
|
+
isPermittedAny(permission, route, actionCtx) {
|
|
2889
|
+
return combineLatest(permission.permissions.map(p => this.isPermitted(p, route, actionCtx))).pipe(map(res => res.some(ip => ip === true)));
|
|
2890
|
+
}
|
|
2891
|
+
isPermittedService(permission, route, actionCtx) {
|
|
2892
|
+
const serviceInstance = this.injector.get(permission.service);
|
|
2893
|
+
if (!serviceInstance) {
|
|
2894
|
+
this.logger.debug(`WARNING: Service instance could not be retreived for type ${permission.service}`);
|
|
2895
|
+
return of(false);
|
|
2896
|
+
}
|
|
2897
|
+
return serviceInstance.isPermitted(route, this.router.routerState.snapshot, actionCtx);
|
|
2898
|
+
}
|
|
2899
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: PermissionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2900
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: PermissionService }); }
|
|
2901
|
+
}
|
|
2902
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: PermissionService, decorators: [{
|
|
2903
|
+
type: Injectable
|
|
2904
|
+
}] });
|
|
2905
|
+
|
|
2906
|
+
const permissionGuard = (route) => {
|
|
2907
|
+
const permission = inject(PermissionService);
|
|
2908
|
+
const data = route.data;
|
|
2909
|
+
if (data.permissions) {
|
|
2910
|
+
return permission.isPermitted(data.permissions).pipe(first());
|
|
2911
|
+
}
|
|
2912
|
+
else {
|
|
2913
|
+
return of(true);
|
|
2914
|
+
}
|
|
2915
|
+
};
|
|
2916
|
+
|
|
2917
|
+
class RouteBuilder {
|
|
2918
|
+
constructor(route) {
|
|
2919
|
+
this.routePath = [];
|
|
2920
|
+
this.routeData = { breadcrumb: null };
|
|
2921
|
+
this.children = [];
|
|
2922
|
+
this.menuItemChildren = [];
|
|
2923
|
+
this.menuItemChildrenAfter = []; // append after route children
|
|
2924
|
+
this.route = route;
|
|
2925
|
+
if (this.route.path && this.route.path.length > 0) {
|
|
2926
|
+
this.routePath = [this.route.path];
|
|
2927
|
+
}
|
|
2928
|
+
}
|
|
2929
|
+
static create(path, component) {
|
|
2930
|
+
return new RouteBuilder({
|
|
2931
|
+
path: path,
|
|
2932
|
+
component: component
|
|
2933
|
+
});
|
|
2934
|
+
}
|
|
2935
|
+
static createRedirect(path, redirectTo, pathMatch = 'prefix') {
|
|
2936
|
+
return new RouteBuilder({
|
|
2937
|
+
path: path,
|
|
2938
|
+
redirectTo: redirectTo,
|
|
2939
|
+
pathMatch: pathMatch
|
|
2940
|
+
});
|
|
2941
|
+
}
|
|
2942
|
+
static createLazyRouteModule(path, loadChildren, canMatch) {
|
|
2943
|
+
const route = { path: path, loadChildren: loadChildren };
|
|
2944
|
+
if (canMatch?.length) {
|
|
2945
|
+
route.canMatch = canMatch;
|
|
2946
|
+
}
|
|
2947
|
+
return new RouteBuilder(route);
|
|
2948
|
+
}
|
|
2949
|
+
static createLazyRouteComponent(path, loadComponent, canMatch) {
|
|
2950
|
+
const route = { path: path, loadComponent: loadComponent };
|
|
2951
|
+
if (canMatch?.length) {
|
|
2952
|
+
route.canMatch = canMatch;
|
|
2953
|
+
}
|
|
2954
|
+
return new RouteBuilder(route);
|
|
2955
|
+
}
|
|
2956
|
+
static createFromRoute(route) {
|
|
2957
|
+
return new RouteBuilder(route);
|
|
2958
|
+
}
|
|
2959
|
+
withRoot(routesBuilder) {
|
|
2960
|
+
this.root = routesBuilder;
|
|
2961
|
+
return this;
|
|
2962
|
+
}
|
|
2963
|
+
withParent(parent) {
|
|
2964
|
+
this.parent = parent;
|
|
2965
|
+
this.routePath = removeRouteEmptyPathSegments([...this.parent.routePath, this.route.path ?? '']);
|
|
2966
|
+
return this;
|
|
2967
|
+
}
|
|
2968
|
+
withBreadcrumb(breadcrumb) {
|
|
2969
|
+
this.breadcrumb = breadcrumb;
|
|
2970
|
+
this.routeData.breadcrumb = breadcrumb;
|
|
2971
|
+
return this;
|
|
2972
|
+
}
|
|
2973
|
+
withPageTitle(pageTitle) {
|
|
2974
|
+
this.pageTitle = pageTitle;
|
|
2975
|
+
this.routeData.pageTitle = pageTitle;
|
|
2976
|
+
return this;
|
|
2977
|
+
}
|
|
2978
|
+
withRedirectTo(redirectTo) {
|
|
2979
|
+
this.route.redirectTo = redirectTo;
|
|
2980
|
+
return this;
|
|
2981
|
+
}
|
|
2982
|
+
withPathMatch(pathMatch) {
|
|
2983
|
+
this.route.pathMatch = pathMatch;
|
|
2984
|
+
return this;
|
|
2985
|
+
}
|
|
2986
|
+
withTitle(title) {
|
|
2987
|
+
this.withPageTitle(title);
|
|
2988
|
+
this.withBreadcrumb(title);
|
|
2989
|
+
return this;
|
|
2990
|
+
}
|
|
2991
|
+
withCanActivate(diToken) {
|
|
2992
|
+
if (!this.route.canActivate) {
|
|
2993
|
+
this.route.canActivate = [];
|
|
2994
|
+
}
|
|
2995
|
+
this.route.canActivate.push(diToken);
|
|
2996
|
+
return this;
|
|
2997
|
+
}
|
|
2998
|
+
withCanDeactivate(diToken) {
|
|
2999
|
+
if (!this.route.canDeactivate) {
|
|
3000
|
+
this.route.canDeactivate = [];
|
|
3001
|
+
}
|
|
3002
|
+
this.route.canDeactivate.push(diToken);
|
|
3003
|
+
return this;
|
|
3004
|
+
}
|
|
3005
|
+
withResolver(diToken, name) {
|
|
3006
|
+
if (!this.route.resolve) {
|
|
3007
|
+
this.route.resolve = {};
|
|
3008
|
+
}
|
|
3009
|
+
this.route.resolve[name] = diToken;
|
|
3010
|
+
return this;
|
|
3011
|
+
}
|
|
3012
|
+
withProvider(provider) {
|
|
3013
|
+
if (!this.route.providers) {
|
|
3014
|
+
this.route.providers = [];
|
|
3015
|
+
}
|
|
3016
|
+
this.route.providers.push(provider);
|
|
3017
|
+
return this;
|
|
3018
|
+
}
|
|
3019
|
+
withData(data) {
|
|
3020
|
+
if (!data.breadcrumb) {
|
|
3021
|
+
data.breadcrumb = null;
|
|
3022
|
+
}
|
|
3023
|
+
this.routeData = data;
|
|
3024
|
+
return this;
|
|
3025
|
+
}
|
|
3026
|
+
withCommonsMenuItem(menuItem) {
|
|
3027
|
+
this.menuItem = menuItem;
|
|
3028
|
+
return this;
|
|
3029
|
+
}
|
|
3030
|
+
withMenuItem(icon, label, routerLink, breadcrumb = false) {
|
|
3031
|
+
this.menuItem = this.createMenuItem(icon, label, routerLink);
|
|
3032
|
+
if (breadcrumb && label) {
|
|
3033
|
+
this.withBreadcrumb({
|
|
3034
|
+
label: label
|
|
3035
|
+
});
|
|
3036
|
+
}
|
|
3037
|
+
return this;
|
|
3038
|
+
}
|
|
3039
|
+
/**
|
|
3040
|
+
* Adds menu item child to this instance of menu item.
|
|
3041
|
+
* @param label Label.
|
|
3042
|
+
* @param icon Icon.
|
|
3043
|
+
* @param routerLink Router link.
|
|
3044
|
+
* @param afterRouteChildren If false, menu item child will be appended before route children menu items, at the end otherwise.
|
|
3045
|
+
*/
|
|
3046
|
+
withMenuItemChild(label, icon, routerLink, afterRouteChildren = false) {
|
|
3047
|
+
if (afterRouteChildren) {
|
|
3048
|
+
this.menuItemChildrenAfter.push(this.createMenuItem(icon, label, routerLink));
|
|
3049
|
+
}
|
|
3050
|
+
else {
|
|
3051
|
+
this.menuItemChildren.push(this.createMenuItem(icon, label, routerLink));
|
|
3052
|
+
}
|
|
3053
|
+
return this;
|
|
3054
|
+
}
|
|
3055
|
+
/**
|
|
3056
|
+
* Adds menu item child to this instance of menu item.
|
|
3057
|
+
* @param menuItem Configuration object for menu item.
|
|
3058
|
+
* @param afterRouteChildren If false, menu item child will be appended before route children menu items, at the end otherwise.
|
|
3059
|
+
*/
|
|
3060
|
+
withCommonsMenuItemChild(menuItem, afterRouteChildren = false) {
|
|
3061
|
+
if (afterRouteChildren) {
|
|
3062
|
+
this.menuItemChildrenAfter.push(menuItem);
|
|
3063
|
+
}
|
|
3064
|
+
else {
|
|
3065
|
+
this.menuItemChildren.push(menuItem);
|
|
3066
|
+
}
|
|
3067
|
+
return this;
|
|
3068
|
+
}
|
|
3069
|
+
withMenuItemLazyChildren() {
|
|
3070
|
+
if (!this.menuItem) {
|
|
3071
|
+
this.menuItem = {};
|
|
3072
|
+
}
|
|
3073
|
+
this.menuItem.lazyChildren = true;
|
|
3074
|
+
return this;
|
|
3075
|
+
}
|
|
3076
|
+
withPermissions(permissions) {
|
|
3077
|
+
this.permissions = permissions;
|
|
3078
|
+
this.withCanActivate(permissionGuard);
|
|
3079
|
+
return this;
|
|
3080
|
+
}
|
|
3081
|
+
addChild(path, component, adjustFn) {
|
|
3082
|
+
const childRouteBuilder = RouteBuilder.create(path, component);
|
|
3083
|
+
adjustFn?.(childRouteBuilder);
|
|
3084
|
+
return this.addChildBuilder(childRouteBuilder);
|
|
3085
|
+
}
|
|
3086
|
+
addChildBuilder(builder) {
|
|
3087
|
+
builder.withParent(this);
|
|
3088
|
+
if (this.root) {
|
|
3089
|
+
builder.withRoot(this.root);
|
|
3090
|
+
}
|
|
3091
|
+
this.children.push(builder);
|
|
3092
|
+
return this;
|
|
3093
|
+
}
|
|
3094
|
+
build() {
|
|
3095
|
+
const angularRoute = {
|
|
3096
|
+
...this.route
|
|
3097
|
+
};
|
|
3098
|
+
if (angularRoute.data) {
|
|
3099
|
+
angularRoute.data = {
|
|
3100
|
+
...angularRoute.data,
|
|
3101
|
+
...this.routeData
|
|
3102
|
+
};
|
|
3103
|
+
}
|
|
3104
|
+
else {
|
|
3105
|
+
angularRoute.data = { ...this.routeData };
|
|
3106
|
+
}
|
|
3107
|
+
// append permissions if not already in route data
|
|
3108
|
+
if (this.permissions && !angularRoute.data.permissions) {
|
|
3109
|
+
angularRoute.data.permissions = this.permissions;
|
|
3110
|
+
}
|
|
3111
|
+
const menu = this.buildMenu();
|
|
3112
|
+
if (menu.length > 0) {
|
|
3113
|
+
angularRoute.data.menuItems = menu;
|
|
3114
|
+
}
|
|
3115
|
+
if ((this.route.children?.length ?? 0) > 0 || this.children.length > 0) {
|
|
3116
|
+
// route has children
|
|
3117
|
+
angularRoute.children = [];
|
|
3118
|
+
if (this.route.children?.length) {
|
|
3119
|
+
angularRoute.children.push(...this.route.children);
|
|
3120
|
+
}
|
|
3121
|
+
if (this.children.length) {
|
|
3122
|
+
for (const childRoute of this.children) {
|
|
3123
|
+
angularRoute.children.push(childRoute.build());
|
|
3124
|
+
}
|
|
3125
|
+
}
|
|
3126
|
+
}
|
|
3127
|
+
if (this.route.canActivate) {
|
|
3128
|
+
angularRoute.canActivate = [...this.route.canActivate];
|
|
3129
|
+
}
|
|
3130
|
+
if (this.route.canActivateChild) {
|
|
3131
|
+
angularRoute.canActivateChild = [...this.route.canActivateChild];
|
|
3132
|
+
}
|
|
3133
|
+
if (this.route.canLoad) {
|
|
3134
|
+
angularRoute.canLoad = [...this.route.canLoad];
|
|
3135
|
+
}
|
|
3136
|
+
if (this.route.canDeactivate) {
|
|
3137
|
+
angularRoute.canDeactivate = [...this.route.canDeactivate];
|
|
3138
|
+
}
|
|
3139
|
+
if (this.route.resolve) {
|
|
3140
|
+
angularRoute.resolve = { ...this.route.resolve };
|
|
3141
|
+
}
|
|
3142
|
+
return angularRoute;
|
|
3143
|
+
}
|
|
3144
|
+
buildMenu() {
|
|
3145
|
+
const menuItemBuild = this.menuItem ? { ...this.menuItem } : null;
|
|
3146
|
+
const routeChildrenMenuItems = this.children.flatMap(child => child.buildMenu());
|
|
3147
|
+
const menuItemChildren = [];
|
|
3148
|
+
const menuItemChildrenBuild = [];
|
|
3149
|
+
if (menuItemBuild?.items) {
|
|
3150
|
+
menuItemChildrenBuild.push(...menuItemBuild.items);
|
|
3151
|
+
}
|
|
3152
|
+
const processMenuItemChild = (child) => {
|
|
3153
|
+
const finalChild = { ...child };
|
|
3154
|
+
if (typeof finalChild.routerLink === 'undefined') {
|
|
3155
|
+
finalChild.routerLink = this.routePath;
|
|
3156
|
+
}
|
|
3157
|
+
if (typeof finalChild.routerLink === 'string') {
|
|
3158
|
+
finalChild.routerLink = [finalChild.routerLink];
|
|
3159
|
+
}
|
|
3160
|
+
if (finalChild.routerLink) {
|
|
3161
|
+
finalChild.routerLink = removeRouteEmptyPathSegments(finalChild.routerLink);
|
|
3162
|
+
}
|
|
3163
|
+
return finalChild;
|
|
3164
|
+
};
|
|
3165
|
+
this.menuItemChildren.forEach(child => menuItemChildren.push(processMenuItemChild(child)));
|
|
3166
|
+
const menuItemChildrenAfterBuild = this.menuItemChildrenAfter.map(child => processMenuItemChild(child));
|
|
3167
|
+
menuItemChildrenBuild.push(...menuItemChildren, ...routeChildrenMenuItems, ...menuItemChildrenAfterBuild);
|
|
3168
|
+
if (!menuItemBuild) {
|
|
3169
|
+
return menuItemChildrenBuild;
|
|
3170
|
+
}
|
|
3171
|
+
menuItemBuild.label = menuItemBuild.label ?? this.pageTitle;
|
|
3172
|
+
if (typeof menuItemBuild.routerLink === 'string') {
|
|
3173
|
+
menuItemBuild.routerLink = [menuItemBuild.routerLink];
|
|
3174
|
+
}
|
|
3175
|
+
menuItemBuild.routerLink = removeRouteEmptyPathSegments(menuItemBuild.routerLink ?? this.routePath);
|
|
3176
|
+
if (menuItemChildrenBuild.length > 0) {
|
|
3177
|
+
menuItemBuild.items = menuItemChildrenBuild;
|
|
3178
|
+
}
|
|
3179
|
+
if (!menuItemBuild.guards) {
|
|
3180
|
+
const guards = this.findMenuItemGuards();
|
|
3181
|
+
if (guards.length > 0) {
|
|
3182
|
+
menuItemBuild.guards = guards;
|
|
3183
|
+
}
|
|
3184
|
+
}
|
|
3185
|
+
if (!menuItemBuild.permissions) {
|
|
3186
|
+
menuItemBuild.permissions = this.findMenuItemPermissions();
|
|
3187
|
+
}
|
|
3188
|
+
return [menuItemBuild];
|
|
3189
|
+
}
|
|
3190
|
+
createMenuItem(icon, label, routerLink) {
|
|
3191
|
+
const menuItem = {};
|
|
3192
|
+
if (icon) {
|
|
3193
|
+
menuItem.icon = icon;
|
|
3194
|
+
}
|
|
3195
|
+
if (label) {
|
|
3196
|
+
menuItem.label = label;
|
|
3197
|
+
}
|
|
3198
|
+
if (routerLink) {
|
|
3199
|
+
menuItem.routerLink = routerLink;
|
|
3200
|
+
}
|
|
3201
|
+
return menuItem;
|
|
3202
|
+
}
|
|
3203
|
+
findMenuItemGuards() {
|
|
3204
|
+
const guards = [];
|
|
3205
|
+
if (this.route.canActivate?.length) {
|
|
3206
|
+
guards.push(...this.route.canActivate);
|
|
3207
|
+
}
|
|
3208
|
+
if (this.parent) {
|
|
3209
|
+
// Check for parent guards that should be included in decision to hide menu item!
|
|
3210
|
+
// Some parent routes might have guards, but no menu items, so this guards must be taken into account here,
|
|
3211
|
+
// because there is no parent menu item to hide.
|
|
3212
|
+
this.parent.findMenuItemGuards().forEach(g => {
|
|
3213
|
+
if (guards.indexOf(g) < 0) {
|
|
3214
|
+
guards.push(g);
|
|
3215
|
+
}
|
|
3216
|
+
});
|
|
3217
|
+
}
|
|
3218
|
+
return guards;
|
|
3219
|
+
}
|
|
3220
|
+
findMenuItemPermissions() {
|
|
3221
|
+
if (this.menuItem?.permissions) {
|
|
3222
|
+
return this.menuItem.permissions;
|
|
3223
|
+
}
|
|
3224
|
+
if (this.routeData.permissions) {
|
|
3225
|
+
// this is already built
|
|
3226
|
+
return this.routeData.permissions;
|
|
3227
|
+
}
|
|
3228
|
+
if (this.permissions) {
|
|
3229
|
+
return this.permissions;
|
|
3230
|
+
}
|
|
3231
|
+
return undefined;
|
|
3232
|
+
}
|
|
3233
|
+
}
|
|
3234
|
+
|
|
3235
|
+
class RoutesBuilder {
|
|
3236
|
+
constructor(layoutRoute) {
|
|
3237
|
+
this.routes = [];
|
|
3238
|
+
this.layoutRoute = layoutRoute?.withRoot(this);
|
|
3239
|
+
this.currentRoute = layoutRoute;
|
|
3240
|
+
}
|
|
3241
|
+
static create() {
|
|
3242
|
+
return new RoutesBuilder();
|
|
3243
|
+
}
|
|
3244
|
+
addAngularRoute(route, builderAdjustFn) {
|
|
3245
|
+
const builder = RouteBuilder.createFromRoute(route);
|
|
3246
|
+
builderAdjustFn?.(builder);
|
|
3247
|
+
return this.addRouteBuilder(builder);
|
|
3248
|
+
}
|
|
3249
|
+
addRouteRedirect(path, redirectTo, pathMatch = 'prefix') {
|
|
3250
|
+
return this.addRouteBuilder(RouteBuilder.createRedirect(path, redirectTo, pathMatch));
|
|
3251
|
+
}
|
|
3252
|
+
addLazyRouteComponent(path, loadComponent, canMatch, builderAdjustFn) {
|
|
3253
|
+
const builder = RouteBuilder.createLazyRouteComponent(path, loadComponent, canMatch);
|
|
3254
|
+
builderAdjustFn?.(builder);
|
|
3255
|
+
return this.addRouteBuilder(builder);
|
|
3256
|
+
}
|
|
3257
|
+
addLazyRouteModule(path, loadChildren, canMatch, builderAdjustFn) {
|
|
3258
|
+
const builder = RouteBuilder.createLazyRouteModule(path, loadChildren, canMatch);
|
|
3259
|
+
builderAdjustFn?.(builder);
|
|
3260
|
+
return this.addRouteBuilder(builder);
|
|
3261
|
+
}
|
|
3262
|
+
addRoute(path, component, builderAdjustFn) {
|
|
3263
|
+
const builder = RouteBuilder.create(path, component);
|
|
3264
|
+
builderAdjustFn?.(builder);
|
|
3265
|
+
return this.addRouteBuilder(builder);
|
|
3266
|
+
}
|
|
3267
|
+
addRouteBuilder(routeBuilder) {
|
|
3268
|
+
this.currentRoute = routeBuilder.withRoot(this);
|
|
3269
|
+
this.routes.push(routeBuilder);
|
|
3270
|
+
return this;
|
|
3271
|
+
}
|
|
3272
|
+
build() {
|
|
3273
|
+
let angularRoutes = [];
|
|
3274
|
+
for (const route of this.routes) {
|
|
3275
|
+
angularRoutes.push(route.build());
|
|
3276
|
+
}
|
|
3277
|
+
if (this.layoutRoute) {
|
|
3278
|
+
const layoutAngularRoute = this.layoutRoute.build();
|
|
3279
|
+
if (angularRoutes.length > 0) {
|
|
3280
|
+
layoutAngularRoute.children = angularRoutes;
|
|
3281
|
+
}
|
|
3282
|
+
angularRoutes = [layoutAngularRoute];
|
|
3283
|
+
}
|
|
3284
|
+
return angularRoutes;
|
|
3285
|
+
}
|
|
3286
|
+
}
|
|
3287
|
+
|
|
3288
|
+
/**
|
|
3289
|
+
* Maps an Observable of data with optional totalCount and data to a data list result object with provided defaults of empty array and count 0.
|
|
3290
|
+
*/
|
|
3291
|
+
function mapToDataList() {
|
|
3292
|
+
return function (source) {
|
|
3293
|
+
return new Observable(subscriber => {
|
|
3294
|
+
return source.subscribe({
|
|
3295
|
+
next(value) {
|
|
3296
|
+
subscriber.next({
|
|
3297
|
+
data: value.data ?? [],
|
|
3298
|
+
totalCount: value.totalCount ?? value.data?.length ?? 0
|
|
3299
|
+
});
|
|
3300
|
+
}
|
|
3301
|
+
});
|
|
3302
|
+
});
|
|
3303
|
+
};
|
|
3304
|
+
}
|
|
3305
|
+
|
|
3306
|
+
function commonsInitializerProvider(handler, commonsInit) {
|
|
3307
|
+
return () => commonsInit.initialize(handler);
|
|
3308
|
+
}
|
|
3309
|
+
|
|
3310
|
+
const COMMONS_INITIALIZER_IT = new InjectionToken('COMMONS_INIZIALIZER');
|
|
3311
|
+
|
|
3312
|
+
const LOG_PUBLISHERS = new InjectionToken('LOG_PUBLISHERS');
|
|
3313
|
+
|
|
3314
|
+
class CommonsConfigurationService {
|
|
3315
|
+
static { this._instance = new CommonsConfigurationService(); }
|
|
3316
|
+
static get() {
|
|
3317
|
+
return CommonsConfigurationService._instance;
|
|
3318
|
+
}
|
|
3319
|
+
constructor() {
|
|
3320
|
+
this.jsonSources = [];
|
|
3321
|
+
this.objectSources = [];
|
|
3322
|
+
this.configuration = { ...this.projectEnvironment };
|
|
3323
|
+
/**
|
|
3324
|
+
* returns true if there is no jsonSources
|
|
3325
|
+
*/
|
|
3326
|
+
this.skipJsonConfigsLoading = () => this.jsonSources === null || this.jsonSources.length === 0;
|
|
3327
|
+
/**
|
|
3328
|
+
* loads json sources or skips them returning true in both cases
|
|
3329
|
+
* used for `skipJsonSourceInit` configuration parameter
|
|
3330
|
+
*/
|
|
3331
|
+
this.loadJsonConfigurations = () => (this.skipJsonConfigsLoading() ? of(true) : this.loadJsonSources());
|
|
3332
|
+
// empty, but needed for private constructor
|
|
3333
|
+
}
|
|
3334
|
+
init(httpClient, logger) {
|
|
3335
|
+
this.http = httpClient;
|
|
3336
|
+
this.logger = logger?.create('ConfigurationService');
|
|
3337
|
+
return this;
|
|
3338
|
+
}
|
|
3339
|
+
/**
|
|
3340
|
+
* Add commons module config.
|
|
3341
|
+
* @param config Module config.
|
|
3342
|
+
*/
|
|
3343
|
+
addModuleConfigSource(config) {
|
|
3344
|
+
this.moduleConfig = config;
|
|
3345
|
+
this.mergeConfigs();
|
|
3346
|
+
this.logger?.debug(`Module configuration source added.`);
|
|
3347
|
+
}
|
|
3348
|
+
/**
|
|
3349
|
+
* Add project environment source.
|
|
3350
|
+
* @param environment Environment.
|
|
3351
|
+
*/
|
|
3352
|
+
addEnvironmentSource(environment) {
|
|
3353
|
+
this.projectEnvironment = environment;
|
|
3354
|
+
this.mergeConfigs();
|
|
3355
|
+
this.logger?.debug(`Environment configuration source added.`);
|
|
3356
|
+
}
|
|
3357
|
+
/**
|
|
3358
|
+
* Adds new config source from JSON file loaded from HTTP.
|
|
3359
|
+
* @param config Config for JSON file.
|
|
3360
|
+
* @param loadImmediately Load is by default triggered on app initialization. If immediate load is required, pass true.
|
|
3361
|
+
*/
|
|
3362
|
+
addJsonSource(config = {}, loadImmediately = false) {
|
|
3363
|
+
if (!config) {
|
|
3364
|
+
config = {};
|
|
3365
|
+
}
|
|
3366
|
+
const url = config?.url ?? 'assets/config/env{{environment}}.json';
|
|
3367
|
+
const enableEnvProdReplace = config?.enableEnvProd ?? false;
|
|
3368
|
+
const sourceInfo = {
|
|
3369
|
+
url: url,
|
|
3370
|
+
isEnvironment: false,
|
|
3371
|
+
environmentEnableEnvProd: enableEnvProdReplace,
|
|
3372
|
+
isLoaded: false
|
|
3373
|
+
};
|
|
3374
|
+
this.jsonSources.push(sourceInfo);
|
|
3375
|
+
this.logger?.debug(`JSON configuration source added: ${url}.`);
|
|
3376
|
+
if (loadImmediately) {
|
|
3377
|
+
return this.loadJsonConfigurations();
|
|
3378
|
+
}
|
|
3379
|
+
else {
|
|
3380
|
+
return of(true);
|
|
3381
|
+
}
|
|
3382
|
+
}
|
|
3383
|
+
/**
|
|
3384
|
+
* Adds new config object from any object.
|
|
3385
|
+
* @param config Config object.
|
|
3386
|
+
*/
|
|
3387
|
+
addObjectSource(config) {
|
|
3388
|
+
this.objectSources.push(config);
|
|
3389
|
+
this.logger?.debug(`Object configuration source added.`);
|
|
3390
|
+
this.mergeConfigs();
|
|
3391
|
+
}
|
|
3392
|
+
loadJsonSources() {
|
|
3393
|
+
if (!this.http) {
|
|
3394
|
+
this.logger?.warn('HTTP client was not initialized. Json source cannot be loaded');
|
|
3395
|
+
return of(false);
|
|
3396
|
+
}
|
|
3397
|
+
const httpClient = this.http;
|
|
3398
|
+
return combineLatest(this.jsonSources
|
|
3399
|
+
.filter(source => !source.isLoaded)
|
|
3400
|
+
.map(sourceInfo => {
|
|
3401
|
+
let url = sourceInfo.url;
|
|
3402
|
+
sourceInfo.environment = this.projectEnvironment?.name || (this.projectEnvironment?.production ? (sourceInfo.environmentEnableEnvProd ? 'prod' : null) : 'dev');
|
|
3403
|
+
sourceInfo.isEnvironment = !!sourceInfo.environment;
|
|
3404
|
+
if (sourceInfo.isEnvironment) {
|
|
3405
|
+
url = url.replace('{{environment}}', '.' + sourceInfo.environment);
|
|
3406
|
+
}
|
|
3407
|
+
else {
|
|
3408
|
+
// replace possible environment entry and change source info url
|
|
3409
|
+
url = url.replace('{{environment}}', '');
|
|
3410
|
+
sourceInfo.url = url;
|
|
3411
|
+
}
|
|
3412
|
+
this.logger?.debug(`Loading JSON configuration source from ${url}.`);
|
|
3413
|
+
return httpClient.get(url).pipe(catchError((err) => {
|
|
3414
|
+
if (sourceInfo.isEnvironment) {
|
|
3415
|
+
const noEnvUrl = sourceInfo.url.replace('{{environment}}', '');
|
|
3416
|
+
sourceInfo.environment = null;
|
|
3417
|
+
return httpClient.get(noEnvUrl);
|
|
3418
|
+
}
|
|
3419
|
+
else {
|
|
3420
|
+
this.logger?.warn(`Configuration file ${url} not loaded`, err);
|
|
3421
|
+
return of(false);
|
|
3422
|
+
}
|
|
3423
|
+
}), map(configuration => {
|
|
3424
|
+
if (typeof configuration !== 'object') {
|
|
3425
|
+
return false;
|
|
3426
|
+
}
|
|
3427
|
+
sourceInfo.configuration = configuration;
|
|
3428
|
+
sourceInfo.isLoaded = true;
|
|
3429
|
+
return true;
|
|
3430
|
+
}));
|
|
3431
|
+
})).pipe(map(sourceResults => sourceResults.every(sr => sr)), tap(() => this.mergeConfigs()));
|
|
3432
|
+
}
|
|
3433
|
+
/**
|
|
3434
|
+
* Get configuration.
|
|
3435
|
+
*/
|
|
3436
|
+
getConfig() {
|
|
3437
|
+
return this.configuration;
|
|
3438
|
+
}
|
|
3439
|
+
/**
|
|
3440
|
+
* Get configuration value for key.
|
|
3441
|
+
* @param key Configuration key.
|
|
3442
|
+
*/
|
|
3443
|
+
getConfigValue(key) {
|
|
3444
|
+
return this.configuration[key] ? this.configuration[key] : null;
|
|
3445
|
+
}
|
|
3446
|
+
/**
|
|
3447
|
+
* Has configuration for key.
|
|
3448
|
+
* @param key Configuration key.
|
|
3449
|
+
*/
|
|
3450
|
+
hasConfigKey(key) {
|
|
3451
|
+
return Object.keys(this.configuration).some(k => k === key);
|
|
3452
|
+
}
|
|
3453
|
+
/**
|
|
3454
|
+
* Merges configuration from multiple sources with
|
|
3455
|
+
*/
|
|
3456
|
+
mergeConfigs() {
|
|
3457
|
+
let config = {};
|
|
3458
|
+
// 1. object sources have highest priority
|
|
3459
|
+
if (this.objectSources.length) {
|
|
3460
|
+
for (const objConfig of this.objectSources) {
|
|
3461
|
+
config = objectDeepMerge(config, objConfig);
|
|
3462
|
+
}
|
|
3463
|
+
}
|
|
3464
|
+
// 2. JSON sources come next
|
|
3465
|
+
const jsonConfigs = this.jsonSources.filter(source => source.isLoaded && typeof source.configuration === 'object').map(source => source.configuration);
|
|
3466
|
+
if (jsonConfigs.length) {
|
|
3467
|
+
for (const jsonConfig of jsonConfigs) {
|
|
3468
|
+
if (jsonConfig) {
|
|
3469
|
+
config = objectDeepMerge(config, jsonConfig);
|
|
3470
|
+
}
|
|
3471
|
+
}
|
|
3472
|
+
}
|
|
3473
|
+
// 3. project env has the next priority
|
|
3474
|
+
if (this.projectEnvironment) {
|
|
3475
|
+
config = objectDeepMerge(config, this.projectEnvironment);
|
|
3476
|
+
}
|
|
3477
|
+
// 4. module config has the lowest priority
|
|
3478
|
+
if (this.moduleConfig) {
|
|
3479
|
+
config = objectDeepMerge(config, this.moduleConfig);
|
|
3480
|
+
}
|
|
3481
|
+
this.configuration = config;
|
|
3482
|
+
}
|
|
3483
|
+
}
|
|
3484
|
+
|
|
3485
|
+
class CommonsRouterService {
|
|
3486
|
+
constructor(router) {
|
|
3487
|
+
this.router = router;
|
|
3488
|
+
this.logger = inject(LoggerService).create('CommonsRouterService');
|
|
3489
|
+
this.routesLoadedPropKey = '_loadedRoutes';
|
|
3490
|
+
this.currentNavigationModuleKeys = [];
|
|
3491
|
+
this.lazyLoadedRoutesConfig = {};
|
|
3492
|
+
}
|
|
3493
|
+
getRouteLoadedChildren(path) {
|
|
3494
|
+
return this.getOrCreateRouteForModule(this.getModulePathFromRouterLink(path)).loadedRoutes;
|
|
3495
|
+
}
|
|
3496
|
+
getRouteLoadedChildren$(path) {
|
|
3497
|
+
return this.getOrCreateRouteForModule(this.getModulePathFromRouterLink(path)).loadedRoutesSubject.asObservable().pipe(first());
|
|
3498
|
+
}
|
|
3499
|
+
initialize() {
|
|
3500
|
+
this.router.events.subscribe(event => {
|
|
3501
|
+
if (event instanceof NavigationStart) {
|
|
3502
|
+
this.startNavigation(event.url);
|
|
3503
|
+
}
|
|
3504
|
+
else if (event instanceof RouteConfigLoadStart) {
|
|
3505
|
+
this.markNavigationConfigLoad(event.route);
|
|
3506
|
+
}
|
|
3507
|
+
else if (event instanceof RouteConfigLoadEnd) {
|
|
3508
|
+
this.markNavigationConfigLoad(event.route, true);
|
|
3509
|
+
}
|
|
3510
|
+
else if (event instanceof NavigationEnd || event instanceof NavigationCancel || event instanceof NavigationError) {
|
|
3511
|
+
this.finishNavigation();
|
|
3512
|
+
}
|
|
3513
|
+
});
|
|
3514
|
+
}
|
|
3515
|
+
startNavigation(url) {
|
|
3516
|
+
this.currentNavigationPath = url.split('?')[0].split('#')[0];
|
|
3517
|
+
this.currentNavigationModuleKeys = [];
|
|
3518
|
+
}
|
|
3519
|
+
finishNavigation() {
|
|
3520
|
+
if (this.currentNavigationModuleKeys.length) {
|
|
3521
|
+
this.currentNavigationModuleKeys.forEach(k => this.getLoadedRoutesFromRoute(k, true));
|
|
3522
|
+
}
|
|
3523
|
+
this.currentNavigationPath = undefined;
|
|
3524
|
+
}
|
|
3525
|
+
markNavigationConfigLoad(route, isEnd = false) {
|
|
3526
|
+
const routePath = route.path ?? '';
|
|
3527
|
+
let moduleKey = routePath;
|
|
3528
|
+
const currentNavigationPathRoutePathIdx = this.currentNavigationPath?.indexOf(routePath) ?? -1;
|
|
3529
|
+
if (this.currentNavigationPath && currentNavigationPathRoutePathIdx >= 0) {
|
|
3530
|
+
moduleKey = this.currentNavigationPath.substring(0, currentNavigationPathRoutePathIdx + routePath.length);
|
|
3531
|
+
}
|
|
3532
|
+
else if (this.currentNavigationPath && routePath !== this.currentNavigationPath && !routePath.startsWith('/')) {
|
|
3533
|
+
// usually means that redirect to currentNavigationPath was done, additionally, route path was also triggered on lazy routes load
|
|
3534
|
+
moduleKey = `${this.currentNavigationPath}/${routePath}`;
|
|
3535
|
+
}
|
|
3536
|
+
if (!isEnd && this.currentNavigationModuleKeys.indexOf(moduleKey) < 0) {
|
|
3537
|
+
this.currentNavigationModuleKeys.push(moduleKey);
|
|
3538
|
+
}
|
|
3539
|
+
this.logger.trace(`Config load ${isEnd ? 'end' : 'start'} for ${moduleKey} (routePath: ${routePath}; navigationUrl: ${this.currentNavigationPath})`);
|
|
3540
|
+
const config = this.getOrCreateRouteForModule(moduleKey);
|
|
3541
|
+
config.route = route;
|
|
3542
|
+
config.isLoadEnd = isEnd;
|
|
3543
|
+
if (isEnd) {
|
|
3544
|
+
this.getLoadedRoutesFromRoute(moduleKey);
|
|
3545
|
+
}
|
|
3546
|
+
}
|
|
3547
|
+
getLoadedRoutesFromRoute(moduleKey, isFinish = false) {
|
|
3548
|
+
const moduleConfig = this.lazyLoadedRoutesConfig[moduleKey];
|
|
3549
|
+
if (!moduleConfig?.route || Array.isArray(moduleConfig.loadedRoutes)) {
|
|
3550
|
+
return;
|
|
3551
|
+
}
|
|
3552
|
+
moduleConfig.loadedRoutes = moduleConfig.route[this.routesLoadedPropKey];
|
|
3553
|
+
if (!Array.isArray(moduleConfig.loadedRoutes) && isFinish) {
|
|
3554
|
+
// if is called from finish and no lazy loaded routes are matched from router events, try finding in route config, it should be there!
|
|
3555
|
+
this.logger.trace(`Route loadedRoutes for ${moduleKey} not found, searching in router config now`);
|
|
3556
|
+
const route = this.findRouteInRouteConfig(moduleKey);
|
|
3557
|
+
if (route) {
|
|
3558
|
+
moduleConfig.route = route;
|
|
3559
|
+
moduleConfig.loadedRoutes = moduleConfig.route[this.routesLoadedPropKey];
|
|
3560
|
+
}
|
|
3561
|
+
else {
|
|
3562
|
+
this.logger.warn(`Route loadedRoutes for ${moduleKey} were not found in router config`);
|
|
3563
|
+
}
|
|
3564
|
+
}
|
|
3565
|
+
if (typeof moduleConfig.loadedRoutes !== 'undefined') {
|
|
3566
|
+
moduleConfig.loadedRoutesSubject.next(moduleConfig.loadedRoutes);
|
|
3567
|
+
moduleConfig.loadedRoutesSubject.complete();
|
|
3568
|
+
this.logger.trace(`Config load for ${moduleKey} is complete`, moduleConfig);
|
|
3569
|
+
}
|
|
3570
|
+
}
|
|
3571
|
+
/**
|
|
3572
|
+
* Search for route config by module path by recursive scanning of router config tree.
|
|
3573
|
+
* @param modulePath Path of module that is searched.
|
|
3574
|
+
* @param routes Routes to be scanned. If not provided, it starts on root router config.
|
|
3575
|
+
* @private
|
|
3576
|
+
*/
|
|
3577
|
+
findRouteInRouteConfig(modulePath, routes = this.router.config) {
|
|
3578
|
+
if (modulePath.startsWith('/')) {
|
|
3579
|
+
modulePath = modulePath.substring(1);
|
|
3580
|
+
}
|
|
3581
|
+
for (const route of routes) {
|
|
3582
|
+
if (typeof route.path === 'undefined') {
|
|
3583
|
+
continue;
|
|
3584
|
+
}
|
|
3585
|
+
let routePath = route.path;
|
|
3586
|
+
if (routePath.startsWith('/')) {
|
|
3587
|
+
routePath = routePath.substring(1);
|
|
3588
|
+
}
|
|
3589
|
+
const longestPathMatch = this.findLongestPathMatch(modulePath, routePath);
|
|
3590
|
+
if (longestPathMatch === null) {
|
|
3591
|
+
continue;
|
|
3592
|
+
}
|
|
3593
|
+
// there is a partial or full match
|
|
3594
|
+
if (route.loadChildren && modulePath === longestPathMatch) {
|
|
3595
|
+
// it's a hit!
|
|
3596
|
+
return route;
|
|
3597
|
+
}
|
|
3598
|
+
else if (route.loadChildren && Array.isArray(route[this.routesLoadedPropKey])) {
|
|
3599
|
+
const result = this.findRouteInRouteConfig(modulePath.substring(longestPathMatch.length, modulePath.length), route[this.routesLoadedPropKey]);
|
|
3600
|
+
if (result) {
|
|
3601
|
+
return result;
|
|
3602
|
+
}
|
|
3603
|
+
}
|
|
3604
|
+
else if (route.children) {
|
|
3605
|
+
const result = this.findRouteInRouteConfig(modulePath.substring(longestPathMatch.length, modulePath.length), route.children);
|
|
3606
|
+
if (result) {
|
|
3607
|
+
return result;
|
|
3608
|
+
}
|
|
3609
|
+
}
|
|
3610
|
+
}
|
|
3611
|
+
return null;
|
|
3612
|
+
}
|
|
3613
|
+
/**
|
|
3614
|
+
* Finds longest path match of source to match string. If match is '', it is considered as a match in Angular routing.
|
|
3615
|
+
* @param source Source string from on which comparison is based.
|
|
3616
|
+
* @param match Match string to which the source is matched to.
|
|
3617
|
+
* @private
|
|
3618
|
+
*/
|
|
3619
|
+
findLongestPathMatch(source, match) {
|
|
3620
|
+
const sourceSegments = source.split('/');
|
|
3621
|
+
const matchSegments = match.split('/');
|
|
3622
|
+
if (matchSegments.length === 1 && matchSegments[0] === '') {
|
|
3623
|
+
// it's a hit, because empty route must always be processed (kind of a "abstract" route)
|
|
3624
|
+
return '';
|
|
3625
|
+
}
|
|
3626
|
+
if (sourceSegments[0] === matchSegments[0]) {
|
|
3627
|
+
// there is a match, find how long it is
|
|
3628
|
+
for (let i = 1; i < sourceSegments.length; i++) {
|
|
3629
|
+
if (sourceSegments[i] !== matchSegments[i]) {
|
|
3630
|
+
// end of match
|
|
3631
|
+
return sourceSegments.slice(0, i).join('/');
|
|
3632
|
+
}
|
|
3633
|
+
}
|
|
3634
|
+
// there is full match
|
|
3635
|
+
return sourceSegments.join('/');
|
|
3636
|
+
}
|
|
3637
|
+
return null;
|
|
3638
|
+
}
|
|
3639
|
+
getOrCreateRouteForModule(moduleKey) {
|
|
3640
|
+
if (!this.lazyLoadedRoutesConfig[moduleKey]) {
|
|
3641
|
+
this.lazyLoadedRoutesConfig[moduleKey] = {
|
|
3642
|
+
loadedRoutesSubject: new ReplaySubject(1),
|
|
3643
|
+
isLoadEnd: false
|
|
3644
|
+
};
|
|
3645
|
+
}
|
|
3646
|
+
return this.lazyLoadedRoutesConfig[moduleKey];
|
|
3647
|
+
}
|
|
3648
|
+
getModulePathFromRouterLink(path) {
|
|
3649
|
+
return ('/' + (Array.isArray(path) ? path.join('/') : path)).replace(/\/\//g, '/');
|
|
3650
|
+
}
|
|
3651
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: CommonsRouterService, deps: [{ token: i1$1.Router }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3652
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: CommonsRouterService }); }
|
|
3653
|
+
}
|
|
3654
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: CommonsRouterService, decorators: [{
|
|
3655
|
+
type: Injectable
|
|
3656
|
+
}], ctorParameters: () => [{ type: i1$1.Router }] });
|
|
3657
|
+
|
|
3658
|
+
var CommonsInitEventEnum;
|
|
3659
|
+
(function (CommonsInitEventEnum) {
|
|
3660
|
+
CommonsInitEventEnum[CommonsInitEventEnum["CommonsInitStart"] = 0] = "CommonsInitStart";
|
|
3661
|
+
CommonsInitEventEnum[CommonsInitEventEnum["ConfigSourceModuleLoaded"] = 1] = "ConfigSourceModuleLoaded";
|
|
3662
|
+
CommonsInitEventEnum[CommonsInitEventEnum["ConfigSourceProjectEnvLoaded"] = 2] = "ConfigSourceProjectEnvLoaded";
|
|
3663
|
+
CommonsInitEventEnum[CommonsInitEventEnum["ConfigSourceJsonAdded"] = 3] = "ConfigSourceJsonAdded";
|
|
3664
|
+
CommonsInitEventEnum[CommonsInitEventEnum["ConfigSourceJsonLoaded"] = 4] = "ConfigSourceJsonLoaded";
|
|
3665
|
+
CommonsInitEventEnum[CommonsInitEventEnum["CommonsInitEnd"] = 5] = "CommonsInitEnd";
|
|
3666
|
+
CommonsInitEventEnum[CommonsInitEventEnum["CommonsInitError"] = 6] = "CommonsInitError";
|
|
3667
|
+
})(CommonsInitEventEnum || (CommonsInitEventEnum = {}));
|
|
3668
|
+
class CommonsInitService {
|
|
3669
|
+
constructor() {
|
|
3670
|
+
this.logger = inject(LoggerService);
|
|
3671
|
+
this.logPublishers = inject(LOG_PUBLISHERS, { optional: true });
|
|
3672
|
+
this.config = inject(CommonsConfigurationService);
|
|
3673
|
+
this.commons = inject(CommonsService);
|
|
3674
|
+
this.commonsRouter = inject(CommonsRouterService);
|
|
3675
|
+
this.moduleConfig = inject(COMMONS_MODULE_CONFIG_IT, { optional: true });
|
|
3676
|
+
this.commonsInitializers = inject(COMMONS_INITIALIZER_IT, { optional: true });
|
|
3677
|
+
this.isInitialized = false;
|
|
3678
|
+
this.isInitializedSubject = new ReplaySubject();
|
|
3679
|
+
this.commonsInitServiceEvents = new Subject();
|
|
3680
|
+
}
|
|
3681
|
+
get events$() {
|
|
3682
|
+
return this.commonsInitServiceEvents.asObservable();
|
|
3683
|
+
}
|
|
3684
|
+
get isInitialized$() {
|
|
3685
|
+
return this.isInitializedSubject.asObservable().pipe(take(1));
|
|
3686
|
+
}
|
|
3687
|
+
initialize(handler) {
|
|
3688
|
+
if (this.isInitialized) {
|
|
3689
|
+
return of(void 0);
|
|
3690
|
+
}
|
|
3691
|
+
this.isInitialized = true;
|
|
3692
|
+
LoggerService.configure({ timestampFormat: this.moduleConfig?.log?.timestampFormat });
|
|
3693
|
+
const ctxLogger = this.logger.create('CommonsInitService');
|
|
3694
|
+
ctxLogger.debug('Commons initialization is starting');
|
|
3695
|
+
this.commonsInitServiceEvents.next(CommonsInitEventEnum.CommonsInitStart);
|
|
3696
|
+
// init http client
|
|
3697
|
+
this.httpClient = new HttpClient(handler);
|
|
3698
|
+
// init router
|
|
3699
|
+
this.commonsRouter.initialize();
|
|
3700
|
+
// init configurations with settings from module config
|
|
3701
|
+
this.config.init(this.httpClient, this.logger);
|
|
3702
|
+
this.config.addModuleConfigSource(this.moduleConfig ?? undefined);
|
|
3703
|
+
this.commonsInitServiceEvents.next(CommonsInitEventEnum.ConfigSourceModuleLoaded);
|
|
3704
|
+
if (this.moduleConfig?.configuration?.projectEnvironment) {
|
|
3705
|
+
this.config.addEnvironmentSource(this.moduleConfig.configuration.projectEnvironment);
|
|
3706
|
+
this.commonsInitServiceEvents.next(CommonsInitEventEnum.ConfigSourceProjectEnvLoaded);
|
|
3707
|
+
}
|
|
3708
|
+
// init configurations with settings from module config for json source
|
|
3709
|
+
if (!(this.moduleConfig?.configuration?.skipJsonSourceInit ?? false)) {
|
|
3710
|
+
const jsonSourceEnableEnvProd = this.moduleConfig?.configuration?.jsonSourceEnableEnvProd ?? false;
|
|
3711
|
+
const jsonSource = this.moduleConfig?.configuration?.jsonSource;
|
|
3712
|
+
if (!jsonSource) {
|
|
3713
|
+
this.config.addJsonSource({ enableEnvProd: jsonSourceEnableEnvProd });
|
|
3714
|
+
}
|
|
3715
|
+
else if (Array.isArray(jsonSource)) {
|
|
3716
|
+
jsonSource.forEach(source => this.config.addJsonSource({ url: source, enableEnvProd: jsonSourceEnableEnvProd }));
|
|
3717
|
+
}
|
|
3718
|
+
else {
|
|
3719
|
+
this.config.addJsonSource({ url: jsonSource, enableEnvProd: jsonSourceEnableEnvProd });
|
|
3720
|
+
}
|
|
3721
|
+
this.commonsInitServiceEvents.next(CommonsInitEventEnum.ConfigSourceJsonAdded);
|
|
3722
|
+
}
|
|
3723
|
+
return this.config.loadJsonConfigurations().pipe(mergeMap(() => {
|
|
3724
|
+
if (!(this.moduleConfig?.configuration?.skipJsonSourceInit ?? false)) {
|
|
3725
|
+
this.commonsInitServiceEvents.next(CommonsInitEventEnum.ConfigSourceJsonLoaded);
|
|
3726
|
+
}
|
|
3727
|
+
// init logger
|
|
3728
|
+
LoggerService.init(this.config, this.logPublishers ?? []);
|
|
3729
|
+
if (this.commonsInitializers) {
|
|
3730
|
+
ctxLogger.debug('Project initializers are being initialized');
|
|
3731
|
+
return combineLatest(this.commonsInitializers.map(ci => ci())).pipe(map(res => res));
|
|
3732
|
+
}
|
|
3733
|
+
else {
|
|
3734
|
+
return of(true);
|
|
3735
|
+
}
|
|
3736
|
+
}), map(() => {
|
|
3737
|
+
ctxLogger.debug('Commons initialization is finished');
|
|
3738
|
+
this.commonsInitServiceEvents.next(CommonsInitEventEnum.CommonsInitEnd);
|
|
3739
|
+
this.commonsInitServiceEvents.complete();
|
|
3740
|
+
this.isInitializedSubject.next(true);
|
|
3741
|
+
return this.commons.reset();
|
|
3742
|
+
}), catchError(err => {
|
|
3743
|
+
ctxLogger.warn('Commons initialization failed with error', err);
|
|
3744
|
+
this.commonsInitServiceEvents.next(CommonsInitEventEnum.CommonsInitError);
|
|
3745
|
+
this.commonsInitServiceEvents.complete();
|
|
3746
|
+
this.isInitializedSubject.next(false);
|
|
3747
|
+
return throwError(() => err);
|
|
3748
|
+
}));
|
|
3749
|
+
}
|
|
3750
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: CommonsInitService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3751
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: CommonsInitService }); }
|
|
3752
|
+
}
|
|
3753
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: CommonsInitService, decorators: [{
|
|
3754
|
+
type: Injectable
|
|
3755
|
+
}] });
|
|
3756
|
+
|
|
3757
|
+
class LocalStorageService {
|
|
3758
|
+
constructor() {
|
|
3759
|
+
this._configKey = 'CommonsUserPrefs';
|
|
3760
|
+
}
|
|
3761
|
+
buildLocalStorageKey(type, key) {
|
|
3762
|
+
return `${this._configKey}_${type}_${key}`;
|
|
3763
|
+
}
|
|
3764
|
+
getItem(type, key) {
|
|
3765
|
+
const localstorageData = localStorage.getItem(this.buildLocalStorageKey(type, key));
|
|
3766
|
+
if (localstorageData) {
|
|
3767
|
+
return JSON.parse(localstorageData);
|
|
3768
|
+
}
|
|
3769
|
+
return undefined;
|
|
3770
|
+
}
|
|
3771
|
+
setItem(type, key, value) {
|
|
3772
|
+
localStorage.setItem(this.buildLocalStorageKey(type, key), JSON.stringify(value));
|
|
3773
|
+
}
|
|
3774
|
+
removeItem(type, key) {
|
|
3775
|
+
localStorage.removeItem(this.buildLocalStorageKey(type, key));
|
|
3776
|
+
}
|
|
3777
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: LocalStorageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3778
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: LocalStorageService }); }
|
|
3779
|
+
}
|
|
3780
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: LocalStorageService, decorators: [{
|
|
3781
|
+
type: Injectable
|
|
3782
|
+
}] });
|
|
3783
|
+
|
|
3784
|
+
var StyleSizeEnum;
|
|
3785
|
+
(function (StyleSizeEnum) {
|
|
3786
|
+
StyleSizeEnum[StyleSizeEnum["ExtraSmall"] = 0] = "ExtraSmall";
|
|
3787
|
+
StyleSizeEnum[StyleSizeEnum["Small"] = 1] = "Small";
|
|
3788
|
+
StyleSizeEnum[StyleSizeEnum["Normal"] = 2] = "Normal";
|
|
3789
|
+
StyleSizeEnum[StyleSizeEnum["Large"] = 3] = "Large";
|
|
3790
|
+
StyleSizeEnum[StyleSizeEnum["ExtraLarge"] = 4] = "ExtraLarge";
|
|
3791
|
+
})(StyleSizeEnum || (StyleSizeEnum = {}));
|
|
3792
|
+
var StyleLevelEnum;
|
|
3793
|
+
(function (StyleLevelEnum) {
|
|
3794
|
+
StyleLevelEnum[StyleLevelEnum["Default"] = 0] = "Default";
|
|
3795
|
+
StyleLevelEnum[StyleLevelEnum["Primary"] = 1] = "Primary";
|
|
3796
|
+
StyleLevelEnum[StyleLevelEnum["Secondary"] = 2] = "Secondary";
|
|
3797
|
+
StyleLevelEnum[StyleLevelEnum["Info"] = 3] = "Info";
|
|
3798
|
+
StyleLevelEnum[StyleLevelEnum["Help"] = 4] = "Help";
|
|
3799
|
+
StyleLevelEnum[StyleLevelEnum["Success"] = 5] = "Success";
|
|
3800
|
+
StyleLevelEnum[StyleLevelEnum["Warning"] = 6] = "Warning";
|
|
3801
|
+
StyleLevelEnum[StyleLevelEnum["Danger"] = 7] = "Danger";
|
|
3802
|
+
})(StyleLevelEnum || (StyleLevelEnum = {}));
|
|
3803
|
+
|
|
3804
|
+
class Styles {
|
|
3805
|
+
static { this.BUTTON_ROUNDED_WIDTH_XS = 26; }
|
|
3806
|
+
static { this.BUTTON_ROUNDED_WIDTH_SM = 28; }
|
|
3807
|
+
static { this.BUTTON_ROUNDED_WIDTH = 32; }
|
|
3808
|
+
static { this.BUTTON_ROUNDED_WIDTH_LG = 45; }
|
|
3809
|
+
static { this.ACTION_BUTTON_MARGIN_X = 2; }
|
|
3810
|
+
static { this.TABLE_CELL_PADDING_X = 8; } // left and right paddings are same
|
|
3811
|
+
static { this.TABLE_CELL_PADDING_X_SM = 4; }
|
|
3812
|
+
static { this.TABLE_CELL_PADDING_X_LG = 12; }
|
|
3813
|
+
}
|
|
3814
|
+
|
|
3815
|
+
var CommonsFeatureTypeEnum;
|
|
3816
|
+
(function (CommonsFeatureTypeEnum) {
|
|
3817
|
+
CommonsFeatureTypeEnum[CommonsFeatureTypeEnum["Layout"] = 0] = "Layout";
|
|
3818
|
+
CommonsFeatureTypeEnum[CommonsFeatureTypeEnum["Tableview"] = 1] = "Tableview";
|
|
3819
|
+
CommonsFeatureTypeEnum[CommonsFeatureTypeEnum["DataApiAsClassV1"] = 2] = "DataApiAsClassV1";
|
|
3820
|
+
})(CommonsFeatureTypeEnum || (CommonsFeatureTypeEnum = {}));
|
|
3821
|
+
function provideCommons(config, ...features) {
|
|
3822
|
+
const providers = [
|
|
3823
|
+
// primeng services
|
|
3824
|
+
DialogService,
|
|
3825
|
+
MessageService,
|
|
3826
|
+
ConfirmationService,
|
|
3827
|
+
// services
|
|
3828
|
+
CommonsInitService,
|
|
3829
|
+
CommonsService,
|
|
3830
|
+
CommonsRouterService,
|
|
3831
|
+
PermissionService,
|
|
3832
|
+
LocalStorageService,
|
|
3833
|
+
{
|
|
3834
|
+
provide: COMMONS_MODULE_CONFIG_IT,
|
|
3835
|
+
useValue: config
|
|
3836
|
+
},
|
|
3837
|
+
{
|
|
3838
|
+
provide: TypeRegistry,
|
|
3839
|
+
useFactory: () => TypeRegistry.get()
|
|
3840
|
+
},
|
|
3841
|
+
{
|
|
3842
|
+
provide: CommonsConfigurationService,
|
|
3843
|
+
useFactory: () => CommonsConfigurationService.get()
|
|
3844
|
+
},
|
|
3845
|
+
{
|
|
3846
|
+
provide: APP_INITIALIZER,
|
|
3847
|
+
useFactory: commonsInitializerProvider,
|
|
3848
|
+
deps: [HttpBackend, CommonsInitService],
|
|
3849
|
+
multi: true
|
|
3850
|
+
},
|
|
3851
|
+
{
|
|
3852
|
+
provide: LoggerService,
|
|
3853
|
+
useFactory: () => LoggerService.get()
|
|
3854
|
+
},
|
|
3855
|
+
{
|
|
3856
|
+
provide: LOG_PUBLISHERS,
|
|
3857
|
+
useClass: LogPublisherConsoleService,
|
|
3858
|
+
multi: true
|
|
3859
|
+
},
|
|
3860
|
+
{
|
|
3861
|
+
provide: BROWSER_STORAGE_IT,
|
|
3862
|
+
useFactory: () => localStorage
|
|
3863
|
+
},
|
|
3864
|
+
{
|
|
3865
|
+
provide: ErrorHandler,
|
|
3866
|
+
useClass: CommonsErrorHandler
|
|
3867
|
+
}
|
|
3868
|
+
];
|
|
3869
|
+
features.forEach(f => {
|
|
3870
|
+
providers.push(...f.providers);
|
|
3871
|
+
});
|
|
3872
|
+
return providers;
|
|
3873
|
+
}
|
|
3874
|
+
|
|
3875
|
+
// action
|
|
3876
|
+
|
|
3877
|
+
/**
|
|
3878
|
+
* Generated bundle index. Do not edit.
|
|
3879
|
+
*/
|
|
3880
|
+
|
|
3881
|
+
export { ACommonsErrorBase, APermissions, BROWSER_STORAGE_IT, BooleanPipe, COMMONS_INITIALIZER_IT, COMMONS_MODULE_CONFIG_IT, ClassMapPipe, CommonsConfigurationService, CommonsErrorHandler, CommonsFeatureTypeEnum, CommonsHttpError, CommonsInitEventEnum, CommonsInitService, CommonsInternalError, CommonsRouterService, CommonsService, ComponentDirective, DataProvider, DataProviderInst, DialogKeydownHandlerDirective, EnumName, EnumPipe, EnumerateAsyncPipe, EnumeratePipe, ErrorPageComponent, FilterMatchMode, GetterPipe, I18nPropertyPipe, JsonPathPipe, LOG_PUBLISHERS, LocalStorageService, LogLevelEnum, LogPublisherConsoleService, LoggerService, NotFoundPageComponent, NotificationWrapperComponent, ParametrizePipe, PermissionService, PermissionTypeEnum, Permissions, RouteBuilder, RoutesBuilder, StyleLevelEnum, StyleSizeEnum, Styles, TemplateDirective, TemplatePipe, TypeName, TypeRegistry, adjustRouteMenuLazyChildrenRouterLinks, angularDateFormatHasSeconds, angularDateFormatHasTime, appendRoutePathToBasePath, boolean$Attribute, commonsActionErrorContextToString, commonsErrorToString, commonsInitializerProvider, copyDataListParams, dataListParamsFilterToUrlQuery, dataListParamsFilterValueToUrlString, dataListParamsFiltersToUrlQuery, dataListParamsSortToUrlQuery, dataListParamsToUrlQuery, dateToIsoString, defineReflectEnumName, defineReflectTypeName, doesUrlMatchRouterLink, errorCauseToString, errorToString, escapeHtml, escapeHtmlAny, findReflectEnumName, findReflectTypeName, findTemplateByName, flattenObjectKeys, fromAngularDateFormatToPrime, fromEnumConstantsAsValueArray, fromEnumValuesAsValueArray, fromSubscribeError, fromTableLoadToDataListParams, fromUrlQueryToDataListParams, getEnumConstantName, getEnumConstantNameFromObject, getEnumConstantNames, getEnumConstantNamesFromObject, getEnumConstantValuesAsNumber, getEnumConstantValuesAsString, getEnumerationI18nBaseKey, getErrorLogLevel, getErrorName, getHttpErrorResponse, getHttpErrorResponseStatus, getI18n, getI18nAsync, getI18nClassGroupKey, getI18nClassKeyBasePath, getI18nClassName, getI18nClassNameAsync, getI18nClassParams, getI18nClassParamsAsync, getI18nClassPropertyKey, getI18nClassTabKey, getI18nErrorParams, getI18nForError, getI18nTypeGroupKey, getI18nTypeKeyBasePath, getI18nTypeName, getI18nTypeNameAsync, getI18nTypeParams, getI18nTypeParamsAsync, getI18nTypePropertyKey, getI18nTypeTabKey, getObjectGetters, getObjectProperties, getObjectPropertyByPath, httpErrorResponseToString, isHttpErrorResponse, isPermitted, isRbacPermitted, itemIdToDefined, itemIdToNumber, itemIdToString, mapToDataList, mergeDataListParamsWithDefaults, number$Attribute, objectDeepCopy, objectDeepMerge, permissionGuard, populateI18nParams, populateI18nTypeParams, provideCommons, reflectEnumNameKey, reflectTypeNameExists, reflectTypeNameKey, removeRouteEmptyPathSegments, selectEnumerationI18n, selectI18n, stringify, toEnumerationI18nEnumerate, toObservable, toastMessage, valueToDefined };
|
|
3882
|
+
//# sourceMappingURL=mediusinc-mng-commons-core.mjs.map
|