@mediusinc/mng-commons 0.2.1-rc → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/lib/api/models/builders/query-param.builder.mjs +48 -0
- package/esm2020/lib/api/models/filter-match-type.model.mjs +26 -0
- package/esm2020/lib/api/models/filter-param.model.mjs +46 -0
- package/esm2020/lib/api/models/index.mjs +9 -0
- package/esm2020/lib/api/models/mappers.mjs +17 -0
- package/esm2020/lib/api/models/query-mode.model.mjs +19 -0
- package/esm2020/lib/api/models/query-param.model.mjs +69 -0
- package/esm2020/lib/api/models/query-result.model.mjs +45 -0
- package/esm2020/lib/api/models/serialization.model.mjs +2 -0
- package/esm2020/lib/api/services/crud-api.abstract.service.mjs +72 -0
- package/esm2020/lib/api/services/index.mjs +2 -0
- package/esm2020/lib/api/utils/index.mjs +3 -0
- package/esm2020/lib/api/utils/medius-rest.util.mjs +122 -0
- package/esm2020/lib/api/utils/object-serializer.util.mjs +226 -0
- package/esm2020/lib/components/action/action.component.mjs +65 -0
- package/esm2020/lib/components/action/dialog/action-dialog.component.mjs +148 -0
- package/esm2020/lib/components/action/index.mjs +4 -0
- package/esm2020/lib/components/action/models/action-confirmation-service.model.mjs +2 -0
- package/esm2020/lib/components/action/models/action-execution.model.mjs +58 -0
- package/esm2020/lib/components/action/models/index.mjs +3 -0
- package/esm2020/lib/components/action/route/action-route.component.mjs +144 -0
- package/esm2020/lib/components/form/autocomplete/autocomplete.component.mjs +114 -0
- package/esm2020/lib/components/form/dropdown/dropdown.component.mjs +113 -0
- package/esm2020/lib/components/form/editor/form-editor.component.mjs +141 -0
- package/esm2020/lib/components/form/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.mjs +19 -0
- package/esm2020/lib/components/form/formly/fields/formly-field-dropdown/formly-field-dropdown.component.mjs +19 -0
- package/esm2020/lib/components/form/formly/fields/formly-field-fieldset/formly-field-fieldset.component.mjs +16 -0
- package/esm2020/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.mjs +26 -0
- package/esm2020/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +109 -0
- package/esm2020/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.mjs +122 -0
- package/esm2020/lib/components/form/formly/fields/formly-field-tabs/formly-field-tabs.component.mjs +17 -0
- package/esm2020/lib/components/form/formly/fields/index.mjs +8 -0
- package/esm2020/lib/components/form/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.mjs +17 -0
- package/esm2020/lib/components/form/formly/wrappers/formly-table-wrapper/formly-table-wrapper.component.mjs +16 -0
- package/esm2020/lib/components/form/formly/wrappers/index.mjs +3 -0
- package/esm2020/lib/components/form/index.mjs +4 -0
- package/esm2020/lib/components/form/models/form-editor.event.mjs +7 -0
- package/esm2020/lib/components/form/models/index.mjs +2 -0
- package/esm2020/lib/components/layout/breadcrumb.component.mjs +17 -0
- package/esm2020/lib/components/layout/footer.component.mjs +17 -0
- package/esm2020/lib/components/layout/index.mjs +7 -0
- package/esm2020/lib/components/layout/main-layout.component.mjs +54 -0
- package/esm2020/lib/components/layout/menu-item.component.mjs +173 -0
- package/esm2020/lib/components/layout/menu.component.mjs +20 -0
- package/esm2020/lib/components/layout/services/index.mjs +2 -0
- package/esm2020/lib/components/layout/services/main-layout.component.service.mjs +190 -0
- package/esm2020/lib/components/layout/topbar.component.mjs +59 -0
- package/esm2020/lib/components/tableview/index.mjs +6 -0
- package/esm2020/lib/components/tableview/models/index.mjs +2 -0
- package/esm2020/lib/components/tableview/models/table.event.mjs +16 -0
- package/esm2020/lib/components/tableview/route/tableview-route.abstract.component.mjs +24 -0
- package/esm2020/lib/components/tableview/services/index.mjs +2 -0
- package/esm2020/lib/components/tableview/services/tableview.component.service.mjs +17 -0
- package/esm2020/lib/components/tableview/table/column-filter/column-filter.component.mjs +74 -0
- package/esm2020/lib/components/tableview/table/column-value/column-value.component.mjs +25 -0
- package/esm2020/lib/components/tableview/table/table.component.mjs +307 -0
- package/esm2020/lib/components/tableview/tableview.component.mjs +82 -0
- package/esm2020/lib/config/formly.config.mjs +136 -0
- package/esm2020/lib/config/index.mjs +2 -0
- package/esm2020/lib/config/models/index.mjs +2 -0
- package/esm2020/lib/config/models/mng-config.model.mjs +2 -0
- package/esm2020/lib/data-providers/base.data-provider.mjs +24 -0
- package/esm2020/lib/data-providers/editor.data-provider.mjs +37 -0
- package/esm2020/lib/data-providers/index.mjs +6 -0
- package/esm2020/lib/data-providers/lookup.data-provider.mjs +16 -0
- package/esm2020/lib/data-providers/table.data-provider.mjs +2 -0
- package/esm2020/lib/data-providers/tableview.data-provider.mjs +17 -0
- package/esm2020/lib/descriptors/action.descriptor.mjs +332 -0
- package/esm2020/lib/descriptors/editor.descriptor.mjs +670 -0
- package/esm2020/lib/descriptors/field.validator.mjs +21 -0
- package/esm2020/lib/descriptors/index.mjs +8 -0
- package/esm2020/lib/descriptors/lookup.descriptor.mjs +2 -0
- package/esm2020/lib/descriptors/model.descriptor.mjs +34 -0
- package/esm2020/lib/descriptors/table.descriptor.mjs +401 -0
- package/esm2020/lib/descriptors/tableview.descriptor.mjs +131 -0
- package/esm2020/lib/directives/component.directive.mjs +23 -0
- package/esm2020/lib/directives/index.mjs +3 -0
- package/esm2020/lib/directives/template.directive.mjs +29 -0
- package/esm2020/lib/mng-commons.module.mjs +410 -0
- package/esm2020/lib/models/index.mjs +3 -0
- package/esm2020/lib/models/router.model.mjs +2 -0
- package/esm2020/lib/models/user.model.mjs +2 -0
- package/esm2020/lib/pipes/boolean.pipe.mjs +22 -0
- package/esm2020/lib/pipes/index.mjs +3 -0
- package/esm2020/lib/pipes/property-path.pipe.mjs +36 -0
- package/esm2020/lib/services/action.service.mjs +269 -0
- package/esm2020/lib/services/commons.service.mjs +354 -0
- package/esm2020/lib/services/configuration.service.mjs +78 -0
- package/esm2020/lib/services/index.mjs +5 -0
- package/esm2020/lib/services/navigation.service.mjs +48 -0
- package/esm2020/lib/services/providers/commons-init.provider.mjs +4 -0
- package/esm2020/lib/services/providers/config-service.provider.mjs +20 -0
- package/esm2020/lib/services/providers/formly-config.provider.mjs +31 -0
- package/esm2020/lib/services/providers/index.mjs +4 -0
- package/esm2020/lib/services/tokens/browser-storage.token.mjs +6 -0
- package/esm2020/lib/services/tokens/index.mjs +3 -0
- package/esm2020/lib/services/tokens/module-config.token.mjs +3 -0
- package/esm2020/lib/types/index.mjs +3 -0
- package/esm2020/lib/types/type.decorator.mjs +7 -0
- package/esm2020/lib/types/type.model.mjs +2 -0
- package/esm2020/lib/utils/editor-formly.util.mjs +176 -0
- package/esm2020/lib/utils/i18n.util.mjs +125 -0
- package/esm2020/lib/utils/index.mjs +6 -0
- package/esm2020/lib/utils/model.util.mjs +57 -0
- package/esm2020/lib/utils/toast.util.mjs +39 -0
- package/esm2020/lib/utils/type.util.mjs +39 -0
- package/esm2020/mediusinc-mng-commons.mjs +5 -0
- package/esm2020/public-api.mjs +36 -0
- package/fesm2015/mediusinc-mng-commons.mjs +6252 -0
- package/fesm2015/mediusinc-mng-commons.mjs.map +1 -0
- package/fesm2020/mediusinc-mng-commons.mjs +6177 -0
- package/fesm2020/mediusinc-mng-commons.mjs.map +1 -0
- package/lib/api/models/builders/query-param.builder.d.ts +11 -0
- package/{src/lib/api/models/query-mode.model.ts → lib/api/models/filter-match-type.model.d.ts} +11 -6
- package/lib/api/models/filter-param.model.d.ts +23 -0
- package/{src/lib/api/models/index.ts → lib/api/models/index.d.ts} +0 -2
- package/lib/api/models/mappers.d.ts +6 -0
- package/lib/api/models/query-mode.model.d.ts +16 -0
- package/lib/api/models/query-param.model.d.ts +31 -0
- package/lib/api/models/query-result.model.d.ts +36 -0
- package/{src/lib/api/models/serialization.model.ts → lib/api/models/serialization.model.d.ts} +0 -1
- package/lib/api/services/crud-api.abstract.service.d.ts +23 -0
- package/{src/lib/api/services/index.ts → lib/api/services/index.d.ts} +0 -0
- package/{src/lib/api/utils/index.ts → lib/api/utils/index.d.ts} +0 -0
- package/lib/api/utils/medius-rest.util.d.ts +12 -0
- package/lib/api/utils/object-serializer.util.d.ts +30 -0
- package/lib/components/action/action.component.d.ts +36 -0
- package/lib/components/action/dialog/action-dialog.component.d.ts +46 -0
- package/{src/lib/components/action/index.ts → lib/components/action/index.d.ts} +0 -0
- package/{src/lib/components/action/models/action-confirmation-service.model.ts → lib/components/action/models/action-confirmation-service.model.d.ts} +2 -3
- package/lib/components/action/models/action-execution.model.d.ts +53 -0
- package/{src/lib/components/action/models/index.ts → lib/components/action/models/index.d.ts} +0 -0
- package/lib/components/action/route/action-route.component.d.ts +32 -0
- package/lib/components/form/autocomplete/autocomplete.component.d.ts +36 -0
- package/lib/components/form/dropdown/dropdown.component.d.ts +34 -0
- package/lib/components/form/editor/form-editor.component.d.ts +39 -0
- package/lib/components/form/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.d.ts +11 -0
- package/lib/components/form/formly/fields/formly-field-dropdown/formly-field-dropdown.component.d.ts +11 -0
- package/lib/components/form/formly/fields/formly-field-fieldset/formly-field-fieldset.component.d.ts +6 -0
- package/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.d.ts +12 -0
- package/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.d.ts +17 -0
- package/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.d.ts +36 -0
- package/lib/components/form/formly/fields/formly-field-tabs/formly-field-tabs.component.d.ts +6 -0
- package/{src/lib/components/form/formly/fields/index.ts → lib/components/form/formly/fields/index.d.ts} +0 -0
- package/lib/components/form/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.d.ts +8 -0
- package/lib/components/form/formly/wrappers/formly-table-wrapper/formly-table-wrapper.component.d.ts +8 -0
- package/{src/lib/components/form/formly/wrappers/index.ts → lib/components/form/formly/wrappers/index.d.ts} +0 -0
- package/{src/lib/components/form/index.ts → lib/components/form/index.d.ts} +0 -0
- package/lib/components/form/models/form-editor.event.d.ts +5 -0
- package/{src/lib/components/form/models/index.ts → lib/components/form/models/index.d.ts} +0 -0
- package/lib/components/layout/breadcrumb.component.d.ts +8 -0
- package/lib/components/layout/footer.component.d.ts +9 -0
- package/{src/lib/components/layout/index.ts → lib/components/layout/index.d.ts} +0 -0
- package/lib/components/layout/main-layout.component.d.ts +21 -0
- package/lib/components/layout/menu-item.component.d.ts +29 -0
- package/lib/components/layout/menu.component.d.ts +10 -0
- package/{src/lib/components/layout/services/index.ts → lib/components/layout/services/index.d.ts} +0 -0
- package/lib/components/layout/services/main-layout.component.service.d.ts +65 -0
- package/lib/components/layout/topbar.component.d.ts +25 -0
- package/{src/lib/components/tableview/index.ts → lib/components/tableview/index.d.ts} +0 -0
- package/{src/lib/components/tableview/models/index.ts → lib/components/tableview/models/index.d.ts} +0 -0
- package/lib/components/tableview/models/table.event.d.ts +17 -0
- package/lib/components/tableview/route/tableview-route.abstract.component.d.ts +14 -0
- package/{src/lib/components/tableview/services/index.ts → lib/components/tableview/services/index.d.ts} +0 -0
- package/lib/components/tableview/services/tableview.component.service.d.ts +13 -0
- package/lib/components/tableview/table/column-filter/column-filter.component.d.ts +22 -0
- package/lib/components/tableview/table/column-value/column-value.component.d.ts +12 -0
- package/lib/components/tableview/table/table.component.d.ts +79 -0
- package/lib/components/tableview/tableview.component.d.ts +35 -0
- package/lib/config/formly.config.d.ts +14 -0
- package/{src/lib/config/index.ts → lib/config/index.d.ts} +0 -0
- package/{src/lib/config/models/index.ts → lib/config/models/index.d.ts} +0 -0
- package/{src/lib/config/models/mng-config.model.ts → lib/config/models/mng-config.model.d.ts} +8 -9
- package/lib/data-providers/base.data-provider.d.ts +17 -0
- package/lib/data-providers/editor.data-provider.d.ts +25 -0
- package/{src/lib/data-providers/index.ts → lib/data-providers/index.d.ts} +0 -0
- package/lib/data-providers/lookup.data-provider.d.ts +14 -0
- package/{src/lib/data-providers/table.data-provider.ts → lib/data-providers/table.data-provider.d.ts} +3 -5
- package/lib/data-providers/tableview.data-provider.d.ts +15 -0
- package/lib/descriptors/action.descriptor.d.ts +148 -0
- package/lib/descriptors/editor.descriptor.d.ts +255 -0
- package/lib/descriptors/field.validator.d.ts +18 -0
- package/{src/lib/descriptors/index.ts → lib/descriptors/index.d.ts} +0 -0
- package/{src/lib/descriptors/lookup.descriptor.ts → lib/descriptors/lookup.descriptor.d.ts} +6 -9
- package/lib/descriptors/model.descriptor.d.ts +15 -0
- package/lib/descriptors/table.descriptor.d.ts +164 -0
- package/lib/descriptors/tableview.descriptor.d.ts +39 -0
- package/lib/directives/component.directive.d.ts +11 -0
- package/{src/lib/directives/index.ts → lib/directives/index.d.ts} +0 -0
- package/lib/directives/template.directive.d.ts +13 -0
- package/lib/mng-commons.module.d.ts +79 -0
- package/{src/lib/models/index.ts → lib/models/index.d.ts} +0 -0
- package/lib/models/router.model.d.ts +14 -0
- package/{src/lib/models/user.model.ts → lib/models/user.model.d.ts} +2 -3
- package/lib/pipes/boolean.pipe.d.ts +7 -0
- package/{src/lib/pipes/index.ts → lib/pipes/index.d.ts} +0 -0
- package/lib/pipes/property-path.pipe.d.ts +7 -0
- package/lib/services/action.service.d.ts +92 -0
- package/lib/services/commons.service.d.ts +72 -0
- package/lib/services/configuration.service.d.ts +35 -0
- package/{src/lib/services/index.ts → lib/services/index.d.ts} +0 -0
- package/lib/services/navigation.service.d.ts +14 -0
- package/lib/services/providers/commons-init.provider.d.ts +2 -0
- package/lib/services/providers/config-service.provider.d.ts +5 -0
- package/lib/services/providers/formly-config.provider.d.ts +4 -0
- package/{src/lib/services/providers/index.ts → lib/services/providers/index.d.ts} +0 -0
- package/lib/services/tokens/browser-storage.token.d.ts +2 -0
- package/{src/lib/services/tokens/index.ts → lib/services/tokens/index.d.ts} +0 -0
- package/lib/services/tokens/module-config.token.d.ts +3 -0
- package/{src/lib/types/index.ts → lib/types/index.d.ts} +0 -0
- package/lib/types/type.decorator.d.ts +2 -0
- package/lib/types/type.model.d.ts +10 -0
- package/lib/utils/editor-formly.util.d.ts +9 -0
- package/lib/utils/i18n.util.d.ts +18 -0
- package/{src/lib/utils/index.ts → lib/utils/index.d.ts} +0 -0
- package/lib/utils/model.util.d.ts +7 -0
- package/lib/utils/toast.util.d.ts +13 -0
- package/lib/utils/type.util.d.ts +15 -0
- package/mediusinc-mng-commons.d.ts +5 -0
- package/package.json +27 -6
- package/{src/public-api.ts → public-api.d.ts} +0 -17
- package/.browserslistrc +0 -16
- package/karma.conf.js +0 -51
- package/ng-package.json +0 -14
- package/src/lib/api/models/builders/query-param.builder.ts +0 -54
- package/src/lib/api/models/filter-match-type.model.ts +0 -25
- package/src/lib/api/models/filter-param.model.ts +0 -59
- package/src/lib/api/models/mappers.ts +0 -18
- package/src/lib/api/models/query-param.model.ts +0 -99
- package/src/lib/api/models/query-result.model.ts +0 -77
- package/src/lib/api/services/crud-api.abstract.service.ts +0 -113
- package/src/lib/api/utils/medius-rest.util.ts +0 -146
- package/src/lib/api/utils/object-serializer.util.ts +0 -227
- package/src/lib/components/action/action.component.html +0 -30
- package/src/lib/components/action/action.component.ts +0 -77
- package/src/lib/components/action/dialog/action-dialog.component.html +0 -26
- package/src/lib/components/action/dialog/action-dialog.component.ts +0 -171
- package/src/lib/components/action/models/action-execution.model.ts +0 -81
- package/src/lib/components/action/route/action-route.component.html +0 -1
- package/src/lib/components/action/route/action-route.component.ts +0 -159
- package/src/lib/components/form/autocomplete/autocomplete.component.html +0 -16
- package/src/lib/components/form/autocomplete/autocomplete.component.ts +0 -113
- package/src/lib/components/form/dropdown/dropdown.component.html +0 -29
- package/src/lib/components/form/dropdown/dropdown.component.ts +0 -109
- package/src/lib/components/form/editor/form-editor.component.html +0 -5
- package/src/lib/components/form/editor/form-editor.component.ts +0 -149
- package/src/lib/components/form/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.html +0 -7
- package/src/lib/components/form/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.ts +0 -21
- package/src/lib/components/form/formly/fields/formly-field-dropdown/formly-field-dropdown.component.html +0 -9
- package/src/lib/components/form/formly/fields/formly-field-dropdown/formly-field-dropdown.component.ts +0 -22
- package/src/lib/components/form/formly/fields/formly-field-fieldset/formly-field-fieldset.component.html +0 -8
- package/src/lib/components/form/formly/fields/formly-field-fieldset/formly-field-fieldset.component.ts +0 -10
- package/src/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.html +0 -56
- package/src/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.ts +0 -22
- package/src/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.html +0 -13
- package/src/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.scss +0 -4
- package/src/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.ts +0 -114
- package/src/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.html +0 -37
- package/src/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.ts +0 -133
- package/src/lib/components/form/formly/fields/formly-field-tabs/formly-field-tabs.component.html +0 -10
- package/src/lib/components/form/formly/fields/formly-field-tabs/formly-field-tabs.component.ts +0 -10
- package/src/lib/components/form/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.html +0 -7
- package/src/lib/components/form/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.ts +0 -13
- package/src/lib/components/form/formly/wrappers/formly-table-wrapper/formly-table-wrapper.component.html +0 -6
- package/src/lib/components/form/formly/wrappers/formly-table-wrapper/formly-table-wrapper.component.ts +0 -13
- package/src/lib/components/form/models/form-editor.event.ts +0 -7
- package/src/lib/components/layout/breadcrumb.component.html +0 -5
- package/src/lib/components/layout/breadcrumb.component.ts +0 -12
- package/src/lib/components/layout/footer.component.html +0 -7
- package/src/lib/components/layout/footer.component.ts +0 -15
- package/src/lib/components/layout/main-layout.component.html +0 -26
- package/src/lib/components/layout/main-layout.component.ts +0 -54
- package/src/lib/components/layout/menu-item.component.html +0 -41
- package/src/lib/components/layout/menu-item.component.ts +0 -170
- package/src/lib/components/layout/menu.component.html +0 -27
- package/src/lib/components/layout/menu.component.ts +0 -17
- package/src/lib/components/layout/services/main-layout.component.service.ts +0 -231
- package/src/lib/components/layout/topbar.component.html +0 -38
- package/src/lib/components/layout/topbar.component.ts +0 -62
- package/src/lib/components/tableview/models/table.event.ts +0 -22
- package/src/lib/components/tableview/route/tableview-route.abstract.component.ts +0 -31
- package/src/lib/components/tableview/services/tableview.component.service.ts +0 -22
- package/src/lib/components/tableview/table/column-filter/column-filter.component.html +0 -36
- package/src/lib/components/tableview/table/column-filter/column-filter.component.ts +0 -70
- package/src/lib/components/tableview/table/column-value/column-value.component.html +0 -14
- package/src/lib/components/tableview/table/column-value/column-value.component.ts +0 -19
- package/src/lib/components/tableview/table/table.component.html +0 -110
- package/src/lib/components/tableview/table/table.component.ts +0 -327
- package/src/lib/components/tableview/tableview.component.html +0 -37
- package/src/lib/components/tableview/tableview.component.ts +0 -78
- package/src/lib/config/formly.config.ts +0 -154
- package/src/lib/data-providers/base.data-provider.ts +0 -42
- package/src/lib/data-providers/editor.data-provider.ts +0 -60
- package/src/lib/data-providers/lookup.data-provider.ts +0 -29
- package/src/lib/data-providers/tableview.data-provider.ts +0 -29
- package/src/lib/descriptors/action.descriptor.ts +0 -439
- package/src/lib/descriptors/editor.descriptor.ts +0 -880
- package/src/lib/descriptors/field.validator.ts +0 -35
- package/src/lib/descriptors/model.descriptor.ts +0 -47
- package/src/lib/descriptors/table.descriptor.ts +0 -514
- package/src/lib/descriptors/tableview.descriptor.ts +0 -180
- package/src/lib/directives/component.directive.ts +0 -18
- package/src/lib/directives/template.directive.ts +0 -24
- package/src/lib/mng-commons.module.ts +0 -240
- package/src/lib/models/router.model.ts +0 -16
- package/src/lib/pipes/boolean.pipe.ts +0 -17
- package/src/lib/pipes/property-path.pipe.ts +0 -30
- package/src/lib/services/action.service.ts +0 -310
- package/src/lib/services/commons.service.ts +0 -407
- package/src/lib/services/configuration.service.ts +0 -98
- package/src/lib/services/navigation.service.ts +0 -42
- package/src/lib/services/providers/commons-init.provider.ts +0 -5
- package/src/lib/services/providers/config-service.provider.ts +0 -22
- package/src/lib/services/providers/formly-config.provider.ts +0 -39
- package/src/lib/services/tokens/browser-storage.token.ts +0 -9
- package/src/lib/services/tokens/module-config.token.ts +0 -5
- package/src/lib/types/type.decorator.ts +0 -7
- package/src/lib/types/type.model.ts +0 -12
- package/src/lib/utils/editor-formly.util.ts +0 -193
- package/src/lib/utils/i18n.util.ts +0 -148
- package/src/lib/utils/model.util.ts +0 -66
- package/src/lib/utils/toast.util.ts +0 -49
- package/src/lib/utils/type.util.ts +0 -44
- package/src/test.ts +0 -26
- package/tsconfig.lib.json +0 -15
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -17
|
@@ -1,407 +0,0 @@
|
|
|
1
|
-
import {Inject, Injectable} from '@angular/core';
|
|
2
|
-
import {ActivatedRouteSnapshot, NavigationEnd, Router} from '@angular/router';
|
|
3
|
-
import {Title} from '@angular/platform-browser';
|
|
4
|
-
|
|
5
|
-
import {FilterMatchMode, MenuItem, PrimeNGConfig} from 'primeng/api';
|
|
6
|
-
import {TranslateService} from '@ngx-translate/core';
|
|
7
|
-
import {BehaviorSubject, Observable, ReplaySubject, Subject, Subscription} from 'rxjs';
|
|
8
|
-
import {filter, map} from 'rxjs/operators';
|
|
9
|
-
|
|
10
|
-
import {MngConfigurationService} from './configuration.service';
|
|
11
|
-
import {MngModuleConfig} from '../config/models';
|
|
12
|
-
import {MngBreadcrumbMenuItem, MngRouterData, IUser} from '../models';
|
|
13
|
-
import {MNG_BROWSER_STORAGE_IT, MNG_MODULE_CONFIG_IT} from './tokens';
|
|
14
|
-
|
|
15
|
-
@Injectable()
|
|
16
|
-
export class MngCommonsService {
|
|
17
|
-
|
|
18
|
-
// menu
|
|
19
|
-
private _menuMode: 'static'|'sidebar'|'slim'|'overlay' = 'sidebar';
|
|
20
|
-
private _menuModeSubject: Subject<'static'|'sidebar'|'slim'|'overlay'> = new BehaviorSubject(this._menuMode);
|
|
21
|
-
private _menuItems: MenuItem[] = [];
|
|
22
|
-
private _menuPinEnabled: boolean = false;
|
|
23
|
-
private _menuActiveKeySubject = new Subject<string>();
|
|
24
|
-
private _menuResetSubject = new Subject();
|
|
25
|
-
|
|
26
|
-
// breadcrumbs
|
|
27
|
-
private readonly breadcrumbHomeSubject = new BehaviorSubject<MenuItem|null>({
|
|
28
|
-
icon: 'pi pi-home',
|
|
29
|
-
routerLink: '/'
|
|
30
|
-
});
|
|
31
|
-
private readonly breadcrumbsSubject = new BehaviorSubject<MenuItem[]>([]);
|
|
32
|
-
private breadcrumbsTranslateSubscription?: Subscription;
|
|
33
|
-
private breadcrumbHomeTranslateSubscription?: Subscription;
|
|
34
|
-
|
|
35
|
-
// visual
|
|
36
|
-
private _colorScheme: 'light'|'dark' = 'light';
|
|
37
|
-
|
|
38
|
-
// user
|
|
39
|
-
private _user?: IUser;
|
|
40
|
-
private userSubject: Subject<IUser> = new ReplaySubject(1);
|
|
41
|
-
|
|
42
|
-
constructor(
|
|
43
|
-
private router: Router,
|
|
44
|
-
private primengConfig: PrimeNGConfig,
|
|
45
|
-
private translate: TranslateService,
|
|
46
|
-
private titleService: Title,
|
|
47
|
-
private configurationService: MngConfigurationService,
|
|
48
|
-
@Inject(MNG_MODULE_CONFIG_IT) private moduleConfig: MngModuleConfig,
|
|
49
|
-
@Inject(MNG_BROWSER_STORAGE_IT) private localStorage: Storage
|
|
50
|
-
) { }
|
|
51
|
-
|
|
52
|
-
// APP section
|
|
53
|
-
|
|
54
|
-
public get appName() {
|
|
55
|
-
return this.moduleConfig?.app?.name ?? 'app.name';
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
public get appOwner() {
|
|
59
|
-
return this.moduleConfig?.app?.owner ?? 'app.owner';
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
public get appLogoLight() {
|
|
63
|
-
return this.moduleConfig?.app?.logoPathLight
|
|
64
|
-
? this.moduleConfig.app.logoPathLight
|
|
65
|
-
: (this.moduleConfig?.app?.logoPath ?? 'assets/layout/images/logo.png');
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
public get appLogoDark() {
|
|
69
|
-
return this.moduleConfig?.app?.logoPathDark
|
|
70
|
-
? this.moduleConfig.app.logoPathDark
|
|
71
|
-
: (this.moduleConfig?.app?.logoPath ?? 'assets/layout/images/logo.png');
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
public get appLogoNameLight() {
|
|
75
|
-
return this.moduleConfig?.app?.logoNamePathLight
|
|
76
|
-
? this.moduleConfig.app.logoNamePathLight
|
|
77
|
-
: (this.moduleConfig?.app?.logoNamePath ?? 'assets/layout/images/logo-appname.png');
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
public get appLogoNameDark() {
|
|
81
|
-
return this.moduleConfig?.app?.logoNamePathDark
|
|
82
|
-
? this.moduleConfig.app.logoNamePathDark
|
|
83
|
-
: (this.moduleConfig?.app?.logoNamePath ?? 'assets/layout/images/logo-appname.png');
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
public get appLanguages() {
|
|
87
|
-
return this.moduleConfig?.app?.languages ?? ['en'];
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
public get appLanguage(): string {
|
|
91
|
-
const lang = this.localStorage.getItem('lang');
|
|
92
|
-
if (lang) {
|
|
93
|
-
return lang;
|
|
94
|
-
}
|
|
95
|
-
const browserLang = this.translate.getBrowserLang();
|
|
96
|
-
if (browserLang && this.appLanguages.some(l => l === browserLang)) {
|
|
97
|
-
this.appLanguage = browserLang;
|
|
98
|
-
return browserLang;
|
|
99
|
-
}
|
|
100
|
-
this.appLanguage = 'en';
|
|
101
|
-
return 'en';
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
public set appLanguage(language: string) {
|
|
105
|
-
if (this.appLanguages.some(l => l === language)) {
|
|
106
|
-
this.localStorage.setItem('lang', language);
|
|
107
|
-
this.translate.use(language);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// MENU section
|
|
112
|
-
|
|
113
|
-
public get menuModeIsStatic() {
|
|
114
|
-
return this._menuMode === 'static';
|
|
115
|
-
}
|
|
116
|
-
public get menuModeIsStatic$(): Observable<boolean> {
|
|
117
|
-
return this._menuModeSubject.pipe(map(e => e === 'static'));
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
public get menuModeIsOverlay() {
|
|
121
|
-
return this._menuMode === 'overlay';
|
|
122
|
-
}
|
|
123
|
-
public get menuModeIsOverlay$(): Observable<boolean> {
|
|
124
|
-
return this._menuModeSubject.pipe(map(e => e === 'overlay'));
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
public get menuModeIsSlim() {
|
|
128
|
-
return this._menuMode === 'slim';
|
|
129
|
-
}
|
|
130
|
-
public get menuModeIsSlim$(): Observable<boolean> {
|
|
131
|
-
return this._menuModeSubject.pipe(map(e => e === 'slim'));
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
public get menuModeIsSidebar() {
|
|
135
|
-
return this._menuMode === 'sidebar';
|
|
136
|
-
}
|
|
137
|
-
public get menuModeIsSidebar$(): Observable<boolean> {
|
|
138
|
-
return this._menuModeSubject.pipe(map(e => e === 'sidebar'));
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
public get menuActiveKey$(): Observable<string> {
|
|
142
|
-
return this._menuActiveKeySubject.asObservable();
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
public get menuReset$(): Observable<any> {
|
|
146
|
-
return this._menuResetSubject.asObservable();
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
public get menuItems() {
|
|
150
|
-
return this._menuItems;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
public set menuItems(menuItems: MenuItem[]) {
|
|
154
|
-
this._menuItems = menuItems;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
public get menuPinEnabled() {
|
|
158
|
-
return this._menuPinEnabled;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
// BREADCRUMB section
|
|
162
|
-
public get breadcrumbHome$() {
|
|
163
|
-
return this.breadcrumbHomeSubject.asObservable();
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
public get breadcrumbs$() {
|
|
167
|
-
return this.breadcrumbsSubject.asObservable();
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
// VISUAL section
|
|
171
|
-
|
|
172
|
-
public get colorSchemeIsLight() {
|
|
173
|
-
return this._colorScheme === 'light';
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
public get colorSchemeIsDark() {
|
|
177
|
-
return this._colorScheme === 'dark';
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// USER section
|
|
181
|
-
|
|
182
|
-
public get user() {
|
|
183
|
-
// @ts-ignore
|
|
184
|
-
return this._user;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
public get user$() {
|
|
188
|
-
return this.userSubject.asObservable();
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
public set user(user: IUser) {
|
|
192
|
-
this._user = user;
|
|
193
|
-
this.userSubject.next(user);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
public initialize() {
|
|
197
|
-
console.log('Initializing app');
|
|
198
|
-
|
|
199
|
-
// menu
|
|
200
|
-
this._menuMode = this.moduleConfig?.menu?.mode ?? 'sidebar';
|
|
201
|
-
this._menuModeSubject.next(this._menuMode);
|
|
202
|
-
this._menuItems = this.moduleConfig?.menu?.menuItems ?? [];
|
|
203
|
-
this._menuPinEnabled = this.moduleConfig?.menu?.pinEnabled ?? false;
|
|
204
|
-
|
|
205
|
-
// visual
|
|
206
|
-
this._colorScheme = this.moduleConfig?.app?.colorScheme ?? 'light';
|
|
207
|
-
|
|
208
|
-
// ripple
|
|
209
|
-
this.primengConfig.ripple = true;
|
|
210
|
-
this.primengConfig.filterMatchModeOptions = {
|
|
211
|
-
text: [
|
|
212
|
-
FilterMatchMode.CONTAINS,
|
|
213
|
-
FilterMatchMode.EQUALS,
|
|
214
|
-
FilterMatchMode.NOT_EQUALS,
|
|
215
|
-
FilterMatchMode.STARTS_WITH,
|
|
216
|
-
FilterMatchMode.ENDS_WITH
|
|
217
|
-
],
|
|
218
|
-
numeric: [
|
|
219
|
-
FilterMatchMode.EQUALS,
|
|
220
|
-
FilterMatchMode.NOT_EQUALS,
|
|
221
|
-
FilterMatchMode.LESS_THAN_OR_EQUAL_TO,
|
|
222
|
-
FilterMatchMode.GREATER_THAN_OR_EQUAL_TO
|
|
223
|
-
],
|
|
224
|
-
date: [
|
|
225
|
-
FilterMatchMode.DATE_IS,
|
|
226
|
-
FilterMatchMode.DATE_IS_NOT,
|
|
227
|
-
FilterMatchMode.DATE_BEFORE,
|
|
228
|
-
FilterMatchMode.DATE_AFTER
|
|
229
|
-
]
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
// translate
|
|
233
|
-
this.translate.langs = this.appLanguages;
|
|
234
|
-
this.translate.use(this.appLanguage);
|
|
235
|
-
this.translate.get('mngPrime').subscribe(value => this.primengConfig.setTranslation(value));
|
|
236
|
-
|
|
237
|
-
this.router.events.pipe(
|
|
238
|
-
// Filter the NavigationEnd events as the breadcrumb is updated only when the route reaches its end
|
|
239
|
-
filter((event) => event instanceof NavigationEnd)
|
|
240
|
-
)
|
|
241
|
-
.subscribe((event) => {
|
|
242
|
-
this.updateBreadcrumbs();
|
|
243
|
-
this.setPageTitle();
|
|
244
|
-
});
|
|
245
|
-
this.translate.onLangChange.subscribe(event => {
|
|
246
|
-
this.updateBreadcrumbs();
|
|
247
|
-
this.setPageTitle();
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
// MENU actions
|
|
252
|
-
|
|
253
|
-
menuChangeActiveKey(key: string) {
|
|
254
|
-
this._menuActiveKeySubject.next(key);
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
menuReset() {
|
|
258
|
-
this._menuResetSubject.next(null);
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
// BREADCRUMB actions
|
|
262
|
-
|
|
263
|
-
private updateBreadcrumbs() {
|
|
264
|
-
if (this.breadcrumbsTranslateSubscription) {
|
|
265
|
-
this.breadcrumbsTranslateSubscription.unsubscribe();
|
|
266
|
-
this.breadcrumbsTranslateSubscription = undefined;
|
|
267
|
-
}
|
|
268
|
-
if (this.breadcrumbHomeTranslateSubscription) {
|
|
269
|
-
this.breadcrumbHomeTranslateSubscription.unsubscribe();
|
|
270
|
-
this.breadcrumbHomeTranslateSubscription = undefined;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
const rootRoute = this.router.routerState.snapshot.root;
|
|
274
|
-
|
|
275
|
-
const homeBreadcrumb = this.generateHomeBreadcrumb(rootRoute);
|
|
276
|
-
if (homeBreadcrumb) {
|
|
277
|
-
if (homeBreadcrumb.label) {
|
|
278
|
-
this.breadcrumbHomeTranslateSubscription = this.translate.get(homeBreadcrumb.label).subscribe(i18n => {
|
|
279
|
-
homeBreadcrumb.label = i18n;
|
|
280
|
-
this.breadcrumbHomeSubject.next(homeBreadcrumb);
|
|
281
|
-
});
|
|
282
|
-
} else {
|
|
283
|
-
this.breadcrumbHomeSubject.next(homeBreadcrumb);
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
const breadcrumbs: MenuItem[] = [];
|
|
288
|
-
this.generateBreadcrumbs(rootRoute, [], breadcrumbs);
|
|
289
|
-
|
|
290
|
-
// @ts-ignore
|
|
291
|
-
const i18nKeys: Array<string> = breadcrumbs.filter(b => typeof b.label === 'string').map(b => b.label);
|
|
292
|
-
if (i18nKeys.length > 0) {
|
|
293
|
-
this.breadcrumbsTranslateSubscription = this.translate.get(i18nKeys)
|
|
294
|
-
.subscribe(i18n => {
|
|
295
|
-
// Construct the breadcrumb hierarchy
|
|
296
|
-
breadcrumbs.forEach(b => {
|
|
297
|
-
if (b.label && i18n[b.label]) {
|
|
298
|
-
b.label = i18n[b.label];
|
|
299
|
-
}
|
|
300
|
-
});
|
|
301
|
-
|
|
302
|
-
// Emit the new breadcrumbs
|
|
303
|
-
this.breadcrumbsSubject.next(breadcrumbs);
|
|
304
|
-
});
|
|
305
|
-
} else {
|
|
306
|
-
this.breadcrumbsSubject.next(breadcrumbs);
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
private generateHomeBreadcrumb(route: ActivatedRouteSnapshot|null): MenuItem|null {
|
|
311
|
-
if (!route) {
|
|
312
|
-
return null;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
const routeData = route.data as MngRouterData;
|
|
316
|
-
const breadcrumbRouteData = routeData?.breadcrumb;
|
|
317
|
-
if (breadcrumbRouteData && typeof breadcrumbRouteData === 'object' && 'isHome' in breadcrumbRouteData) {
|
|
318
|
-
if (breadcrumbRouteData.isHome === false) {
|
|
319
|
-
return null;
|
|
320
|
-
}
|
|
321
|
-
const breadcrumb = this.createBreadcrumb('/', breadcrumbRouteData, true);
|
|
322
|
-
if (breadcrumb) {
|
|
323
|
-
if (typeof breadcrumb.icon === 'undefined') {
|
|
324
|
-
breadcrumb.icon = 'pi pi-home';
|
|
325
|
-
}
|
|
326
|
-
return breadcrumb;
|
|
327
|
-
}
|
|
328
|
-
} else {
|
|
329
|
-
return this.generateHomeBreadcrumb(route.firstChild)
|
|
330
|
-
}
|
|
331
|
-
return null;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
private generateBreadcrumbs(route: ActivatedRouteSnapshot | null, parentUrlSegments: string[], breadcrumbs: MenuItem[]) {
|
|
335
|
-
if (!route) {
|
|
336
|
-
return;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
const routeData = route.data as MngRouterData;
|
|
340
|
-
const routeUrlSegments = parentUrlSegments.concat(route.url.map(url => url.path));
|
|
341
|
-
const routeUrl = `/${routeUrlSegments.join('/')}`;
|
|
342
|
-
if (routeData?.breadcrumb) {
|
|
343
|
-
const breadcrumbRouteData = routeData.breadcrumb;
|
|
344
|
-
|
|
345
|
-
if (Array.isArray(breadcrumbRouteData)) {
|
|
346
|
-
for (const breadcrumbRouteDataItem of breadcrumbRouteData) {
|
|
347
|
-
const breadcrumb = this.createBreadcrumb(routeUrl, breadcrumbRouteDataItem);
|
|
348
|
-
if (breadcrumb) {
|
|
349
|
-
breadcrumbs.push(breadcrumb);
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
} else if (typeof breadcrumbRouteData === 'function') {
|
|
353
|
-
breadcrumbs.push(...breadcrumbRouteData(routeUrl, route));
|
|
354
|
-
} else {
|
|
355
|
-
const breadcrumb = this.createBreadcrumb(routeUrl, breadcrumbRouteData);
|
|
356
|
-
if (breadcrumb) {
|
|
357
|
-
breadcrumbs.push(breadcrumb);
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
this.generateBreadcrumbs(route.firstChild, routeUrlSegments, breadcrumbs);
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
private createBreadcrumb(routeUrl: string, routeBreadcrumb: string|MngBreadcrumbMenuItem, includeHome: boolean = false): MenuItem|null {
|
|
365
|
-
if (typeof routeBreadcrumb === 'string') {
|
|
366
|
-
return {
|
|
367
|
-
label: routeBreadcrumb,
|
|
368
|
-
routerLink: routeUrl
|
|
369
|
-
};
|
|
370
|
-
} else {
|
|
371
|
-
if (!includeHome && typeof routeBreadcrumb.isHome !== 'undefined') {
|
|
372
|
-
// home should not be included
|
|
373
|
-
return null;
|
|
374
|
-
}
|
|
375
|
-
if (typeof routeBreadcrumb.routerLink === 'undefined') {
|
|
376
|
-
routeBreadcrumb.routerLink = routeUrl;
|
|
377
|
-
}
|
|
378
|
-
return routeBreadcrumb;
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
// TITLE section
|
|
383
|
-
|
|
384
|
-
public setPageTitle(title?: string) {
|
|
385
|
-
let currentRoute = this.router.routerState.snapshot.root;
|
|
386
|
-
while (currentRoute.firstChild) {
|
|
387
|
-
currentRoute = currentRoute.firstChild;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
const routeData = currentRoute.data as MngRouterData;
|
|
391
|
-
const pageTitle = title ?? routeData.pageTitle;
|
|
392
|
-
|
|
393
|
-
this.titleService.setTitle(this.formatPageTitle(pageTitle));
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
private formatPageTitle(titlePrefix?: string) {
|
|
397
|
-
const titlePieces = [];
|
|
398
|
-
|
|
399
|
-
if (titlePrefix) {
|
|
400
|
-
titlePieces.push(this.translate.instant(titlePrefix));
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
titlePieces.push(this.translate.instant('app.name'));
|
|
404
|
-
|
|
405
|
-
return titlePieces.join(' - ');
|
|
406
|
-
}
|
|
407
|
-
}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import {HttpClient} from '@angular/common/http';
|
|
2
|
-
|
|
3
|
-
import {catchError, first, map} from 'rxjs/operators';
|
|
4
|
-
import {Observable} from 'rxjs';
|
|
5
|
-
|
|
6
|
-
export class MngConfigurationService {
|
|
7
|
-
|
|
8
|
-
private static _instance: MngConfigurationService|null = null;
|
|
9
|
-
public static init(httpClient: HttpClient): MngConfigurationService {
|
|
10
|
-
if (!this._instance) {
|
|
11
|
-
MngConfigurationService._instance = new MngConfigurationService(httpClient);
|
|
12
|
-
}
|
|
13
|
-
return MngConfigurationService.get();
|
|
14
|
-
}
|
|
15
|
-
public static get(): MngConfigurationService {
|
|
16
|
-
if (!MngConfigurationService._instance) {
|
|
17
|
-
throw new Error('Configuration service instance not set. Call init first.');
|
|
18
|
-
}
|
|
19
|
-
return MngConfigurationService._instance;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
private projectEnvironment?: any;
|
|
23
|
-
private jsonEnvironments: Array<any> = [];
|
|
24
|
-
|
|
25
|
-
private configuration = {...this.projectEnvironment};
|
|
26
|
-
|
|
27
|
-
private constructor(private http: HttpClient) {
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Add project environment source.
|
|
32
|
-
* @param environemnt Environment.
|
|
33
|
-
*/
|
|
34
|
-
public addEnvironmentSource(environment: any): void {
|
|
35
|
-
this.projectEnvironment = environment;
|
|
36
|
-
this.mergeConfigs();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Adds new config source from JSON file.
|
|
41
|
-
* @param url Url to JSON file.
|
|
42
|
-
*/
|
|
43
|
-
public addJsonSource(url: string = this.projectEnvironment.configurationJsonSource): Observable<boolean> {
|
|
44
|
-
|
|
45
|
-
if (!url) {
|
|
46
|
-
console.warn('No path to configuration file specified. Setting default.');
|
|
47
|
-
url = 'assets/config/env{{environment}}.json';
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const envName = this.projectEnvironment.name || (this.projectEnvironment.production ? 'prod' : 'dev');
|
|
51
|
-
url = url.replace('{{environment}}', '.' + envName);
|
|
52
|
-
|
|
53
|
-
return this.http.get<any>(url)
|
|
54
|
-
.pipe(
|
|
55
|
-
catchError((err => {
|
|
56
|
-
console.warn('Error loading configuration file:' + err.message + '. Falling back to env.json');
|
|
57
|
-
|
|
58
|
-
const pathSegments = url.split('/');
|
|
59
|
-
pathSegments[pathSegments.length - 1] = 'env.json';
|
|
60
|
-
return this.http.get<any>(pathSegments.join('/'));
|
|
61
|
-
})),
|
|
62
|
-
first(),
|
|
63
|
-
map(res => {
|
|
64
|
-
this.jsonEnvironments.push(res);
|
|
65
|
-
this.mergeConfigs();
|
|
66
|
-
return true;
|
|
67
|
-
})
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Get configuration.
|
|
73
|
-
*/
|
|
74
|
-
public getConfig() {
|
|
75
|
-
return this.configuration;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Get configuration value for key.
|
|
80
|
-
* @param key Configuration key.
|
|
81
|
-
*/
|
|
82
|
-
public getConfigValue(key: string) {
|
|
83
|
-
return this.configuration[key] ? this.configuration[key] : null;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Merges configuration from multiple sources with
|
|
88
|
-
*/
|
|
89
|
-
private mergeConfigs() {
|
|
90
|
-
let config = {...this.projectEnvironment};
|
|
91
|
-
if (this.jsonEnvironments.length) {
|
|
92
|
-
for (const je of this.jsonEnvironments) {
|
|
93
|
-
config = {...config, ...je};
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
this.configuration = config;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import {Injectable} from '@angular/core';
|
|
2
|
-
import {NavigationEnd, Router} from '@angular/router';
|
|
3
|
-
import {Location} from '@angular/common';
|
|
4
|
-
|
|
5
|
-
@Injectable()
|
|
6
|
-
export class MngNavigationService {
|
|
7
|
-
|
|
8
|
-
private history: Array<string> = [];
|
|
9
|
-
|
|
10
|
-
constructor(private router: Router, private location: Location) {
|
|
11
|
-
this.router.events.subscribe((event) => {
|
|
12
|
-
if (event instanceof NavigationEnd) {
|
|
13
|
-
this.history.push(event.urlAfterRedirects);
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
public getCurrentLocation(): string|null {
|
|
19
|
-
if (this.history.length > 0) {
|
|
20
|
-
return this.history[this.history.length - 1];
|
|
21
|
-
} else {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public getPreviousLocation(): string|null {
|
|
27
|
-
if (this.history.length > 1) {
|
|
28
|
-
return this.history[this.history.length - 2];
|
|
29
|
-
} else {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
public back(): void {
|
|
35
|
-
this.history.pop();
|
|
36
|
-
if (this.history.length > 0) {
|
|
37
|
-
this.location.back();
|
|
38
|
-
} else {
|
|
39
|
-
this.router.navigateByUrl('/')
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import {HttpClient} from '@angular/common/http';
|
|
2
|
-
import {MngModuleConfig} from '../../config/models';
|
|
3
|
-
import {MngConfigurationService} from '../configuration.service';
|
|
4
|
-
import {of} from 'rxjs';
|
|
5
|
-
|
|
6
|
-
export const mngConfigurationServiceProvider = (httpClient: HttpClient, moduleConfig: MngModuleConfig): MngConfigurationService => {
|
|
7
|
-
const service = MngConfigurationService.init(httpClient);
|
|
8
|
-
if (moduleConfig?.configuration?.projectEnvironment) {
|
|
9
|
-
service.addEnvironmentSource(moduleConfig.configuration.projectEnvironment);
|
|
10
|
-
}
|
|
11
|
-
return service;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function mngConfigJsonAppInitializerProvider(configService: MngConfigurationService, moduleConfig: MngModuleConfig) {
|
|
15
|
-
return () => {
|
|
16
|
-
if (moduleConfig?.configuration?.skipJsonSourceInit) {
|
|
17
|
-
return of(false);
|
|
18
|
-
} else {
|
|
19
|
-
return configService.addJsonSource(moduleConfig?.configuration?.jsonSource ?? undefined);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import {TranslateService} from '@ngx-translate/core';
|
|
2
|
-
import {ConfigOption} from '@ngx-formly/core';
|
|
3
|
-
|
|
4
|
-
import {formlyTypesConfig, formlyWrappersConfig, getFormlyValidationMessages} from '../../config';
|
|
5
|
-
import {MngModuleConfig} from '../../config/models';
|
|
6
|
-
|
|
7
|
-
export function mngFormlyConfigProvider(translate: TranslateService, moduleConfig: MngModuleConfig = {}): ConfigOption {
|
|
8
|
-
const merge = moduleConfig.formly?.merge ?? true;
|
|
9
|
-
|
|
10
|
-
let types = formlyTypesConfig;
|
|
11
|
-
if (moduleConfig.formly?.types) {
|
|
12
|
-
if (!merge) {
|
|
13
|
-
types = [];
|
|
14
|
-
}
|
|
15
|
-
types = [...types, ...moduleConfig.formly.types];
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
let wrappers = formlyWrappersConfig;
|
|
19
|
-
if (moduleConfig.formly?.wrappers) {
|
|
20
|
-
if (!merge) {
|
|
21
|
-
wrappers = [];
|
|
22
|
-
}
|
|
23
|
-
wrappers = [...wrappers, ...moduleConfig.formly.wrappers];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
let validationMessages = getFormlyValidationMessages(translate);
|
|
27
|
-
if (typeof moduleConfig.formly?.getValidationMessages === 'function') {
|
|
28
|
-
if (!merge) {
|
|
29
|
-
validationMessages = [];
|
|
30
|
-
}
|
|
31
|
-
validationMessages = [...validationMessages, ...moduleConfig.formly.getValidationMessages(translate)];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return {
|
|
35
|
-
types: types,
|
|
36
|
-
wrappers: wrappers,
|
|
37
|
-
validationMessages: validationMessages
|
|
38
|
-
};
|
|
39
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface ClassType<T> extends Function {
|
|
2
|
-
new(...args: any[]): T;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
export interface EnumType {
|
|
6
|
-
[key: number]: EnumMemberType;
|
|
7
|
-
}
|
|
8
|
-
export type EnumMemberType = string|number;
|
|
9
|
-
|
|
10
|
-
export type IdType = number|string;
|
|
11
|
-
export type PrimitiveType = string|boolean|number;
|
|
12
|
-
export type PropertyType = PrimitiveType|Date|EnumType;
|