@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
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import {ChangeDetectionStrategy, Component, EventEmitter, ExistingProvider, forwardRef, Injector, Input, OnInit, Output, ViewChild} from '@angular/core';
|
|
2
|
+
import {ControlValueAccessor, FormControl, NG_VALUE_ACCESSOR} from '@angular/forms';
|
|
3
|
+
|
|
4
|
+
import {Observable, ReplaySubject, Subject} from 'rxjs';
|
|
5
|
+
import {first} from 'rxjs/operators';
|
|
6
|
+
import {Dropdown} from 'primeng/dropdown';
|
|
7
|
+
|
|
8
|
+
import {ILookupDataProvider} from '../../../data-providers';
|
|
9
|
+
import {MediusQueryParamBuilder} from '../../../api/models';
|
|
10
|
+
|
|
11
|
+
export const MNG_DROPDOWN_VALUE_ACCESSOR: ExistingProvider = {
|
|
12
|
+
provide: NG_VALUE_ACCESSOR,
|
|
13
|
+
useExisting: forwardRef(() => MngDropdownComponent),
|
|
14
|
+
multi: true
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
@Component({
|
|
18
|
+
selector: 'mng-dropdown',
|
|
19
|
+
templateUrl: './dropdown.component.html',
|
|
20
|
+
providers: [MNG_DROPDOWN_VALUE_ACCESSOR],
|
|
21
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
22
|
+
})
|
|
23
|
+
export class MngDropdownComponent implements OnInit, ControlValueAccessor {
|
|
24
|
+
|
|
25
|
+
@Input() dataProvider?: ILookupDataProvider<any, any>;
|
|
26
|
+
@Input() dataKeyProperty?: string;
|
|
27
|
+
@Input() itemsLabelProperty?: string;
|
|
28
|
+
@Input() itemsValueProperty?: string;
|
|
29
|
+
@Input() multiselect: boolean = false;
|
|
30
|
+
@Input() placeholder?: string;
|
|
31
|
+
@Input() showClear = true;
|
|
32
|
+
@Input() className: string|null = null;
|
|
33
|
+
@Input() dropdownClassName: string|null = null;
|
|
34
|
+
|
|
35
|
+
@Output() onChange = new EventEmitter();
|
|
36
|
+
|
|
37
|
+
@ViewChild(Dropdown) private primeDropdown?: Dropdown;
|
|
38
|
+
|
|
39
|
+
private itemsSubject: Subject<Array<any>> = new ReplaySubject<Array<any>>(1);
|
|
40
|
+
private dataProviderService: any = null;
|
|
41
|
+
private onChangeFn: any = () => { };
|
|
42
|
+
private onTouchedFn: any = () => { };
|
|
43
|
+
|
|
44
|
+
public dropdownFormControl: FormControl = new FormControl();
|
|
45
|
+
public items$: Observable<Array<any>> = this.itemsSubject.asObservable();
|
|
46
|
+
|
|
47
|
+
constructor(private injector: Injector) {
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
ngOnInit(): void {
|
|
51
|
+
|
|
52
|
+
this.dropdownFormControl.valueChanges
|
|
53
|
+
.subscribe(v => {
|
|
54
|
+
this.onChangeFn(v);
|
|
55
|
+
this.onChange.next(v);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
if (this.dataProvider) {
|
|
59
|
+
this.dataProviderService = this.dataProvider.serviceType
|
|
60
|
+
? this.injector.get<any>(this.dataProvider.serviceType)
|
|
61
|
+
: null;
|
|
62
|
+
|
|
63
|
+
const queryParamBuilder = MediusQueryParamBuilder.create();
|
|
64
|
+
this.dataProvider.lookup(queryParamBuilder.build(), this.dataProviderService)
|
|
65
|
+
.pipe(
|
|
66
|
+
first()
|
|
67
|
+
)
|
|
68
|
+
.subscribe(res => {
|
|
69
|
+
this.itemsSubject.next(res);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
if (!this.dropdownFormControl?.value) {
|
|
73
|
+
this.items$.pipe(first()).subscribe(res => {
|
|
74
|
+
// TODO: check if really only way
|
|
75
|
+
if (res.length === 1) {
|
|
76
|
+
const value = this.itemsValueProperty ? res[0][this.itemsValueProperty] : res[0];
|
|
77
|
+
this.dropdownFormControl?.patchValue(value);
|
|
78
|
+
console.log('patched dropdown form value with', value);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
} else {
|
|
83
|
+
console.warn(`Data provider should be provided for MngDropdownComponent.`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
registerOnChange(fn: any): void {
|
|
88
|
+
this.onChangeFn = fn;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
registerOnTouched(fn: any): void {
|
|
92
|
+
this.onTouchedFn = fn;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
setDisabledState(isDisabled: boolean): void {
|
|
96
|
+
if (isDisabled) {
|
|
97
|
+
this.dropdownFormControl.disable();
|
|
98
|
+
} else {
|
|
99
|
+
this.dropdownFormControl.enable();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
writeValue(obj: any): void {
|
|
104
|
+
this.dropdownFormControl.setValue(obj, { emitEvent: false });
|
|
105
|
+
if (this.primeDropdown) {
|
|
106
|
+
this.primeDropdown.writeValue(obj);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<form [formGroup]="form" (ngSubmit)="onSubmit($event)">
|
|
2
|
+
<formly-form [form]="form" [fields]="formFields" [options]="formOptions" [model]="formModel"></formly-form>
|
|
3
|
+
<button #submitButton pButton type="submit" [class.hidden]="!isSubmitButtonVisible" [disabled]="form.disabled" [loading]="(submitLoading$ | async) ?? false"></button>
|
|
4
|
+
</form>
|
|
5
|
+
<p-messages [value]="formMessages" [enableService]="false"></p-messages>
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import {AfterContentInit, ChangeDetectionStrategy, Component, ContentChildren, ElementRef, EventEmitter, Input, OnDestroy, OnInit, Output, QueryList, ViewChild} from '@angular/core';
|
|
2
|
+
import {FormGroup} from '@angular/forms';
|
|
3
|
+
|
|
4
|
+
import {FormlyFieldConfig, FormlyFormOptions} from '@ngx-formly/core';
|
|
5
|
+
import {Message} from 'primeng/api';
|
|
6
|
+
import {Observable, of, Subscription} from 'rxjs';
|
|
7
|
+
import {TranslateService} from '@ngx-translate/core';
|
|
8
|
+
|
|
9
|
+
import {EditorDescriptor} from '../../../descriptors';
|
|
10
|
+
import {MngFormEditorSubmitEvent} from '../models';
|
|
11
|
+
import {MngTemplateDirective} from '../../../directives';
|
|
12
|
+
import {EditorFormlyUtil, ToastUtil} from '../../../utils';
|
|
13
|
+
|
|
14
|
+
@Component({
|
|
15
|
+
selector: 'mng-form-editor',
|
|
16
|
+
templateUrl: './form-editor.component.html',
|
|
17
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
18
|
+
})
|
|
19
|
+
export class MngFormEditorComponent<T> implements OnInit, AfterContentInit, OnDestroy {
|
|
20
|
+
|
|
21
|
+
// metadata and editor mode input
|
|
22
|
+
@Input() public descriptor!: EditorDescriptor<T>;
|
|
23
|
+
@Input() public submitLoading: Observable<boolean>|boolean = false;
|
|
24
|
+
|
|
25
|
+
// data source inputs;
|
|
26
|
+
@Input() public item?: T;
|
|
27
|
+
|
|
28
|
+
// extra features input
|
|
29
|
+
@Input() public isSubmitButtonVisible = false;
|
|
30
|
+
@Input() public isFormDisabled = null;
|
|
31
|
+
|
|
32
|
+
// event outputs
|
|
33
|
+
@Output('onSubmit') private submitEventEmitter = new EventEmitter<MngFormEditorSubmitEvent<T>>();
|
|
34
|
+
|
|
35
|
+
// content and view queries
|
|
36
|
+
@ContentChildren(MngTemplateDirective) templates!: QueryList<MngTemplateDirective>;
|
|
37
|
+
|
|
38
|
+
@ViewChild('submitButton')
|
|
39
|
+
public submitButtonElementRef?: ElementRef;
|
|
40
|
+
|
|
41
|
+
public form: FormGroup = new FormGroup({});
|
|
42
|
+
public formOptions: FormlyFormOptions = {
|
|
43
|
+
formState: {
|
|
44
|
+
add: false,
|
|
45
|
+
edit: false,
|
|
46
|
+
disabled: false
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
public formFields!: FormlyFieldConfig[];
|
|
50
|
+
public formOrigItem?: T;
|
|
51
|
+
public formModel: any = {};
|
|
52
|
+
public formMessages: Message[] = [];
|
|
53
|
+
public submitLoading$!: Observable<boolean>;
|
|
54
|
+
|
|
55
|
+
private subscriptions: Subscription[] = [];
|
|
56
|
+
|
|
57
|
+
constructor(private translateService: TranslateService) { }
|
|
58
|
+
|
|
59
|
+
public ngOnInit() {
|
|
60
|
+
|
|
61
|
+
this.updateFormModel(this.item);
|
|
62
|
+
this.submitLoading$ = this.submitLoading instanceof Observable ? this.submitLoading : of(this.submitLoading);
|
|
63
|
+
|
|
64
|
+
// init fields for formly
|
|
65
|
+
this.formFields = EditorFormlyUtil.createFormlyConfigFromDescriptor(this.descriptor);
|
|
66
|
+
this.updateFormState();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
public ngAfterContentInit() {
|
|
70
|
+
this.templates.forEach(template => {
|
|
71
|
+
switch(template.getType()) {
|
|
72
|
+
// case 'caption':
|
|
73
|
+
// this.captionTemplate = template.template;
|
|
74
|
+
// break;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
public ngOnDestroy() {
|
|
80
|
+
this.subscriptions.forEach(s => s.unsubscribe());
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
public submit() {
|
|
84
|
+
this.submitButtonElementRef?.nativeElement.click();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
public onSubmit(event: Event) {
|
|
88
|
+
this.formOptions.formState.submittedOn = Date.now();
|
|
89
|
+
this.formMessages = [];
|
|
90
|
+
|
|
91
|
+
const formSubmitItem = this.form.getRawValue() as T;
|
|
92
|
+
if (this.form.valid) {
|
|
93
|
+
this.descriptor.fields.forEach(field => {
|
|
94
|
+
if (field && field.setter) {
|
|
95
|
+
field.setter(formSubmitItem, this.form.value[field.property]);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
this.submitEventEmitter.next(new MngFormEditorSubmitEvent(formSubmitItem));
|
|
100
|
+
} else {
|
|
101
|
+
// find and mark invalid tabs
|
|
102
|
+
if (this.formFields[0].type === 'tabs' && this.formFields[0].fieldGroup) {
|
|
103
|
+
for (const tab of this.formFields[0].fieldGroup) {
|
|
104
|
+
const isInvalid = this.isAnyFieldInvalid(tab.fieldGroup);
|
|
105
|
+
this.formOptions.formState['tab_' + (tab.id ? tab.id : tab.templateOptions?.label) + '_invalid'] = isInvalid;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
const event = new MngFormEditorSubmitEvent(formSubmitItem);
|
|
109
|
+
event.success = false;
|
|
110
|
+
this.formMessages.push(ToastUtil.getFormEditorWarningMessage(this.translateService, 'mngEditor.invalidFormToastTitle', 'mngEditor.invalidFormToastMessage'));
|
|
111
|
+
this.submitEventEmitter.next(event);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
private isAnyFieldInvalid(fields: FormlyFieldConfig[] = []): boolean {
|
|
116
|
+
for (const field of fields) {
|
|
117
|
+
let fieldInvalid = false;
|
|
118
|
+
if (Array.isArray(field.fieldGroup)) {
|
|
119
|
+
fieldInvalid = this.isAnyFieldInvalid(field.fieldGroup);
|
|
120
|
+
} else if (typeof field.type !== 'undefined') {
|
|
121
|
+
fieldInvalid = !field.formControl?.valid;
|
|
122
|
+
}
|
|
123
|
+
if (fieldInvalid) {
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
private updateFormModel(item?: T) {
|
|
131
|
+
this.formOrigItem = item;
|
|
132
|
+
// TODO: to check if this is ok, could be problems with dates, if so, try lodash
|
|
133
|
+
const formModel = JSON.parse(JSON.stringify(item ?? {}));
|
|
134
|
+
|
|
135
|
+
this.descriptor.fields.forEach(field => {
|
|
136
|
+
if (field.getter && item) {
|
|
137
|
+
formModel[field.property] = field.getter(item);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
if (typeof this.formOptions.resetModel === 'function') { // could not be initiated yet
|
|
141
|
+
this.formOptions.resetModel(this.formModel);
|
|
142
|
+
}
|
|
143
|
+
this.formModel = formModel;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
private updateFormState() {
|
|
147
|
+
this.formOptions.formState.disabled = this.isFormDisabled !== null ? this.isFormDisabled === true : this.descriptor.disabled;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<mng-autocomplete [id]="$any(key)"
|
|
2
|
+
[formControl]="aFormControl"
|
|
3
|
+
[formlyAttributes]="field"
|
|
4
|
+
[dataProvider]="$any(descriptor.dataProvider)"
|
|
5
|
+
[dataKeyProperty]="$any(descriptor.dataKeyProperty)"
|
|
6
|
+
[itemsLabelProperty]="$any(descriptor.itemsLabelProperty)">
|
|
7
|
+
</mng-autocomplete>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {ChangeDetectionStrategy, Component} from '@angular/core';
|
|
2
|
+
import {FormControl} from '@angular/forms';
|
|
3
|
+
|
|
4
|
+
import {FieldType} from '@ngx-formly/core';
|
|
5
|
+
import {FieldLookupDescriptor} from '../../../../../descriptors';
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
selector: 'mng-formly-field-autocomplete',
|
|
9
|
+
templateUrl: './formly-field-autocomplete.component.html',
|
|
10
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
11
|
+
})
|
|
12
|
+
export class MngFormlyFieldAutocompleteComponent<T> extends FieldType {
|
|
13
|
+
|
|
14
|
+
public aFormControl!: FormControl;
|
|
15
|
+
public descriptor!: FieldLookupDescriptor<T, any>;
|
|
16
|
+
|
|
17
|
+
public ngOnInit() {
|
|
18
|
+
this.aFormControl = this.formControl as FormControl;
|
|
19
|
+
this.descriptor = this.to['descriptor'];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<mng-dropdown [id]="$any(key)"
|
|
2
|
+
[formControl]="dFormControl"
|
|
3
|
+
[formlyAttributes]="field"
|
|
4
|
+
[placeholder]="$any(descriptor.placeholder)"
|
|
5
|
+
[itemsLabelProperty]="$any(descriptor.itemsLabelProperty)"
|
|
6
|
+
[itemsValueProperty]="$any(descriptor.itemsValueProperty)"
|
|
7
|
+
[showClear]="!this.to.required"
|
|
8
|
+
[dataKeyProperty]="$any(descriptor.dataKeyProperty)">
|
|
9
|
+
</mng-dropdown>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {ChangeDetectionStrategy, Component} from '@angular/core';
|
|
2
|
+
import {FormControl} from '@angular/forms';
|
|
3
|
+
|
|
4
|
+
import {FieldType} from '@ngx-formly/core';
|
|
5
|
+
|
|
6
|
+
import {FieldLookupDescriptor} from '../../../../../descriptors';
|
|
7
|
+
|
|
8
|
+
@Component({
|
|
9
|
+
selector: 'mng-formly-field-dropdown',
|
|
10
|
+
templateUrl: './formly-field-dropdown.component.html',
|
|
11
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
12
|
+
})
|
|
13
|
+
export class MngFormlyFieldDropdownComponent<T> extends FieldType {
|
|
14
|
+
|
|
15
|
+
public dFormControl!: FormControl;
|
|
16
|
+
public descriptor!: FieldLookupDescriptor<T, any>;
|
|
17
|
+
|
|
18
|
+
public ngOnInit() {
|
|
19
|
+
this.dFormControl = this.formControl as FormControl;
|
|
20
|
+
this.descriptor = this.to['descriptor'];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<ng-container *ngFor="let group of field.fieldGroup; let i = index; let last = last;">
|
|
2
|
+
<p-fieldset *ngIf="!group.templateOptions?.['descriptor']?.default; else defaultSet" [legend]="group.templateOptions?.label! | translate">
|
|
3
|
+
<formly-field [field]="group"></formly-field>
|
|
4
|
+
</p-fieldset>
|
|
5
|
+
<ng-template #defaultSet>
|
|
6
|
+
<formly-field [field]="group"></formly-field>
|
|
7
|
+
</ng-template>
|
|
8
|
+
</ng-container>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {Component, ChangeDetectionStrategy} from '@angular/core';
|
|
2
|
+
import { FieldType } from '@ngx-formly/core';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'mng-formly-field-fieldset',
|
|
6
|
+
templateUrl: './formly-field-fieldset.component.html',
|
|
7
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
8
|
+
})
|
|
9
|
+
export class MngFormlyFieldFieldsetComponent extends FieldType {
|
|
10
|
+
}
|
package/src/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.html
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<ng-container [ngSwitch]="to.type">
|
|
2
|
+
<p-inputNumber *ngSwitchCase="'number'"
|
|
3
|
+
[id]="$any(key)"
|
|
4
|
+
[formControl]="iFormControl"
|
|
5
|
+
[formlyAttributes]="field"
|
|
6
|
+
[min]="$any(descriptor.numberMin)"
|
|
7
|
+
[max]="$any(descriptor.numberMax)"
|
|
8
|
+
[step]="$any(descriptor.numberStep)"
|
|
9
|
+
[minFractionDigits]="descriptor.numberMinFractionDigits || 0"
|
|
10
|
+
[maxFractionDigits]="descriptor.numberMaxFractionDigits || 0">
|
|
11
|
+
</p-inputNumber>
|
|
12
|
+
|
|
13
|
+
<div *ngSwitchCase="'switch'" class="flex flex-column">
|
|
14
|
+
<label [for]="key">{{ to?.label! | translate }} <span *ngIf="to.required && to['hideRequiredMarker'] !== true">*</span></label>
|
|
15
|
+
<p-inputSwitch [id]="$any(key)"
|
|
16
|
+
[formControl]="iFormControl"
|
|
17
|
+
[formlyAttributes]="field">
|
|
18
|
+
</p-inputSwitch>
|
|
19
|
+
<small *ngIf="showError" class="p-error">
|
|
20
|
+
<formly-validation-message [field]="field"></formly-validation-message>
|
|
21
|
+
</small>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<ng-container *ngSwitchCase="'radio'">
|
|
25
|
+
<div *ngFor="let category of descriptor.radioOptions" [id]="$any(key)" class="p-field-radiobutton">
|
|
26
|
+
<p-radioButton [value]="category" [formControl]="iFormControl" [formlyAttributes]="field"></p-radioButton>
|
|
27
|
+
<label [for]="category" class="mng-radio-button-label">{{category}}</label>
|
|
28
|
+
</div>
|
|
29
|
+
</ng-container>
|
|
30
|
+
|
|
31
|
+
<textarea *ngSwitchCase="'textarea'"
|
|
32
|
+
[id]="$any(key)"
|
|
33
|
+
[formControl]="iFormControl"
|
|
34
|
+
[formlyAttributes]="field"
|
|
35
|
+
[rows]="descriptor.rows ?? 3"
|
|
36
|
+
pInputTextarea>
|
|
37
|
+
</textarea>
|
|
38
|
+
|
|
39
|
+
<p-calendar *ngSwitchCase="'datepicker'"
|
|
40
|
+
[formControl]="iFormControl"
|
|
41
|
+
[formlyAttributes]="field"
|
|
42
|
+
[dateFormat]="$any(descriptor.datePickerFormat)"
|
|
43
|
+
[minDate]="$any(descriptor.datePickerMin)"
|
|
44
|
+
[maxDate]="$any(descriptor.datePickerMax)"
|
|
45
|
+
[showTime]="descriptor.datePickerShowTime"
|
|
46
|
+
[showIcon]="true">
|
|
47
|
+
</p-calendar>
|
|
48
|
+
|
|
49
|
+
<input *ngSwitchDefault
|
|
50
|
+
pInputText
|
|
51
|
+
[id]="$any(key)"
|
|
52
|
+
[type]="to.type || 'text'"
|
|
53
|
+
[formControl]="iFormControl"
|
|
54
|
+
[formlyAttributes]="field"
|
|
55
|
+
/>
|
|
56
|
+
</ng-container>
|
package/src/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {Component, ChangeDetectionStrategy, OnInit} from '@angular/core';
|
|
2
|
+
import {FormControl} from '@angular/forms';
|
|
3
|
+
|
|
4
|
+
import { FieldType } from '@ngx-formly/core';
|
|
5
|
+
|
|
6
|
+
import {FieldInputDescriptor} from '../../../../../descriptors';
|
|
7
|
+
|
|
8
|
+
@Component({
|
|
9
|
+
selector: 'mng-formly-field-input',
|
|
10
|
+
templateUrl: './formly-field-input.component.html',
|
|
11
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
12
|
+
})
|
|
13
|
+
export class MngFormlyFieldInputComponent extends FieldType implements OnInit {
|
|
14
|
+
|
|
15
|
+
public iFormControl!: FormControl;
|
|
16
|
+
public descriptor!: FieldInputDescriptor<any>;
|
|
17
|
+
|
|
18
|
+
ngOnInit(): void {
|
|
19
|
+
this.iFormControl = this.formControl as FormControl;
|
|
20
|
+
this.descriptor = this.to['descriptor'];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<mng-table [descriptor]="descriptor.tableDescriptor" [items]="items$">
|
|
2
|
+
<ng-template mngTemplate="caption">
|
|
3
|
+
<div class="flex flex-column md:flex-row md:justify-content-end table-header">
|
|
4
|
+
<label class="mng-datatable-form-label p-m-0" [for]="key">{{ to?.label! | translate }} <span *ngIf="to.required && to['hideRequiredMarker'] !== true">*</span></label>
|
|
5
|
+
<mng-action *ngFor="let action of toolbarActions" [action]="action"></mng-action>
|
|
6
|
+
</div>
|
|
7
|
+
</ng-template>
|
|
8
|
+
<ng-template mngTemplate="columnAction" let-item="rowItem" let-idx="rowIndex">
|
|
9
|
+
<mng-action *ngFor="let action of rowActions"
|
|
10
|
+
[action]="action" [item]="item" [itemId]="descriptor.tableviewDescriptor.model.idPropertyName ? item[descriptor.tableviewDescriptor.model.idPropertyName] : undefined" [actionData]="{ itemIndex: idx }">
|
|
11
|
+
</mng-action>
|
|
12
|
+
</ng-template>
|
|
13
|
+
</mng-table>
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import {ChangeDetectionStrategy, Component, OnDestroy, OnInit} from '@angular/core';
|
|
2
|
+
|
|
3
|
+
import {FieldType} from '@ngx-formly/core';
|
|
4
|
+
import {Observable, of, ReplaySubject, Subject, Subscription} from 'rxjs';
|
|
5
|
+
import {startWith} from 'rxjs/operators';
|
|
6
|
+
|
|
7
|
+
import {FieldManyEditorDescriptor, ActionDescriptor, ActionEditorDescriptor, ActionLevelEnum} from '../../../../../descriptors';
|
|
8
|
+
|
|
9
|
+
@Component({
|
|
10
|
+
selector: 'mng-formly-table-dialog-form-field',
|
|
11
|
+
templateUrl: './formly-field-table-dialog-form.component.html',
|
|
12
|
+
styleUrls: ['./formly-field-table-dialog-form.component.scss'],
|
|
13
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
14
|
+
})
|
|
15
|
+
export class MngFormlyFieldTableDialogFormComponent<T, ET> extends FieldType implements OnInit, OnDestroy {
|
|
16
|
+
|
|
17
|
+
public descriptor!: FieldManyEditorDescriptor<T, ET>;
|
|
18
|
+
|
|
19
|
+
public itemsSubject: Subject<Array<T>> = new ReplaySubject(1);
|
|
20
|
+
public items$: Observable<Array<T>> = this.itemsSubject.asObservable();
|
|
21
|
+
|
|
22
|
+
public toolbarActions: Array<ActionDescriptor<T>> = [];
|
|
23
|
+
public rowActions: Array<ActionDescriptor<T>> = [];
|
|
24
|
+
|
|
25
|
+
private subscriptions: Subscription[] = [];
|
|
26
|
+
|
|
27
|
+
public ngOnInit() {
|
|
28
|
+
|
|
29
|
+
this.descriptor = this.to['descriptor'];
|
|
30
|
+
const hasAddAction = this.descriptor.actions.some(a => a === FieldManyEditorDescriptor.ActionEnum.Add);
|
|
31
|
+
const hasEditAction = this.descriptor.actions.some(a => a === FieldManyEditorDescriptor.ActionEnum.Edit);
|
|
32
|
+
const hasDeleteAction = this.descriptor.actions.some(a => a === FieldManyEditorDescriptor.ActionEnum.Delete);
|
|
33
|
+
|
|
34
|
+
if (hasAddAction) {
|
|
35
|
+
console.log(this.descriptor.tableviewDescriptor.addEditor);
|
|
36
|
+
const addAction = new ActionEditorDescriptor(this.descriptor.tableviewDescriptor.addEditor, 'add', this.descriptor.editor.model.type, this.descriptor.property)
|
|
37
|
+
.withTitle(null)
|
|
38
|
+
.withIcon('pi pi-plus')
|
|
39
|
+
.withClassName('mng-formly-field-table-form-dialog')
|
|
40
|
+
.withSubmitFunction(ctx => {
|
|
41
|
+
if (!ctx.data?.item) {
|
|
42
|
+
throw new Error(`No item was provided in context, edit cannot be done.`);
|
|
43
|
+
}
|
|
44
|
+
this.formState.submittedOn = Date.now();
|
|
45
|
+
let value = this.formControl.value;
|
|
46
|
+
value = [...value, ctx.data.item];
|
|
47
|
+
this.formControl.patchValue(value);
|
|
48
|
+
return of(ctx.data.item);
|
|
49
|
+
})
|
|
50
|
+
.withIsVisibleFunction(ctx => of(!this.options?.formState.disabled));
|
|
51
|
+
this.toolbarActions.push(addAction as ActionDescriptor<T>);
|
|
52
|
+
}
|
|
53
|
+
if (hasEditAction) {
|
|
54
|
+
const editAction = new ActionEditorDescriptor(this.descriptor.tableviewDescriptor.editEditor, 'edit', this.descriptor.editor.model.type, this.descriptor.property)
|
|
55
|
+
.withTitle(null)
|
|
56
|
+
.withIcon('pi pi-pencil')
|
|
57
|
+
.withClassName('mng-formly-field-table-form-dialog')
|
|
58
|
+
.withSubmitFunction(ctx => {
|
|
59
|
+
if (!ctx.data?.item) {
|
|
60
|
+
throw new Error(`No item was provided in context, edit cannot be done.`);
|
|
61
|
+
}
|
|
62
|
+
this.formState.submittedOn = Date.now();
|
|
63
|
+
let formControlValue = this.formControl.value;
|
|
64
|
+
formControlValue[ctx.data.actionData?.['itemIndex']] = ctx.data.item;
|
|
65
|
+
this.formControl.patchValue(formControlValue);
|
|
66
|
+
return of(ctx.data.item);
|
|
67
|
+
})
|
|
68
|
+
.withIsVisibleFunction(ctx => of(!this.options?.formState.disabled));
|
|
69
|
+
this.rowActions.push(editAction as ActionDescriptor<T>);
|
|
70
|
+
}
|
|
71
|
+
if (hasDeleteAction) {
|
|
72
|
+
const deleteAction = new ActionDescriptor(this.descriptor.tableviewDescriptor.model, 'delete', this.descriptor.editor.model.type, this.descriptor.property)
|
|
73
|
+
.withLevel(ActionLevelEnum.Danger)
|
|
74
|
+
.withTitle(null)
|
|
75
|
+
.withIcon('pi pi-trash')
|
|
76
|
+
.withRunFunction(ctx => {
|
|
77
|
+
if (!ctx.data?.item) {
|
|
78
|
+
throw new Error(`No item was provided in context, delete cannot be done.`);
|
|
79
|
+
}
|
|
80
|
+
let formControlValue = this.formControl.value;
|
|
81
|
+
const compareProperty = this.descriptor.tableDescriptor.dataKeyProperty ? this.descriptor.tableDescriptor.dataKeyProperty : this.descriptor.tableDescriptor.model.idPropertyName;
|
|
82
|
+
if (!compareProperty) {
|
|
83
|
+
throw new Error('Cannot compare items, please provide main table data key property or model id property.');
|
|
84
|
+
}
|
|
85
|
+
const ctxItem: any = ctx.data.item;
|
|
86
|
+
if (!ctxItem?.[compareProperty]) {
|
|
87
|
+
return formControlValue;
|
|
88
|
+
}
|
|
89
|
+
formControlValue = formControlValue.filter((i: any) => i[compareProperty] !== ctxItem[compareProperty]);
|
|
90
|
+
this.formControl.patchValue(formControlValue);
|
|
91
|
+
return of(ctx.data.item);
|
|
92
|
+
})
|
|
93
|
+
.withIsVisibleFunction(ctx => of(!this.options?.formState.disabled));
|
|
94
|
+
this.rowActions.push(deleteAction);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// init values
|
|
98
|
+
if (typeof this.formControl.value === 'undefined' || this.formControl.value === null) {
|
|
99
|
+
this.formControl.patchValue([]);
|
|
100
|
+
}
|
|
101
|
+
const subscription = this.formControl.valueChanges
|
|
102
|
+
.pipe(
|
|
103
|
+
startWith(this.formControl.value)
|
|
104
|
+
)
|
|
105
|
+
.subscribe(v => {
|
|
106
|
+
this.itemsSubject.next(v);
|
|
107
|
+
});
|
|
108
|
+
this.subscriptions.push(subscription);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
public ngOnDestroy() {
|
|
112
|
+
this.subscriptions.forEach(s => s.unsubscribe());
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<mng-table [descriptor]="descriptor.mainTableDescriptor" [items]="itemsAsync">
|
|
2
|
+
<ng-template mngTemplate="caption">
|
|
3
|
+
<div class="flex flex-column md:flex-row md:justify-content-end table-header">
|
|
4
|
+
<label class="mng-datatable-form-label p-m-0" [for]="key">{{ to?.label! | translate }} <span *ngIf="to.required && to['hideRequiredMarker'] !== true">*</span></label>
|
|
5
|
+
<button *ngIf="hasAddAction && !formControl.disabled" pButton pRipple type="button" icon="pi pi-plus" class="p-button-rounded p-button-success"
|
|
6
|
+
(click)="openAddDialog()">
|
|
7
|
+
</button>
|
|
8
|
+
</div>
|
|
9
|
+
</ng-template>
|
|
10
|
+
<ng-template mngTemplate="columnAction" let-item="rowItem">
|
|
11
|
+
<button *ngIf="hasDeleteAction && !formControl.disabled" pButton pRipple type="button" icon="pi pi-trash" class="p-button-rounded p-button-danger"
|
|
12
|
+
(click)="removeItem(item)">
|
|
13
|
+
</button>
|
|
14
|
+
</ng-template>
|
|
15
|
+
</mng-table>
|
|
16
|
+
|
|
17
|
+
<p-dialog *ngIf="hasAddAction" [(visible)]="isDialogVisible"
|
|
18
|
+
[draggable]="false"
|
|
19
|
+
[header]="'general.addItem' | translate: {item: to?.label!}"
|
|
20
|
+
[modal]="true"
|
|
21
|
+
appendTo="body"
|
|
22
|
+
styleClass="p-fluid mng-formly-field-table-multiselect-dialog">
|
|
23
|
+
<ng-template pTemplate="content">
|
|
24
|
+
<mng-table [descriptor]="descriptor.mainTableDescriptor"
|
|
25
|
+
[queryResult]="addItemsAsync"
|
|
26
|
+
[selectionEnabled]="true"
|
|
27
|
+
[loading]="dialogIsLoading$"
|
|
28
|
+
(onSelectionChange)="onSelectionChange($event)">
|
|
29
|
+
</mng-table>
|
|
30
|
+
<p-messages [value]="dialogMessages"></p-messages>
|
|
31
|
+
</ng-template>
|
|
32
|
+
|
|
33
|
+
<ng-template pTemplate="footer">
|
|
34
|
+
<button pButton pRipple type="button" [label]="'general.cancel' | translate" icon="pi pi-times" class="p-button-text" (click)="hideDialog()"></button>
|
|
35
|
+
<button pButton pRipple type="button" [label]="'general.add' | translate" icon="pi pi-check" class="p-button-text" (click)="addItems()" [loading]="(dialogIsLoading$ | async) ?? false" [disabled]="form.disabled"></button>
|
|
36
|
+
</ng-template>
|
|
37
|
+
</p-dialog>
|