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