@mediusinc/mng-commons 5.5.0 → 6.0.0-rc.3
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/core/action/action-parameters.model.d.ts +4 -4
- package/core/data-providers/base.data-provider.d.ts +4 -7
- package/core/data-providers/lookup.data-provider.d.ts +2 -2
- package/core/descriptors/model.descriptor.d.ts +1 -7
- package/core/descriptors/tableview.descriptor.d.ts +5 -5
- package/core/helpers/notification.d.ts +17 -1
- package/core/helpers/route.d.ts +0 -1
- package/core/helpers/type-helpers.d.ts +8 -0
- package/core/i18n/i18n-error.d.ts +2 -3
- package/core/index.d.ts +0 -3
- package/core/models/menu.model.d.ts +0 -4
- package/core/router/route-builder.d.ts +1 -1
- package/core/services/commons.service.d.ts +0 -32
- package/core/services/tokens/module-config.token.d.ts +0 -28
- package/esm2022/core/action/action-parameters.model.mjs +1 -1
- package/esm2022/core/data-providers/base.data-provider.mjs +2 -4
- package/esm2022/core/data-providers/lookup.data-provider.mjs +1 -1
- package/esm2022/core/descriptors/model.descriptor.mjs +1 -1
- package/esm2022/core/descriptors/tableview.descriptor.mjs +1 -1
- package/esm2022/core/helpers/notification.mjs +19 -4
- package/esm2022/core/helpers/type-helpers.mjs +1 -1
- package/esm2022/core/i18n/i18n-error.mjs +10 -8
- package/esm2022/core/index.mjs +1 -4
- package/esm2022/core/models/menu.model.mjs +1 -1
- package/esm2022/core/router/route-builder.mjs +2 -2
- package/esm2022/core/services/commons.service.mjs +1 -34
- package/esm2022/core/services/tokens/module-config.token.mjs +1 -1
- package/esm2022/filter/descriptors/filter-lookup.descriptor.mjs +5 -86
- package/esm2022/filter/descriptors/filter.descriptor.mjs +7 -29
- package/esm2022/form/api/data-providers/lookup-data-provider.factory.mjs +14 -41
- package/esm2022/form/api/data-providers/lookup.data-provider.mjs +3 -3
- package/esm2022/form/api/descriptors/action-button.descriptor.mjs +5 -17
- package/esm2022/form/api/descriptors/button-style.builder.mjs +80 -101
- package/esm2022/form/api/index.mjs +2 -1
- package/esm2022/form/api/models/button.model.mjs +2 -0
- package/esm2022/model/class/data-providers/base-from-class-data-provider.factory.mjs +5 -0
- package/esm2022/model/class/descriptors/model-class.descriptor.mjs +28 -0
- package/esm2022/model/class/descriptors/type-class.descriptor.mjs +6 -0
- package/esm2022/model/class/helpers/model.mjs +53 -0
- package/esm2022/model/class/index.mjs +8 -0
- package/esm2022/model/class/mediusinc-mng-commons-model-class.mjs +5 -0
- package/esm2022/model/data-providers/base-from-type-data-provider.factory.mjs +11 -6
- package/esm2022/model/descriptors/model.descriptor.mjs +11 -54
- package/esm2022/model/descriptors/type.descriptor.mjs +2 -10
- package/esm2022/model/helpers/i18n.mjs +14 -9
- package/esm2022/model/index.mjs +1 -2
- package/esm2022/table/api/class/class-table-attribute-converter.mjs +80 -0
- package/esm2022/table/api/class/class-table-attribute.model.mjs +2 -0
- package/esm2022/table/api/class/class-table-data-provider.factory.mjs +5 -0
- package/esm2022/table/api/class/class-table-descriptor-helpers.mjs +99 -0
- package/esm2022/table/api/class/class-table-descriptor.factory.mjs +21 -0
- package/esm2022/table/api/class/index.mjs +6 -0
- package/esm2022/table/api/class/mediusinc-mng-commons-table-api-class.mjs +5 -0
- package/esm2022/table/api/data-providers/table-data-provider.factory.mjs +14 -41
- package/esm2022/table/api/data-providers/table.data-provider.mjs +3 -9
- package/esm2022/table/api/descriptors/column.descriptor.mjs +8 -3
- package/esm2022/table/api/descriptors/table-descriptor.factory.mjs +10 -77
- package/esm2022/table/api/descriptors/table.descriptor.mjs +3 -3
- package/esm2022/table/api/helpers/column-converter.mjs +25 -0
- package/esm2022/table/api/helpers/table-data-provider-descriptor-convert.mjs +4 -4
- package/esm2022/table/api/index.mjs +2 -4
- package/esm2022/table/api/models/table-columns.model.mjs +1 -1
- package/esm2022/table/components/column-value/column-value.component.mjs +7 -5
- package/esm2022/table/components/filter/filter-active-tag/filter-active-tag.component.mjs +3 -3
- package/esm2022/table/components/filter/filter-form/filter-form.component.mjs +5 -5
- package/esm2022/table/components/table/table.component.mjs +17 -18
- package/esm2022/table/helpers/notification.mjs +19 -13
- package/esm2022/tableview/action/components/action/action.component.mjs +41 -37
- package/esm2022/tableview/action/components/editor/injector-context/action-editor-injector-context.component.mjs +22 -13
- package/esm2022/tableview/action/helpers/action-execution.mjs +1 -1
- package/esm2022/tableview/action/helpers/i18n.mjs +50 -30
- package/esm2022/tableview/action/helpers/notification.mjs +73 -12
- package/esm2022/tableview/action/helpers/styles.mjs +2 -2
- package/esm2022/tableview/action/models/execution/action-context.model.mjs +1 -1
- package/esm2022/tableview/action/models/execution/action-instance.model.mjs +1 -1
- package/esm2022/tableview/action/services/action-executor.service.mjs +92 -75
- package/esm2022/tableview/action/services/data-provider-executor.service.mjs +18 -3
- package/esm2022/tableview/api/action/descriptors/action-descriptor.factory.mjs +13 -104
- package/esm2022/tableview/api/action/descriptors/action-editor-descriptor.factory.mjs +15 -62
- package/esm2022/tableview/api/action/descriptors/action-editor.descriptor.mjs +35 -82
- package/esm2022/tableview/api/action/descriptors/action-link-descriptor.factory.mjs +20 -33
- package/esm2022/tableview/api/action/descriptors/action-link.descriptor.mjs +1 -1
- package/esm2022/tableview/api/action/descriptors/action.descriptor.mjs +54 -95
- package/esm2022/tableview/api/action/descriptors/editor-action-descriptor.factory.mjs +21 -0
- package/esm2022/tableview/api/action/descriptors/editor-action-editor-descriptor.factory.mjs +21 -0
- package/esm2022/tableview/api/action/descriptors/table-action-descriptor.factory.mjs +37 -0
- package/esm2022/tableview/api/action/descriptors/table-action-editor-descriptor.factory.mjs +40 -0
- package/esm2022/tableview/api/action/helpers/data-provider-executors.mjs +25 -5
- package/esm2022/tableview/api/action/models/action-confirmation.model.mjs +2 -0
- package/esm2022/tableview/api/action/models/action-descriptor.types.mjs +1 -1
- package/esm2022/tableview/api/action/models/action-error.model.mjs +1 -1
- package/esm2022/tableview/api/action/models/execution/action-context-validation.model.mjs +1 -1
- package/esm2022/tableview/api/action/models/execution/action-context.model.mjs +1 -1
- package/esm2022/tableview/api/action/models/execution/action-instance.model.mjs +1 -1
- package/esm2022/tableview/api/action/models/tableview-action-default-categories.model.mjs +6 -6
- package/esm2022/tableview/api/action/services/data-provider-executor.service.mjs +3 -3
- package/esm2022/tableview/api/class/editor/class-editor-attribute-converter.mjs +85 -0
- package/esm2022/tableview/api/class/editor/class-editor-attribute.model.mjs +2 -0
- package/esm2022/tableview/api/class/editor/class-editor-data-provider.factory.mjs +5 -0
- package/esm2022/tableview/api/class/editor/class-editor-descriptor-helpers.mjs +95 -0
- package/esm2022/tableview/api/class/editor/class-editor-descriptor.factory.mjs +21 -0
- package/esm2022/tableview/api/class/index.mjs +13 -0
- package/esm2022/tableview/api/class/mediusinc-mng-commons-tableview-api-class.mjs +5 -0
- package/esm2022/tableview/api/class/tableview/class-tableview-attribute-converter.mjs +35 -0
- package/esm2022/tableview/api/class/tableview/class-tableview-attribute.model.mjs +2 -0
- package/esm2022/tableview/api/class/tableview/class-tableview-data-provider.factory.mjs +5 -0
- package/esm2022/tableview/api/class/tableview/class-tableview-descriptor-helpers.mjs +111 -0
- package/esm2022/tableview/api/class/tableview/class-tableview-descriptor.factory.mjs +26 -0
- package/esm2022/tableview/api/editor/data-providers/editor-data-provider.factory.mjs +14 -32
- package/esm2022/tableview/api/editor/data-providers/editor.data-provider.mjs +40 -7
- package/esm2022/tableview/api/editor/descriptors/editor-descriptor.factory.mjs +7 -73
- package/esm2022/tableview/api/editor/descriptors/editor.descriptor.mjs +49 -134
- package/esm2022/tableview/api/editor/descriptors/field-action.descriptor.mjs +14 -8
- package/esm2022/tableview/api/editor/descriptors/field-base.descriptor.mjs +11 -2
- package/esm2022/tableview/api/editor/descriptors/field-lookup.descriptor.mjs +3 -5
- package/esm2022/tableview/api/editor/descriptors/field-many.descriptor.mjs +2 -18
- package/esm2022/tableview/api/editor/descriptors/wrappers/editor-descriptor-nested-object-wrapper.mjs +51 -0
- package/esm2022/tableview/api/editor/models/editor-fields.model.mjs +1 -1
- package/esm2022/tableview/api/editor/models/form-editor.event.mjs +1 -1
- package/esm2022/tableview/api/editor/models/formly-custom-field.model.mjs +1 -1
- package/esm2022/tableview/api/index.mjs +9 -9
- package/esm2022/tableview/api/tableview/data-providers/tableview-data-provider.factory.mjs +13 -51
- package/esm2022/tableview/api/tableview/data-providers/tableview.data-provider.mjs +19 -11
- package/esm2022/tableview/api/tableview/descriptors/tableview-descriptor.factory.mjs +19 -96
- package/esm2022/tableview/api/tableview/descriptors/tableview.descriptor.mjs +29 -182
- package/esm2022/tableview/api/tableview/helpers/tableview-create.mjs +8 -6
- package/esm2022/tableview/api/tableview/helpers/tableview-data-provider-descriptor-convert.mjs +4 -4
- package/esm2022/tableview/api/tableview/helpers/tableview-default-actions.mjs +154 -106
- package/esm2022/tableview/api/tableview/helpers/tableview-input-builder.mjs +164 -7
- package/esm2022/tableview/api/tableview/models/tableview-descriptor-fields-manage-helper.type.mjs +2 -0
- package/esm2022/tableview/api/tableview/models/tableview-descriptor-helper.type.mjs +2 -0
- package/esm2022/tableview/api/tableview/models/tableview-input.model.mjs +1 -1
- package/esm2022/tableview/api/tableview/models/tableview-route.model.mjs +1 -1
- package/esm2022/tableview/editor/components/editor/form-editor.component.mjs +5 -8
- package/esm2022/tableview/editor/components/formly/fields/formly-field-action/formly-field-action.component.mjs +7 -5
- package/esm2022/tableview/editor/components/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +34 -23
- package/esm2022/tableview/editor/helpers/editor-field.mjs +3 -3
- package/esm2022/tableview/editor/helpers/editor-formly.mjs +4 -4
- package/esm2022/tableview/editor/helpers/field-create.mjs +21 -0
- package/esm2022/tableview/index.mjs +3 -2
- package/esm2022/tableview/provide.mjs +44 -1
- package/esm2022/tableview/tableview/components/route/tableview-route.component.mjs +1 -1
- package/esm2022/tableview/tableview/components/tableview/tableview.component.mjs +3 -1
- package/fesm2022/mediusinc-mng-commons-core.mjs +715 -792
- package/fesm2022/mediusinc-mng-commons-core.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-filter.mjs +10 -113
- package/fesm2022/mediusinc-mng-commons-filter.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-form-api.mjs +144 -203
- package/fesm2022/mediusinc-mng-commons-form-api.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-model-class.mjs +97 -0
- package/fesm2022/mediusinc-mng-commons-model-class.mjs.map +1 -0
- package/fesm2022/mediusinc-mng-commons-model.mjs +35 -144
- package/fesm2022/mediusinc-mng-commons-model.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-table-api-class.mjs +204 -0
- package/fesm2022/mediusinc-mng-commons-table-api-class.mjs.map +1 -0
- package/fesm2022/mediusinc-mng-commons-table-api.mjs +55 -319
- package/fesm2022/mediusinc-mng-commons-table-api.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-table.mjs +45 -38
- package/fesm2022/mediusinc-mng-commons-table.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-tableview-api-class.mjs +367 -0
- package/fesm2022/mediusinc-mng-commons-tableview-api-class.mjs.map +1 -0
- package/fesm2022/mediusinc-mng-commons-tableview-api.mjs +850 -1483
- package/fesm2022/mediusinc-mng-commons-tableview-api.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-tableview.mjs +421 -220
- package/fesm2022/mediusinc-mng-commons-tableview.mjs.map +1 -1
- package/filter/descriptors/filter-lookup.descriptor.d.ts +1 -26
- package/filter/descriptors/filter.descriptor.d.ts +5 -12
- package/form/api/data-providers/lookup-data-provider.factory.d.ts +17 -20
- package/form/api/data-providers/lookup.data-provider.d.ts +3 -3
- package/form/api/descriptors/action-button.descriptor.d.ts +11 -13
- package/form/api/descriptors/button-style.builder.d.ts +30 -44
- package/form/api/index.d.ts +1 -0
- package/form/api/models/button.model.d.ts +19 -0
- package/i18n/sl.json +56 -6
- package/model/class/README.md +8 -0
- package/model/class/data-providers/base-from-class-data-provider.factory.d.ts +3 -0
- package/model/class/descriptors/model-class.descriptor.d.ts +12 -0
- package/model/class/descriptors/type-class.descriptor.d.ts +3 -0
- package/model/{helpers → class/helpers}/model.d.ts +1 -2
- package/model/class/index.d.ts +4 -0
- package/model/data-providers/base-from-type-data-provider.factory.d.ts +13 -6
- package/model/descriptors/model.descriptor.d.ts +12 -27
- package/model/descriptors/type.descriptor.d.ts +0 -5
- package/model/helpers/i18n.d.ts +8 -3
- package/model/index.d.ts +0 -1
- package/package.json +25 -7
- package/table/api/class/README.md +10 -0
- package/table/api/{helpers/class-attribute-converter.d.ts → class/class-table-attribute-converter.d.ts} +2 -9
- package/table/api/{models → class}/class-table-attribute.model.d.ts +1 -1
- package/table/api/class/class-table-data-provider.factory.d.ts +4 -0
- package/table/api/{helpers/table-descriptor-helpers.d.ts → class/class-table-descriptor-helpers.d.ts} +2 -4
- package/table/api/class/class-table-descriptor.factory.d.ts +11 -0
- package/table/api/class/index.d.ts +5 -0
- package/table/api/data-providers/table-data-provider.factory.d.ts +17 -20
- package/table/api/data-providers/table.data-provider.d.ts +4 -12
- package/table/api/descriptors/column.descriptor.d.ts +5 -2
- package/table/api/descriptors/table-descriptor.factory.d.ts +3 -39
- package/table/api/descriptors/table.descriptor.d.ts +3 -3
- package/table/api/helpers/column-converter.d.ts +7 -0
- package/table/api/helpers/table-data-provider-descriptor-convert.d.ts +3 -3
- package/table/api/index.d.ts +1 -3
- package/table/api/models/table-columns.model.d.ts +2 -2
- package/table/components/column-value/column-value.component.d.ts +2 -0
- package/table/components/filter/filter-active-tag/filter-active-tag.component.d.ts +1 -1
- package/table/components/filter/filter-form/filter-form.component.d.ts +1 -1
- package/table/components/filter/filter-overlay-with-tag/filter-overlay-with-tag.component.d.ts +1 -1
- package/table/components/table/table.component.d.ts +0 -10
- package/table/helpers/notification.d.ts +10 -1
- package/tableview/action/components/action/action.component.d.ts +10 -13
- package/tableview/action/components/editor/action-editor.component.d.ts +1 -1
- package/tableview/action/components/editor/injector-context/action-editor-injector-context.component.d.ts +6 -5
- package/tableview/action/components/localization/data-language-dropdown.component.d.ts +3 -3
- package/tableview/action/components/table/action-table.component.d.ts +3 -3
- package/tableview/action/helpers/action-execution.d.ts +1 -1
- package/tableview/action/helpers/i18n.d.ts +36 -11
- package/tableview/action/helpers/notification.d.ts +37 -3
- package/tableview/action/models/execution/action-context.model.d.ts +3 -3
- package/tableview/action/models/execution/action-instance.model.d.ts +5 -5
- package/tableview/action/services/action-executor.service.d.ts +7 -7
- package/tableview/action/services/data-provider-executor.service.d.ts +16 -16
- package/tableview/action/services/view-container.service.d.ts +1 -1
- package/tableview/api/action/descriptors/action-descriptor.factory.d.ts +20 -31
- package/tableview/api/action/descriptors/action-editor-descriptor.factory.d.ts +18 -25
- package/tableview/api/action/descriptors/action-editor.descriptor.d.ts +39 -47
- package/tableview/api/action/descriptors/action-link-descriptor.factory.d.ts +21 -13
- package/tableview/api/action/descriptors/action-link.descriptor.d.ts +3 -3
- package/tableview/api/action/descriptors/action.descriptor.d.ts +49 -60
- package/tableview/api/action/descriptors/editor-action-descriptor.factory.d.ts +21 -0
- package/tableview/api/action/descriptors/editor-action-editor-descriptor.factory.d.ts +21 -0
- package/tableview/api/action/descriptors/table-action-descriptor.factory.d.ts +36 -0
- package/tableview/api/action/descriptors/table-action-editor-descriptor.factory.d.ts +40 -0
- package/tableview/api/action/helpers/data-provider-executors.d.ts +13 -8
- package/tableview/api/action/models/action-confirmation.model.d.ts +14 -0
- package/tableview/api/action/models/action-descriptor.types.d.ts +6 -2
- package/tableview/api/action/models/action-error.model.d.ts +1 -1
- package/tableview/api/action/models/execution/action-context-validation.model.d.ts +2 -2
- package/tableview/api/action/models/execution/action-context.model.d.ts +2 -2
- package/tableview/api/action/models/execution/action-instance.model.d.ts +1 -1
- package/tableview/api/action/models/tableview-action-default-categories.model.d.ts +5 -5
- package/tableview/api/action/services/data-provider-executor.service.d.ts +26 -25
- package/tableview/api/class/README.md +13 -0
- package/tableview/api/{editor/helpers/class-attribute-converter.d.ts → class/editor/class-editor-attribute-converter.d.ts} +2 -2
- package/tableview/api/{editor/models/class-tableview-attribute.model.d.ts → class/editor/class-editor-attribute.model.d.ts} +1 -1
- package/tableview/api/class/editor/class-editor-data-provider.factory.d.ts +4 -0
- package/tableview/api/{editor/helpers/editor-descriptor-helpers.d.ts → class/editor/class-editor-descriptor-helpers.d.ts} +2 -5
- package/tableview/api/class/editor/class-editor-descriptor.factory.d.ts +11 -0
- package/tableview/api/class/index.d.ts +10 -0
- package/tableview/api/{tableview/helpers/class-attribute-converter.d.ts → class/tableview/class-tableview-attribute-converter.d.ts} +1 -1
- package/tableview/api/{tableview/models → class/tableview}/class-tableview-attribute.model.d.ts +2 -2
- package/tableview/api/class/tableview/class-tableview-data-provider.factory.d.ts +4 -0
- package/tableview/api/{tableview/helpers/tableview-descriptor-helpers.d.ts → class/tableview/class-tableview-descriptor-helpers.d.ts} +1 -2
- package/tableview/api/class/tableview/class-tableview-descriptor.factory.d.ts +12 -0
- package/tableview/api/editor/data-providers/editor-data-provider.factory.d.ts +17 -16
- package/tableview/api/editor/data-providers/editor.data-provider.d.ts +64 -29
- package/tableview/api/editor/descriptors/editor-descriptor.factory.d.ts +5 -38
- package/tableview/api/editor/descriptors/editor.descriptor.d.ts +48 -112
- package/tableview/api/editor/descriptors/field-action.descriptor.d.ts +5 -5
- package/tableview/api/editor/descriptors/field-base.descriptor.d.ts +8 -1
- package/tableview/api/editor/descriptors/field-lookup.descriptor.d.ts +2 -3
- package/tableview/api/editor/descriptors/field-many.descriptor.d.ts +3 -11
- package/tableview/api/editor/descriptors/wrappers/editor-descriptor-nested-object-wrapper.d.ts +25 -0
- package/tableview/api/editor/models/editor-fields.model.d.ts +25 -21
- package/tableview/api/editor/models/form-editor.event.d.ts +0 -4
- package/tableview/api/index.d.ts +8 -7
- package/tableview/api/tableview/data-providers/tableview-data-provider.factory.d.ts +20 -25
- package/tableview/api/tableview/data-providers/tableview.data-provider.d.ts +22 -22
- package/tableview/api/tableview/descriptors/tableview-descriptor.factory.d.ts +20 -50
- package/tableview/api/tableview/descriptors/tableview.descriptor.d.ts +69 -163
- package/tableview/api/tableview/helpers/tableview-create.d.ts +18 -5
- package/tableview/api/tableview/helpers/tableview-data-provider-descriptor-convert.d.ts +2 -2
- package/tableview/api/tableview/helpers/tableview-default-actions.d.ts +73 -20
- package/tableview/api/tableview/helpers/tableview-input-builder.d.ts +87 -9
- package/tableview/api/tableview/models/tableview-descriptor-fields-manage-helper.type.d.ts +9 -0
- package/tableview/api/tableview/models/tableview-descriptor-helper.type.d.ts +2 -0
- package/tableview/api/tableview/models/tableview-input.model.d.ts +1 -1
- package/tableview/api/tableview/models/tableview-route.model.d.ts +1 -1
- package/tableview/editor/helpers/field-create.d.ts +9 -0
- package/tableview/index.d.ts +2 -1
- package/tableview/provide.d.ts +7 -0
- package/tableview/tableview/components/route/tableview-route.component.d.ts +1 -1
- package/tableview/tableview/components/tableview/tableview.component.d.ts +6 -6
- package/version-info.json +6 -6
- package/core/components/pages/error/error.page.component.d.ts +0 -11
- package/core/components/pages/not-found/not-found.page.component.d.ts +0 -11
- package/core/data-providers/base-data-provider.factory.d.ts +0 -13
- package/esm2022/core/components/pages/error/error.page.component.mjs +0 -24
- package/esm2022/core/components/pages/not-found/not-found.page.component.mjs +0 -24
- package/esm2022/core/data-providers/base-data-provider.factory.mjs +0 -28
- package/esm2022/model/helpers/model.mjs +0 -71
- package/esm2022/table/api/helpers/class-attribute-converter.mjs +0 -104
- package/esm2022/table/api/helpers/table-descriptor-helpers.mjs +0 -98
- package/esm2022/table/api/models/class-table-attribute.model.mjs +0 -2
- package/esm2022/tableview/api/action/descriptors/action-confirmation.descriptor.mjs +0 -88
- package/esm2022/tableview/api/editor/helpers/class-attribute-converter.mjs +0 -85
- package/esm2022/tableview/api/editor/helpers/editor-descriptor-helpers.mjs +0 -95
- package/esm2022/tableview/api/editor/models/class-tableview-attribute.model.mjs +0 -2
- package/esm2022/tableview/api/tableview/helpers/class-attribute-converter.mjs +0 -34
- package/esm2022/tableview/api/tableview/helpers/tableview-descriptor-helpers.mjs +0 -110
- package/esm2022/tableview/api/tableview/models/class-tableview-attribute.model.mjs +0 -2
- package/tableview/api/action/descriptors/action-confirmation.descriptor.d.ts +0 -37
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { computed, signal, Component, ChangeDetectionStrategy,
|
|
3
|
-
import * as
|
|
2
|
+
import { computed, signal, Component, ChangeDetectionStrategy, inject, Injector, ElementRef, ApplicationRef, ViewContainerRef, EventEmitter, EnvironmentInjector, createComponent, Directive, Input, Output, TemplateRef, input, effect, booleanAttribute, numberAttribute, Pipe, untracked, InjectionToken, DestroyRef, Injectable, APP_INITIALIZER, ErrorHandler } from '@angular/core';
|
|
3
|
+
import * as i4 from '@ngx-translate/core';
|
|
4
4
|
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
|
5
5
|
import * as i3 from 'primeng/confirmdialog';
|
|
6
6
|
import { ConfirmDialogModule } from 'primeng/confirmdialog';
|
|
@@ -10,16 +10,14 @@ import * as i1 from 'primeng/toast';
|
|
|
10
10
|
import { ToastModule } from 'primeng/toast';
|
|
11
11
|
import * as i2 from 'primeng/api';
|
|
12
12
|
import { PrimeNGConfig, MessageService, ConfirmationService } from 'primeng/api';
|
|
13
|
-
import { Router, NavigationEnd, RouterLink, NavigationStart, RouteConfigLoadStart, RouteConfigLoadEnd, NavigationCancel, NavigationError } from '@angular/router';
|
|
14
|
-
import * as i2$1 from 'primeng/button';
|
|
15
|
-
import { ButtonModule } from 'primeng/button';
|
|
16
|
-
import { takeUntilDestroyed, toObservable as toObservable$1 } from '@angular/core/rxjs-interop';
|
|
17
|
-
import { Title } from '@angular/platform-browser';
|
|
18
|
-
import { filter, map, first, catchError } from 'rxjs/operators';
|
|
19
|
-
import { DatePipe } from '@angular/common';
|
|
20
13
|
import { HttpErrorResponse, HttpClient, HttpBackend } from '@angular/common/http';
|
|
14
|
+
import { DatePipe } from '@angular/common';
|
|
21
15
|
import { isObservable, of, mergeMap, combineLatest, Observable, tap, ReplaySubject, Subject, take, throwError as throwError$1 } from 'rxjs';
|
|
16
|
+
import { map, filter, first, catchError } from 'rxjs/operators';
|
|
22
17
|
import 'reflect-metadata';
|
|
18
|
+
import { takeUntilDestroyed, toObservable as toObservable$1 } from '@angular/core/rxjs-interop';
|
|
19
|
+
import { Title } from '@angular/platform-browser';
|
|
20
|
+
import { Router, NavigationEnd, NavigationStart, RouteConfigLoadStart, RouteConfigLoadEnd, NavigationCancel, NavigationError } from '@angular/router';
|
|
23
21
|
import { DialogService } from 'primeng/dynamicdialog';
|
|
24
22
|
|
|
25
23
|
class NotificationWrapperComponent {
|
|
@@ -54,7 +52,7 @@ class NotificationWrapperComponent {
|
|
|
54
52
|
}
|
|
55
53
|
}
|
|
56
54
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: NotificationWrapperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
57
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.12", 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 ' + getMessageIcon(message)\"></span>\n <div class=\"p-toast-message-text\">\n <div class=\"p-toast-summary\">{{ message.summary }}</div>\n @if (message.detail) {\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 }\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 appendTo=\"body\"\n draggable=\"false\"\n modal=\"true\">\n <ng-template pTemplate=\"header\" mngDialogKeydownHandler>\n <span class=\"p-dialog-title font-bold mng-dialog-success\">\n <span [class]=\"'mr-2 pi ' + dialogNotificationIconClass()\"></span>\n {{ dialogNotification()?.summary ?? '' }}\n </span>\n </ng-template>\n <div class=\"mng-notification-details\">\n {{ dialogNotification()?.detail ?? '' }}\n </div>\n</p-dialog>\n", styles: [".mng-notification-details{white-space:pre-wrap;word-wrap:break-word}\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:
|
|
55
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.12", 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 ' + getMessageIcon(message)\"></span>\n <div class=\"p-toast-message-text\">\n <div class=\"p-toast-summary\">{{ message.summary }}</div>\n @if (message.detail) {\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 }\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 appendTo=\"body\"\n draggable=\"false\"\n modal=\"true\">\n <ng-template pTemplate=\"header\" mngDialogKeydownHandler>\n <span class=\"p-dialog-title font-bold mng-dialog-success\">\n <span [class]=\"'mr-2 pi ' + dialogNotificationIconClass()\"></span>\n {{ dialogNotification()?.summary ?? '' }}\n </span>\n </ng-template>\n <div class=\"mng-notification-details\">\n {{ dialogNotification()?.detail ?? '' }}\n </div>\n</p-dialog>\n", styles: [".mng-notification-details{white-space:pre-wrap;word-wrap:break-word}\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: i4.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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
58
56
|
}
|
|
59
57
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: NotificationWrapperComponent, decorators: [{
|
|
60
58
|
type: Component,
|
|
@@ -213,672 +211,155 @@ function angularDateFormatHasSeconds(ngDateFormat) {
|
|
|
213
211
|
return /[sS]/.test(ngDateFormat);
|
|
214
212
|
}
|
|
215
213
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
static { this.
|
|
228
|
-
static { this.
|
|
229
|
-
static { this.
|
|
230
|
-
static { this.
|
|
231
|
-
static { this.
|
|
232
|
-
static { this.
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}
|
|
239
|
-
static
|
|
240
|
-
|
|
241
|
-
}
|
|
242
|
-
static
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
-
static
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
214
|
+
class FilterMatchMode {
|
|
215
|
+
static { this.Equals = 'equals'; }
|
|
216
|
+
static { this.EqualsAbbr = 'eq'; }
|
|
217
|
+
static { this.NotEquals = 'notEquals'; }
|
|
218
|
+
static { this.NotEqualsAbbr = 'ne'; }
|
|
219
|
+
static { this.Contains = 'contains'; }
|
|
220
|
+
static { this.ContainsAbbr = 'cn'; }
|
|
221
|
+
static { this.NotContains = 'notContains'; }
|
|
222
|
+
static { this.NotContainsAbbr = 'nc'; }
|
|
223
|
+
static { this.In = 'in'; }
|
|
224
|
+
static { this.InAbbr = 'in'; }
|
|
225
|
+
static { this.NotIn = 'notIn'; }
|
|
226
|
+
static { this.NotInAbbr = 'ni'; }
|
|
227
|
+
static { this.StartsWith = 'startsWith'; }
|
|
228
|
+
static { this.StartsWithAbbr = 'sw'; }
|
|
229
|
+
static { this.EndsWith = 'endsWith'; }
|
|
230
|
+
static { this.EndsWithAbbr = 'ew'; }
|
|
231
|
+
static { this.LessThan = 'lessThan'; }
|
|
232
|
+
static { this.LessThanAbbr = 'lt'; }
|
|
233
|
+
static { this.LessThanOrEqualTo = 'lessThanOrEqualTo'; }
|
|
234
|
+
static { this.LessThanOrEqualToAbbr = 'le'; }
|
|
235
|
+
static { this.GreaterThan = 'greaterThan'; }
|
|
236
|
+
static { this.GreaterThanAbbr = 'gt'; }
|
|
237
|
+
static { this.GreaterThanOrEqualTo = 'greaterThanOrEqualTo'; }
|
|
238
|
+
static { this.GreaterThanOrEqualToAbbr = 'ge'; }
|
|
239
|
+
static { this.Between = 'between'; }
|
|
240
|
+
static { this.BetweenAbbr = 'bt'; }
|
|
241
|
+
static { this.Exists = 'exists'; }
|
|
242
|
+
static { this.ExistsAbbr = 'ex'; }
|
|
243
|
+
static { this.DoesNotExist = 'doesNotExist'; }
|
|
244
|
+
static { this.DoesNotExistAbbr = 'nx'; }
|
|
245
|
+
static getAbbreviation(mode) {
|
|
246
|
+
switch (mode) {
|
|
247
|
+
case FilterMatchMode.Equals:
|
|
248
|
+
return FilterMatchMode.EqualsAbbr;
|
|
249
|
+
case FilterMatchMode.NotEquals:
|
|
250
|
+
return FilterMatchMode.NotEqualsAbbr;
|
|
251
|
+
case FilterMatchMode.Contains:
|
|
252
|
+
return FilterMatchMode.ContainsAbbr;
|
|
253
|
+
case FilterMatchMode.NotContains:
|
|
254
|
+
return FilterMatchMode.NotContainsAbbr;
|
|
255
|
+
case FilterMatchMode.In:
|
|
256
|
+
return FilterMatchMode.InAbbr;
|
|
257
|
+
case FilterMatchMode.NotIn:
|
|
258
|
+
return FilterMatchMode.NotInAbbr;
|
|
259
|
+
case FilterMatchMode.StartsWith:
|
|
260
|
+
return FilterMatchMode.StartsWithAbbr;
|
|
261
|
+
case FilterMatchMode.EndsWith:
|
|
262
|
+
return FilterMatchMode.EndsWithAbbr;
|
|
263
|
+
case FilterMatchMode.LessThan:
|
|
264
|
+
return FilterMatchMode.LessThanAbbr;
|
|
265
|
+
case FilterMatchMode.LessThanOrEqualTo:
|
|
266
|
+
return FilterMatchMode.LessThanOrEqualToAbbr;
|
|
267
|
+
case FilterMatchMode.GreaterThan:
|
|
268
|
+
return FilterMatchMode.GreaterThanAbbr;
|
|
269
|
+
case FilterMatchMode.GreaterThanOrEqualTo:
|
|
270
|
+
return FilterMatchMode.GreaterThanOrEqualToAbbr;
|
|
271
|
+
case FilterMatchMode.Between:
|
|
272
|
+
return FilterMatchMode.BetweenAbbr;
|
|
273
|
+
case FilterMatchMode.Exists:
|
|
274
|
+
return FilterMatchMode.ExistsAbbr;
|
|
275
|
+
case FilterMatchMode.DoesNotExist:
|
|
276
|
+
return FilterMatchMode.DoesNotExistAbbr;
|
|
277
|
+
default:
|
|
278
|
+
return null;
|
|
259
279
|
}
|
|
260
|
-
LoggerService._entriesBuffer.forEach(e => this._instance._log(e));
|
|
261
|
-
LoggerService._entriesBuffer = [];
|
|
262
280
|
}
|
|
263
|
-
static
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
281
|
+
static fromAbbreviation(abbr) {
|
|
282
|
+
switch (abbr) {
|
|
283
|
+
case FilterMatchMode.EqualsAbbr:
|
|
284
|
+
return FilterMatchMode.Equals;
|
|
285
|
+
case FilterMatchMode.NotEqualsAbbr:
|
|
286
|
+
return FilterMatchMode.NotEquals;
|
|
287
|
+
case FilterMatchMode.ContainsAbbr:
|
|
288
|
+
return FilterMatchMode.Contains;
|
|
289
|
+
case FilterMatchMode.NotContainsAbbr:
|
|
290
|
+
return FilterMatchMode.NotContains;
|
|
291
|
+
case FilterMatchMode.InAbbr:
|
|
292
|
+
return FilterMatchMode.In;
|
|
293
|
+
case FilterMatchMode.NotInAbbr:
|
|
294
|
+
return FilterMatchMode.NotIn;
|
|
295
|
+
case FilterMatchMode.StartsWithAbbr:
|
|
296
|
+
return FilterMatchMode.StartsWith;
|
|
297
|
+
case FilterMatchMode.EndsWithAbbr:
|
|
298
|
+
return FilterMatchMode.EndsWith;
|
|
299
|
+
case FilterMatchMode.LessThanAbbr:
|
|
300
|
+
return FilterMatchMode.LessThan;
|
|
301
|
+
case FilterMatchMode.LessThanOrEqualToAbbr:
|
|
302
|
+
return FilterMatchMode.LessThanOrEqualTo;
|
|
303
|
+
case FilterMatchMode.GreaterThanAbbr:
|
|
304
|
+
return FilterMatchMode.GreaterThan;
|
|
305
|
+
case FilterMatchMode.GreaterThanOrEqualToAbbr:
|
|
306
|
+
return FilterMatchMode.GreaterThanOrEqualTo;
|
|
307
|
+
case FilterMatchMode.BetweenAbbr:
|
|
308
|
+
return FilterMatchMode.Between;
|
|
309
|
+
case FilterMatchMode.ExistsAbbr:
|
|
310
|
+
return FilterMatchMode.Exists;
|
|
311
|
+
case FilterMatchMode.DoesNotExistAbbr:
|
|
312
|
+
return FilterMatchMode.DoesNotExist;
|
|
313
|
+
default:
|
|
314
|
+
return null;
|
|
272
315
|
}
|
|
273
|
-
const logger = new LoggerService();
|
|
274
|
-
logger.category = category;
|
|
275
|
-
LoggerService._categoryInstances[category] = logger;
|
|
276
|
-
return logger;
|
|
277
316
|
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
logEntry.error = msgOrError;
|
|
291
|
-
}
|
|
292
|
-
else if (data?.length && data[0] instanceof Error) {
|
|
293
|
-
// if first data is error, also consider as error
|
|
294
|
-
logEntry.error = data[0];
|
|
295
|
-
logEntry.data = data.splice(1);
|
|
296
|
-
}
|
|
297
|
-
this._log(logEntry);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Converts a TableLazyLoadEvent to DataListParams.
|
|
321
|
+
*
|
|
322
|
+
* @param {TableLazyLoadEvent} event - The event containing the data to convert.
|
|
323
|
+
* @return {DataListParams} - The converted DataListParams object.
|
|
324
|
+
*/
|
|
325
|
+
function fromTableLoadToDataListParams(event) {
|
|
326
|
+
const params = {};
|
|
327
|
+
if (event.first != null) {
|
|
328
|
+
params.offset = event.first;
|
|
298
329
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
const timestampFormatted = this.datePipe.transform(timestamp, LoggerService._timestampFormat) ?? dateToIsoString(timestamp);
|
|
302
|
-
return [timestamp, timestampFormatted];
|
|
330
|
+
if (event.rows != null) {
|
|
331
|
+
params.limit = event.rows;
|
|
303
332
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
// add to buffer
|
|
307
|
-
LoggerService._entriesBuffer.push(log);
|
|
308
|
-
return;
|
|
309
|
-
}
|
|
310
|
-
const logConfig = (LoggerService._configurationService?.getConfigValue)?.('log');
|
|
311
|
-
if ((this.category && log.level < (logConfig?.category?.[this.category]?.level ?? logConfig?.level ?? this.defaultLogLevel)) ||
|
|
312
|
-
(!this.category && log.level < (logConfig?.level ?? this.defaultLogLevel))) {
|
|
313
|
-
return;
|
|
314
|
-
}
|
|
315
|
-
if (logConfig?.timestampFormat) {
|
|
316
|
-
log.timestampFormatted = this.datePipe.transform(log.timestamp, logConfig.timestampFormat) ?? undefined;
|
|
317
|
-
}
|
|
318
|
-
LoggerService._publishers.forEach(p => p.addEntry(log));
|
|
333
|
+
if (typeof event.globalFilter === 'string') {
|
|
334
|
+
params.search = event.globalFilter;
|
|
319
335
|
}
|
|
320
|
-
|
|
321
|
-
|
|
336
|
+
else if (Array.isArray(event.globalFilter) && event.globalFilter.length > 0) {
|
|
337
|
+
params.search = event.globalFilter[0];
|
|
322
338
|
}
|
|
323
|
-
|
|
324
|
-
|
|
339
|
+
if (Array.isArray(event.multiSortMeta) && event.multiSortMeta.length > 0) {
|
|
340
|
+
params.sort = event.multiSortMeta.map(m => ({ property: m.field, ascending: m.order >= 0 }));
|
|
325
341
|
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
}
|
|
348
|
-
error(msgOrError, ...data) {
|
|
349
|
-
this._processLog(msgOrError, LogLevelEnum.Error, undefined, data);
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
const BROWSER_STORAGE_IT = new InjectionToken('BROWSER_STORAGE');
|
|
354
|
-
|
|
355
|
-
const COMMONS_MODULE_CONFIG_IT = new InjectionToken('COMMONS_MODULE_CONFIG');
|
|
356
|
-
|
|
357
|
-
class CommonsService {
|
|
358
|
-
getDefaultLocale() {
|
|
359
|
-
const browserLang = this.translate.getBrowserLang();
|
|
360
|
-
if (browserLang && this.appLocales().some(l => l === browserLang)) {
|
|
361
|
-
return browserLang;
|
|
362
|
-
}
|
|
363
|
-
return this.appLocales()?.length > 0 ? this.appLocales()[0] : 'en';
|
|
364
|
-
}
|
|
365
|
-
initAppLocale() {
|
|
366
|
-
const lsLang = this.localStorage.getItem('lang');
|
|
367
|
-
if (lsLang && this.appLocales().some(l => l === lsLang)) {
|
|
368
|
-
return lsLang;
|
|
369
|
-
}
|
|
370
|
-
return this.getDefaultLocale();
|
|
371
|
-
}
|
|
372
|
-
setAppLocale(language) {
|
|
373
|
-
if (this.appLocales().some(l => l === language)) {
|
|
374
|
-
this.translate.use(language);
|
|
375
|
-
this._appLocale.set(language);
|
|
376
|
-
if (language !== this.getDefaultLocale())
|
|
377
|
-
this.localStorage.setItem('lang', language);
|
|
378
|
-
else
|
|
379
|
-
this.localStorage.removeItem('lang');
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
clearAppLocale() {
|
|
383
|
-
this.localStorage.removeItem('lang');
|
|
384
|
-
this._appLocale.set(this.getDefaultLocale());
|
|
385
|
-
}
|
|
386
|
-
initAppDataLocale() {
|
|
387
|
-
const dataLang = this.localStorage.getItem('dataLang');
|
|
388
|
-
if (dataLang && this.appDataLocales().some(dl => dl === dataLang)) {
|
|
389
|
-
return dataLang;
|
|
390
|
-
}
|
|
391
|
-
return this.appDataLocales()?.length > 0 ? this.getDefaultLocale() : 'en';
|
|
392
|
-
}
|
|
393
|
-
setAppDataLocale(dataLocale) {
|
|
394
|
-
if (this.appDataLocales().some(dl => dl === dataLocale)) {
|
|
395
|
-
this._appDataLocale.set(dataLocale);
|
|
396
|
-
if (dataLocale !== this.getDefaultLocale())
|
|
397
|
-
this.localStorage.setItem('dataLang', dataLocale);
|
|
398
|
-
else
|
|
399
|
-
this.localStorage.removeItem('dataLang');
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
clearAppDataLocale() {
|
|
403
|
-
this.localStorage.removeItem('lang');
|
|
404
|
-
this._appDataLocale.set(this.getDefaultLocale());
|
|
405
|
-
}
|
|
406
|
-
constructor() {
|
|
407
|
-
// internal
|
|
408
|
-
this.logger = inject(LoggerService).create('CommonsService');
|
|
409
|
-
this.router = inject(Router);
|
|
410
|
-
this.primengConfig = inject(PrimeNGConfig);
|
|
411
|
-
this.translate = inject(TranslateService);
|
|
412
|
-
this.titleService = inject(Title);
|
|
413
|
-
this.moduleConfig = inject(COMMONS_MODULE_CONFIG_IT, { optional: true });
|
|
414
|
-
this.localStorage = inject(BROWSER_STORAGE_IT);
|
|
415
|
-
this.destroyRef = inject(DestroyRef);
|
|
416
|
-
// breadcrumbs
|
|
417
|
-
this.breadcrumbHome = signal({
|
|
418
|
-
icon: 'pi pi-home',
|
|
419
|
-
routerLink: '/'
|
|
420
|
-
});
|
|
421
|
-
this.breadcrumbs = signal([]);
|
|
422
|
-
// visual
|
|
423
|
-
/**
|
|
424
|
-
* @deprecated Use layout colorScheme instead.
|
|
425
|
-
*/
|
|
426
|
-
this.colorScheme = signal(this.moduleConfig?.app?.colorScheme ?? 'light');
|
|
427
|
-
/**
|
|
428
|
-
* @deprecated Use layout colorScheme instead.
|
|
429
|
-
*/
|
|
430
|
-
this.colorSchemeIsLight = computed(() => this.colorScheme() === 'light');
|
|
431
|
-
// user
|
|
432
|
-
this.user = signal(undefined);
|
|
433
|
-
this.userRoles = signal([]);
|
|
434
|
-
// APP section
|
|
435
|
-
this.appName = signal(this.moduleConfig?.app?.name ?? 'app.name');
|
|
436
|
-
this.appOwner = signal(this.moduleConfig?.app?.owner ?? 'app.owner');
|
|
437
|
-
/**
|
|
438
|
-
* @deprecated Use layout app logo instead.
|
|
439
|
-
*/
|
|
440
|
-
this.appLogoLight = signal(this.moduleConfig?.app?.logoPathLight ? this.moduleConfig.app.logoPathLight : (this.moduleConfig?.app?.logoPath ?? 'assets/layout/images/logo.png'));
|
|
441
|
-
/**
|
|
442
|
-
* @deprecated Use layout app logo instead.
|
|
443
|
-
*/
|
|
444
|
-
this.appLogoDark = signal(this.moduleConfig?.app?.logoPathDark ? this.moduleConfig.app.logoPathDark : (this.moduleConfig?.app?.logoPath ?? 'assets/layout/images/logo.png'));
|
|
445
|
-
/**
|
|
446
|
-
* @deprecated Use layout app logo instead.
|
|
447
|
-
*/
|
|
448
|
-
this.appLogo = computed(() => (this.colorSchemeIsLight() ? this.appLogoLight() : this.appLogoDark()));
|
|
449
|
-
/**
|
|
450
|
-
* @deprecated Use layout app logo instead.
|
|
451
|
-
*/
|
|
452
|
-
this.appLogoNameLight = signal(this.moduleConfig?.app?.logoNamePathLight ? this.moduleConfig.app.logoNamePathLight : (this.moduleConfig?.app?.logoNamePath ?? 'assets/layout/images/logo-appname.png'));
|
|
453
|
-
/**
|
|
454
|
-
* @deprecated Use layout app logo instead.
|
|
455
|
-
*/
|
|
456
|
-
this.appLogoNameDark = signal(this.moduleConfig?.app?.logoNamePathDark ? this.moduleConfig.app.logoNamePathDark : (this.moduleConfig?.app?.logoNamePath ?? 'assets/layout/images/logo-appname.png'));
|
|
457
|
-
/**
|
|
458
|
-
* @deprecated Use layout app logo instead.
|
|
459
|
-
*/
|
|
460
|
-
this.appLogoName = computed(() => (this.colorSchemeIsLight() ? this.appLogoNameLight() : this.appLogoNameDark()));
|
|
461
|
-
this.appLocales = signal(this.moduleConfig?.app?.locales ?? ['en']);
|
|
462
|
-
this._appLocale = signal(this.initAppLocale());
|
|
463
|
-
this.appLocale = computed(() => this._appLocale());
|
|
464
|
-
this.appDataLocales = signal(this.moduleConfig?.app?.dataLocales ?? ['en']);
|
|
465
|
-
this._appDataLocale = signal(this.initAppDataLocale());
|
|
466
|
-
this.appDataLocale = computed(() => this._appDataLocale());
|
|
467
|
-
this.appVersion = signal(this.moduleConfig?.app?.version);
|
|
468
|
-
// ripple
|
|
469
|
-
this.primengConfig.ripple = true;
|
|
470
|
-
effect(() => {
|
|
471
|
-
const appLocales = this.appLocales();
|
|
472
|
-
if (appLocales) {
|
|
473
|
-
this.setAppLocale(this.initAppLocale());
|
|
474
|
-
this.translate.langs = this.appLocales();
|
|
475
|
-
}
|
|
476
|
-
const appDataLocales = this.appDataLocales();
|
|
477
|
-
if (appDataLocales)
|
|
478
|
-
this.setAppDataLocale(this.initAppDataLocale());
|
|
479
|
-
}, { allowSignalWrites: true });
|
|
480
|
-
this.router.events
|
|
481
|
-
.pipe(
|
|
482
|
-
// Filter the NavigationEnd events as the breadcrumb is updated only when the route reaches its end
|
|
483
|
-
filter(event => event instanceof NavigationEnd), takeUntilDestroyed())
|
|
484
|
-
.subscribe(() => {
|
|
485
|
-
this.updateBreadcrumbs();
|
|
486
|
-
this.setPageTitle();
|
|
487
|
-
});
|
|
488
|
-
this.translate.onLangChange.pipe(takeUntilDestroyed()).subscribe(() => {
|
|
489
|
-
this.updateBreadcrumbs();
|
|
490
|
-
this.setPageTitle();
|
|
491
|
-
});
|
|
492
|
-
this.translate
|
|
493
|
-
.stream('mngPrime')
|
|
494
|
-
.pipe(takeUntilDestroyed())
|
|
495
|
-
.subscribe(value => this.primengConfig.setTranslation(value));
|
|
496
|
-
}
|
|
497
|
-
initialize() {
|
|
498
|
-
this.logger.debug('Initialize');
|
|
499
|
-
}
|
|
500
|
-
// BREADCRUMB actions
|
|
501
|
-
findBreadcrumbItem(item) {
|
|
502
|
-
const items = this.breadcrumbs();
|
|
503
|
-
if (item.id) {
|
|
504
|
-
return items.find(i => i.id && i.id === item.id) ?? null;
|
|
505
|
-
}
|
|
506
|
-
else if (item.routerLink) {
|
|
507
|
-
const routerLinkStr = Array.isArray(item.routerLink) ? item.routerLink.join('/') : item.routerLink;
|
|
508
|
-
return items.find(i => i.routerLink && (Array.isArray(i.routerLink) ? i.routerLink.join('/') : i.routerLink) === routerLinkStr) ?? null;
|
|
509
|
-
}
|
|
510
|
-
else if (item.positionIndex) {
|
|
511
|
-
return items.find(i => i.positionIndex && i.positionIndex === i.positionIndex) ?? null;
|
|
512
|
-
}
|
|
513
|
-
else if (item.label) {
|
|
514
|
-
return items.find(i => i.label && i.label === i.label) ?? null;
|
|
515
|
-
}
|
|
516
|
-
else if (item.icon) {
|
|
517
|
-
return items.find(i => i.icon && i.icon === i.icon) ?? null;
|
|
518
|
-
}
|
|
519
|
-
return null;
|
|
520
|
-
}
|
|
521
|
-
updateBreadcrumbItem(item) {
|
|
522
|
-
const items = [...this.breadcrumbs()];
|
|
523
|
-
let posIdx = -1;
|
|
524
|
-
if (item.id) {
|
|
525
|
-
posIdx = items.findIndex(i => i.id && i.id === item.id);
|
|
526
|
-
}
|
|
527
|
-
else if (item.routerLink) {
|
|
528
|
-
const routerLinkStr = Array.isArray(item.routerLink) ? item.routerLink.join('/') : item.routerLink;
|
|
529
|
-
posIdx = items.findIndex(i => i.routerLink && (Array.isArray(i.routerLink) ? i.routerLink.join('/') : i.routerLink) === routerLinkStr);
|
|
530
|
-
}
|
|
531
|
-
else if (item.positionIndex) {
|
|
532
|
-
posIdx = items.findIndex(i => i.positionIndex && i.positionIndex === i.positionIndex);
|
|
533
|
-
}
|
|
534
|
-
else if (item.label) {
|
|
535
|
-
posIdx = items.findIndex(i => i.label && i.label === i.label);
|
|
536
|
-
}
|
|
537
|
-
else if (item.icon) {
|
|
538
|
-
posIdx = items.findIndex(i => i.icon && i.icon === i.icon);
|
|
539
|
-
}
|
|
540
|
-
if (posIdx < 0) {
|
|
541
|
-
return false;
|
|
542
|
-
}
|
|
543
|
-
items[posIdx] = {
|
|
544
|
-
...items[posIdx],
|
|
545
|
-
...item,
|
|
546
|
-
updated: true
|
|
547
|
-
};
|
|
548
|
-
this.breadcrumbs.set(items);
|
|
549
|
-
return true;
|
|
550
|
-
}
|
|
551
|
-
updateBreadcrumbs() {
|
|
552
|
-
if (this.breadcrumbsTranslateSubscription) {
|
|
553
|
-
this.breadcrumbsTranslateSubscription.unsubscribe();
|
|
554
|
-
this.breadcrumbsTranslateSubscription = undefined;
|
|
555
|
-
}
|
|
556
|
-
if (this.breadcrumbHomeTranslateSubscription) {
|
|
557
|
-
this.breadcrumbHomeTranslateSubscription.unsubscribe();
|
|
558
|
-
this.breadcrumbHomeTranslateSubscription = undefined;
|
|
559
|
-
}
|
|
560
|
-
const rootRoute = this.router.routerState.snapshot.root;
|
|
561
|
-
const homeBreadcrumb = this.generateHomeBreadcrumb(rootRoute);
|
|
562
|
-
if (homeBreadcrumb) {
|
|
563
|
-
if (homeBreadcrumb.label) {
|
|
564
|
-
this.breadcrumbHomeTranslateSubscription = this.translate
|
|
565
|
-
.get(homeBreadcrumb.label)
|
|
566
|
-
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
567
|
-
.subscribe(i18n => {
|
|
568
|
-
homeBreadcrumb.label = i18n;
|
|
569
|
-
this.breadcrumbHome.set(homeBreadcrumb);
|
|
570
|
-
});
|
|
571
|
-
}
|
|
572
|
-
else {
|
|
573
|
-
this.breadcrumbHome.set(homeBreadcrumb);
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
const breadcrumbs = [];
|
|
577
|
-
this.generateBreadcrumbs(rootRoute, [], breadcrumbs);
|
|
578
|
-
breadcrumbs.forEach((b, idx) => {
|
|
579
|
-
b.positionIndex = idx;
|
|
580
|
-
});
|
|
581
|
-
const i18nKeys = breadcrumbs.filter(b => typeof b.label === 'string').map(b => b.label);
|
|
582
|
-
if (i18nKeys.length > 0) {
|
|
583
|
-
this.breadcrumbsTranslateSubscription = this.translate
|
|
584
|
-
.get(i18nKeys)
|
|
585
|
-
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
586
|
-
.subscribe(i18n => {
|
|
587
|
-
// Construct the breadcrumb hierarchy
|
|
588
|
-
breadcrumbs.forEach(b => {
|
|
589
|
-
if (b.label && i18n[b.label]) {
|
|
590
|
-
b.label = i18n[b.label];
|
|
591
|
-
}
|
|
592
|
-
});
|
|
593
|
-
// Emit the new breadcrumbs
|
|
594
|
-
this.breadcrumbs.set(breadcrumbs);
|
|
595
|
-
});
|
|
596
|
-
}
|
|
597
|
-
else {
|
|
598
|
-
this.breadcrumbs.set(breadcrumbs);
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
generateHomeBreadcrumb(route) {
|
|
602
|
-
if (!route) {
|
|
603
|
-
return null;
|
|
604
|
-
}
|
|
605
|
-
const routeData = route.data;
|
|
606
|
-
const breadcrumbRouteData = routeData?.breadcrumb;
|
|
607
|
-
if (breadcrumbRouteData && typeof breadcrumbRouteData === 'object' && 'isHome' in breadcrumbRouteData) {
|
|
608
|
-
if (breadcrumbRouteData.isHome === false) {
|
|
609
|
-
return null;
|
|
610
|
-
}
|
|
611
|
-
const breadcrumb = this.createBreadcrumb('/', breadcrumbRouteData, true);
|
|
612
|
-
if (breadcrumb) {
|
|
613
|
-
if (typeof breadcrumb.icon === 'undefined') {
|
|
614
|
-
breadcrumb.icon = 'pi pi-home';
|
|
615
|
-
}
|
|
616
|
-
return breadcrumb;
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
else {
|
|
620
|
-
return this.generateHomeBreadcrumb(route.firstChild);
|
|
621
|
-
}
|
|
622
|
-
return null;
|
|
623
|
-
}
|
|
624
|
-
generateBreadcrumbs(route, parentUrlSegments, breadcrumbs) {
|
|
625
|
-
if (!route) {
|
|
626
|
-
return;
|
|
627
|
-
}
|
|
628
|
-
const routeData = route.data;
|
|
629
|
-
const routeUrlSegments = parentUrlSegments.concat(route.url.map(url => url.path));
|
|
630
|
-
const routeUrl = `/${routeUrlSegments.join('/')}`;
|
|
631
|
-
if (routeData?.breadcrumb) {
|
|
632
|
-
const breadcrumbRouteData = routeData.breadcrumb;
|
|
633
|
-
if (Array.isArray(breadcrumbRouteData)) {
|
|
634
|
-
for (const breadcrumbRouteDataItem of breadcrumbRouteData) {
|
|
635
|
-
const breadcrumb = this.createBreadcrumb(routeUrl, breadcrumbRouteDataItem);
|
|
636
|
-
if (breadcrumb) {
|
|
637
|
-
breadcrumbs.push(breadcrumb);
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
else if (typeof breadcrumbRouteData === 'function') {
|
|
642
|
-
breadcrumbs.push(...breadcrumbRouteData(routeUrl, route));
|
|
643
|
-
}
|
|
644
|
-
else {
|
|
645
|
-
const breadcrumb = this.createBreadcrumb(routeUrl, breadcrumbRouteData);
|
|
646
|
-
if (breadcrumb) {
|
|
647
|
-
breadcrumbs.push(breadcrumb);
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
this.generateBreadcrumbs(route.firstChild, routeUrlSegments, breadcrumbs);
|
|
652
|
-
}
|
|
653
|
-
createBreadcrumb(routeUrl, routeBreadcrumb, includeHome = false) {
|
|
654
|
-
const existingBreadcrumb = this.findBreadcrumbItem({ routerLink: routeUrl });
|
|
655
|
-
if (existingBreadcrumb?.updated) {
|
|
656
|
-
return existingBreadcrumb;
|
|
657
|
-
}
|
|
658
|
-
if (typeof routeBreadcrumb === 'string') {
|
|
659
|
-
// check for updated existing breadcrumb
|
|
660
|
-
return {
|
|
661
|
-
id: routeUrl,
|
|
662
|
-
label: routeBreadcrumb,
|
|
663
|
-
routerLink: routeUrl
|
|
664
|
-
};
|
|
665
|
-
}
|
|
666
|
-
else {
|
|
667
|
-
if (!includeHome && typeof routeBreadcrumb.isHome !== 'undefined') {
|
|
668
|
-
// home should not be included
|
|
669
|
-
return null;
|
|
670
|
-
}
|
|
671
|
-
if (typeof routeBreadcrumb.routerLink === 'undefined') {
|
|
672
|
-
routeBreadcrumb.routerLink = routeUrl;
|
|
673
|
-
}
|
|
674
|
-
routeBreadcrumb.id = routeUrl;
|
|
675
|
-
return routeBreadcrumb;
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
// TITLE section
|
|
679
|
-
setPageTitle(title) {
|
|
680
|
-
let currentRoute = this.router.routerState.snapshot.root;
|
|
681
|
-
while (currentRoute.firstChild) {
|
|
682
|
-
currentRoute = currentRoute.firstChild;
|
|
683
|
-
}
|
|
684
|
-
const routeData = currentRoute.data;
|
|
685
|
-
const pageTitle = title ?? routeData.pageTitle;
|
|
686
|
-
this.titleService.setTitle(this.formatPageTitle(pageTitle));
|
|
687
|
-
}
|
|
688
|
-
formatPageTitle(titlePrefix) {
|
|
689
|
-
const titlePieces = [];
|
|
690
|
-
if (titlePrefix) {
|
|
691
|
-
titlePieces.push(this.translate.instant(titlePrefix));
|
|
692
|
-
}
|
|
693
|
-
titlePieces.push(this.translate.instant('app.name'));
|
|
694
|
-
return titlePieces.join(' - ');
|
|
695
|
-
}
|
|
696
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: CommonsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
697
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: CommonsService }); }
|
|
698
|
-
}
|
|
699
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: CommonsService, decorators: [{
|
|
700
|
-
type: Injectable
|
|
701
|
-
}], ctorParameters: () => [] });
|
|
702
|
-
|
|
703
|
-
/**
|
|
704
|
-
* @deprecated Use ErrorPageComponent from layout instead.
|
|
705
|
-
*/
|
|
706
|
-
class ErrorPageComponent {
|
|
707
|
-
constructor(commons) {
|
|
708
|
-
this.commons = commons;
|
|
709
|
-
}
|
|
710
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: ErrorPageComponent, deps: [{ token: CommonsService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
711
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.12", type: ErrorPageComponent, isStandalone: true, selector: "mng-error-page-deprecated", 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.appLogo()\" class=\"exception-logo\" alt=\"App logo\" />\n <img [src]=\"commons.appLogoName()\" 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", "severity", "raised", "rounded", "text", "outlined", "size", "plain"] }, { 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 }); }
|
|
712
|
-
}
|
|
713
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: ErrorPageComponent, decorators: [{
|
|
714
|
-
type: Component,
|
|
715
|
-
args: [{ standalone: true, selector: 'mng-error-page-deprecated', 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.appLogo()\" class=\"exception-logo\" alt=\"App logo\" />\n <img [src]=\"commons.appLogoName()\" 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"] }]
|
|
716
|
-
}], ctorParameters: () => [{ type: CommonsService }] });
|
|
717
|
-
|
|
718
|
-
/**
|
|
719
|
-
* @deprecated Use ErrorPageComponent from layout instead.
|
|
720
|
-
*/
|
|
721
|
-
class NotFoundPageComponent {
|
|
722
|
-
constructor(commons) {
|
|
723
|
-
this.commons = commons;
|
|
724
|
-
}
|
|
725
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: NotFoundPageComponent, deps: [{ token: CommonsService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
726
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.12", type: NotFoundPageComponent, isStandalone: true, selector: "mng-not-found-page-deprecated", 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.appLogo()\" class=\"exception-logo\" alt=\"App logo\" />\n <img [src]=\"commons.appLogoName()\" 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", "severity", "raised", "rounded", "text", "outlined", "size", "plain"] }, { 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 }); }
|
|
727
|
-
}
|
|
728
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: NotFoundPageComponent, decorators: [{
|
|
729
|
-
type: Component,
|
|
730
|
-
args: [{ standalone: true, selector: 'mng-not-found-page-deprecated', 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.appLogo()\" class=\"exception-logo\" alt=\"App logo\" />\n <img [src]=\"commons.appLogoName()\" 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"] }]
|
|
731
|
-
}], ctorParameters: () => [{ type: CommonsService }] });
|
|
732
|
-
|
|
733
|
-
class FilterMatchMode {
|
|
734
|
-
static { this.Equals = 'equals'; }
|
|
735
|
-
static { this.EqualsAbbr = 'eq'; }
|
|
736
|
-
static { this.NotEquals = 'notEquals'; }
|
|
737
|
-
static { this.NotEqualsAbbr = 'ne'; }
|
|
738
|
-
static { this.Contains = 'contains'; }
|
|
739
|
-
static { this.ContainsAbbr = 'cn'; }
|
|
740
|
-
static { this.NotContains = 'notContains'; }
|
|
741
|
-
static { this.NotContainsAbbr = 'nc'; }
|
|
742
|
-
static { this.In = 'in'; }
|
|
743
|
-
static { this.InAbbr = 'in'; }
|
|
744
|
-
static { this.NotIn = 'notIn'; }
|
|
745
|
-
static { this.NotInAbbr = 'ni'; }
|
|
746
|
-
static { this.StartsWith = 'startsWith'; }
|
|
747
|
-
static { this.StartsWithAbbr = 'sw'; }
|
|
748
|
-
static { this.EndsWith = 'endsWith'; }
|
|
749
|
-
static { this.EndsWithAbbr = 'ew'; }
|
|
750
|
-
static { this.LessThan = 'lessThan'; }
|
|
751
|
-
static { this.LessThanAbbr = 'lt'; }
|
|
752
|
-
static { this.LessThanOrEqualTo = 'lessThanOrEqualTo'; }
|
|
753
|
-
static { this.LessThanOrEqualToAbbr = 'le'; }
|
|
754
|
-
static { this.GreaterThan = 'greaterThan'; }
|
|
755
|
-
static { this.GreaterThanAbbr = 'gt'; }
|
|
756
|
-
static { this.GreaterThanOrEqualTo = 'greaterThanOrEqualTo'; }
|
|
757
|
-
static { this.GreaterThanOrEqualToAbbr = 'ge'; }
|
|
758
|
-
static { this.Between = 'between'; }
|
|
759
|
-
static { this.BetweenAbbr = 'bt'; }
|
|
760
|
-
static { this.Exists = 'exists'; }
|
|
761
|
-
static { this.ExistsAbbr = 'ex'; }
|
|
762
|
-
static { this.DoesNotExist = 'doesNotExist'; }
|
|
763
|
-
static { this.DoesNotExistAbbr = 'nx'; }
|
|
764
|
-
static getAbbreviation(mode) {
|
|
765
|
-
switch (mode) {
|
|
766
|
-
case FilterMatchMode.Equals:
|
|
767
|
-
return FilterMatchMode.EqualsAbbr;
|
|
768
|
-
case FilterMatchMode.NotEquals:
|
|
769
|
-
return FilterMatchMode.NotEqualsAbbr;
|
|
770
|
-
case FilterMatchMode.Contains:
|
|
771
|
-
return FilterMatchMode.ContainsAbbr;
|
|
772
|
-
case FilterMatchMode.NotContains:
|
|
773
|
-
return FilterMatchMode.NotContainsAbbr;
|
|
774
|
-
case FilterMatchMode.In:
|
|
775
|
-
return FilterMatchMode.InAbbr;
|
|
776
|
-
case FilterMatchMode.NotIn:
|
|
777
|
-
return FilterMatchMode.NotInAbbr;
|
|
778
|
-
case FilterMatchMode.StartsWith:
|
|
779
|
-
return FilterMatchMode.StartsWithAbbr;
|
|
780
|
-
case FilterMatchMode.EndsWith:
|
|
781
|
-
return FilterMatchMode.EndsWithAbbr;
|
|
782
|
-
case FilterMatchMode.LessThan:
|
|
783
|
-
return FilterMatchMode.LessThanAbbr;
|
|
784
|
-
case FilterMatchMode.LessThanOrEqualTo:
|
|
785
|
-
return FilterMatchMode.LessThanOrEqualToAbbr;
|
|
786
|
-
case FilterMatchMode.GreaterThan:
|
|
787
|
-
return FilterMatchMode.GreaterThanAbbr;
|
|
788
|
-
case FilterMatchMode.GreaterThanOrEqualTo:
|
|
789
|
-
return FilterMatchMode.GreaterThanOrEqualToAbbr;
|
|
790
|
-
case FilterMatchMode.Between:
|
|
791
|
-
return FilterMatchMode.BetweenAbbr;
|
|
792
|
-
case FilterMatchMode.Exists:
|
|
793
|
-
return FilterMatchMode.ExistsAbbr;
|
|
794
|
-
case FilterMatchMode.DoesNotExist:
|
|
795
|
-
return FilterMatchMode.DoesNotExistAbbr;
|
|
796
|
-
default:
|
|
797
|
-
return null;
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
|
-
static fromAbbreviation(abbr) {
|
|
801
|
-
switch (abbr) {
|
|
802
|
-
case FilterMatchMode.EqualsAbbr:
|
|
803
|
-
return FilterMatchMode.Equals;
|
|
804
|
-
case FilterMatchMode.NotEqualsAbbr:
|
|
805
|
-
return FilterMatchMode.NotEquals;
|
|
806
|
-
case FilterMatchMode.ContainsAbbr:
|
|
807
|
-
return FilterMatchMode.Contains;
|
|
808
|
-
case FilterMatchMode.NotContainsAbbr:
|
|
809
|
-
return FilterMatchMode.NotContains;
|
|
810
|
-
case FilterMatchMode.InAbbr:
|
|
811
|
-
return FilterMatchMode.In;
|
|
812
|
-
case FilterMatchMode.NotInAbbr:
|
|
813
|
-
return FilterMatchMode.NotIn;
|
|
814
|
-
case FilterMatchMode.StartsWithAbbr:
|
|
815
|
-
return FilterMatchMode.StartsWith;
|
|
816
|
-
case FilterMatchMode.EndsWithAbbr:
|
|
817
|
-
return FilterMatchMode.EndsWith;
|
|
818
|
-
case FilterMatchMode.LessThanAbbr:
|
|
819
|
-
return FilterMatchMode.LessThan;
|
|
820
|
-
case FilterMatchMode.LessThanOrEqualToAbbr:
|
|
821
|
-
return FilterMatchMode.LessThanOrEqualTo;
|
|
822
|
-
case FilterMatchMode.GreaterThanAbbr:
|
|
823
|
-
return FilterMatchMode.GreaterThan;
|
|
824
|
-
case FilterMatchMode.GreaterThanOrEqualToAbbr:
|
|
825
|
-
return FilterMatchMode.GreaterThanOrEqualTo;
|
|
826
|
-
case FilterMatchMode.BetweenAbbr:
|
|
827
|
-
return FilterMatchMode.Between;
|
|
828
|
-
case FilterMatchMode.ExistsAbbr:
|
|
829
|
-
return FilterMatchMode.Exists;
|
|
830
|
-
case FilterMatchMode.DoesNotExistAbbr:
|
|
831
|
-
return FilterMatchMode.DoesNotExist;
|
|
832
|
-
default:
|
|
833
|
-
return null;
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
/**
|
|
839
|
-
* Converts a TableLazyLoadEvent to DataListParams.
|
|
840
|
-
*
|
|
841
|
-
* @param {TableLazyLoadEvent} event - The event containing the data to convert.
|
|
842
|
-
* @return {DataListParams} - The converted DataListParams object.
|
|
843
|
-
*/
|
|
844
|
-
function fromTableLoadToDataListParams(event) {
|
|
845
|
-
const params = {};
|
|
846
|
-
if (event.first != null) {
|
|
847
|
-
params.offset = event.first;
|
|
848
|
-
}
|
|
849
|
-
if (event.rows != null) {
|
|
850
|
-
params.limit = event.rows;
|
|
851
|
-
}
|
|
852
|
-
if (typeof event.globalFilter === 'string') {
|
|
853
|
-
params.search = event.globalFilter;
|
|
854
|
-
}
|
|
855
|
-
else if (Array.isArray(event.globalFilter) && event.globalFilter.length > 0) {
|
|
856
|
-
params.search = event.globalFilter[0];
|
|
857
|
-
}
|
|
858
|
-
if (Array.isArray(event.multiSortMeta) && event.multiSortMeta.length > 0) {
|
|
859
|
-
params.sort = event.multiSortMeta.map(m => ({ property: m.field, ascending: m.order >= 0 }));
|
|
860
|
-
}
|
|
861
|
-
if (event.filters) {
|
|
862
|
-
params.filters = Object.keys(event.filters).reduce((acc, key) => {
|
|
863
|
-
const filter = {};
|
|
864
|
-
const eventFilter = event.filters?.[key];
|
|
865
|
-
if (Array.isArray(eventFilter)) {
|
|
866
|
-
filter.value = eventFilter[0].value;
|
|
867
|
-
filter.matchMode = eventFilter[0].matchMode;
|
|
868
|
-
filter.caseSensitive = eventFilter[0].caseSensitive;
|
|
869
|
-
}
|
|
870
|
-
else if (eventFilter !== undefined) {
|
|
871
|
-
filter.value = eventFilter.value;
|
|
872
|
-
filter.matchMode = eventFilter.matchMode;
|
|
873
|
-
filter.caseSensitive = eventFilter.caseSensitive;
|
|
874
|
-
}
|
|
875
|
-
// handle search case sensitivity to be also written on searchCaseSensitive
|
|
876
|
-
if (key === 'global' && typeof params.search === 'string' && filter.caseSensitive !== undefined) {
|
|
877
|
-
params.searchCaseSensitive = filter.caseSensitive;
|
|
878
|
-
return acc;
|
|
879
|
-
}
|
|
880
|
-
return { ...acc, [key]: filter };
|
|
881
|
-
}, {});
|
|
342
|
+
if (event.filters) {
|
|
343
|
+
params.filters = Object.keys(event.filters).reduce((acc, key) => {
|
|
344
|
+
const filter = {};
|
|
345
|
+
const eventFilter = event.filters?.[key];
|
|
346
|
+
if (Array.isArray(eventFilter)) {
|
|
347
|
+
filter.value = eventFilter[0].value;
|
|
348
|
+
filter.matchMode = eventFilter[0].matchMode;
|
|
349
|
+
filter.caseSensitive = eventFilter[0].caseSensitive;
|
|
350
|
+
}
|
|
351
|
+
else if (eventFilter !== undefined) {
|
|
352
|
+
filter.value = eventFilter.value;
|
|
353
|
+
filter.matchMode = eventFilter.matchMode;
|
|
354
|
+
filter.caseSensitive = eventFilter.caseSensitive;
|
|
355
|
+
}
|
|
356
|
+
// handle search case sensitivity to be also written on searchCaseSensitive
|
|
357
|
+
if (key === 'global' && typeof params.search === 'string' && filter.caseSensitive !== undefined) {
|
|
358
|
+
params.searchCaseSensitive = filter.caseSensitive;
|
|
359
|
+
return acc;
|
|
360
|
+
}
|
|
361
|
+
return { ...acc, [key]: filter };
|
|
362
|
+
}, {});
|
|
882
363
|
}
|
|
883
364
|
return params;
|
|
884
365
|
}
|
|
@@ -1302,12 +783,10 @@ function dataListParamsFilterValueToUrlString(value, allowNull = false) {
|
|
|
1302
783
|
*
|
|
1303
784
|
* @tparam Model - The type of data this data provider will handle.
|
|
1304
785
|
* @tparam Service - The type of service used by this data provider (optional).
|
|
1305
|
-
* @tparam ModelClass - The model type for the data provider (optional).
|
|
1306
786
|
* @tparam ServiceClass - The service type for the data provider (optional).
|
|
1307
787
|
*/
|
|
1308
788
|
class DataProviderInst {
|
|
1309
|
-
constructor(
|
|
1310
|
-
this.classType = classType;
|
|
789
|
+
constructor(serviceType) {
|
|
1311
790
|
this.serviceType = serviceType;
|
|
1312
791
|
}
|
|
1313
792
|
get isDataProvider() {
|
|
@@ -1315,33 +794,6 @@ class DataProviderInst {
|
|
|
1315
794
|
}
|
|
1316
795
|
}
|
|
1317
796
|
|
|
1318
|
-
class DataProvider extends DataProviderInst {
|
|
1319
|
-
constructor() {
|
|
1320
|
-
super(undefined, undefined);
|
|
1321
|
-
}
|
|
1322
|
-
static create() {
|
|
1323
|
-
return dataProviderBase();
|
|
1324
|
-
}
|
|
1325
|
-
static fromClass(type) {
|
|
1326
|
-
return dataProviderFromClass(type);
|
|
1327
|
-
}
|
|
1328
|
-
static fromClassWithService(type, serviceType) {
|
|
1329
|
-
return dataProviderFromClass(type, serviceType);
|
|
1330
|
-
}
|
|
1331
|
-
static fromService(serviceType) {
|
|
1332
|
-
return dataProviderWithService(serviceType);
|
|
1333
|
-
}
|
|
1334
|
-
}
|
|
1335
|
-
function dataProviderBase() {
|
|
1336
|
-
return new DataProviderInst(undefined, undefined);
|
|
1337
|
-
}
|
|
1338
|
-
function dataProviderWithService(serviceType) {
|
|
1339
|
-
return new DataProviderInst(undefined, serviceType);
|
|
1340
|
-
}
|
|
1341
|
-
function dataProviderFromClass(type, serviceType) {
|
|
1342
|
-
return new DataProviderInst(type, serviceType);
|
|
1343
|
-
}
|
|
1344
|
-
|
|
1345
797
|
class ComponentDirective {
|
|
1346
798
|
constructor() {
|
|
1347
799
|
this.injector = inject(Injector);
|
|
@@ -1535,22 +987,159 @@ function getEnumConstantName(enumType, value) {
|
|
|
1535
987
|
if (typeof value === 'string') {
|
|
1536
988
|
return getEnumConstantNames(enumType).find(c => enumType[c] === value) ?? null;
|
|
1537
989
|
}
|
|
1538
|
-
else {
|
|
1539
|
-
return typeof enumType[value] !== 'undefined' ? enumType[value] : null;
|
|
990
|
+
else {
|
|
991
|
+
return typeof enumType[value] !== 'undefined' ? enumType[value] : null;
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
/**
|
|
995
|
+
* Gets constant name for value.
|
|
996
|
+
* @param enumObj Enum object.
|
|
997
|
+
* @param value Value of enum constant.
|
|
998
|
+
*/
|
|
999
|
+
function getEnumConstantNameFromObject(enumObj, value) {
|
|
1000
|
+
const enumObjAny = enumObj;
|
|
1001
|
+
if (typeof value === 'string') {
|
|
1002
|
+
return getEnumConstantNamesFromObject(enumObj).find(c => enumObjAny[c] === value) ?? null;
|
|
1003
|
+
}
|
|
1004
|
+
else {
|
|
1005
|
+
return typeof enumObjAny[value] !== 'undefined' ? enumObjAny[value] : null;
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
var LogLevelEnum;
|
|
1010
|
+
(function (LogLevelEnum) {
|
|
1011
|
+
LogLevelEnum[LogLevelEnum["Trace"] = 0] = "Trace";
|
|
1012
|
+
LogLevelEnum[LogLevelEnum["Debug"] = 1] = "Debug";
|
|
1013
|
+
LogLevelEnum[LogLevelEnum["Log"] = 2] = "Log";
|
|
1014
|
+
LogLevelEnum[LogLevelEnum["Info"] = 3] = "Info";
|
|
1015
|
+
LogLevelEnum[LogLevelEnum["Warning"] = 4] = "Warning";
|
|
1016
|
+
LogLevelEnum[LogLevelEnum["Error"] = 5] = "Error";
|
|
1017
|
+
})(LogLevelEnum || (LogLevelEnum = {}));
|
|
1018
|
+
|
|
1019
|
+
class LoggerService {
|
|
1020
|
+
static { this._instance = new LoggerService(); }
|
|
1021
|
+
static { this._isInit = false; }
|
|
1022
|
+
static { this._publishers = []; }
|
|
1023
|
+
static { this._entriesBuffer = []; }
|
|
1024
|
+
static { this._categoryInstances = {}; }
|
|
1025
|
+
static { this._timestampFormat = 'yyyy-MM-dd HH:mm:ss.SSS'; }
|
|
1026
|
+
constructor() {
|
|
1027
|
+
// Temporary settings that cover logging calls before initialisation
|
|
1028
|
+
this.defaultLogLevel = LogLevelEnum.Info;
|
|
1029
|
+
this.datePipe = new DatePipe('en-US');
|
|
1030
|
+
// empty
|
|
1031
|
+
}
|
|
1032
|
+
static get() {
|
|
1033
|
+
return LoggerService._instance;
|
|
1034
|
+
}
|
|
1035
|
+
static configure(config) {
|
|
1036
|
+
if (config.timestampFormat) {
|
|
1037
|
+
LoggerService._timestampFormat = config.timestampFormat;
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
static init(configurationService, publishers) {
|
|
1041
|
+
if (LoggerService._isInit) {
|
|
1042
|
+
return;
|
|
1043
|
+
}
|
|
1044
|
+
LoggerService._configurationService = configurationService;
|
|
1045
|
+
LoggerService._publishers = publishers;
|
|
1046
|
+
LoggerService._isInit = true;
|
|
1047
|
+
LoggerService._flushBuffer();
|
|
1048
|
+
}
|
|
1049
|
+
static _flushBuffer() {
|
|
1050
|
+
if (!LoggerService._isInit) {
|
|
1051
|
+
return;
|
|
1052
|
+
}
|
|
1053
|
+
LoggerService._entriesBuffer.forEach(e => this._instance._log(e));
|
|
1054
|
+
LoggerService._entriesBuffer = [];
|
|
1055
|
+
}
|
|
1056
|
+
static create(category) {
|
|
1057
|
+
return LoggerService._instance.create(category);
|
|
1058
|
+
}
|
|
1059
|
+
create(category) {
|
|
1060
|
+
if (this.category) {
|
|
1061
|
+
throw new CommonsInternalError(`Cannot create logger with category inside another category (${this.category}). Must create logger on root.`);
|
|
1062
|
+
}
|
|
1063
|
+
if (LoggerService._categoryInstances[category]) {
|
|
1064
|
+
return LoggerService._categoryInstances[category];
|
|
1065
|
+
}
|
|
1066
|
+
const logger = new LoggerService();
|
|
1067
|
+
logger.category = category;
|
|
1068
|
+
LoggerService._categoryInstances[category] = logger;
|
|
1069
|
+
return logger;
|
|
1070
|
+
}
|
|
1071
|
+
_processLog(msgOrError, logLevel, category = undefined, data) {
|
|
1072
|
+
const [timestamp, timestampFormatted] = [...this._getTimestamps()];
|
|
1073
|
+
const logEntry = {
|
|
1074
|
+
level: logLevel,
|
|
1075
|
+
message: typeof msgOrError === 'string' ? msgOrError : msgOrError.message,
|
|
1076
|
+
data: data,
|
|
1077
|
+
category: this.category ?? category,
|
|
1078
|
+
timestamp: timestamp,
|
|
1079
|
+
timestampFormatted: timestampFormatted ?? undefined
|
|
1080
|
+
};
|
|
1081
|
+
if (msgOrError instanceof Error) {
|
|
1082
|
+
// set error from message param
|
|
1083
|
+
logEntry.error = msgOrError;
|
|
1084
|
+
}
|
|
1085
|
+
else if (data?.length && data[0] instanceof Error) {
|
|
1086
|
+
// if first data is error, also consider as error
|
|
1087
|
+
logEntry.error = data[0];
|
|
1088
|
+
logEntry.data = data.splice(1);
|
|
1089
|
+
}
|
|
1090
|
+
this._log(logEntry);
|
|
1091
|
+
}
|
|
1092
|
+
_getTimestamps() {
|
|
1093
|
+
const timestamp = new Date();
|
|
1094
|
+
const timestampFormatted = this.datePipe.transform(timestamp, LoggerService._timestampFormat) ?? dateToIsoString(timestamp);
|
|
1095
|
+
return [timestamp, timestampFormatted];
|
|
1096
|
+
}
|
|
1097
|
+
_log(log) {
|
|
1098
|
+
if (!LoggerService._isInit) {
|
|
1099
|
+
// add to buffer
|
|
1100
|
+
LoggerService._entriesBuffer.push(log);
|
|
1101
|
+
return;
|
|
1102
|
+
}
|
|
1103
|
+
const logConfig = (LoggerService._configurationService?.getConfigValue)?.('log');
|
|
1104
|
+
if ((this.category && log.level < (logConfig?.category?.[this.category]?.level ?? logConfig?.level ?? this.defaultLogLevel)) ||
|
|
1105
|
+
(!this.category && log.level < (logConfig?.level ?? this.defaultLogLevel))) {
|
|
1106
|
+
return;
|
|
1107
|
+
}
|
|
1108
|
+
if (logConfig?.timestampFormat) {
|
|
1109
|
+
log.timestampFormatted = this.datePipe.transform(log.timestamp, logConfig.timestampFormat) ?? undefined;
|
|
1110
|
+
}
|
|
1111
|
+
LoggerService._publishers.forEach(p => p.addEntry(log));
|
|
1112
|
+
}
|
|
1113
|
+
trace(msgOrError, ...data) {
|
|
1114
|
+
this._processLog(msgOrError, LogLevelEnum.Trace, undefined, data);
|
|
1540
1115
|
}
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
* Gets constant name for value.
|
|
1544
|
-
* @param enumObj Enum object.
|
|
1545
|
-
* @param value Value of enum constant.
|
|
1546
|
-
*/
|
|
1547
|
-
function getEnumConstantNameFromObject(enumObj, value) {
|
|
1548
|
-
const enumObjAny = enumObj;
|
|
1549
|
-
if (typeof value === 'string') {
|
|
1550
|
-
return getEnumConstantNamesFromObject(enumObj).find(c => enumObjAny[c] === value) ?? null;
|
|
1116
|
+
debug(msgOrError, ...data) {
|
|
1117
|
+
this._processLog(msgOrError, LogLevelEnum.Debug, undefined, data);
|
|
1551
1118
|
}
|
|
1552
|
-
|
|
1553
|
-
|
|
1119
|
+
log(msgOrError, logLevel = LogLevelEnum.Log, category = undefined, ...data) {
|
|
1120
|
+
this._processLog(msgOrError, logLevel, category, data);
|
|
1121
|
+
}
|
|
1122
|
+
logEntry(logEntry) {
|
|
1123
|
+
const [timestamp, timestampFormatted] = [...this._getTimestamps()];
|
|
1124
|
+
const logEntryFinal = {
|
|
1125
|
+
timestamp: timestamp,
|
|
1126
|
+
timestampFormatted: timestampFormatted ?? undefined,
|
|
1127
|
+
category: this.category ?? logEntry.category,
|
|
1128
|
+
message: '',
|
|
1129
|
+
messageDetails: logEntry.messageDetails,
|
|
1130
|
+
level: LogLevelEnum.Log,
|
|
1131
|
+
...logEntry
|
|
1132
|
+
};
|
|
1133
|
+
this._log(logEntryFinal);
|
|
1134
|
+
}
|
|
1135
|
+
info(msgOrError, ...data) {
|
|
1136
|
+
this._processLog(msgOrError, LogLevelEnum.Info, undefined, data);
|
|
1137
|
+
}
|
|
1138
|
+
warn(msgOrError, ...data) {
|
|
1139
|
+
this._processLog(msgOrError, LogLevelEnum.Warning, undefined, data);
|
|
1140
|
+
}
|
|
1141
|
+
error(msgOrError, ...data) {
|
|
1142
|
+
this._processLog(msgOrError, LogLevelEnum.Error, undefined, data);
|
|
1554
1143
|
}
|
|
1555
1144
|
}
|
|
1556
1145
|
|
|
@@ -2098,9 +1687,24 @@ const valueToDefined = (value) => {
|
|
|
2098
1687
|
}
|
|
2099
1688
|
};
|
|
2100
1689
|
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
1690
|
+
/**
|
|
1691
|
+
* Displays a toast notification message with a specified severity level and optional customization. Presets the life of message and requires message.
|
|
1692
|
+
*
|
|
1693
|
+
* @param {string} message - The content of the toast message to be displayed.
|
|
1694
|
+
* @param {'success' | 'warn' | 'warning' | 'error'} [severity='success'] - The severity level of the message.
|
|
1695
|
+
* @param {ToastMessageOptsType} [opts] - Optional configuration for the toast message, which can include a title, icon, and message service for displaying the notification. If message service is provided, the message will be automatically added.
|
|
1696
|
+
* @return {Message} - The notification message object created for the toast.
|
|
1697
|
+
*/
|
|
1698
|
+
function toastMessage(message, severity = 'success', opts) {
|
|
1699
|
+
switch (severity) {
|
|
1700
|
+
case 'warning':
|
|
1701
|
+
// primeng does not support 'warning', must be 'warn'
|
|
1702
|
+
severity = 'warn';
|
|
1703
|
+
break;
|
|
1704
|
+
}
|
|
1705
|
+
const notification = { severity: severity, summary: opts?.title, detail: message, life: severity === 'error' ? 10000 : 5000, icon: opts?.icon };
|
|
1706
|
+
// it will only be added if message service is provided, otherwise provide manually
|
|
1707
|
+
opts?.messageService?.add(notification);
|
|
2104
1708
|
return notification;
|
|
2105
1709
|
}
|
|
2106
1710
|
|
|
@@ -2209,8 +1813,10 @@ function selectI18n(keys, i18n) {
|
|
|
2209
1813
|
|
|
2210
1814
|
function getI18nForError(translate, error, params = {}) {
|
|
2211
1815
|
const i18nParams = getI18nErrorParams(error, params);
|
|
2212
|
-
|
|
2213
|
-
|
|
1816
|
+
// try to get message code from code or http status
|
|
1817
|
+
const messageCode = error['messageCode'] ?? i18nParams.httpStatus;
|
|
1818
|
+
if (messageCode) {
|
|
1819
|
+
const keys = [`errors.${messageCode}`, `messages.${messageCode}`];
|
|
2214
1820
|
const i18n = getI18n(translate, i18nParams, ...keys);
|
|
2215
1821
|
if (i18n) {
|
|
2216
1822
|
return i18n;
|
|
@@ -2220,14 +1826,14 @@ function getI18nForError(translate, error, params = {}) {
|
|
|
2220
1826
|
}
|
|
2221
1827
|
function getI18nErrorParams(error, params = {}) {
|
|
2222
1828
|
const paramsRes = { ...params };
|
|
2223
|
-
paramsRes.errorStatus = '';
|
|
2224
|
-
paramsRes.errorMessage = '';
|
|
2225
1829
|
if (isHttpErrorResponse(error)) {
|
|
2226
1830
|
const httpError = getHttpErrorResponse(error);
|
|
2227
|
-
paramsRes.
|
|
2228
|
-
paramsRes.
|
|
2229
|
-
paramsRes.
|
|
1831
|
+
paramsRes.httpUrl = httpError?.url;
|
|
1832
|
+
paramsRes.httpStatus = httpError?.status;
|
|
1833
|
+
paramsRes.httpMessage = httpError?.message;
|
|
1834
|
+
paramsRes.httpStatusText = httpError?.statusText;
|
|
2230
1835
|
}
|
|
1836
|
+
paramsRes.message = error.message;
|
|
2231
1837
|
paramsRes.error = error;
|
|
2232
1838
|
return paramsRes;
|
|
2233
1839
|
}
|
|
@@ -2738,98 +2344,415 @@ class TypeRegistry {
|
|
|
2738
2344
|
get typeMap() {
|
|
2739
2345
|
return this._typeMap;
|
|
2740
2346
|
}
|
|
2741
|
-
get enumMap() {
|
|
2742
|
-
return this._enumMap;
|
|
2347
|
+
get enumMap() {
|
|
2348
|
+
return this._enumMap;
|
|
2349
|
+
}
|
|
2350
|
+
/**
|
|
2351
|
+
* Only use one instance of object (out of Angular context)
|
|
2352
|
+
*/
|
|
2353
|
+
static get() {
|
|
2354
|
+
return TypeRegistry._instance;
|
|
2355
|
+
}
|
|
2356
|
+
findAttributeDefinitionByClassType(type, attributeName) {
|
|
2357
|
+
const typeName = findReflectTypeName(type);
|
|
2358
|
+
return typeName ? this.findAttributeDefinition(typeName, attributeName) : null;
|
|
2359
|
+
}
|
|
2360
|
+
findAttributeDefinition(typeName, attributeName) {
|
|
2361
|
+
const attributeDefs = this.findAttributesDefinition(typeName);
|
|
2362
|
+
if (!attributeDefs) {
|
|
2363
|
+
return null;
|
|
2364
|
+
}
|
|
2365
|
+
for (const attribute of attributeDefs) {
|
|
2366
|
+
if (attribute.name === attributeName) {
|
|
2367
|
+
return attribute;
|
|
2368
|
+
}
|
|
2369
|
+
}
|
|
2370
|
+
return null;
|
|
2371
|
+
}
|
|
2372
|
+
findAttributesDefinitionByClassType(type) {
|
|
2373
|
+
const typeName = findReflectTypeName(type);
|
|
2374
|
+
return typeName ? this.findAttributesDefinition(typeName) : null;
|
|
2375
|
+
}
|
|
2376
|
+
findAttributesDefinition(typeName) {
|
|
2377
|
+
const typeDef = this.findType(typeName);
|
|
2378
|
+
if (!typeDef || typeof typeDef.getAttributeTypeMap !== 'function') {
|
|
2379
|
+
return null;
|
|
2380
|
+
}
|
|
2381
|
+
return typeDef.getAttributeTypeMap();
|
|
2382
|
+
}
|
|
2383
|
+
findByClassType(type) {
|
|
2384
|
+
const typeName = findReflectTypeName(type);
|
|
2385
|
+
return typeName ? this.findType(typeName) : null;
|
|
2386
|
+
}
|
|
2387
|
+
findType(typeName) {
|
|
2388
|
+
return this._typeMap[typeName];
|
|
2389
|
+
}
|
|
2390
|
+
findEnum(enumName) {
|
|
2391
|
+
return this._enumMap[enumName];
|
|
2392
|
+
}
|
|
2393
|
+
registerTypes(types) {
|
|
2394
|
+
for (const key in types) {
|
|
2395
|
+
this.registerType(types[key], key);
|
|
2396
|
+
}
|
|
2397
|
+
}
|
|
2398
|
+
registerType(type, optTypeName) {
|
|
2399
|
+
// try to find name from metadata
|
|
2400
|
+
let typeName;
|
|
2401
|
+
if (reflectTypeNameExists(type)) {
|
|
2402
|
+
// defined name from optional type name
|
|
2403
|
+
typeName = findReflectTypeName(type) ?? undefined;
|
|
2404
|
+
}
|
|
2405
|
+
else if (optTypeName) {
|
|
2406
|
+
typeName = optTypeName;
|
|
2407
|
+
// register metadata
|
|
2408
|
+
defineReflectTypeName(type, typeName);
|
|
2409
|
+
}
|
|
2410
|
+
if (!typeName) {
|
|
2411
|
+
// this._logger.debug(`WARNING: registering type ${type} failed, because typeName could not be determined and optional name was not provided.`);
|
|
2412
|
+
LoggerService.get().log(`WARNING: registering type ${type} failed, because typeName could not be determined and optional name was not provided.`, LogLevelEnum.Debug, this._logCategory);
|
|
2413
|
+
return;
|
|
2414
|
+
}
|
|
2415
|
+
if (typeof this._typeMap[typeName] !== 'undefined') {
|
|
2416
|
+
// this._logger.debug(`WARNING: registering type ${type} under key ${typeName} skipped, because type already exists for this key.`);
|
|
2417
|
+
LoggerService.get().log(`WARNING: registering type ${type} under key ${typeName} skipped, because type already exists for this key.`, LogLevelEnum.Debug, this._logCategory);
|
|
2418
|
+
}
|
|
2419
|
+
else {
|
|
2420
|
+
this._typeMap[typeName] = type;
|
|
2421
|
+
}
|
|
2422
|
+
}
|
|
2423
|
+
registerEnums(enums) {
|
|
2424
|
+
for (const key in enums) {
|
|
2425
|
+
this.registerEnum(enums[key], key);
|
|
2426
|
+
}
|
|
2427
|
+
}
|
|
2428
|
+
registerEnum(enumType, enumName) {
|
|
2429
|
+
// try to find name from decorator
|
|
2430
|
+
defineReflectEnumName(enumType, enumName);
|
|
2431
|
+
if (typeof this._enumMap[enumName] !== 'undefined') {
|
|
2432
|
+
LoggerService.get().log(`Registering enum ${enumName} skipped, because enum already exists.`, LogLevelEnum.Debug, this._logCategory);
|
|
2433
|
+
}
|
|
2434
|
+
else {
|
|
2435
|
+
this._enumMap[enumName] = enumType;
|
|
2436
|
+
}
|
|
2437
|
+
}
|
|
2438
|
+
}
|
|
2439
|
+
|
|
2440
|
+
const BROWSER_STORAGE_IT = new InjectionToken('BROWSER_STORAGE');
|
|
2441
|
+
|
|
2442
|
+
const COMMONS_MODULE_CONFIG_IT = new InjectionToken('COMMONS_MODULE_CONFIG');
|
|
2443
|
+
|
|
2444
|
+
class CommonsService {
|
|
2445
|
+
getDefaultLocale() {
|
|
2446
|
+
const browserLang = this.translate.getBrowserLang();
|
|
2447
|
+
if (browserLang && this.appLocales().some(l => l === browserLang)) {
|
|
2448
|
+
return browserLang;
|
|
2449
|
+
}
|
|
2450
|
+
return this.appLocales()?.length > 0 ? this.appLocales()[0] : 'en';
|
|
2451
|
+
}
|
|
2452
|
+
initAppLocale() {
|
|
2453
|
+
const lsLang = this.localStorage.getItem('lang');
|
|
2454
|
+
if (lsLang && this.appLocales().some(l => l === lsLang)) {
|
|
2455
|
+
return lsLang;
|
|
2456
|
+
}
|
|
2457
|
+
return this.getDefaultLocale();
|
|
2458
|
+
}
|
|
2459
|
+
setAppLocale(language) {
|
|
2460
|
+
if (this.appLocales().some(l => l === language)) {
|
|
2461
|
+
this.translate.use(language);
|
|
2462
|
+
this._appLocale.set(language);
|
|
2463
|
+
if (language !== this.getDefaultLocale())
|
|
2464
|
+
this.localStorage.setItem('lang', language);
|
|
2465
|
+
else
|
|
2466
|
+
this.localStorage.removeItem('lang');
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
clearAppLocale() {
|
|
2470
|
+
this.localStorage.removeItem('lang');
|
|
2471
|
+
this._appLocale.set(this.getDefaultLocale());
|
|
2472
|
+
}
|
|
2473
|
+
initAppDataLocale() {
|
|
2474
|
+
const dataLang = this.localStorage.getItem('dataLang');
|
|
2475
|
+
if (dataLang && this.appDataLocales().some(dl => dl === dataLang)) {
|
|
2476
|
+
return dataLang;
|
|
2477
|
+
}
|
|
2478
|
+
return this.appDataLocales()?.length > 0 ? this.getDefaultLocale() : 'en';
|
|
2479
|
+
}
|
|
2480
|
+
setAppDataLocale(dataLocale) {
|
|
2481
|
+
if (this.appDataLocales().some(dl => dl === dataLocale)) {
|
|
2482
|
+
this._appDataLocale.set(dataLocale);
|
|
2483
|
+
if (dataLocale !== this.getDefaultLocale())
|
|
2484
|
+
this.localStorage.setItem('dataLang', dataLocale);
|
|
2485
|
+
else
|
|
2486
|
+
this.localStorage.removeItem('dataLang');
|
|
2487
|
+
}
|
|
2488
|
+
}
|
|
2489
|
+
clearAppDataLocale() {
|
|
2490
|
+
this.localStorage.removeItem('lang');
|
|
2491
|
+
this._appDataLocale.set(this.getDefaultLocale());
|
|
2492
|
+
}
|
|
2493
|
+
constructor() {
|
|
2494
|
+
// internal
|
|
2495
|
+
this.logger = inject(LoggerService).create('CommonsService');
|
|
2496
|
+
this.router = inject(Router);
|
|
2497
|
+
this.primengConfig = inject(PrimeNGConfig);
|
|
2498
|
+
this.translate = inject(TranslateService);
|
|
2499
|
+
this.titleService = inject(Title);
|
|
2500
|
+
this.moduleConfig = inject(COMMONS_MODULE_CONFIG_IT, { optional: true });
|
|
2501
|
+
this.localStorage = inject(BROWSER_STORAGE_IT);
|
|
2502
|
+
this.destroyRef = inject(DestroyRef);
|
|
2503
|
+
// breadcrumbs
|
|
2504
|
+
this.breadcrumbHome = signal({
|
|
2505
|
+
icon: 'pi pi-home',
|
|
2506
|
+
routerLink: '/'
|
|
2507
|
+
});
|
|
2508
|
+
this.breadcrumbs = signal([]);
|
|
2509
|
+
// user
|
|
2510
|
+
this.user = signal(undefined);
|
|
2511
|
+
this.userRoles = signal([]);
|
|
2512
|
+
// APP section
|
|
2513
|
+
this.appName = signal(this.moduleConfig?.app?.name ?? 'app.name');
|
|
2514
|
+
this.appOwner = signal(this.moduleConfig?.app?.owner ?? 'app.owner');
|
|
2515
|
+
this.appLocales = signal(this.moduleConfig?.app?.locales ?? ['en']);
|
|
2516
|
+
this._appLocale = signal(this.initAppLocale());
|
|
2517
|
+
this.appLocale = computed(() => this._appLocale());
|
|
2518
|
+
this.appDataLocales = signal(this.moduleConfig?.app?.dataLocales ?? ['en']);
|
|
2519
|
+
this._appDataLocale = signal(this.initAppDataLocale());
|
|
2520
|
+
this.appDataLocale = computed(() => this._appDataLocale());
|
|
2521
|
+
this.appVersion = signal(this.moduleConfig?.app?.version);
|
|
2522
|
+
// ripple
|
|
2523
|
+
this.primengConfig.ripple = true;
|
|
2524
|
+
effect(() => {
|
|
2525
|
+
const appLocales = this.appLocales();
|
|
2526
|
+
if (appLocales) {
|
|
2527
|
+
this.setAppLocale(this.initAppLocale());
|
|
2528
|
+
this.translate.langs = this.appLocales();
|
|
2529
|
+
}
|
|
2530
|
+
const appDataLocales = this.appDataLocales();
|
|
2531
|
+
if (appDataLocales)
|
|
2532
|
+
this.setAppDataLocale(this.initAppDataLocale());
|
|
2533
|
+
}, { allowSignalWrites: true });
|
|
2534
|
+
this.router.events
|
|
2535
|
+
.pipe(
|
|
2536
|
+
// Filter the NavigationEnd events as the breadcrumb is updated only when the route reaches its end
|
|
2537
|
+
filter(event => event instanceof NavigationEnd), takeUntilDestroyed())
|
|
2538
|
+
.subscribe(() => {
|
|
2539
|
+
this.updateBreadcrumbs();
|
|
2540
|
+
this.setPageTitle();
|
|
2541
|
+
});
|
|
2542
|
+
this.translate.onLangChange.pipe(takeUntilDestroyed()).subscribe(() => {
|
|
2543
|
+
this.updateBreadcrumbs();
|
|
2544
|
+
this.setPageTitle();
|
|
2545
|
+
});
|
|
2546
|
+
this.translate
|
|
2547
|
+
.stream('mngPrime')
|
|
2548
|
+
.pipe(takeUntilDestroyed())
|
|
2549
|
+
.subscribe(value => this.primengConfig.setTranslation(value));
|
|
2550
|
+
}
|
|
2551
|
+
initialize() {
|
|
2552
|
+
this.logger.debug('Initialize');
|
|
2743
2553
|
}
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2554
|
+
// BREADCRUMB actions
|
|
2555
|
+
findBreadcrumbItem(item) {
|
|
2556
|
+
const items = this.breadcrumbs();
|
|
2557
|
+
if (item.id) {
|
|
2558
|
+
return items.find(i => i.id && i.id === item.id) ?? null;
|
|
2559
|
+
}
|
|
2560
|
+
else if (item.routerLink) {
|
|
2561
|
+
const routerLinkStr = Array.isArray(item.routerLink) ? item.routerLink.join('/') : item.routerLink;
|
|
2562
|
+
return items.find(i => i.routerLink && (Array.isArray(i.routerLink) ? i.routerLink.join('/') : i.routerLink) === routerLinkStr) ?? null;
|
|
2563
|
+
}
|
|
2564
|
+
else if (item.positionIndex) {
|
|
2565
|
+
return items.find(i => i.positionIndex && i.positionIndex === i.positionIndex) ?? null;
|
|
2566
|
+
}
|
|
2567
|
+
else if (item.label) {
|
|
2568
|
+
return items.find(i => i.label && i.label === i.label) ?? null;
|
|
2569
|
+
}
|
|
2570
|
+
else if (item.icon) {
|
|
2571
|
+
return items.find(i => i.icon && i.icon === i.icon) ?? null;
|
|
2572
|
+
}
|
|
2573
|
+
return null;
|
|
2749
2574
|
}
|
|
2750
|
-
|
|
2751
|
-
const
|
|
2752
|
-
|
|
2575
|
+
updateBreadcrumbItem(item) {
|
|
2576
|
+
const items = [...this.breadcrumbs()];
|
|
2577
|
+
let posIdx = -1;
|
|
2578
|
+
if (item.id) {
|
|
2579
|
+
posIdx = items.findIndex(i => i.id && i.id === item.id);
|
|
2580
|
+
}
|
|
2581
|
+
else if (item.routerLink) {
|
|
2582
|
+
const routerLinkStr = Array.isArray(item.routerLink) ? item.routerLink.join('/') : item.routerLink;
|
|
2583
|
+
posIdx = items.findIndex(i => i.routerLink && (Array.isArray(i.routerLink) ? i.routerLink.join('/') : i.routerLink) === routerLinkStr);
|
|
2584
|
+
}
|
|
2585
|
+
else if (item.positionIndex) {
|
|
2586
|
+
posIdx = items.findIndex(i => i.positionIndex && i.positionIndex === i.positionIndex);
|
|
2587
|
+
}
|
|
2588
|
+
else if (item.label) {
|
|
2589
|
+
posIdx = items.findIndex(i => i.label && i.label === i.label);
|
|
2590
|
+
}
|
|
2591
|
+
else if (item.icon) {
|
|
2592
|
+
posIdx = items.findIndex(i => i.icon && i.icon === i.icon);
|
|
2593
|
+
}
|
|
2594
|
+
if (posIdx < 0) {
|
|
2595
|
+
return false;
|
|
2596
|
+
}
|
|
2597
|
+
items[posIdx] = {
|
|
2598
|
+
...items[posIdx],
|
|
2599
|
+
...item,
|
|
2600
|
+
updated: true
|
|
2601
|
+
};
|
|
2602
|
+
this.breadcrumbs.set(items);
|
|
2603
|
+
return true;
|
|
2753
2604
|
}
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2605
|
+
updateBreadcrumbs() {
|
|
2606
|
+
if (this.breadcrumbsTranslateSubscription) {
|
|
2607
|
+
this.breadcrumbsTranslateSubscription.unsubscribe();
|
|
2608
|
+
this.breadcrumbsTranslateSubscription = undefined;
|
|
2758
2609
|
}
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2610
|
+
if (this.breadcrumbHomeTranslateSubscription) {
|
|
2611
|
+
this.breadcrumbHomeTranslateSubscription.unsubscribe();
|
|
2612
|
+
this.breadcrumbHomeTranslateSubscription = undefined;
|
|
2613
|
+
}
|
|
2614
|
+
const rootRoute = this.router.routerState.snapshot.root;
|
|
2615
|
+
const homeBreadcrumb = this.generateHomeBreadcrumb(rootRoute);
|
|
2616
|
+
if (homeBreadcrumb) {
|
|
2617
|
+
if (homeBreadcrumb.label) {
|
|
2618
|
+
this.breadcrumbHomeTranslateSubscription = this.translate
|
|
2619
|
+
.get(homeBreadcrumb.label)
|
|
2620
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
2621
|
+
.subscribe(i18n => {
|
|
2622
|
+
homeBreadcrumb.label = i18n;
|
|
2623
|
+
this.breadcrumbHome.set(homeBreadcrumb);
|
|
2624
|
+
});
|
|
2625
|
+
}
|
|
2626
|
+
else {
|
|
2627
|
+
this.breadcrumbHome.set(homeBreadcrumb);
|
|
2762
2628
|
}
|
|
2763
2629
|
}
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2630
|
+
const breadcrumbs = [];
|
|
2631
|
+
this.generateBreadcrumbs(rootRoute, [], breadcrumbs);
|
|
2632
|
+
breadcrumbs.forEach((b, idx) => {
|
|
2633
|
+
b.positionIndex = idx;
|
|
2634
|
+
});
|
|
2635
|
+
const i18nKeys = breadcrumbs.filter(b => typeof b.label === 'string').map(b => b.label);
|
|
2636
|
+
if (i18nKeys.length > 0) {
|
|
2637
|
+
this.breadcrumbsTranslateSubscription = this.translate
|
|
2638
|
+
.get(i18nKeys)
|
|
2639
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
2640
|
+
.subscribe(i18n => {
|
|
2641
|
+
// Construct the breadcrumb hierarchy
|
|
2642
|
+
breadcrumbs.forEach(b => {
|
|
2643
|
+
if (b.label && i18n[b.label]) {
|
|
2644
|
+
b.label = i18n[b.label];
|
|
2645
|
+
}
|
|
2646
|
+
});
|
|
2647
|
+
// Emit the new breadcrumbs
|
|
2648
|
+
this.breadcrumbs.set(breadcrumbs);
|
|
2649
|
+
});
|
|
2650
|
+
}
|
|
2651
|
+
else {
|
|
2652
|
+
this.breadcrumbs.set(breadcrumbs);
|
|
2653
|
+
}
|
|
2769
2654
|
}
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
if (!typeDef || typeof typeDef.getAttributeTypeMap !== 'function') {
|
|
2655
|
+
generateHomeBreadcrumb(route) {
|
|
2656
|
+
if (!route) {
|
|
2773
2657
|
return null;
|
|
2774
2658
|
}
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2659
|
+
const routeData = route.data;
|
|
2660
|
+
const breadcrumbRouteData = routeData?.breadcrumb;
|
|
2661
|
+
if (breadcrumbRouteData && typeof breadcrumbRouteData === 'object' && 'isHome' in breadcrumbRouteData) {
|
|
2662
|
+
if (breadcrumbRouteData.isHome === false) {
|
|
2663
|
+
return null;
|
|
2664
|
+
}
|
|
2665
|
+
const breadcrumb = this.createBreadcrumb('/', breadcrumbRouteData, true);
|
|
2666
|
+
if (breadcrumb) {
|
|
2667
|
+
if (typeof breadcrumb.icon === 'undefined') {
|
|
2668
|
+
breadcrumb.icon = 'pi pi-home';
|
|
2669
|
+
}
|
|
2670
|
+
return breadcrumb;
|
|
2671
|
+
}
|
|
2672
|
+
}
|
|
2673
|
+
else {
|
|
2674
|
+
return this.generateHomeBreadcrumb(route.firstChild);
|
|
2790
2675
|
}
|
|
2676
|
+
return null;
|
|
2791
2677
|
}
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
if (reflectTypeNameExists(type)) {
|
|
2796
|
-
// defined name from optional type name
|
|
2797
|
-
typeName = findReflectTypeName(type) ?? undefined;
|
|
2678
|
+
generateBreadcrumbs(route, parentUrlSegments, breadcrumbs) {
|
|
2679
|
+
if (!route) {
|
|
2680
|
+
return;
|
|
2798
2681
|
}
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2682
|
+
const routeData = route.data;
|
|
2683
|
+
const routeUrlSegments = parentUrlSegments.concat(route.url.map(url => url.path));
|
|
2684
|
+
const routeUrl = `/${routeUrlSegments.join('/')}`;
|
|
2685
|
+
if (routeData?.breadcrumb) {
|
|
2686
|
+
const breadcrumbRouteData = routeData.breadcrumb;
|
|
2687
|
+
if (Array.isArray(breadcrumbRouteData)) {
|
|
2688
|
+
for (const breadcrumbRouteDataItem of breadcrumbRouteData) {
|
|
2689
|
+
const breadcrumb = this.createBreadcrumb(routeUrl, breadcrumbRouteDataItem);
|
|
2690
|
+
if (breadcrumb) {
|
|
2691
|
+
breadcrumbs.push(breadcrumb);
|
|
2692
|
+
}
|
|
2693
|
+
}
|
|
2694
|
+
}
|
|
2695
|
+
else if (typeof breadcrumbRouteData === 'function') {
|
|
2696
|
+
breadcrumbs.push(...breadcrumbRouteData(routeUrl, route));
|
|
2697
|
+
}
|
|
2698
|
+
else {
|
|
2699
|
+
const breadcrumb = this.createBreadcrumb(routeUrl, breadcrumbRouteData);
|
|
2700
|
+
if (breadcrumb) {
|
|
2701
|
+
breadcrumbs.push(breadcrumb);
|
|
2702
|
+
}
|
|
2703
|
+
}
|
|
2803
2704
|
}
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2705
|
+
this.generateBreadcrumbs(route.firstChild, routeUrlSegments, breadcrumbs);
|
|
2706
|
+
}
|
|
2707
|
+
createBreadcrumb(routeUrl, routeBreadcrumb, includeHome = false) {
|
|
2708
|
+
const existingBreadcrumb = this.findBreadcrumbItem({ routerLink: routeUrl });
|
|
2709
|
+
if (existingBreadcrumb?.updated) {
|
|
2710
|
+
return existingBreadcrumb;
|
|
2808
2711
|
}
|
|
2809
|
-
if (typeof
|
|
2810
|
-
//
|
|
2811
|
-
|
|
2712
|
+
if (typeof routeBreadcrumb === 'string') {
|
|
2713
|
+
// check for updated existing breadcrumb
|
|
2714
|
+
return {
|
|
2715
|
+
id: routeUrl,
|
|
2716
|
+
label: routeBreadcrumb,
|
|
2717
|
+
routerLink: routeUrl
|
|
2718
|
+
};
|
|
2812
2719
|
}
|
|
2813
2720
|
else {
|
|
2814
|
-
|
|
2721
|
+
if (!includeHome && typeof routeBreadcrumb.isHome !== 'undefined') {
|
|
2722
|
+
// home should not be included
|
|
2723
|
+
return null;
|
|
2724
|
+
}
|
|
2725
|
+
if (typeof routeBreadcrumb.routerLink === 'undefined') {
|
|
2726
|
+
routeBreadcrumb.routerLink = routeUrl;
|
|
2727
|
+
}
|
|
2728
|
+
routeBreadcrumb.id = routeUrl;
|
|
2729
|
+
return routeBreadcrumb;
|
|
2815
2730
|
}
|
|
2816
2731
|
}
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2732
|
+
// TITLE section
|
|
2733
|
+
setPageTitle(title) {
|
|
2734
|
+
let currentRoute = this.router.routerState.snapshot.root;
|
|
2735
|
+
while (currentRoute.firstChild) {
|
|
2736
|
+
currentRoute = currentRoute.firstChild;
|
|
2820
2737
|
}
|
|
2738
|
+
const routeData = currentRoute.data;
|
|
2739
|
+
const pageTitle = title ?? routeData.pageTitle;
|
|
2740
|
+
this.titleService.setTitle(this.formatPageTitle(pageTitle));
|
|
2821
2741
|
}
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
LoggerService.get().log(`Registering enum ${enumName} skipped, because enum already exists.`, LogLevelEnum.Debug, this._logCategory);
|
|
2827
|
-
}
|
|
2828
|
-
else {
|
|
2829
|
-
this._enumMap[enumName] = enumType;
|
|
2742
|
+
formatPageTitle(titlePrefix) {
|
|
2743
|
+
const titlePieces = [];
|
|
2744
|
+
if (titlePrefix) {
|
|
2745
|
+
titlePieces.push(this.translate.instant(titlePrefix));
|
|
2830
2746
|
}
|
|
2747
|
+
titlePieces.push(this.translate.instant('app.name'));
|
|
2748
|
+
return titlePieces.join(' - ');
|
|
2831
2749
|
}
|
|
2750
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: CommonsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2751
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: CommonsService }); }
|
|
2832
2752
|
}
|
|
2753
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: CommonsService, decorators: [{
|
|
2754
|
+
type: Injectable
|
|
2755
|
+
}], ctorParameters: () => [] });
|
|
2833
2756
|
|
|
2834
2757
|
var PermissionTypeEnum;
|
|
2835
2758
|
(function (PermissionTypeEnum) {
|
|
@@ -3445,7 +3368,7 @@ function createRouteRedirect(path, redirectTo, pathMatch = 'prefix') {
|
|
|
3445
3368
|
* @param {Array<any>} [canMatch] - An optional array of objects that can match the route.
|
|
3446
3369
|
* @returns {RouteBuilder} - A new instance of RouteBuilder class.
|
|
3447
3370
|
*/
|
|
3448
|
-
function
|
|
3371
|
+
function createChildrenLazyRoute(path, loadChildren, canMatch) {
|
|
3449
3372
|
const route = { path: path, loadChildren: loadChildren };
|
|
3450
3373
|
if (canMatch?.length) {
|
|
3451
3374
|
route.canMatch = canMatch;
|
|
@@ -4132,5 +4055,5 @@ function provideCommons(config, ...features) {
|
|
|
4132
4055
|
* Generated bundle index. Do not edit.
|
|
4133
4056
|
*/
|
|
4134
4057
|
|
|
4135
|
-
export { ACommonsErrorBase, APermissions, BROWSER_STORAGE_IT, BooleanPipe, COMMONS_INITIALIZER_IT, COMMONS_MODULE_CONFIG_IT, ClassMapPipe, CommonsConfigurationService, CommonsErrorHandler, CommonsFeatureTypeEnum, CommonsHttpError, CommonsInitEventEnum, CommonsInitService, CommonsInternalError, CommonsRouterService, CommonsService, CommonsStorageService, ComponentDirective,
|
|
4058
|
+
export { ACommonsErrorBase, APermissions, BROWSER_STORAGE_IT, BooleanPipe, COMMONS_INITIALIZER_IT, COMMONS_MODULE_CONFIG_IT, ClassMapPipe, CommonsConfigurationService, CommonsErrorHandler, CommonsFeatureTypeEnum, CommonsHttpError, CommonsInitEventEnum, CommonsInitService, CommonsInternalError, CommonsRouterService, CommonsService, CommonsStorageService, ComponentDirective, DataProviderInst, EnumName, EnumPipe, EnumerateAsyncPipe, EnumeratePipe, FilterMatchMode, GetterPipe, I18nPropertyPipe, JsonPathPipe, LOG_PUBLISHERS, LogLevelEnum, LogPublisherConsoleService, LoggerService, NotificationWrapperComponent, ParametrizePipe, PermissionService, PermissionTypeEnum, Permissions, RerenderDirective, RouteBuilder, RoutesBuilder, StyleLevelEnum, StyleSizeEnum, Styles, TemplateDirective, TemplatePipe, TypeName, TypeRegistry, adjustRouteMenuLazyChildrenRouterLinks, angularDateFormatHasSeconds, angularDateFormatHasTime, appendRoutePathToBasePath, boolean$Attribute, booleanOrUndefinedAttribute, commonsActionErrorContextToString, commonsErrorToString, commonsInitializerProvider, copyDataListParams, createChildrenLazyRoute, createLazyRoute, createRoute, createRouteRedirect, createRoutes, dataListParamsFilterToUrlQuery, dataListParamsFilterValueToUrlString, dataListParamsFiltersToUrlQuery, dataListParamsSortToUrlQuery, dataListParamsToUrlQuery, dateToIsoString, defineReflectEnumName, defineReflectTypeName, doesUrlMatchRouterLink, effectWithDeps, errorCauseToString, errorToString, escapeHtml, escapeHtmlAny, findReflectEnumName, findReflectTypeName, findTemplateByName, flattenObjectKeys, fromAngularDateFormatToPrime, fromAngularNumberFormatToFractions, fromEnumConstantsAsValueArray, fromEnumValuesAsValueArray, fromSubscribeError, fromTableLoadToDataListParams, fromUrlQueryToDataListParams, getEnumConstantName, getEnumConstantNameFromObject, getEnumConstantNames, getEnumConstantNamesFromObject, getEnumConstantValues, getEnumConstantValuesAsNumber, getEnumConstantValuesAsString, getEnumerationI18nBaseKey, getErrorLogLevel, getErrorName, getHttpErrorResponse, getHttpErrorResponseStatus, getHttpErrorResponseStatusText, getI18n, getI18nAsync, getI18nErrorParams, getI18nForError, getI18nTypeGroupKey, getI18nTypeKeyBasePath, getI18nTypeName, getI18nTypeNameAsync, getI18nTypeParams, getI18nTypeParamsAsync, getI18nTypePropertyKey, getI18nTypeTabKey, getObjectGetters, getObjectProperties, getObjectPropertyByPath, httpErrorResponseToString, isHttpErrorResponse, isPermitted, isRbacPermitted, itemIdToDefined, itemIdToNumber, itemIdToString, mapToDataList, mergeDataListParamsWithDefaults, number$Attribute, objectDeepCopy, objectDeepMerge, permissionGuard, populateI18nParams, populateI18nTypeParams, provideCommons, reflectEnumNameKey, reflectTypeNameExists, reflectTypeNameKey, removeRouteEmptyPathSegments, selectEnumerationI18n, selectI18n, stringify, throwError, toEnumerationI18nEnumerate, toObservable, toastMessage, valueToDefined };
|
|
4136
4059
|
//# sourceMappingURL=mediusinc-mng-commons-core.mjs.map
|