@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,227 +0,0 @@
|
|
|
1
|
-
import {AttributeDef, enumsMapBase, SerializableTypeMap, typeMapBase} from '../models';
|
|
2
|
-
import {ClassType} from '../../types';
|
|
3
|
-
import {TypeUtil} from '../../utils';
|
|
4
|
-
|
|
5
|
-
export class ObjectSerializer {
|
|
6
|
-
|
|
7
|
-
private readonly _primitives: string[] = [
|
|
8
|
-
'string',
|
|
9
|
-
'boolean',
|
|
10
|
-
'double',
|
|
11
|
-
'integer',
|
|
12
|
-
'long',
|
|
13
|
-
'float',
|
|
14
|
-
'number',
|
|
15
|
-
'any'
|
|
16
|
-
];
|
|
17
|
-
private readonly _typeMap: SerializableTypeMap = {
|
|
18
|
-
...typeMapBase
|
|
19
|
-
}
|
|
20
|
-
private readonly _enumMap: SerializableTypeMap = {
|
|
21
|
-
...enumsMapBase
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
private static _instance: ObjectSerializer = new ObjectSerializer();
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Only use one instance of object (out of Angular context)
|
|
28
|
-
*/
|
|
29
|
-
public static get(): ObjectSerializer {
|
|
30
|
-
return ObjectSerializer._instance;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
public get primitives() { return this._primitives }
|
|
34
|
-
public get typeMap() { return this._typeMap }
|
|
35
|
-
public get enumMap() { return this._enumMap }
|
|
36
|
-
|
|
37
|
-
public findAttributeDefinitionByClassType(type: ClassType<any>, attributeName: string): AttributeDef|null {
|
|
38
|
-
return this.findAttributeDefinition(TypeUtil.findTypeName(type), attributeName);
|
|
39
|
-
}
|
|
40
|
-
public findAttributeDefinition(typeName: string, attributeName: string): AttributeDef|null {
|
|
41
|
-
const attributeDefs = this.findAttributesDefinition(typeName);
|
|
42
|
-
if (!attributeDefs) {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
for (let attribute of attributeDefs) {
|
|
46
|
-
if (attribute.name === attributeName) {
|
|
47
|
-
return attribute;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
public findAttributesDefinitionByClassType(type: ClassType<any>): Array<AttributeDef>|null {
|
|
53
|
-
return this.findAttributesDefinition(TypeUtil.findTypeName(type));
|
|
54
|
-
}
|
|
55
|
-
public findAttributesDefinition(typeName: string): Array<AttributeDef>|null {
|
|
56
|
-
const typeDef = this.findType(typeName);
|
|
57
|
-
if (!typeDef) {
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
return typeDef.getAttributeTypeMap() as Array<AttributeDef>;
|
|
61
|
-
}
|
|
62
|
-
public findByClassType(type: ClassType<any>): any {
|
|
63
|
-
return this.findType(TypeUtil.findTypeName(type));
|
|
64
|
-
}
|
|
65
|
-
public findType(typeName: string): any {
|
|
66
|
-
return this._typeMap[typeName];
|
|
67
|
-
}
|
|
68
|
-
public findEnum(enumName: string): any {
|
|
69
|
-
return this._enumMap[enumName];
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
public registerTypes(types: SerializableTypeMap) {
|
|
73
|
-
for (const key in types) {
|
|
74
|
-
this.registerType(types[key], key);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
public registerType(type: ClassType<any>, optTypeName?: string) {
|
|
79
|
-
// try to find name from decorator
|
|
80
|
-
let typeName = TypeUtil.getDecoratorTypeName(type);
|
|
81
|
-
if (!typeName) {
|
|
82
|
-
// defined name from optional type name
|
|
83
|
-
typeName = optTypeName;
|
|
84
|
-
if (!typeName) {
|
|
85
|
-
console.warn(`Registering type ${type} failed, because typeName could not be determined and optional name was not provided.`);
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
if (typeof this._typeMap[typeName] !== 'undefined') {
|
|
90
|
-
console.warn(`Registering type ${type} under key ${typeName} skipped, because type already exists for this key.`);
|
|
91
|
-
} else {
|
|
92
|
-
TypeUtil.defineReflectTypeName(type, typeName);
|
|
93
|
-
this._typeMap[typeName] = type;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
public registerEnums(enums: SerializableTypeMap) {
|
|
98
|
-
for (const key in enums) {
|
|
99
|
-
if (typeof this._enumMap[key] !== 'undefined') {
|
|
100
|
-
console.warn(`Registering enum ${key} skipped, because enum already exists.`);
|
|
101
|
-
} else {
|
|
102
|
-
this._enumMap[key] = enums[key];
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
public findCorrectType(data: any, expectedType: string) {
|
|
108
|
-
if (data == undefined) {
|
|
109
|
-
return expectedType;
|
|
110
|
-
} else if (this._primitives.indexOf(expectedType.toLowerCase()) !== -1) {
|
|
111
|
-
return expectedType;
|
|
112
|
-
} else if (expectedType === 'Date') {
|
|
113
|
-
return expectedType;
|
|
114
|
-
} else {
|
|
115
|
-
if (this._enumMap[expectedType]) {
|
|
116
|
-
return expectedType;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (!this._typeMap[expectedType]) {
|
|
120
|
-
return expectedType; // w/e we don't know the type
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// Check the discriminator
|
|
124
|
-
const discriminatorProperty = this._typeMap[expectedType].discriminator;
|
|
125
|
-
if (discriminatorProperty == null) {
|
|
126
|
-
return expectedType; // the type does not have a discriminator. use it.
|
|
127
|
-
} else {
|
|
128
|
-
if (data[discriminatorProperty]) {
|
|
129
|
-
const discriminatorType = data[discriminatorProperty];
|
|
130
|
-
if (this._typeMap[discriminatorType]) {
|
|
131
|
-
return discriminatorType; // use the type given in the discriminator
|
|
132
|
-
} else {
|
|
133
|
-
return expectedType; // discriminator did not map to a type
|
|
134
|
-
}
|
|
135
|
-
} else {
|
|
136
|
-
return expectedType; // discriminator was not present (or an empty string)
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
public serializeClass<T>(data: any, type: ClassType<T>) {
|
|
143
|
-
return this.serialize(data, TypeUtil.findTypeName(type));
|
|
144
|
-
}
|
|
145
|
-
public serialize(data: any, type: string) {
|
|
146
|
-
if (data == undefined) {
|
|
147
|
-
return data;
|
|
148
|
-
} else if (this._primitives.indexOf(type.toLowerCase()) !== -1) {
|
|
149
|
-
return data;
|
|
150
|
-
} else if (type.lastIndexOf('Array<', 0) === 0) { // string.startsWith pre es6
|
|
151
|
-
let subType: string = type.replace('Array<', ''); // Array<Type> => Type>
|
|
152
|
-
subType = subType.substring(0, subType.length - 1); // Type> => Type
|
|
153
|
-
const transformedData: any[] = [];
|
|
154
|
-
// tslint:disable-next-line:prefer-for-of
|
|
155
|
-
for (let index = 0; index < data.length; index++) {
|
|
156
|
-
const datum = data[index];
|
|
157
|
-
transformedData.push(this.serialize(datum, subType));
|
|
158
|
-
}
|
|
159
|
-
return transformedData;
|
|
160
|
-
} else if (type === 'Date') {
|
|
161
|
-
return data.toISOString();
|
|
162
|
-
} else {
|
|
163
|
-
if (this._enumMap[type]) {
|
|
164
|
-
return data;
|
|
165
|
-
}
|
|
166
|
-
if (!this._typeMap[type]) { // in case we dont know the type
|
|
167
|
-
return data;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
// Get the actual type of this object
|
|
171
|
-
type = this.findCorrectType(data, type);
|
|
172
|
-
|
|
173
|
-
// get the map for the correct type.
|
|
174
|
-
const attributeTypes = this._typeMap[type].getAttributeTypeMap() as Array<AttributeDef>;
|
|
175
|
-
const instance: {[index: string]: any} = {};
|
|
176
|
-
// tslint:disable-next-line:prefer-for-of
|
|
177
|
-
for (let index = 0; index < attributeTypes.length; index++) {
|
|
178
|
-
const attributeType = attributeTypes[index];
|
|
179
|
-
instance[attributeType.baseName] = this.serialize(data[attributeType.name],
|
|
180
|
-
attributeType.type);
|
|
181
|
-
}
|
|
182
|
-
return instance;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
public deserializeClass<T>(data: any, type: ClassType<T>) {
|
|
187
|
-
return this.deserialize(data, TypeUtil.findTypeName(type));
|
|
188
|
-
}
|
|
189
|
-
public deserialize(data: any, type: string) {
|
|
190
|
-
// polymorphism may change the actual type.
|
|
191
|
-
type = this.findCorrectType(data, type);
|
|
192
|
-
if (data == undefined) {
|
|
193
|
-
return data;
|
|
194
|
-
} else if (this._primitives.indexOf(type.toLowerCase()) !== -1) {
|
|
195
|
-
return data;
|
|
196
|
-
} else if (type.lastIndexOf('Array<', 0) === 0) { // string.startsWith pre es6
|
|
197
|
-
let subType: string = type.replace('Array<', ''); // Array<Type> => Type>
|
|
198
|
-
subType = subType.substring(0, subType.length - 1); // Type> => Type
|
|
199
|
-
const transformedData: any[] = [];
|
|
200
|
-
// tslint:disable-next-line:prefer-for-of
|
|
201
|
-
for (let index = 0; index < data.length; index++) {
|
|
202
|
-
const datum = data[index];
|
|
203
|
-
transformedData.push(this.deserialize(datum, subType));
|
|
204
|
-
}
|
|
205
|
-
return transformedData;
|
|
206
|
-
} else if (type === 'Date') {
|
|
207
|
-
return new Date(data);
|
|
208
|
-
} else {
|
|
209
|
-
if (this._enumMap[type]) {// is Enum
|
|
210
|
-
return data;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
if (!this._typeMap[type]) { // dont know the type
|
|
214
|
-
return data;
|
|
215
|
-
}
|
|
216
|
-
const instance = new this._typeMap[type]();
|
|
217
|
-
const attributeTypes = this._typeMap[type].getAttributeTypeMap() as Array<AttributeDef>;
|
|
218
|
-
// tslint:disable-next-line:prefer-for-of
|
|
219
|
-
for (let index = 0; index < attributeTypes.length; index++) {
|
|
220
|
-
const attributeType = attributeTypes[index];
|
|
221
|
-
instance[attributeType.name] = this.deserialize(data[attributeType.baseName],
|
|
222
|
-
attributeType.type);
|
|
223
|
-
}
|
|
224
|
-
return instance;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
<ng-container *ngIf="$isVisible | async">
|
|
2
|
-
<button *ngIf="action.icon && action.title === null; else noIcon" type="button"
|
|
3
|
-
pButton pRipple
|
|
4
|
-
[icon]="action.icon"
|
|
5
|
-
[loading]="($loading | async) ?? false"
|
|
6
|
-
[disabled]="!($isEnabled | async)"
|
|
7
|
-
[pTooltip]="$any($tooltip | async)"
|
|
8
|
-
(click)="triggerAction($event)"
|
|
9
|
-
class="mng-action-button mng-action-button-icon p-button-rounded"
|
|
10
|
-
[class.p-button-primary]="action.level === 1"
|
|
11
|
-
[class.p-button-success]="action.level === 5"
|
|
12
|
-
[class.p-button-danger]="action.level === 7">
|
|
13
|
-
</button>
|
|
14
|
-
<ng-template #noIcon>
|
|
15
|
-
<button type="button"
|
|
16
|
-
pButton pRipple
|
|
17
|
-
[icon]="$any(action.icon)"
|
|
18
|
-
[label]="($label | async) ?? ''"
|
|
19
|
-
[loading]="($loading | async) ?? false"
|
|
20
|
-
[disabled]="!($isEnabled | async)"
|
|
21
|
-
[pTooltip]="$any($tooltip | async)"
|
|
22
|
-
(click)="triggerAction($event)"
|
|
23
|
-
class="mng-action-button p-button-text"
|
|
24
|
-
[class.p-button-primary]="action.level === 1"
|
|
25
|
-
[class.p-button-success]="action.level === 5"
|
|
26
|
-
[class.p-button-danger]="action.level === 7">
|
|
27
|
-
</button>
|
|
28
|
-
</ng-template>
|
|
29
|
-
<p-confirmDialog *ngIf="action.hasRunConfirmation" [key]="action.actionName + '_' + cmpId" [baseZIndex]="50" appendTo="body"></p-confirmDialog>
|
|
30
|
-
</ng-container>
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import {ChangeDetectionStrategy, Component, Input, OnInit} from '@angular/core';
|
|
2
|
-
import {ActivatedRoute} from '@angular/router';
|
|
3
|
-
|
|
4
|
-
import {TranslateService} from '@ngx-translate/core';
|
|
5
|
-
|
|
6
|
-
import {Observable, of, ReplaySubject} from 'rxjs';
|
|
7
|
-
import {finalize, first} from 'rxjs/operators';
|
|
8
|
-
import {ConfirmationService, MessageService} from 'primeng/api';
|
|
9
|
-
|
|
10
|
-
import {IdType} from '../../types';
|
|
11
|
-
import {ActionDescriptor} from '../../descriptors';
|
|
12
|
-
import {IActionConfirmationService, ActionData} from './models';
|
|
13
|
-
import {MngActionService} from '../../services';
|
|
14
|
-
import {I18nUtil} from '../../utils';
|
|
15
|
-
import {TableviewComponentService} from '../tableview/services';
|
|
16
|
-
|
|
17
|
-
@Component({
|
|
18
|
-
selector: 'mng-action',
|
|
19
|
-
templateUrl: './action.component.html',
|
|
20
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
21
|
-
providers: [MessageService, ConfirmationService]
|
|
22
|
-
})
|
|
23
|
-
export class MngActionComponent<T, S> implements OnInit, IActionConfirmationService {
|
|
24
|
-
|
|
25
|
-
// metadata and editor mode input
|
|
26
|
-
@Input() public action!: ActionDescriptor<T>;
|
|
27
|
-
@Input() public item?: T;
|
|
28
|
-
@Input() public itemId?: IdType;
|
|
29
|
-
@Input() public actionData?: ActionData;
|
|
30
|
-
|
|
31
|
-
private loadingSubject = new ReplaySubject<boolean>(1);
|
|
32
|
-
public $loading: Observable<boolean> = this.loadingSubject.asObservable();
|
|
33
|
-
|
|
34
|
-
public cmpId: string = Math.random().toString(36).substring(2);
|
|
35
|
-
public $isVisible!: Observable<boolean>;
|
|
36
|
-
public $isEnabled!: Observable<boolean>;
|
|
37
|
-
public $label!: Observable<string|null>;
|
|
38
|
-
public $tooltip!: Observable<string|null>;
|
|
39
|
-
|
|
40
|
-
constructor(
|
|
41
|
-
private route: ActivatedRoute,
|
|
42
|
-
private translate: TranslateService,
|
|
43
|
-
private actionService: MngActionService,
|
|
44
|
-
private confirmationService: ConfirmationService,
|
|
45
|
-
private tableviewService: TableviewComponentService<T, S>
|
|
46
|
-
) {
|
|
47
|
-
this.loadingSubject.next(false);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
public ngOnInit() {
|
|
51
|
-
const context = this.actionService.getActionExecContext(this.action, this.itemId, this.item, this.tableviewService?.dataProvider ?? undefined, this.tableviewService, this, this.actionData);
|
|
52
|
-
this.$isVisible = typeof this.action.isVisibleFunction === 'function' ? this.action.isVisibleFunction(context) : of(true);
|
|
53
|
-
this.$isEnabled = typeof this.action.isEnabledFunction === 'function' ? this.action.isEnabledFunction(context) : of(true);
|
|
54
|
-
this.$label = I18nUtil.streamActionTranslation(this.translate, this.action, 'title', this.action?.title ?? undefined, this.item);
|
|
55
|
-
this.$tooltip = I18nUtil.streamActionTranslation(this.translate, this.action, 'tooltip', this.action?.tooltip ?? undefined, this.item);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
public triggerAction(event: Event) {
|
|
59
|
-
this.loadingSubject.next(true);
|
|
60
|
-
const actionData = this.actionData ? this.actionData : {};
|
|
61
|
-
actionData['cmpId'] = this.cmpId;
|
|
62
|
-
this.actionService.triggerAction(this.action, this.itemId, this.item, actionData, this.route, this.tableviewService, this)
|
|
63
|
-
.pipe(
|
|
64
|
-
first(),
|
|
65
|
-
finalize(() => this.loadingSubject.next(false))
|
|
66
|
-
)
|
|
67
|
-
.subscribe(res => {});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
public getConfirmationService() {
|
|
71
|
-
return this.confirmationService;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
public getConfirmationServiceInstanceKey(action: ActionDescriptor<any>) {
|
|
75
|
-
return `${action.actionName}_${this.cmpId}`;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
<div class="h-full flex flex-column">
|
|
2
|
-
<div class="flex-grow-1">
|
|
3
|
-
<div class="text-center" *ngIf="loading$ | async">
|
|
4
|
-
<p-progressSpinner [style]="{width: '3rem', height: '3rem'}" strokeWidth="3"></p-progressSpinner>
|
|
5
|
-
</div>
|
|
6
|
-
<mng-form-editor *ngIf="action.editorDescriptor && !(loading$ | async)"
|
|
7
|
-
[descriptor]="action.editorDescriptor"
|
|
8
|
-
[item]="item"
|
|
9
|
-
(onSubmit)="onSubmit($event)">
|
|
10
|
-
</mng-form-editor>
|
|
11
|
-
</div>
|
|
12
|
-
<div class="flex flex-row justify-content-between">
|
|
13
|
-
<div></div>
|
|
14
|
-
<div>
|
|
15
|
-
<button type="button" pButton pRipple [label]="'general.close' | translate" icon="pi pi-times" class="p-button-text" (click)="closeDialog()" [disabled]="submitLoading$ | async"></button>
|
|
16
|
-
<button *ngIf="isSaveButton" #submitButton type="button" pButton pRipple
|
|
17
|
-
[label]="'general.save' | translate"
|
|
18
|
-
icon="pi pi-check"
|
|
19
|
-
class="p-button-text"
|
|
20
|
-
(click)="saveItem()"
|
|
21
|
-
[loading]="(submitLoading$ | async) ?? false"
|
|
22
|
-
[disabled]="(submitLoading$ | async) ?? false">
|
|
23
|
-
</button>
|
|
24
|
-
</div>
|
|
25
|
-
</div>
|
|
26
|
-
</div>
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import {ChangeDetectionStrategy, Component, ContentChildren, ElementRef, EventEmitter, Injector, Input, OnDestroy, OnInit, Output, QueryList, ViewChild} from '@angular/core';
|
|
2
|
-
|
|
3
|
-
import {TranslateService} from '@ngx-translate/core';
|
|
4
|
-
import {DynamicDialogConfig, DynamicDialogRef} from 'primeng/dynamicdialog';
|
|
5
|
-
import {Observable, of, ReplaySubject, Subscription} from 'rxjs';
|
|
6
|
-
import {catchError, finalize, first, mergeMap} from 'rxjs/operators';
|
|
7
|
-
|
|
8
|
-
import {ActionData, ActionError, ActionRunResult} from '../models';
|
|
9
|
-
import {ActionDescriptor, ActionEditorDescriptor} from '../../../descriptors';
|
|
10
|
-
import {IdType} from '../../../types';
|
|
11
|
-
import {IEditorDataProvider} from '../../../data-providers';
|
|
12
|
-
import {MngFormEditorSubmitEvent} from '../../form/models';
|
|
13
|
-
import {MngActionService, MngCommonsService} from '../../../services';
|
|
14
|
-
import {MngTemplateDirective} from '../../../directives';
|
|
15
|
-
import {MngFormEditorComponent} from '../../form';
|
|
16
|
-
import {I18nUtil, ToastUtil} from '../../../utils';
|
|
17
|
-
import {TableviewComponentService} from '../../tableview/services';
|
|
18
|
-
|
|
19
|
-
@Component({
|
|
20
|
-
selector: 'mng-action-dialog',
|
|
21
|
-
templateUrl: './action-dialog.component.html',
|
|
22
|
-
changeDetection: ChangeDetectionStrategy.OnPush
|
|
23
|
-
})
|
|
24
|
-
export class MngActionDialogComponent<T, S> implements OnInit, OnDestroy {
|
|
25
|
-
|
|
26
|
-
// metadata and editor mode input
|
|
27
|
-
@Input() public action!: ActionEditorDescriptor<T>;
|
|
28
|
-
|
|
29
|
-
// data source inputs
|
|
30
|
-
@Input() public itemId?: IdType;
|
|
31
|
-
@Input() public item?: T;
|
|
32
|
-
@Input() public actionData?: ActionData;
|
|
33
|
-
@Input() public dataProvider?: IEditorDataProvider<T, S>;
|
|
34
|
-
|
|
35
|
-
// content and view queries
|
|
36
|
-
@ContentChildren(MngTemplateDirective) templates!: QueryList<MngTemplateDirective>;
|
|
37
|
-
|
|
38
|
-
@ViewChild('submitButton') private submitButtonElementRef!: ElementRef;
|
|
39
|
-
@ViewChild(MngFormEditorComponent) private editorComponent!: MngFormEditorComponent<T>;
|
|
40
|
-
|
|
41
|
-
public cmpId: string = Math.random().toString(36).substring(2);
|
|
42
|
-
|
|
43
|
-
private loadingSubject = new ReplaySubject<boolean>(1);
|
|
44
|
-
private submitLoadingSubject = new ReplaySubject<boolean>(1);
|
|
45
|
-
public loading$: Observable<boolean> = this.loadingSubject.asObservable();
|
|
46
|
-
public submitLoading$: Observable<boolean> = this.submitLoadingSubject.asObservable();
|
|
47
|
-
public isSaveButton = true;
|
|
48
|
-
|
|
49
|
-
private tableviewService?: TableviewComponentService<T, S>;
|
|
50
|
-
private sourceComponent: any = this;
|
|
51
|
-
private subscriptions: Array<Subscription> = [];
|
|
52
|
-
|
|
53
|
-
constructor(
|
|
54
|
-
private injector: Injector,
|
|
55
|
-
private translate: TranslateService,
|
|
56
|
-
public dialogRef: DynamicDialogRef,
|
|
57
|
-
public dialogConfig: DynamicDialogConfig,
|
|
58
|
-
private actionService: MngActionService,
|
|
59
|
-
// private mngCommonsService: MngCommonsService
|
|
60
|
-
) {
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
public ngOnInit() {
|
|
64
|
-
|
|
65
|
-
if (this.dialogConfig.data) {
|
|
66
|
-
if (this.dialogConfig.data.action) {
|
|
67
|
-
this.action = this.dialogConfig.data.action;
|
|
68
|
-
}
|
|
69
|
-
if (this.dialogConfig.data.item) {
|
|
70
|
-
this.item = this.dialogConfig.data.item;
|
|
71
|
-
}
|
|
72
|
-
if (this.dialogConfig.data.itemId) {
|
|
73
|
-
this.itemId = this.dialogConfig.data.itemId;
|
|
74
|
-
}
|
|
75
|
-
if (this.dialogConfig.data.actionData) {
|
|
76
|
-
this.actionData = this.dialogConfig.data.actionData;
|
|
77
|
-
}
|
|
78
|
-
if (this.dialogConfig.data.tableview) {
|
|
79
|
-
this.tableviewService = this.dialogConfig.data.tableview;
|
|
80
|
-
if (!this.dataProvider && this.tableviewService?.dataProvider) {
|
|
81
|
-
this.dataProvider = this.tableviewService.dataProvider;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
if (this.dialogConfig.data.sourceComponent) {
|
|
85
|
-
this.sourceComponent = this.dialogConfig.data.sourceComponent;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
this.isSaveButton = typeof this.action.submitFunction === 'function';
|
|
90
|
-
this.setDialogHeaderTitle();
|
|
91
|
-
|
|
92
|
-
this.loadItemWithDataProvider();
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
public ngOnDestroy() {
|
|
96
|
-
this.subscriptions.forEach(s => s.unsubscribe());
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
public onSubmit(event: MngFormEditorSubmitEvent<T>) {
|
|
100
|
-
if (event.success) {
|
|
101
|
-
if (typeof this.action.submitFunction !== 'function') {
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
this.submitLoadingSubject.next(true);
|
|
105
|
-
this.actionService.runEditorSave(this.action, this.itemId, event.formItem, this.dataProvider, this.sourceComponent, this.tableviewService, this.actionData)
|
|
106
|
-
.pipe(
|
|
107
|
-
first(),
|
|
108
|
-
finalize(() => this.submitLoadingSubject.next(false))
|
|
109
|
-
)
|
|
110
|
-
.subscribe(res => {
|
|
111
|
-
this.closeDialog(res);
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
public closeDialog(result?: ActionRunResult<T, any, any>) {
|
|
117
|
-
this.dialogRef.close(result ? result : new ActionRunResult(undefined, undefined, new ActionError(null, true)));
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
public saveItem() {
|
|
121
|
-
this.editorComponent.submit();
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
private loadItemWithDataProvider() {
|
|
125
|
-
if (typeof this.action.fetchFunction !== 'function') {
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
this.loadingSubject.next(true);
|
|
129
|
-
this.actionService.runEditorFetch(this.action, this.itemId, this.dataProvider, this.sourceComponent, this.tableviewService)
|
|
130
|
-
.pipe(
|
|
131
|
-
first(),
|
|
132
|
-
catchError(err => {
|
|
133
|
-
if (this.action.hasRunNotificationError) {
|
|
134
|
-
ToastUtil.actionNotificationError(this.translate, this.action, err, 'fetch', this.tableviewService, this.item);
|
|
135
|
-
}
|
|
136
|
-
throw err;
|
|
137
|
-
}),
|
|
138
|
-
finalize(() => this.loadingSubject.next(false))
|
|
139
|
-
)
|
|
140
|
-
.subscribe(res => {
|
|
141
|
-
this.item = res.result;
|
|
142
|
-
if (this.action.hasFetchNotificationSuccess) {
|
|
143
|
-
ToastUtil.actionNotificationSuccess(this.translate, this.action, 'fetch', this.action.fetchNotificationSuccessTitle,
|
|
144
|
-
this.action.fetchNotificationSuccessMessage,this.tableviewService, this.item);
|
|
145
|
-
}
|
|
146
|
-
this.setDialogHeaderTitle();
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
private setDialogHeaderTitle() {
|
|
151
|
-
if (this.action.editorTitle === null) {
|
|
152
|
-
requestAnimationFrame(() => {
|
|
153
|
-
this.dialogConfig.header = undefined;
|
|
154
|
-
});
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
const subscription = I18nUtil.streamActionTranslation(this.translate, this.action as ActionDescriptor<T>, 'dialog.title', undefined, this.item)
|
|
158
|
-
.pipe(
|
|
159
|
-
mergeMap(i18nDialogTitle => i18nDialogTitle === null
|
|
160
|
-
? I18nUtil.getActionTranslation(this.translate, this.action as ActionDescriptor<T>, 'title', this.action.editorTitle, this.item)
|
|
161
|
-
: of(i18nDialogTitle))
|
|
162
|
-
)
|
|
163
|
-
.subscribe(t => {
|
|
164
|
-
requestAnimationFrame(() => {
|
|
165
|
-
this.dialogConfig.header = t ?? undefined;
|
|
166
|
-
// this.mngCommonsService.setPageTitle(t ?? undefined);
|
|
167
|
-
});
|
|
168
|
-
});
|
|
169
|
-
this.subscriptions.push(subscription);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import {DynamicDialogRef} from 'primeng/dynamicdialog';
|
|
2
|
-
import {Observable} from 'rxjs';
|
|
3
|
-
|
|
4
|
-
import {IdType} from '../../../types';
|
|
5
|
-
import {IDataProvider} from '../../../data-providers';
|
|
6
|
-
import {TableviewComponentService} from '../../tableview/services';
|
|
7
|
-
|
|
8
|
-
export class ActionExecContext<T, S, DP extends IDataProvider<T, S>> {
|
|
9
|
-
constructor(
|
|
10
|
-
public readonly dataProvider?: DP,
|
|
11
|
-
public readonly serviceInstance?: S,
|
|
12
|
-
public readonly data?: {
|
|
13
|
-
item?: T;
|
|
14
|
-
itemId?: IdType;
|
|
15
|
-
actionData?: ActionData;
|
|
16
|
-
},
|
|
17
|
-
public readonly sourceComponent: any = null,
|
|
18
|
-
public readonly tableview: TableviewComponentService<T, S>|null = null
|
|
19
|
-
) {}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export class ActionError {
|
|
23
|
-
constructor(
|
|
24
|
-
public readonly error: any, // error details
|
|
25
|
-
public readonly dismissed: boolean = false // by user
|
|
26
|
-
) {}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export class ActionRunResult<T, S, DP extends IDataProvider<T, S>> {
|
|
30
|
-
constructor(
|
|
31
|
-
public readonly context?: ActionExecContext<T, S, DP>,
|
|
32
|
-
public readonly result?: T,
|
|
33
|
-
public readonly error?: ActionError
|
|
34
|
-
) {}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export class ActionActivationResult<T, S, DP extends IDataProvider<T, S>> {
|
|
38
|
-
constructor(
|
|
39
|
-
public readonly runResult?: ActionRunResult<T, S, DP>,
|
|
40
|
-
public readonly dialogRef?: DynamicDialogRef
|
|
41
|
-
) {}
|
|
42
|
-
|
|
43
|
-
public get runContext() {
|
|
44
|
-
return this.runResult ? this.runResult.context : null;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
public get result() {
|
|
48
|
-
return this.runResult ? this.runResult.result : null;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
public get error() {
|
|
52
|
-
return this.runResult ? this.runResult.error : null;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export class ActionTriggerResult<T, S, DP extends IDataProvider<T, S>> {
|
|
57
|
-
constructor(
|
|
58
|
-
public readonly activationResult?: ActionActivationResult<T, S, DP>,
|
|
59
|
-
public readonly routerNavigation?: Observable<boolean>
|
|
60
|
-
) {}
|
|
61
|
-
|
|
62
|
-
public get runContext() {
|
|
63
|
-
return this.activationResult ? this.activationResult.runResult : null;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
public get result() {
|
|
67
|
-
return this.activationResult ? this.activationResult.result : null;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
public get error() {
|
|
71
|
-
return this.activationResult ? this.activationResult.error : null;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
public get dialogRef() {
|
|
75
|
-
return this.activationResult ? this.activationResult.dialogRef : null;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export type ActionData = {
|
|
80
|
-
[key: string]: any;
|
|
81
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<p-confirmDialog [key]="'actionRoute_' + cmpId" [baseZIndex]="50" appendTo="body"></p-confirmDialog>
|