@mediusinc/mng-commons 0.0.1-rc.3 → 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/README.md +96 -1
- package/assets/i18n/en.json +156 -0
- package/assets/i18n/sl.json +156 -0
- package/assets/images/effect-ondark.png +0 -0
- package/assets/images/effect-ondark.svg +38 -0
- package/assets/images/effect-ondark@2x.png +0 -0
- package/assets/images/effect-onlight.png +0 -0
- package/assets/images/effect-onlight.svg +38 -0
- package/assets/images/effect-onlight@2x.png +0 -0
- package/assets/images/pages/exception-ondark.png +0 -0
- package/assets/images/pages/exception-onlight.png +0 -0
- package/assets/images/pages/login-ondark.png +0 -0
- package/assets/images/pages/login-onlight.png +0 -0
- package/assets/templates/tableview-route.component.html +5 -0
- package/karma.conf.js +51 -0
- package/ng-package.json +14 -0
- package/package.json +3 -24
- package/scss/common/layout/_breadcrumb.scss +96 -0
- package/scss/common/layout/_config.scss +101 -0
- package/scss/common/layout/_dashboard.scss +16 -0
- package/scss/common/layout/_exception.scss +131 -0
- package/scss/common/layout/_footer.scss +29 -0
- package/scss/common/layout/_help.scss +157 -0
- package/scss/common/layout/_inlinemenu.scss +55 -0
- package/scss/common/layout/_invoice.scss +176 -0
- package/scss/common/layout/_landing.scss +639 -0
- package/scss/common/layout/_layout_dark.scss +23 -0
- package/scss/common/layout/_layout_light.scss +23 -0
- package/scss/common/layout/_loader.scss +18 -0
- package/scss/common/layout/_login.scss +106 -0
- package/scss/common/layout/_main.scss +45 -0
- package/scss/common/layout/_mixins.scss +214 -0
- package/scss/common/layout/_rightmenu.scss +125 -0
- package/scss/common/layout/_topbar.scss +189 -0
- package/scss/common/layout/_typography.scss +63 -0
- package/scss/common/layout/_utils.scss +96 -0
- package/scss/common/layout/_widgets.scss +391 -0
- package/scss/common/layout/menu/_menu.scss +7 -0
- package/scss/common/layout/menu/_menu_common.scss +183 -0
- package/scss/common/layout/menu/_menu_overlay.scss +52 -0
- package/scss/common/layout/menu/_menu_sidebar.scss +232 -0
- package/scss/common/layout/menu/_menu_slim.scss +138 -0
- package/scss/common/layout/menu/_menu_static.scss +70 -0
- package/scss/common/layout/menu/_menu_theme.scss +365 -0
- package/scss/common/theme/_theme_dark.scss +5 -0
- package/scss/common/theme/_theme_light.scss +5 -0
- package/scss/common/theme/designer/_colors.scss +18 -0
- package/scss/common/theme/designer/_common.scss +40 -0
- package/scss/common/theme/designer/_components.scss +101 -0
- package/scss/common/theme/designer/_mixins.scss +174 -0
- package/scss/common/theme/designer/components/button/_button.scss +560 -0
- package/scss/common/theme/designer/components/button/_speeddial.scss +79 -0
- package/scss/common/theme/designer/components/button/_splitbutton.scss +1 -0
- package/scss/common/theme/designer/components/data/_carousel.scss +37 -0
- package/scss/common/theme/designer/components/data/_datatable.scss +266 -0
- package/scss/common/theme/designer/components/data/_dataview.scss +55 -0
- package/scss/common/theme/designer/components/data/_filter.scss +138 -0
- package/scss/common/theme/designer/components/data/_fullcalendar.scss +324 -0
- package/scss/common/theme/designer/components/data/_orderlist.scss +91 -0
- package/scss/common/theme/designer/components/data/_organizationchart.scss +50 -0
- package/scss/common/theme/designer/components/data/_paginator.scss +83 -0
- package/scss/common/theme/designer/components/data/_picklist.scss +91 -0
- package/scss/common/theme/designer/components/data/_timeline.scss +38 -0
- package/scss/common/theme/designer/components/data/_tree.scss +144 -0
- package/scss/common/theme/designer/components/data/_treetable.scss +242 -0
- package/scss/common/theme/designer/components/data/_virtualscroller.scss +28 -0
- package/scss/common/theme/designer/components/file/_fileupload.scss +58 -0
- package/scss/common/theme/designer/components/input/_autocomplete.scss +103 -0
- package/scss/common/theme/designer/components/input/_calendar.scss +212 -0
- package/scss/common/theme/designer/components/input/_cascadeselect.scss +98 -0
- package/scss/common/theme/designer/components/input/_checkbox.scss +85 -0
- package/scss/common/theme/designer/components/input/_chips.scss +41 -0
- package/scss/common/theme/designer/components/input/_colorpicker.scss +19 -0
- package/scss/common/theme/designer/components/input/_dropdown.scss +136 -0
- package/scss/common/theme/designer/components/input/_editor.scss +122 -0
- package/scss/common/theme/designer/components/input/_inputgroup.scss +69 -0
- package/scss/common/theme/designer/components/input/_inputmask.scss +3 -0
- package/scss/common/theme/designer/components/input/_inputnumber.scss +3 -0
- package/scss/common/theme/designer/components/input/_inputswitch.scss +58 -0
- package/scss/common/theme/designer/components/input/_inputtext.scss +97 -0
- package/scss/common/theme/designer/components/input/_listbox.scss +82 -0
- package/scss/common/theme/designer/components/input/_multiselect.scss +164 -0
- package/scss/common/theme/designer/components/input/_password.scss +33 -0
- package/scss/common/theme/designer/components/input/_radiobutton.scss +78 -0
- package/scss/common/theme/designer/components/input/_rating.scss +48 -0
- package/scss/common/theme/designer/components/input/_selectbutton.scss +50 -0
- package/scss/common/theme/designer/components/input/_slider.scss +69 -0
- package/scss/common/theme/designer/components/input/_togglebutton.scss +48 -0
- package/scss/common/theme/designer/components/input/_treeselect.scss +89 -0
- package/scss/common/theme/designer/components/menu/_breadcrumb.scss +42 -0
- package/scss/common/theme/designer/components/menu/_contextmenu.scss +50 -0
- package/scss/common/theme/designer/components/menu/_dock.scss +51 -0
- package/scss/common/theme/designer/components/menu/_megamenu.scss +102 -0
- package/scss/common/theme/designer/components/menu/_menu.scss +41 -0
- package/scss/common/theme/designer/components/menu/_menubar.scss +179 -0
- package/scss/common/theme/designer/components/menu/_panelmenu.scss +137 -0
- package/scss/common/theme/designer/components/menu/_slidemenu.scss +55 -0
- package/scss/common/theme/designer/components/menu/_steps.scss +55 -0
- package/scss/common/theme/designer/components/menu/_tabmenu.scss +49 -0
- package/scss/common/theme/designer/components/menu/_tieredmenu.scss +56 -0
- package/scss/common/theme/designer/components/messages/_inlinemessage.scss +64 -0
- package/scss/common/theme/designer/components/messages/_message.scss +102 -0
- package/scss/common/theme/designer/components/messages/_toast.scss +95 -0
- package/scss/common/theme/designer/components/misc/_avatar.scss +30 -0
- package/scss/common/theme/designer/components/misc/_badge.scss +48 -0
- package/scss/common/theme/designer/components/misc/_blockui.scss +3 -0
- package/scss/common/theme/designer/components/misc/_chip.scss +36 -0
- package/scss/common/theme/designer/components/misc/_inplace.scss +17 -0
- package/scss/common/theme/designer/components/misc/_progressbar.scss +17 -0
- package/scss/common/theme/designer/components/misc/_scrolltop.scss +20 -0
- package/scss/common/theme/designer/components/misc/_skeleton.scss +8 -0
- package/scss/common/theme/designer/components/misc/_tag.scss +33 -0
- package/scss/common/theme/designer/components/misc/_terminal.scss +11 -0
- package/scss/common/theme/designer/components/multimedia/_galleria.scss +141 -0
- package/scss/common/theme/designer/components/overlay/_confirmpopup.scss +67 -0
- package/scss/common/theme/designer/components/overlay/_dialog.scss +63 -0
- package/scss/common/theme/designer/components/overlay/_overlaypanel.scss +62 -0
- package/scss/common/theme/designer/components/overlay/_sidebar.scss +27 -0
- package/scss/common/theme/designer/components/overlay/_tooltip.scss +33 -0
- package/scss/common/theme/designer/components/panel/_accordion.scss +119 -0
- package/scss/common/theme/designer/components/panel/_card.scss +30 -0
- package/scss/common/theme/designer/components/panel/_divider.scss +31 -0
- package/scss/common/theme/designer/components/panel/_fieldset.scss +47 -0
- package/scss/common/theme/designer/components/panel/_panel.scss +42 -0
- package/scss/common/theme/designer/components/panel/_scrollpanel.scss +6 -0
- package/scss/common/theme/designer/components/panel/_splitter.scss +19 -0
- package/scss/common/theme/designer/components/panel/_tabview.scss +66 -0
- package/scss/common/theme/designer/components/panel/_toolbar.scss +10 -0
- package/scss/common/theme/extensions/_button.scss +99 -0
- package/scss/common/theme/extensions/_calendar.scss +18 -0
- package/scss/common/theme/extensions/_card.scss +6 -0
- package/scss/common/theme/extensions/_carousel.scss +13 -0
- package/scss/common/theme/extensions/_checkbox.scss +10 -0
- package/scss/common/theme/extensions/_contextmenu.scss +16 -0
- package/scss/common/theme/extensions/_datatable.scss +83 -0
- package/scss/common/theme/extensions/_dialog.scss +14 -0
- package/scss/common/theme/extensions/_fieldset.scss +6 -0
- package/scss/common/theme/extensions/_galleria.scss +25 -0
- package/scss/common/theme/extensions/_megamenu.scss +18 -0
- package/scss/common/theme/extensions/_menu.scss +14 -0
- package/scss/common/theme/extensions/_menubar.scss +14 -0
- package/scss/common/theme/extensions/_orderlist.scss +38 -0
- package/scss/common/theme/extensions/_paginator.scss +19 -0
- package/scss/common/theme/extensions/_panelmenu.scss +20 -0
- package/scss/common/theme/extensions/_password.scss +5 -0
- package/scss/common/theme/extensions/_picklist.scss +38 -0
- package/scss/common/theme/extensions/_radiobutton.scss +8 -0
- package/scss/common/theme/extensions/_sidebar.scss +19 -0
- package/scss/common/theme/extensions/_slidemenu.scss +10 -0
- package/scss/common/theme/extensions/_slider.scss +6 -0
- package/scss/common/theme/extensions/_steps.scss +50 -0
- package/scss/common/theme/extensions/_tieredmenu.scss +14 -0
- package/scss/common/theme/extensions/_toast.scss +6 -0
- package/scss/common/theme/extensions/_tree.scss +36 -0
- package/scss/common/theme/extensions/_treetable.scss +35 -0
- package/scss/common/theme/extensions/_vendor_extensions.scss +27 -0
- package/scss/common/variables/layout/_common.scss +12 -0
- package/scss/common/variables/layout/_layout_dark.scss +71 -0
- package/scss/common/variables/layout/_layout_light.scss +71 -0
- package/scss/common/variables/theme/_theme_dark.scss +897 -0
- package/scss/common/variables/theme/_theme_light.scss +885 -0
- package/scss/layout/default/_mng-variables-layout-dark.scss +2 -0
- package/scss/layout/default/_mng-variables-layout-light.scss +2 -0
- package/scss/layout/default/layout-dark.scss +2 -0
- package/scss/layout/default/layout-light.scss +2 -0
- package/scss/mng-commons-dark.scss +5 -0
- package/scss/mng-commons-light.scss +5 -0
- package/scss/mng-overrides/_layout_action.scss +3 -0
- package/scss/mng-overrides/_layout_dialog.scss +34 -0
- package/scss/mng-overrides/_layout_forms.scss +31 -0
- package/scss/mng-overrides/_layout_radio.scss +3 -0
- package/scss/mng-overrides/_layout_styles.scss +4 -0
- package/scss/mng-overrides/_theme_datatable.scss +9 -0
- package/scss/mng-overrides/_theme_dialog.scss +9 -0
- package/scss/mng-overrides/_theme_dropdown.scss +6 -0
- package/scss/mng-overrides/_theme_styles.scss +9 -0
- package/scss/mng-overrides/_theme_tableview.scss +94 -0
- package/scss/theme/default/_mng-variables-theme-dark.scss +8 -0
- package/scss/theme/default/_mng-variables-theme-light.scss +8 -0
- package/scss/theme/default/theme-dark.scss +2 -0
- package/scss/theme/default/theme-light.scss +2 -0
- 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/query-mode.model.d.ts → src/lib/api/models/query-mode.model.ts} +18 -16
- 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/src/lib/api/services/index.ts +1 -0
- 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/src/lib/components/action/models/action-confirmation-service.model.ts +7 -0
- package/src/lib/components/action/models/action-execution.model.ts +81 -0
- package/src/lib/components/action/models/index.ts +2 -0
- 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/src/lib/components/form/index.ts +3 -0
- package/src/lib/components/form/models/form-editor.event.ts +7 -0
- package/src/lib/components/form/models/index.ts +1 -0
- 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/src/lib/components/layout/index.ts +6 -0
- 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/src/lib/components/layout/services/index.ts +1 -0
- 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 -3
- package/src/lib/components/tableview/models/index.ts +1 -0
- 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/src/lib/components/tableview/services/index.ts +1 -0
- 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/models/config/index.d.ts → src/lib/config/models/index.ts} +1 -1
- package/src/lib/config/models/mng-config.model.ts +35 -0
- package/src/lib/data-providers/base.data-provider.ts +42 -0
- package/src/lib/data-providers/editor.data-provider.ts +60 -0
- package/src/lib/data-providers/index.ts +5 -0
- package/src/lib/data-providers/lookup.data-provider.ts +29 -0
- package/src/lib/data-providers/table.data-provider.ts +8 -0
- 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/src/lib/descriptors/index.ts +7 -0
- package/src/lib/descriptors/lookup.descriptor.ts +20 -0
- 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/src/lib/directives/index.ts +2 -0
- package/src/lib/directives/template.directive.ts +24 -0
- package/src/lib/mng-commons.module.ts +240 -0
- package/src/lib/models/index.ts +2 -0
- package/src/lib/models/router.model.ts +16 -0
- package/src/lib/models/user.model.ts +9 -0
- package/src/lib/pipes/boolean.pipe.ts +17 -0
- package/{lib/pipes/index.d.ts → src/lib/pipes/index.ts} +2 -1
- 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 -6
- 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 -2
- package/src/lib/services/tokens/browser-storage.token.ts +9 -0
- package/src/lib/services/tokens/index.ts +2 -0
- package/src/lib/services/tokens/module-config.token.ts +5 -0
- package/{lib/models/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 -4
- 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 -22
- 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 -49
- package/esm2020/lib/api/models/filter-match-type.model.mjs +0 -24
- 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/abstract-crud-api.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 -70
- package/esm2020/lib/api/utils/object-serializer.util.mjs +0 -226
- package/esm2020/lib/components/action/action.component.mjs +0 -63
- 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/route/action-route.component.mjs +0 -144
- package/esm2020/lib/components/form/editor/form-editor.component.mjs +0 -140
- package/esm2020/lib/components/form/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.mjs +0 -58
- package/esm2020/lib/components/form/formly/fields/formly-field-dropdown/formly-field-dropdown.component.mjs +0 -51
- 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 -94
- package/esm2020/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.mjs +0 -124
- 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 -2
- package/esm2020/lib/components/layout/app.breadcrumb.component.mjs +0 -27
- package/esm2020/lib/components/layout/app.footer.component.mjs +0 -35
- package/esm2020/lib/components/layout/app.main.component.mjs +0 -25
- package/esm2020/lib/components/layout/app.main.component.service.mjs +0 -133
- package/esm2020/lib/components/layout/app.menu.component.mjs +0 -38
- package/esm2020/lib/components/layout/app.menuitem.component.mjs +0 -243
- package/esm2020/lib/components/layout/app.topbar.component.mjs +0 -135
- package/esm2020/lib/components/layout/index.mjs +0 -7
- package/esm2020/lib/components/tableview/index.mjs +0 -4
- package/esm2020/lib/components/tableview/route/tableview-route.abstract.component.mjs +0 -31
- package/esm2020/lib/components/tableview/table/table.component.mjs +0 -173
- package/esm2020/lib/components/tableview/tableview.component.mjs +0 -82
- package/esm2020/lib/components/tableview/tableview.component.service.mjs +0 -18
- package/esm2020/lib/config/formly.config.mjs +0 -165
- package/esm2020/lib/config/index.mjs +0 -2
- package/esm2020/lib/directives/index.mjs +0 -2
- package/esm2020/lib/directives/template.directive.mjs +0 -25
- package/esm2020/lib/mng-commons.module.mjs +0 -338
- package/esm2020/lib/models/action/action.model.mjs +0 -58
- package/esm2020/lib/models/action/index.mjs +0 -2
- package/esm2020/lib/models/config/index.mjs +0 -2
- package/esm2020/lib/models/config/mng-config.model.mjs +0 -3
- package/esm2020/lib/models/descriptors/action-descriptor.model.mjs +0 -283
- package/esm2020/lib/models/descriptors/editor-descriptor.model.mjs +0 -647
- package/esm2020/lib/models/descriptors/index.mjs +0 -6
- package/esm2020/lib/models/descriptors/model-descriptor.model.mjs +0 -34
- package/esm2020/lib/models/descriptors/table-descriptor.model.mjs +0 -123
- package/esm2020/lib/models/descriptors/tableview-descriptor.model.mjs +0 -124
- package/esm2020/lib/models/events/editor-event.model.mjs +0 -14
- package/esm2020/lib/models/events/index.mjs +0 -3
- package/esm2020/lib/models/events/table-event.model.mjs +0 -16
- package/esm2020/lib/models/interfaces/confirmation-service.model.mjs +0 -2
- package/esm2020/lib/models/interfaces/index.mjs +0 -2
- package/esm2020/lib/models/providers/data-provider.model.mjs +0 -86
- package/esm2020/lib/models/providers/index.mjs +0 -2
- package/esm2020/lib/models/types/index.mjs +0 -3
- package/esm2020/lib/models/types/type.decorator.mjs +0 -8
- package/esm2020/lib/models/types/type.model.mjs +0 -2
- package/esm2020/lib/models/validators/field.validator.mjs +0 -21
- package/esm2020/lib/models/validators/index.mjs +0 -2
- package/esm2020/lib/pipes/index.mjs +0 -2
- package/esm2020/lib/pipes/property-path.pipe.mjs +0 -36
- package/esm2020/lib/services/action.service.mjs +0 -239
- package/esm2020/lib/services/breadcrumb.service.mjs +0 -21
- package/esm2020/lib/services/configuration.service.mjs +0 -77
- package/esm2020/lib/services/index.mjs +0 -7
- package/esm2020/lib/services/menu.service.mjs +0 -26
- package/esm2020/lib/services/navigation.service.mjs +0 -49
- package/esm2020/lib/services/providers/config-service.provider.mjs +0 -12
- package/esm2020/lib/services/providers/formly-config.provider.mjs +0 -31
- package/esm2020/lib/services/providers/index.mjs +0 -3
- package/esm2020/lib/services/settings.service.mjs +0 -40
- package/esm2020/lib/utils/editor-formly.util.mjs +0 -165
- package/esm2020/lib/utils/i18n.util.mjs +0 -75
- package/esm2020/lib/utils/index.mjs +0 -5
- package/esm2020/lib/utils/model.util.mjs +0 -38
- package/esm2020/lib/utils/type.util.mjs +0 -43
- package/esm2020/mediusinc-mng-commons.mjs +0 -5
- package/esm2020/public-api.mjs +0 -33
- package/fesm2015/mediusinc-mng-commons.mjs +0 -5056
- package/fesm2015/mediusinc-mng-commons.mjs.map +0 -1
- package/fesm2020/mediusinc-mng-commons.mjs +0 -5012
- 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-match-type.model.d.ts +0 -21
- 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-param.model.d.ts +0 -31
- package/lib/api/models/query-result.model.d.ts +0 -36
- package/lib/api/services/abstract-crud-api.service.d.ts +0 -23
- package/lib/api/services/index.d.ts +0 -1
- package/lib/api/utils/medius-rest.util.d.ts +0 -6
- 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 -48
- package/lib/components/action/route/action-route.component.d.ts +0 -32
- package/lib/components/form/editor/form-editor.component.d.ts +0 -37
- package/lib/components/form/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.d.ts +0 -21
- package/lib/components/form/formly/fields/formly-field-dropdown/formly-field-dropdown.component.d.ts +0 -19
- 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/index.d.ts +0 -1
- package/lib/components/layout/app.breadcrumb.component.d.ts +0 -16
- package/lib/components/layout/app.footer.component.d.ts +0 -8
- package/lib/components/layout/app.main.component.d.ts +0 -12
- package/lib/components/layout/app.main.component.service.d.ts +0 -40
- package/lib/components/layout/app.menu.component.d.ts +0 -14
- package/lib/components/layout/app.menuitem.component.d.ts +0 -31
- package/lib/components/layout/app.topbar.component.d.ts +0 -16
- package/lib/components/layout/index.d.ts +0 -6
- package/lib/components/tableview/route/tableview-route.abstract.component.d.ts +0 -15
- package/lib/components/tableview/table/table.component.d.ts +0 -47
- package/lib/components/tableview/tableview.component.d.ts +0 -36
- package/lib/components/tableview/tableview.component.service.d.ts +0 -11
- package/lib/config/formly.config.d.ts +0 -8
- package/lib/directives/index.d.ts +0 -1
- package/lib/directives/template.directive.d.ts +0 -11
- package/lib/mng-commons.module.d.ts +0 -74
- package/lib/models/action/action.model.d.ts +0 -53
- package/lib/models/action/index.d.ts +0 -1
- package/lib/models/config/mng-config.model.d.ts +0 -19
- package/lib/models/descriptors/action-descriptor.model.d.ts +0 -124
- package/lib/models/descriptors/editor-descriptor.model.d.ts +0 -248
- package/lib/models/descriptors/index.d.ts +0 -5
- package/lib/models/descriptors/model-descriptor.model.d.ts +0 -15
- package/lib/models/descriptors/table-descriptor.model.d.ts +0 -45
- package/lib/models/descriptors/tableview-descriptor.model.d.ts +0 -38
- package/lib/models/events/editor-event.model.d.ts +0 -11
- package/lib/models/events/index.d.ts +0 -2
- package/lib/models/events/table-event.model.d.ts +0 -17
- package/lib/models/interfaces/confirmation-service.model.d.ts +0 -6
- package/lib/models/interfaces/index.d.ts +0 -1
- package/lib/models/providers/data-provider.model.d.ts +0 -62
- package/lib/models/providers/index.d.ts +0 -1
- package/lib/models/types/type.decorator.d.ts +0 -2
- package/lib/models/types/type.model.d.ts +0 -10
- package/lib/models/validators/field.validator.d.ts +0 -18
- package/lib/models/validators/index.d.ts +0 -1
- package/lib/pipes/property-path.pipe.d.ts +0 -7
- package/lib/services/action.service.d.ts +0 -92
- package/lib/services/breadcrumb.service.d.ts +0 -9
- package/lib/services/configuration.service.d.ts +0 -35
- package/lib/services/menu.service.d.ts +0 -11
- package/lib/services/navigation.service.d.ts +0 -14
- 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/settings.service.d.ts +0 -18
- package/lib/utils/editor-formly.util.d.ts +0 -9
- package/lib/utils/i18n.util.d.ts +0 -14
- package/lib/utils/model.util.d.ts +0 -5
- package/lib/utils/type.util.d.ts +0 -15
- package/mediusinc-mng-commons-0.0.1-rc.3.tgz +0 -0
- package/mediusinc-mng-commons.d.ts +0 -5
package/{lib/api/models/serialization.model.d.ts → src/lib/api/models/serialization.model.ts}
RENAMED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export interface AttributeDef {
|
|
2
|
-
name: string;
|
|
3
|
-
baseName: string;
|
|
4
|
-
type: string;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
export interface AttributeDef {
|
|
2
|
+
name: string;
|
|
3
|
+
baseName: string;
|
|
4
|
+
type: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface SerializableTypeMap {
|
|
8
|
+
[index: string]: any;
|
|
9
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import {HttpClient} from '@angular/common/http';
|
|
2
|
+
|
|
3
|
+
import {Observable} from 'rxjs';
|
|
4
|
+
import {map} from 'rxjs/operators';
|
|
5
|
+
|
|
6
|
+
import {MediusQueryParam, MediusQueryResult} from '../models';
|
|
7
|
+
import {ObjectSerializer} from '../utils';
|
|
8
|
+
import {ClassType} from '../../types';
|
|
9
|
+
|
|
10
|
+
export abstract class AMngCrudApiService<T, QRT extends MediusQueryResult<T>> {
|
|
11
|
+
|
|
12
|
+
private readonly objectSerializer: ObjectSerializer = ObjectSerializer.get();
|
|
13
|
+
|
|
14
|
+
protected constructor(
|
|
15
|
+
protected type: ClassType<T>,
|
|
16
|
+
protected queryResultType: ClassType<QRT>,
|
|
17
|
+
protected http: HttpClient
|
|
18
|
+
) {
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
protected abstract getBasePath(): string;
|
|
22
|
+
protected abstract getServiceBasePath(): string;
|
|
23
|
+
|
|
24
|
+
protected getGetAllPostPath(): string {
|
|
25
|
+
return '/get-all';
|
|
26
|
+
}
|
|
27
|
+
protected getCreatePostPath(): string {
|
|
28
|
+
return '';
|
|
29
|
+
}
|
|
30
|
+
protected getUpdatePutPath(id: any, item: T): string {
|
|
31
|
+
return `/${id}`;
|
|
32
|
+
}
|
|
33
|
+
protected getGetByIdGetPath(id: any): string {
|
|
34
|
+
return `/${id}`;
|
|
35
|
+
}
|
|
36
|
+
protected getRemoveDeletePath(id: any, item: T) {
|
|
37
|
+
return `/${id}`;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public createPost(item: T): Observable<T> {
|
|
41
|
+
|
|
42
|
+
const url = `${this.getBasePath()}/${this.getServiceBasePath()}${this.getCreatePostPath()}`;
|
|
43
|
+
return this.http.post<T>(url,
|
|
44
|
+
this.objectSerializer.serializeClass(item, this.type),
|
|
45
|
+
{
|
|
46
|
+
withCredentials: true,
|
|
47
|
+
observe: 'body',
|
|
48
|
+
reportProgress: false
|
|
49
|
+
})
|
|
50
|
+
.pipe(
|
|
51
|
+
map(res => this.objectSerializer.deserializeClass(res, this.type))
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public getAllPost(queryParam?: MediusQueryParam): Observable<QRT> {
|
|
56
|
+
|
|
57
|
+
const url = `${this.getBasePath()}/${this.getServiceBasePath()}${this.getGetAllPostPath()}`;
|
|
58
|
+
return this.http.post<QRT>(url,
|
|
59
|
+
this.objectSerializer.serialize(queryParam, 'QueryParam'),
|
|
60
|
+
{
|
|
61
|
+
withCredentials: true,
|
|
62
|
+
observe: 'body',
|
|
63
|
+
reportProgress: false
|
|
64
|
+
})
|
|
65
|
+
.pipe(
|
|
66
|
+
map(res => this.objectSerializer.deserializeClass(res, this.queryResultType))
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
public getByIdGet(id: any): Observable<T> {
|
|
71
|
+
|
|
72
|
+
const url = `${this.getBasePath()}/${this.getServiceBasePath()}${this.getGetByIdGetPath(id)}`;
|
|
73
|
+
return this.http.get<T>(url,
|
|
74
|
+
{
|
|
75
|
+
withCredentials: true,
|
|
76
|
+
observe: 'body',
|
|
77
|
+
reportProgress: false
|
|
78
|
+
})
|
|
79
|
+
.pipe(
|
|
80
|
+
map(res => this.objectSerializer.deserializeClass(res, this.type))
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
public updatePut(id: any, item: T): Observable<T> {
|
|
85
|
+
|
|
86
|
+
const url = `${this.getBasePath()}/${this.getServiceBasePath()}${this.getUpdatePutPath(id, item)}`;
|
|
87
|
+
return this.http.put<T>(url,
|
|
88
|
+
this.objectSerializer.serializeClass(item, this.type),
|
|
89
|
+
{
|
|
90
|
+
withCredentials: true,
|
|
91
|
+
observe: 'body',
|
|
92
|
+
reportProgress: false
|
|
93
|
+
})
|
|
94
|
+
.pipe(
|
|
95
|
+
map(res => this.objectSerializer.deserializeClass(res, this.type))
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
public removeDelete(id: any, item: T): Observable<any> {
|
|
100
|
+
|
|
101
|
+
const url = `${this.getBasePath()}/${this.getServiceBasePath()}${this.getRemoveDeletePath(id, item)}`;
|
|
102
|
+
return this.http.request<any>('delete', url,
|
|
103
|
+
{
|
|
104
|
+
withCredentials: true,
|
|
105
|
+
observe: 'body',
|
|
106
|
+
reportProgress: false,
|
|
107
|
+
body: this.objectSerializer.serializeClass(item, this.type)
|
|
108
|
+
})
|
|
109
|
+
.pipe(
|
|
110
|
+
map(res => this.objectSerializer.deserializeClass(res, this.type))
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './crud-api.abstract.service';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './object-serializer.util';
|
|
2
|
-
export * from './medius-rest.util';
|
|
1
|
+
export * from './object-serializer.util';
|
|
2
|
+
export * from './medius-rest.util';
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import {Params} from '@angular/router';
|
|
2
|
+
|
|
3
|
+
import {FilterMetadata, LazyLoadEvent} from 'primeng/api';
|
|
4
|
+
|
|
5
|
+
import {MediusFilterMatchType, MediusQueryParam, MediusQueryParamBuilder} from '../models';
|
|
6
|
+
import {FilterDescriptor} from '../../descriptors';
|
|
7
|
+
|
|
8
|
+
export class MediusRestUtil {
|
|
9
|
+
|
|
10
|
+
// first value is from primeNG, second is for use in query params
|
|
11
|
+
public static readonly matchModeMapping: Array<[string, string, MediusFilterMatchType]> = [
|
|
12
|
+
['contains', 'c', MediusFilterMatchType.Contains],
|
|
13
|
+
['endsWith', 'ew', MediusFilterMatchType.EndsWith],
|
|
14
|
+
['equals', 'eq', MediusFilterMatchType.Equals],
|
|
15
|
+
['gte', 'gte', MediusFilterMatchType.GreaterThan],
|
|
16
|
+
['leq', 'leq', MediusFilterMatchType.SmallerThan],
|
|
17
|
+
['startsWith', 'sw', MediusFilterMatchType.StartsWith],
|
|
18
|
+
['in', 'in', MediusFilterMatchType.In],
|
|
19
|
+
['notEquals', 'neq', MediusFilterMatchType.NotEquals]
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
public static fromAngularQueryParamsToMediusQueryParams(params: Params, filterDescriptors: Array<FilterDescriptor<any>>, defaultItemsPerPage = 10, defaultOffset= 0): MediusQueryParam {
|
|
23
|
+
const offset = params['first'] ? parseInt(params['first']) : defaultOffset;
|
|
24
|
+
const itemsPerPage = params['rows'] ? parseInt(params['rows']) : defaultItemsPerPage;
|
|
25
|
+
|
|
26
|
+
const mediusParamsBuilder = MediusQueryParamBuilder.create(itemsPerPage, offset);
|
|
27
|
+
|
|
28
|
+
if (params['sort']) {
|
|
29
|
+
for (const sort of params['sort'].split(',')) {
|
|
30
|
+
const qpSortSplit = sort.split(':');
|
|
31
|
+
const field = qpSortSplit[0];
|
|
32
|
+
const asc = qpSortSplit.length > 1 ? qpSortSplit[1] === 'asc' : true;
|
|
33
|
+
mediusParamsBuilder.withSort(field, asc);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (params['filter']) {
|
|
37
|
+
const filterSplit = params['filter'].split(',');
|
|
38
|
+
for (const filterField of filterSplit) {
|
|
39
|
+
const filterFieldSplit = filterField.split(':');
|
|
40
|
+
const field = filterFieldSplit[0];
|
|
41
|
+
const operator = filterFieldSplit.length > 1 ? filterFieldSplit[1] : 'eq';
|
|
42
|
+
|
|
43
|
+
// prepare value
|
|
44
|
+
let value: any = filterFieldSplit.length > 2 ? filterFieldSplit[2] : '';
|
|
45
|
+
let valueTo: any = undefined;
|
|
46
|
+
if (value.startsWith('\'')) {
|
|
47
|
+
value = value.substring(1, value.length - 1);
|
|
48
|
+
}
|
|
49
|
+
if (value.startsWith('[') && value.endsWith(']')) {
|
|
50
|
+
value = value.substring(1, value.length - 1).split(',').map((v: string) => v.startsWith('\'') ? v.substring(1, v.length - 1) : v);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const operatorMapping = MediusRestUtil.matchModeMapping.find(mapping => mapping[1] === operator);
|
|
54
|
+
const filterDescriptor = filterDescriptors.find(f => f.property === field);
|
|
55
|
+
if (operatorMapping && filterDescriptor) {
|
|
56
|
+
const fieldFilterProperty = filterDescriptor.filterProperty ?? filterDescriptor.property;
|
|
57
|
+
mediusParamsBuilder.withFilter(fieldFilterProperty, value, valueTo, MediusRestUtil.getMediusFilterMatchTypeFromPrimeMatchMode(operatorMapping[0]));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return mediusParamsBuilder.build();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
public static fromPrimeLazyLoadEventToAngularQueryParams(event: LazyLoadEvent, defaultItemsPerPage = 10, defaultOffset= 0): Params {
|
|
66
|
+
const params: Params = {
|
|
67
|
+
first: null,
|
|
68
|
+
rows: null,
|
|
69
|
+
sort: null,
|
|
70
|
+
filter: null
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
if (event.first && event.first !== defaultOffset && event.first > 0) {
|
|
74
|
+
params['first'] = event.first;
|
|
75
|
+
}
|
|
76
|
+
if (event.rows && event.rows !== defaultItemsPerPage && event.rows > 0) {
|
|
77
|
+
params['rows'] = event.rows;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (event.multiSortMeta?.length ?? 0 > 0) {
|
|
81
|
+
params['sort'] = event.multiSortMeta?.map(s => `${s.field}${s.order === 1 ? '' : ':desc'}`).join(',');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (event.filters) {
|
|
85
|
+
const filters = [];
|
|
86
|
+
for (const field in event.filters) {
|
|
87
|
+
const primeOperator = event.filters[field].matchMode;
|
|
88
|
+
let value = event.filters[field].value;
|
|
89
|
+
const operatorMapping = MediusRestUtil.matchModeMapping.find(mapping => mapping[0] === primeOperator);
|
|
90
|
+
if (operatorMapping && typeof value !== 'undefined' && value !== null &&
|
|
91
|
+
((typeof value === 'string' && value.length > 0) || (Array.isArray(value) && value.length > 0))) {
|
|
92
|
+
|
|
93
|
+
if (Array.isArray(value)) {
|
|
94
|
+
value = `[${value.map(v => `'${v}'`).join(',')}]`;
|
|
95
|
+
} else {
|
|
96
|
+
value = `'${value}'`;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
filters.push(`${field}:${operatorMapping[1]}:${value}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (filters.length > 0) {
|
|
103
|
+
params['filter'] = filters.join(',');
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return params;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
public static fromPrimeLazyLoadEventToMediusQueryParams(event: LazyLoadEvent): MediusQueryParam {
|
|
111
|
+
|
|
112
|
+
const queryParamBuilder = MediusQueryParamBuilder.create(event.rows, event.first);
|
|
113
|
+
|
|
114
|
+
// apply sorting
|
|
115
|
+
if (event.multiSortMeta) {
|
|
116
|
+
event.multiSortMeta.forEach(msm => queryParamBuilder.withSort(msm.field, msm.order === 1));
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// apply filtering
|
|
120
|
+
if (event.filters) {
|
|
121
|
+
for (const key of Object.keys(event.filters)) {
|
|
122
|
+
const filterEvent = event.filters[key];
|
|
123
|
+
if (Array.isArray(filterEvent)) {
|
|
124
|
+
(filterEvent as FilterMetadata[]).filter(e => e.value)
|
|
125
|
+
.forEach(e => MediusRestUtil.addMediusFilterFromPrimeFilterMetadata(queryParamBuilder, key, e));
|
|
126
|
+
} else if (typeof filterEvent === 'object') {
|
|
127
|
+
if (filterEvent.value) {
|
|
128
|
+
MediusRestUtil.addMediusFilterFromPrimeFilterMetadata(queryParamBuilder, key, filterEvent);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return queryParamBuilder.build();
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
public static addMediusFilterFromPrimeFilterMetadata(queryParamBuilder: MediusQueryParamBuilder, property: string, filterMetadata: FilterMetadata) {
|
|
138
|
+
const matchType: MediusFilterMatchType = MediusRestUtil.getMediusFilterMatchTypeFromPrimeMatchMode(filterMetadata.matchMode ?? 'contains');
|
|
139
|
+
queryParamBuilder.withFilter(property, filterMetadata.value, undefined, matchType);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
public static getMediusFilterMatchTypeFromPrimeMatchMode(matchMode: string): MediusFilterMatchType {
|
|
143
|
+
const mapping = MediusRestUtil.matchModeMapping.find(m => m[0] === matchMode);
|
|
144
|
+
return mapping?.[2] ?? MediusFilterMatchType.Contains;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
@@ -0,0 +1,227 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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>
|
|
@@ -0,0 +1,77 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
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>
|