@mediusinc/mng-commons 0.2.0 → 0.2.1-rc
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/.browserslistrc +16 -0
- package/karma.conf.js +51 -0
- package/ng-package.json +14 -0
- package/package.json +3 -24
- package/src/lib/api/models/builders/query-param.builder.ts +54 -0
- package/src/lib/api/models/filter-match-type.model.ts +25 -0
- package/src/lib/api/models/filter-param.model.ts +59 -0
- package/{lib/api/models/index.d.ts → src/lib/api/models/index.ts} +10 -8
- package/src/lib/api/models/mappers.ts +18 -0
- package/{lib/api/models/filter-match-type.model.d.ts → src/lib/api/models/query-mode.model.ts} +18 -23
- package/src/lib/api/models/query-param.model.ts +99 -0
- package/src/lib/api/models/query-result.model.ts +77 -0
- package/{lib/api/models/serialization.model.d.ts → src/lib/api/models/serialization.model.ts} +9 -8
- package/src/lib/api/services/crud-api.abstract.service.ts +113 -0
- package/{lib/api/services/index.d.ts → src/lib/api/services/index.ts} +1 -1
- package/{lib/api/utils/index.d.ts → src/lib/api/utils/index.ts} +2 -2
- package/src/lib/api/utils/medius-rest.util.ts +146 -0
- package/src/lib/api/utils/object-serializer.util.ts +227 -0
- package/src/lib/components/action/action.component.html +30 -0
- package/src/lib/components/action/action.component.ts +77 -0
- package/src/lib/components/action/dialog/action-dialog.component.html +26 -0
- package/src/lib/components/action/dialog/action-dialog.component.ts +171 -0
- package/{lib/components/action/index.d.ts → src/lib/components/action/index.ts} +3 -3
- package/{lib/components/action/models/action-confirmation-service.model.d.ts → src/lib/components/action/models/action-confirmation-service.model.ts} +7 -6
- package/src/lib/components/action/models/action-execution.model.ts +81 -0
- package/{lib/components/action/models/index.d.ts → src/lib/components/action/models/index.ts} +2 -2
- package/src/lib/components/action/route/action-route.component.html +1 -0
- package/src/lib/components/action/route/action-route.component.ts +159 -0
- package/src/lib/components/form/autocomplete/autocomplete.component.html +16 -0
- package/src/lib/components/form/autocomplete/autocomplete.component.ts +113 -0
- package/src/lib/components/form/dropdown/dropdown.component.html +29 -0
- package/src/lib/components/form/dropdown/dropdown.component.ts +109 -0
- package/src/lib/components/form/editor/form-editor.component.html +5 -0
- package/src/lib/components/form/editor/form-editor.component.ts +149 -0
- package/src/lib/components/form/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.html +7 -0
- package/src/lib/components/form/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.ts +21 -0
- package/src/lib/components/form/formly/fields/formly-field-dropdown/formly-field-dropdown.component.html +9 -0
- package/src/lib/components/form/formly/fields/formly-field-dropdown/formly-field-dropdown.component.ts +22 -0
- package/src/lib/components/form/formly/fields/formly-field-fieldset/formly-field-fieldset.component.html +8 -0
- package/src/lib/components/form/formly/fields/formly-field-fieldset/formly-field-fieldset.component.ts +10 -0
- package/src/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.html +56 -0
- package/src/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.ts +22 -0
- package/src/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.html +13 -0
- package/src/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.scss +4 -0
- package/src/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.ts +114 -0
- package/src/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.html +37 -0
- package/src/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.ts +133 -0
- package/src/lib/components/form/formly/fields/formly-field-tabs/formly-field-tabs.component.html +10 -0
- package/src/lib/components/form/formly/fields/formly-field-tabs/formly-field-tabs.component.ts +10 -0
- package/{lib/components/form/formly/fields/index.d.ts → src/lib/components/form/formly/fields/index.ts} +7 -7
- package/src/lib/components/form/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.html +7 -0
- package/src/lib/components/form/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.ts +13 -0
- package/src/lib/components/form/formly/wrappers/formly-table-wrapper/formly-table-wrapper.component.html +6 -0
- package/src/lib/components/form/formly/wrappers/formly-table-wrapper/formly-table-wrapper.component.ts +13 -0
- package/{lib/components/form/formly/wrappers/index.d.ts → src/lib/components/form/formly/wrappers/index.ts} +2 -2
- package/{lib/components/form/index.d.ts → src/lib/components/form/index.ts} +3 -3
- package/src/lib/components/form/models/form-editor.event.ts +7 -0
- package/{lib/components/form/models/index.d.ts → src/lib/components/form/models/index.ts} +1 -1
- package/src/lib/components/layout/breadcrumb.component.html +5 -0
- package/src/lib/components/layout/breadcrumb.component.ts +12 -0
- package/src/lib/components/layout/footer.component.html +7 -0
- package/src/lib/components/layout/footer.component.ts +15 -0
- package/{lib/components/layout/index.d.ts → src/lib/components/layout/index.ts} +6 -6
- package/src/lib/components/layout/main-layout.component.html +26 -0
- package/src/lib/components/layout/main-layout.component.ts +54 -0
- package/src/lib/components/layout/menu-item.component.html +41 -0
- package/src/lib/components/layout/menu-item.component.ts +170 -0
- package/src/lib/components/layout/menu.component.html +27 -0
- package/src/lib/components/layout/menu.component.ts +17 -0
- package/{lib/components/layout/services/index.d.ts → src/lib/components/layout/services/index.ts} +1 -1
- package/src/lib/components/layout/services/main-layout.component.service.ts +231 -0
- package/src/lib/components/layout/topbar.component.html +38 -0
- package/src/lib/components/layout/topbar.component.ts +62 -0
- package/{lib/components/tableview/index.d.ts → src/lib/components/tableview/index.ts} +5 -5
- package/{lib/components/tableview/models/index.d.ts → src/lib/components/tableview/models/index.ts} +1 -1
- package/src/lib/components/tableview/models/table.event.ts +22 -0
- package/src/lib/components/tableview/route/tableview-route.abstract.component.ts +31 -0
- package/{lib/components/tableview/services/index.d.ts → src/lib/components/tableview/services/index.ts} +1 -1
- package/src/lib/components/tableview/services/tableview.component.service.ts +22 -0
- package/src/lib/components/tableview/table/column-filter/column-filter.component.html +36 -0
- package/src/lib/components/tableview/table/column-filter/column-filter.component.ts +70 -0
- package/src/lib/components/tableview/table/column-value/column-value.component.html +14 -0
- package/src/lib/components/tableview/table/column-value/column-value.component.ts +19 -0
- package/src/lib/components/tableview/table/table.component.html +110 -0
- package/src/lib/components/tableview/table/table.component.ts +327 -0
- package/src/lib/components/tableview/tableview.component.html +37 -0
- package/src/lib/components/tableview/tableview.component.ts +78 -0
- package/src/lib/config/formly.config.ts +154 -0
- package/{lib/config/index.d.ts → src/lib/config/index.ts} +1 -1
- package/{lib/config/models/index.d.ts → src/lib/config/models/index.ts} +1 -1
- package/{lib/config/models/mng-config.model.d.ts → src/lib/config/models/mng-config.model.ts} +35 -34
- package/src/lib/data-providers/base.data-provider.ts +42 -0
- package/src/lib/data-providers/editor.data-provider.ts +60 -0
- package/{lib/data-providers/index.d.ts → src/lib/data-providers/index.ts} +5 -5
- package/src/lib/data-providers/lookup.data-provider.ts +29 -0
- package/{lib/data-providers/table.data-provider.d.ts → src/lib/data-providers/table.data-provider.ts} +8 -6
- package/src/lib/data-providers/tableview.data-provider.ts +29 -0
- package/src/lib/descriptors/action.descriptor.ts +439 -0
- package/src/lib/descriptors/editor.descriptor.ts +880 -0
- package/src/lib/descriptors/field.validator.ts +35 -0
- package/{lib/descriptors/index.d.ts → src/lib/descriptors/index.ts} +7 -7
- package/{lib/descriptors/lookup.descriptor.d.ts → src/lib/descriptors/lookup.descriptor.ts} +20 -17
- package/src/lib/descriptors/model.descriptor.ts +47 -0
- package/src/lib/descriptors/table.descriptor.ts +514 -0
- package/src/lib/descriptors/tableview.descriptor.ts +180 -0
- package/src/lib/directives/component.directive.ts +18 -0
- package/{lib/directives/index.d.ts → src/lib/directives/index.ts} +2 -2
- package/src/lib/directives/template.directive.ts +24 -0
- package/src/lib/mng-commons.module.ts +240 -0
- package/{lib/models/index.d.ts → src/lib/models/index.ts} +2 -2
- package/src/lib/models/router.model.ts +16 -0
- package/{lib/models/user.model.d.ts → src/lib/models/user.model.ts} +9 -8
- package/src/lib/pipes/boolean.pipe.ts +17 -0
- package/{lib/pipes/index.d.ts → src/lib/pipes/index.ts} +2 -2
- package/src/lib/pipes/property-path.pipe.ts +30 -0
- package/src/lib/services/action.service.ts +310 -0
- package/src/lib/services/commons.service.ts +407 -0
- package/src/lib/services/configuration.service.ts +98 -0
- package/{lib/services/index.d.ts → src/lib/services/index.ts} +4 -4
- package/src/lib/services/navigation.service.ts +42 -0
- package/src/lib/services/providers/commons-init.provider.ts +5 -0
- package/src/lib/services/providers/config-service.provider.ts +22 -0
- package/src/lib/services/providers/formly-config.provider.ts +39 -0
- package/{lib/services/providers/index.d.ts → src/lib/services/providers/index.ts} +3 -3
- package/src/lib/services/tokens/browser-storage.token.ts +9 -0
- package/{lib/services/tokens/index.d.ts → src/lib/services/tokens/index.ts} +2 -2
- package/src/lib/services/tokens/module-config.token.ts +5 -0
- package/{lib/types/index.d.ts → src/lib/types/index.ts} +2 -2
- package/src/lib/types/type.decorator.ts +7 -0
- package/src/lib/types/type.model.ts +12 -0
- package/src/lib/utils/editor-formly.util.ts +193 -0
- package/src/lib/utils/i18n.util.ts +148 -0
- package/{lib/utils/index.d.ts → src/lib/utils/index.ts} +5 -5
- package/src/lib/utils/model.util.ts +66 -0
- package/src/lib/utils/toast.util.ts +49 -0
- package/src/lib/utils/type.util.ts +44 -0
- package/{public-api.d.ts → src/public-api.ts} +42 -25
- package/src/test.ts +26 -0
- package/tsconfig.lib.json +15 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +17 -0
- package/esm2020/lib/api/models/builders/query-param.builder.mjs +0 -48
- package/esm2020/lib/api/models/filter-match-type.model.mjs +0 -26
- package/esm2020/lib/api/models/filter-param.model.mjs +0 -46
- package/esm2020/lib/api/models/index.mjs +0 -9
- package/esm2020/lib/api/models/mappers.mjs +0 -17
- package/esm2020/lib/api/models/query-mode.model.mjs +0 -19
- package/esm2020/lib/api/models/query-param.model.mjs +0 -69
- package/esm2020/lib/api/models/query-result.model.mjs +0 -45
- package/esm2020/lib/api/models/serialization.model.mjs +0 -2
- package/esm2020/lib/api/services/crud-api.abstract.service.mjs +0 -72
- package/esm2020/lib/api/services/index.mjs +0 -2
- package/esm2020/lib/api/utils/index.mjs +0 -3
- package/esm2020/lib/api/utils/medius-rest.util.mjs +0 -122
- package/esm2020/lib/api/utils/object-serializer.util.mjs +0 -226
- package/esm2020/lib/components/action/action.component.mjs +0 -65
- package/esm2020/lib/components/action/dialog/action-dialog.component.mjs +0 -148
- package/esm2020/lib/components/action/index.mjs +0 -4
- package/esm2020/lib/components/action/models/action-confirmation-service.model.mjs +0 -2
- package/esm2020/lib/components/action/models/action-execution.model.mjs +0 -58
- package/esm2020/lib/components/action/models/index.mjs +0 -3
- package/esm2020/lib/components/action/route/action-route.component.mjs +0 -144
- package/esm2020/lib/components/form/autocomplete/autocomplete.component.mjs +0 -114
- package/esm2020/lib/components/form/dropdown/dropdown.component.mjs +0 -113
- package/esm2020/lib/components/form/editor/form-editor.component.mjs +0 -141
- package/esm2020/lib/components/form/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.mjs +0 -19
- package/esm2020/lib/components/form/formly/fields/formly-field-dropdown/formly-field-dropdown.component.mjs +0 -19
- package/esm2020/lib/components/form/formly/fields/formly-field-fieldset/formly-field-fieldset.component.mjs +0 -16
- package/esm2020/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.mjs +0 -26
- package/esm2020/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +0 -109
- package/esm2020/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.mjs +0 -122
- package/esm2020/lib/components/form/formly/fields/formly-field-tabs/formly-field-tabs.component.mjs +0 -17
- package/esm2020/lib/components/form/formly/fields/index.mjs +0 -8
- package/esm2020/lib/components/form/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.mjs +0 -17
- package/esm2020/lib/components/form/formly/wrappers/formly-table-wrapper/formly-table-wrapper.component.mjs +0 -16
- package/esm2020/lib/components/form/formly/wrappers/index.mjs +0 -3
- package/esm2020/lib/components/form/index.mjs +0 -4
- package/esm2020/lib/components/form/models/form-editor.event.mjs +0 -7
- package/esm2020/lib/components/form/models/index.mjs +0 -2
- package/esm2020/lib/components/layout/breadcrumb.component.mjs +0 -17
- package/esm2020/lib/components/layout/footer.component.mjs +0 -17
- package/esm2020/lib/components/layout/index.mjs +0 -7
- package/esm2020/lib/components/layout/main-layout.component.mjs +0 -54
- package/esm2020/lib/components/layout/menu-item.component.mjs +0 -173
- package/esm2020/lib/components/layout/menu.component.mjs +0 -20
- package/esm2020/lib/components/layout/services/index.mjs +0 -2
- package/esm2020/lib/components/layout/services/main-layout.component.service.mjs +0 -190
- package/esm2020/lib/components/layout/topbar.component.mjs +0 -59
- package/esm2020/lib/components/tableview/index.mjs +0 -6
- package/esm2020/lib/components/tableview/models/index.mjs +0 -2
- package/esm2020/lib/components/tableview/models/table.event.mjs +0 -16
- package/esm2020/lib/components/tableview/route/tableview-route.abstract.component.mjs +0 -24
- package/esm2020/lib/components/tableview/services/index.mjs +0 -2
- package/esm2020/lib/components/tableview/services/tableview.component.service.mjs +0 -17
- package/esm2020/lib/components/tableview/table/column-filter/column-filter.component.mjs +0 -74
- package/esm2020/lib/components/tableview/table/column-value/column-value.component.mjs +0 -25
- package/esm2020/lib/components/tableview/table/table.component.mjs +0 -307
- package/esm2020/lib/components/tableview/tableview.component.mjs +0 -82
- package/esm2020/lib/config/formly.config.mjs +0 -136
- package/esm2020/lib/config/index.mjs +0 -2
- package/esm2020/lib/config/models/index.mjs +0 -2
- package/esm2020/lib/config/models/mng-config.model.mjs +0 -2
- package/esm2020/lib/data-providers/base.data-provider.mjs +0 -24
- package/esm2020/lib/data-providers/editor.data-provider.mjs +0 -37
- package/esm2020/lib/data-providers/index.mjs +0 -6
- package/esm2020/lib/data-providers/lookup.data-provider.mjs +0 -16
- package/esm2020/lib/data-providers/table.data-provider.mjs +0 -2
- package/esm2020/lib/data-providers/tableview.data-provider.mjs +0 -17
- package/esm2020/lib/descriptors/action.descriptor.mjs +0 -332
- package/esm2020/lib/descriptors/editor.descriptor.mjs +0 -670
- package/esm2020/lib/descriptors/field.validator.mjs +0 -21
- package/esm2020/lib/descriptors/index.mjs +0 -8
- package/esm2020/lib/descriptors/lookup.descriptor.mjs +0 -2
- package/esm2020/lib/descriptors/model.descriptor.mjs +0 -34
- package/esm2020/lib/descriptors/table.descriptor.mjs +0 -401
- package/esm2020/lib/descriptors/tableview.descriptor.mjs +0 -131
- package/esm2020/lib/directives/component.directive.mjs +0 -23
- package/esm2020/lib/directives/index.mjs +0 -3
- package/esm2020/lib/directives/template.directive.mjs +0 -29
- package/esm2020/lib/mng-commons.module.mjs +0 -410
- package/esm2020/lib/models/index.mjs +0 -3
- package/esm2020/lib/models/router.model.mjs +0 -2
- package/esm2020/lib/models/user.model.mjs +0 -2
- package/esm2020/lib/pipes/boolean.pipe.mjs +0 -22
- package/esm2020/lib/pipes/index.mjs +0 -3
- package/esm2020/lib/pipes/property-path.pipe.mjs +0 -36
- package/esm2020/lib/services/action.service.mjs +0 -269
- package/esm2020/lib/services/commons.service.mjs +0 -353
- package/esm2020/lib/services/configuration.service.mjs +0 -78
- package/esm2020/lib/services/index.mjs +0 -5
- package/esm2020/lib/services/navigation.service.mjs +0 -48
- package/esm2020/lib/services/providers/commons-init.provider.mjs +0 -4
- package/esm2020/lib/services/providers/config-service.provider.mjs +0 -20
- package/esm2020/lib/services/providers/formly-config.provider.mjs +0 -31
- package/esm2020/lib/services/providers/index.mjs +0 -4
- package/esm2020/lib/services/tokens/browser-storage.token.mjs +0 -6
- package/esm2020/lib/services/tokens/index.mjs +0 -3
- package/esm2020/lib/services/tokens/module-config.token.mjs +0 -3
- package/esm2020/lib/types/index.mjs +0 -3
- package/esm2020/lib/types/type.decorator.mjs +0 -7
- package/esm2020/lib/types/type.model.mjs +0 -2
- package/esm2020/lib/utils/editor-formly.util.mjs +0 -176
- package/esm2020/lib/utils/i18n.util.mjs +0 -125
- package/esm2020/lib/utils/index.mjs +0 -6
- package/esm2020/lib/utils/model.util.mjs +0 -57
- package/esm2020/lib/utils/toast.util.mjs +0 -39
- package/esm2020/lib/utils/type.util.mjs +0 -39
- package/esm2020/mediusinc-mng-commons.mjs +0 -5
- package/esm2020/public-api.mjs +0 -36
- package/fesm2015/mediusinc-mng-commons.mjs +0 -6250
- package/fesm2015/mediusinc-mng-commons.mjs.map +0 -1
- package/fesm2020/mediusinc-mng-commons.mjs +0 -6176
- package/fesm2020/mediusinc-mng-commons.mjs.map +0 -1
- package/lib/api/models/builders/query-param.builder.d.ts +0 -11
- package/lib/api/models/filter-param.model.d.ts +0 -23
- package/lib/api/models/mappers.d.ts +0 -6
- package/lib/api/models/query-mode.model.d.ts +0 -16
- package/lib/api/models/query-param.model.d.ts +0 -31
- package/lib/api/models/query-result.model.d.ts +0 -36
- package/lib/api/services/crud-api.abstract.service.d.ts +0 -23
- package/lib/api/utils/medius-rest.util.d.ts +0 -12
- package/lib/api/utils/object-serializer.util.d.ts +0 -30
- package/lib/components/action/action.component.d.ts +0 -36
- package/lib/components/action/dialog/action-dialog.component.d.ts +0 -46
- package/lib/components/action/models/action-execution.model.d.ts +0 -53
- package/lib/components/action/route/action-route.component.d.ts +0 -32
- package/lib/components/form/autocomplete/autocomplete.component.d.ts +0 -36
- package/lib/components/form/dropdown/dropdown.component.d.ts +0 -34
- package/lib/components/form/editor/form-editor.component.d.ts +0 -39
- package/lib/components/form/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.d.ts +0 -11
- package/lib/components/form/formly/fields/formly-field-dropdown/formly-field-dropdown.component.d.ts +0 -11
- package/lib/components/form/formly/fields/formly-field-fieldset/formly-field-fieldset.component.d.ts +0 -6
- package/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.d.ts +0 -12
- package/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.d.ts +0 -17
- package/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.d.ts +0 -36
- package/lib/components/form/formly/fields/formly-field-tabs/formly-field-tabs.component.d.ts +0 -6
- package/lib/components/form/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.d.ts +0 -8
- package/lib/components/form/formly/wrappers/formly-table-wrapper/formly-table-wrapper.component.d.ts +0 -8
- package/lib/components/form/models/form-editor.event.d.ts +0 -5
- package/lib/components/layout/breadcrumb.component.d.ts +0 -8
- package/lib/components/layout/footer.component.d.ts +0 -9
- package/lib/components/layout/main-layout.component.d.ts +0 -21
- package/lib/components/layout/menu-item.component.d.ts +0 -29
- package/lib/components/layout/menu.component.d.ts +0 -10
- package/lib/components/layout/services/main-layout.component.service.d.ts +0 -65
- package/lib/components/layout/topbar.component.d.ts +0 -25
- package/lib/components/tableview/models/table.event.d.ts +0 -17
- package/lib/components/tableview/route/tableview-route.abstract.component.d.ts +0 -14
- package/lib/components/tableview/services/tableview.component.service.d.ts +0 -13
- package/lib/components/tableview/table/column-filter/column-filter.component.d.ts +0 -22
- package/lib/components/tableview/table/column-value/column-value.component.d.ts +0 -12
- package/lib/components/tableview/table/table.component.d.ts +0 -79
- package/lib/components/tableview/tableview.component.d.ts +0 -35
- package/lib/config/formly.config.d.ts +0 -14
- package/lib/data-providers/base.data-provider.d.ts +0 -17
- package/lib/data-providers/editor.data-provider.d.ts +0 -25
- package/lib/data-providers/lookup.data-provider.d.ts +0 -14
- package/lib/data-providers/tableview.data-provider.d.ts +0 -15
- package/lib/descriptors/action.descriptor.d.ts +0 -148
- package/lib/descriptors/editor.descriptor.d.ts +0 -255
- package/lib/descriptors/field.validator.d.ts +0 -18
- package/lib/descriptors/model.descriptor.d.ts +0 -15
- package/lib/descriptors/table.descriptor.d.ts +0 -164
- package/lib/descriptors/tableview.descriptor.d.ts +0 -39
- package/lib/directives/component.directive.d.ts +0 -11
- package/lib/directives/template.directive.d.ts +0 -13
- package/lib/mng-commons.module.d.ts +0 -79
- package/lib/models/router.model.d.ts +0 -14
- package/lib/pipes/boolean.pipe.d.ts +0 -7
- package/lib/pipes/property-path.pipe.d.ts +0 -7
- package/lib/services/action.service.d.ts +0 -92
- package/lib/services/commons.service.d.ts +0 -72
- package/lib/services/configuration.service.d.ts +0 -35
- package/lib/services/navigation.service.d.ts +0 -14
- package/lib/services/providers/commons-init.provider.d.ts +0 -2
- package/lib/services/providers/config-service.provider.d.ts +0 -5
- package/lib/services/providers/formly-config.provider.d.ts +0 -4
- package/lib/services/tokens/browser-storage.token.d.ts +0 -2
- package/lib/services/tokens/module-config.token.d.ts +0 -3
- package/lib/types/type.decorator.d.ts +0 -2
- package/lib/types/type.model.d.ts +0 -10
- package/lib/utils/editor-formly.util.d.ts +0 -9
- package/lib/utils/i18n.util.d.ts +0 -18
- package/lib/utils/model.util.d.ts +0 -7
- package/lib/utils/toast.util.d.ts +0 -13
- package/lib/utils/type.util.d.ts +0 -15
- package/mediusinc-mng-commons-0.2.0.tgz +0 -0
- package/mediusinc-mng-commons.d.ts +0 -5
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
import {Injectable, Injector} from '@angular/core';
|
|
2
|
+
import {ActivatedRoute, Router, UrlTree} from '@angular/router';
|
|
3
|
+
|
|
4
|
+
import {DialogService, DynamicDialogConfig} from 'primeng/dynamicdialog';
|
|
5
|
+
import {Confirmation, ConfirmationService} from 'primeng/api';
|
|
6
|
+
import {TranslateService} from '@ngx-translate/core';
|
|
7
|
+
import {from, Observable, of} from 'rxjs';
|
|
8
|
+
import {catchError, first, map} from 'rxjs/operators';
|
|
9
|
+
|
|
10
|
+
import {ActionActivationResult, ActionData, ActionError, ActionExecContext, ActionRunResult, ActionTriggerResult, IActionConfirmationService} from '../components/action/models';
|
|
11
|
+
import {ActionActivationTriggerEnum, ActionDescriptor, ActionEditorDescriptor, ActionTypeEnum} from '../descriptors';
|
|
12
|
+
import {MngTableCellClickEvent} from '../components/tableview/models';
|
|
13
|
+
import {TableviewComponentService} from '../components/tableview/services';
|
|
14
|
+
import {IDataProvider, IEditorDataProvider} from '../data-providers';
|
|
15
|
+
import {IdType} from '../types';
|
|
16
|
+
import {I18nUtil, ToastUtil} from '../utils';
|
|
17
|
+
import {MngActionDialogComponent} from '../components/action';
|
|
18
|
+
|
|
19
|
+
@Injectable()
|
|
20
|
+
export class MngActionService {
|
|
21
|
+
|
|
22
|
+
constructor(
|
|
23
|
+
private injector: Injector,
|
|
24
|
+
private router: Router,
|
|
25
|
+
private dialogService: DialogService,
|
|
26
|
+
private confirmationService: ConfirmationService,
|
|
27
|
+
private translate: TranslateService
|
|
28
|
+
) {
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public getActionExecContext<T, S>(action: ActionDescriptor<T>, itemId?: IdType, item?: T, dataProvider?: IDataProvider<T, S>,
|
|
32
|
+
tableview?: TableviewComponentService<T, S>, sourceComponent?: any, actionData?: ActionData): ActionExecContext<T, S, IDataProvider<T, S>> {
|
|
33
|
+
return new ActionExecContext<T, S, IDataProvider<T, S>>(
|
|
34
|
+
dataProvider,
|
|
35
|
+
this.getDataProviderService(dataProvider) ?? undefined,
|
|
36
|
+
{
|
|
37
|
+
item,
|
|
38
|
+
itemId,
|
|
39
|
+
actionData
|
|
40
|
+
},
|
|
41
|
+
sourceComponent,
|
|
42
|
+
tableview
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public runAction<T, S>(action: ActionDescriptor<T>, itemId?: IdType, item?: T, dataProvider?: IDataProvider<T, S>,
|
|
47
|
+
sourceComponent?: any, tableview?: TableviewComponentService<T, S>, actionData?: ActionData): Observable<ActionRunResult<T, S, IDataProvider<T, S>>> {
|
|
48
|
+
const context = this.getActionExecContext(action, itemId, item, dataProvider, tableview, sourceComponent, actionData);
|
|
49
|
+
if (action.hasRunConfirmation) {
|
|
50
|
+
if (typeof sourceComponent?.getConfirmationService !== 'function' || typeof sourceComponent?.getConfirmationServiceInstanceKey !== 'function') {
|
|
51
|
+
throw Error(`Source component ${sourceComponent} should be implementing IConfirmationService interface to be able to provide confirmation functionality.`);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const srcConfirmComponent = sourceComponent as IActionConfirmationService;
|
|
55
|
+
const confirmParams: Confirmation = {
|
|
56
|
+
key: srcConfirmComponent.getConfirmationServiceInstanceKey(action),
|
|
57
|
+
acceptVisible: false,
|
|
58
|
+
rejectVisible: false
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
if (action.runConfirmationTitle !== null) {
|
|
62
|
+
confirmParams.header = I18nUtil.instantActionTranslation(this.translate, action, 'confirm.title', action.runConfirmationTitle, item, 'general.confirmation') ?? undefined;
|
|
63
|
+
}
|
|
64
|
+
if (action.runConfirmationMessage !== null) {
|
|
65
|
+
confirmParams.message = I18nUtil.instantActionTranslation(this.translate, action, 'confirm.message', action.runConfirmationMessage, item, 'general.confirmation') ?? undefined;
|
|
66
|
+
}
|
|
67
|
+
if (action.runConfirmationIcon !== null) {
|
|
68
|
+
confirmParams.icon = action.runConfirmationIcon === undefined ? 'pi pi-exclamation-triangle' : action.runConfirmationIcon;
|
|
69
|
+
}
|
|
70
|
+
if (action.runConfirmationAcceptTitle !== null) {
|
|
71
|
+
confirmParams.acceptLabel = I18nUtil.instantActionTranslation(this.translate, action, 'confirm.accept', action.runConfirmationAcceptTitle, item, 'general.yes') ?? undefined;
|
|
72
|
+
confirmParams.acceptVisible = true;
|
|
73
|
+
}
|
|
74
|
+
if (action.runConfirmationRejectTitle !== null) {
|
|
75
|
+
confirmParams.rejectLabel = I18nUtil.instantActionTranslation(this.translate, action, 'confirm.reject', action.runConfirmationRejectTitle, item, 'general.no') ?? undefined;
|
|
76
|
+
confirmParams.rejectVisible = true;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const observable = new Observable<ActionRunResult<T, S, IDataProvider<T, S>>>(observer => {
|
|
80
|
+
confirmParams.accept = () => {
|
|
81
|
+
action.runFunction(context).pipe(
|
|
82
|
+
first(),
|
|
83
|
+
map(res => new ActionRunResult(context, res)),
|
|
84
|
+
map(value => {
|
|
85
|
+
if (action.hasRunNotificationSuccess) {
|
|
86
|
+
ToastUtil.actionNotificationSuccess(this.translate, action, 'run', action.runNotificationSuccessTitle, action.runNotificationSuccessMessage, tableview, item);
|
|
87
|
+
}
|
|
88
|
+
return value;
|
|
89
|
+
}),
|
|
90
|
+
catchError(err => {
|
|
91
|
+
if (action.hasRunNotificationError) {
|
|
92
|
+
ToastUtil.actionNotificationError(this.translate, action, err, 'run', tableview, item);
|
|
93
|
+
}
|
|
94
|
+
throw err;
|
|
95
|
+
})
|
|
96
|
+
).subscribe(res => {
|
|
97
|
+
observer.next(res);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
confirmParams.reject = () => {
|
|
102
|
+
observer.error(new ActionRunResult(context, undefined, new ActionError(null, true)));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
srcConfirmComponent.getConfirmationService().confirm(confirmParams);
|
|
106
|
+
});
|
|
107
|
+
return observable;
|
|
108
|
+
} else {
|
|
109
|
+
return action.runFunction(context).pipe(
|
|
110
|
+
map(res => new ActionRunResult(context, res)),
|
|
111
|
+
map(value => {
|
|
112
|
+
if (action.hasRunNotificationSuccess) {
|
|
113
|
+
ToastUtil.actionNotificationSuccess(this.translate, action, 'run', action.runNotificationSuccessTitle, action.runNotificationSuccessMessage, tableview, item);
|
|
114
|
+
}
|
|
115
|
+
return value;
|
|
116
|
+
}),
|
|
117
|
+
catchError(err => {
|
|
118
|
+
if (action.hasRunNotificationError) {
|
|
119
|
+
ToastUtil.actionNotificationError(this.translate, action, err, 'run', tableview, item);
|
|
120
|
+
}
|
|
121
|
+
throw err;
|
|
122
|
+
})
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Runs editor action save function usually triggered on form submit.
|
|
129
|
+
*
|
|
130
|
+
* @param action Action descriptor.
|
|
131
|
+
* @param itemId Item id (if exists).
|
|
132
|
+
* @param formItem Item instance (from form).
|
|
133
|
+
* @param dataProvider Data provider
|
|
134
|
+
* @param sourceComponent Source component from where the fetch function was called.
|
|
135
|
+
* @param tableview Tableview component.
|
|
136
|
+
* @param actionData Additional action data.
|
|
137
|
+
*/
|
|
138
|
+
public runEditorSave<T, S>(action: ActionEditorDescriptor<T>, itemId?: IdType, formItem?: T, dataProvider?: IEditorDataProvider<T, S>,
|
|
139
|
+
sourceComponent?: any, tableview?: TableviewComponentService<T, S>, actionData?: ActionData): Observable<ActionRunResult<T, S, IEditorDataProvider<T, S>>> {
|
|
140
|
+
const context = this.prepareRunContextForEditor(formItem, itemId, dataProvider, sourceComponent, tableview, actionData);
|
|
141
|
+
if (typeof action.submitFunction !== 'function') {
|
|
142
|
+
throw new Error(`Submit function for action ${action.actionName} cannot be invoked.`);
|
|
143
|
+
}
|
|
144
|
+
return action.submitFunction(context).pipe(
|
|
145
|
+
map(res => new ActionRunResult(context, res)),
|
|
146
|
+
map(value => {
|
|
147
|
+
if (action.hasRunNotificationSuccess) {
|
|
148
|
+
ToastUtil.actionNotificationSuccess(this.translate, action, 'submit', action.runNotificationSuccessTitle, action.runNotificationSuccessMessage, tableview, formItem);
|
|
149
|
+
}
|
|
150
|
+
return value;
|
|
151
|
+
}),
|
|
152
|
+
catchError(err => {
|
|
153
|
+
if (action.hasRunNotificationError) {
|
|
154
|
+
ToastUtil.actionNotificationError(this.translate, action, err, 'submit', tableview, formItem);
|
|
155
|
+
}
|
|
156
|
+
throw err;
|
|
157
|
+
})
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Runs editor action fetch function.
|
|
163
|
+
*
|
|
164
|
+
* @param action Action descriptor.
|
|
165
|
+
* @param itemId Item id.
|
|
166
|
+
* @param dataProvider Data provider
|
|
167
|
+
* @param sourceComponent Source component from where the fetch function was called.
|
|
168
|
+
* @param tableview Tableview component.
|
|
169
|
+
* @param actionData Additional action data.
|
|
170
|
+
*/
|
|
171
|
+
public runEditorFetch<T, S>(action: ActionEditorDescriptor<T>, itemId?: IdType, dataProvider?: IEditorDataProvider<T, S>,
|
|
172
|
+
sourceComponent?: any, tableview?: TableviewComponentService<T, S>, actionData?: ActionData): Observable<ActionRunResult<T, S, IEditorDataProvider<T, S>>> {
|
|
173
|
+
const context = this.prepareRunContextForEditor(undefined, itemId, dataProvider, sourceComponent, tableview, actionData);
|
|
174
|
+
return action.fetchFunction(context).pipe(map(res => new ActionRunResult(context, res)));
|
|
175
|
+
// TODO: error handling
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Prepares action run context for action of type editor.
|
|
180
|
+
*
|
|
181
|
+
* @param item Item instance (if exists).
|
|
182
|
+
* @param itemId Item id (if exists).
|
|
183
|
+
* @param dataProvider Data provider.
|
|
184
|
+
* @param sourceComponent Source component from where the context preparation was called.
|
|
185
|
+
* @param tableview Tableview component.
|
|
186
|
+
* @param actionData Additional action data.
|
|
187
|
+
*/
|
|
188
|
+
private prepareRunContextForEditor<T, S>(item?: T, itemId?: IdType, dataProvider?: IEditorDataProvider<T, S>,
|
|
189
|
+
sourceComponent?: any, tableview?: TableviewComponentService<T, S>, actionData?: ActionData): ActionExecContext<T, S, IEditorDataProvider<T, S>> {
|
|
190
|
+
const context = new ActionExecContext<T, S, IEditorDataProvider<T, S>>(
|
|
191
|
+
dataProvider,
|
|
192
|
+
this.getDataProviderService(dataProvider) ?? undefined,
|
|
193
|
+
{
|
|
194
|
+
item,
|
|
195
|
+
itemId,
|
|
196
|
+
actionData
|
|
197
|
+
},
|
|
198
|
+
sourceComponent,
|
|
199
|
+
tableview
|
|
200
|
+
);
|
|
201
|
+
return context;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Gets service instance of data provider.
|
|
206
|
+
*
|
|
207
|
+
* @param dataProvider Data provider instance.
|
|
208
|
+
*/
|
|
209
|
+
private getDataProviderService<T, S>(dataProvider?: IDataProvider<T, S>): S|null {
|
|
210
|
+
if (dataProvider?.serviceType) {
|
|
211
|
+
return this.injector.get<S>(dataProvider.serviceType);
|
|
212
|
+
} else {
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Activates action.
|
|
219
|
+
*
|
|
220
|
+
* @param action Action descriptor.
|
|
221
|
+
* @param item Item instance (if exists).
|
|
222
|
+
* @param itemId Item id (if exists).
|
|
223
|
+
* @param actionData Optional additional action data.
|
|
224
|
+
* @param tableview Tableview component.
|
|
225
|
+
* @param sourceComponent Source activation component.
|
|
226
|
+
*/
|
|
227
|
+
public activateAction<T, S>(action: ActionDescriptor<T>, itemId?: IdType, item?: T, actionData?: ActionData, tableview?: TableviewComponentService<T, S>, sourceComponent?: any): Observable<ActionActivationResult<T, S, IDataProvider<T, S>>> {
|
|
228
|
+
if (action.type === ActionTypeEnum.Editor) {
|
|
229
|
+
const dialogConfig: DynamicDialogConfig = {
|
|
230
|
+
data: {
|
|
231
|
+
action
|
|
232
|
+
},
|
|
233
|
+
styleClass: action.className
|
|
234
|
+
};
|
|
235
|
+
if (itemId) {
|
|
236
|
+
dialogConfig.data.itemId = itemId;
|
|
237
|
+
}
|
|
238
|
+
if (item) {
|
|
239
|
+
dialogConfig.data.item = item;
|
|
240
|
+
}
|
|
241
|
+
if (actionData) {
|
|
242
|
+
dialogConfig.data.actionData = actionData;
|
|
243
|
+
}
|
|
244
|
+
if (tableview) {
|
|
245
|
+
dialogConfig.data.tableview = tableview;
|
|
246
|
+
}
|
|
247
|
+
if (sourceComponent) {
|
|
248
|
+
dialogConfig.data.sourceComponent = sourceComponent;
|
|
249
|
+
}
|
|
250
|
+
const dialogRef = this.dialogService.open(MngActionDialogComponent, dialogConfig);
|
|
251
|
+
return of(new ActionActivationResult<T, S, IDataProvider<T, S>>(undefined, dialogRef));
|
|
252
|
+
} else {
|
|
253
|
+
// directly execute action
|
|
254
|
+
return this.runAction<T, S>(action, itemId, item, tableview?.dataProvider ?? undefined, sourceComponent, tableview, actionData)
|
|
255
|
+
.pipe(map(res => new ActionActivationResult<T, S, IDataProvider<T, S>>(res)));
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Triggers action from table row click position.
|
|
261
|
+
*
|
|
262
|
+
* @param action Action descriptor.
|
|
263
|
+
* @param event Target table click event.
|
|
264
|
+
* @param route Currently activate route.
|
|
265
|
+
*/
|
|
266
|
+
public triggerRowClickAction<T>(action: ActionDescriptor<T>, event: MngTableCellClickEvent<T>, route: ActivatedRoute) {
|
|
267
|
+
if (!action.model.idPropertyName) {
|
|
268
|
+
throw new Error(`Row click action ${action.actionName} can not be triggered, because model id property name is not defined.`);
|
|
269
|
+
}
|
|
270
|
+
const rowItem = event?.rowItem as any;
|
|
271
|
+
return this.triggerAction(action, rowItem[action.model.idPropertyName], event.rowItem, undefined, route);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Triggers action with optional data (item, itemId, ...) and currently activated route.
|
|
276
|
+
*
|
|
277
|
+
* @param action Action.
|
|
278
|
+
* @param actionData Optional action data.
|
|
279
|
+
* @param route Optional activated route.
|
|
280
|
+
*/
|
|
281
|
+
public triggerAction<T, S>(action: ActionDescriptor<T>, itemId?: IdType, item?: T, actionData?: ActionData, route?: ActivatedRoute,
|
|
282
|
+
tableview?: TableviewComponentService<T, S>, sourceComponent?: any): Observable<ActionTriggerResult<T, S, IDataProvider<T, S>>> {
|
|
283
|
+
if (action.activationTrigger === ActionActivationTriggerEnum.OnRoute) {
|
|
284
|
+
const baseUrl = this.router.url.split('?')[0];
|
|
285
|
+
const parsedUrl: UrlTree = this.router.parseUrl(this.router.url);
|
|
286
|
+
let actionUrl = action.routeUrl ?? '';
|
|
287
|
+
// TODO: dont strip '/', but use it accordingly with Angular's router patterns (/, ./, ../)
|
|
288
|
+
if (actionUrl.startsWith('/')) {
|
|
289
|
+
actionUrl = actionUrl.substring(1);
|
|
290
|
+
}
|
|
291
|
+
const itemAny = (item ?? {}) as any;
|
|
292
|
+
const actionUrlSegments = actionUrl.split('/')
|
|
293
|
+
.map(s => {
|
|
294
|
+
if (s === ':itemId') {
|
|
295
|
+
return itemId;
|
|
296
|
+
} else if (s.startsWith(`:${action.model.typeName}.`)) {
|
|
297
|
+
return itemAny[s.substring(action.model.typeName.length + 2)] ?? '';
|
|
298
|
+
} else if (s.startsWith(':')) {
|
|
299
|
+
return actionData?.[s.substring(1)] ?? '';
|
|
300
|
+
} else {
|
|
301
|
+
return s;
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
return of(new ActionTriggerResult<T, S, IDataProvider<T, S>>(undefined, from(this.router.navigate([baseUrl, ...actionUrlSegments], {relativeTo: route, queryParams: parsedUrl.queryParams}))));
|
|
305
|
+
} else {
|
|
306
|
+
return this.activateAction(action, itemId, item, actionData, tableview, sourceComponent)
|
|
307
|
+
.pipe(map(res => new ActionTriggerResult<T, S, IDataProvider<T, S>>(res)));
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|