@mediusinc/mng-commons 0.2.1-rc → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/lib/api/models/builders/query-param.builder.mjs +48 -0
- package/esm2020/lib/api/models/filter-match-type.model.mjs +26 -0
- package/esm2020/lib/api/models/filter-param.model.mjs +46 -0
- package/esm2020/lib/api/models/index.mjs +9 -0
- package/esm2020/lib/api/models/mappers.mjs +17 -0
- package/esm2020/lib/api/models/query-mode.model.mjs +19 -0
- package/esm2020/lib/api/models/query-param.model.mjs +69 -0
- package/esm2020/lib/api/models/query-result.model.mjs +45 -0
- package/esm2020/lib/api/models/serialization.model.mjs +2 -0
- package/esm2020/lib/api/services/crud-api.abstract.service.mjs +72 -0
- package/esm2020/lib/api/services/index.mjs +2 -0
- package/esm2020/lib/api/utils/index.mjs +3 -0
- package/esm2020/lib/api/utils/medius-rest.util.mjs +122 -0
- package/esm2020/lib/api/utils/object-serializer.util.mjs +226 -0
- package/esm2020/lib/components/action/action.component.mjs +65 -0
- package/esm2020/lib/components/action/dialog/action-dialog.component.mjs +148 -0
- package/esm2020/lib/components/action/index.mjs +4 -0
- package/esm2020/lib/components/action/models/action-confirmation-service.model.mjs +2 -0
- package/esm2020/lib/components/action/models/action-execution.model.mjs +58 -0
- package/esm2020/lib/components/action/models/index.mjs +3 -0
- package/esm2020/lib/components/action/route/action-route.component.mjs +144 -0
- package/esm2020/lib/components/form/autocomplete/autocomplete.component.mjs +114 -0
- package/esm2020/lib/components/form/dropdown/dropdown.component.mjs +113 -0
- package/esm2020/lib/components/form/editor/form-editor.component.mjs +141 -0
- package/esm2020/lib/components/form/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.mjs +19 -0
- package/esm2020/lib/components/form/formly/fields/formly-field-dropdown/formly-field-dropdown.component.mjs +19 -0
- package/esm2020/lib/components/form/formly/fields/formly-field-fieldset/formly-field-fieldset.component.mjs +16 -0
- package/esm2020/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.mjs +26 -0
- package/esm2020/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +109 -0
- package/esm2020/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.mjs +122 -0
- package/esm2020/lib/components/form/formly/fields/formly-field-tabs/formly-field-tabs.component.mjs +17 -0
- package/esm2020/lib/components/form/formly/fields/index.mjs +8 -0
- package/esm2020/lib/components/form/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.mjs +17 -0
- package/esm2020/lib/components/form/formly/wrappers/formly-table-wrapper/formly-table-wrapper.component.mjs +16 -0
- package/esm2020/lib/components/form/formly/wrappers/index.mjs +3 -0
- package/esm2020/lib/components/form/index.mjs +4 -0
- package/esm2020/lib/components/form/models/form-editor.event.mjs +7 -0
- package/esm2020/lib/components/form/models/index.mjs +2 -0
- package/esm2020/lib/components/layout/breadcrumb.component.mjs +17 -0
- package/esm2020/lib/components/layout/footer.component.mjs +17 -0
- package/esm2020/lib/components/layout/index.mjs +7 -0
- package/esm2020/lib/components/layout/main-layout.component.mjs +54 -0
- package/esm2020/lib/components/layout/menu-item.component.mjs +173 -0
- package/esm2020/lib/components/layout/menu.component.mjs +20 -0
- package/esm2020/lib/components/layout/services/index.mjs +2 -0
- package/esm2020/lib/components/layout/services/main-layout.component.service.mjs +190 -0
- package/esm2020/lib/components/layout/topbar.component.mjs +59 -0
- package/esm2020/lib/components/tableview/index.mjs +6 -0
- package/esm2020/lib/components/tableview/models/index.mjs +2 -0
- package/esm2020/lib/components/tableview/models/table.event.mjs +16 -0
- package/esm2020/lib/components/tableview/route/tableview-route.abstract.component.mjs +24 -0
- package/esm2020/lib/components/tableview/services/index.mjs +2 -0
- package/esm2020/lib/components/tableview/services/tableview.component.service.mjs +17 -0
- package/esm2020/lib/components/tableview/table/column-filter/column-filter.component.mjs +74 -0
- package/esm2020/lib/components/tableview/table/column-value/column-value.component.mjs +25 -0
- package/esm2020/lib/components/tableview/table/table.component.mjs +307 -0
- package/esm2020/lib/components/tableview/tableview.component.mjs +82 -0
- package/esm2020/lib/config/formly.config.mjs +136 -0
- package/esm2020/lib/config/index.mjs +2 -0
- package/esm2020/lib/config/models/index.mjs +2 -0
- package/esm2020/lib/config/models/mng-config.model.mjs +2 -0
- package/esm2020/lib/data-providers/base.data-provider.mjs +24 -0
- package/esm2020/lib/data-providers/editor.data-provider.mjs +37 -0
- package/esm2020/lib/data-providers/index.mjs +6 -0
- package/esm2020/lib/data-providers/lookup.data-provider.mjs +16 -0
- package/esm2020/lib/data-providers/table.data-provider.mjs +2 -0
- package/esm2020/lib/data-providers/tableview.data-provider.mjs +17 -0
- package/esm2020/lib/descriptors/action.descriptor.mjs +332 -0
- package/esm2020/lib/descriptors/editor.descriptor.mjs +670 -0
- package/esm2020/lib/descriptors/field.validator.mjs +21 -0
- package/esm2020/lib/descriptors/index.mjs +8 -0
- package/esm2020/lib/descriptors/lookup.descriptor.mjs +2 -0
- package/esm2020/lib/descriptors/model.descriptor.mjs +34 -0
- package/esm2020/lib/descriptors/table.descriptor.mjs +401 -0
- package/esm2020/lib/descriptors/tableview.descriptor.mjs +131 -0
- package/esm2020/lib/directives/component.directive.mjs +23 -0
- package/esm2020/lib/directives/index.mjs +3 -0
- package/esm2020/lib/directives/template.directive.mjs +29 -0
- package/esm2020/lib/mng-commons.module.mjs +410 -0
- package/esm2020/lib/models/index.mjs +3 -0
- package/esm2020/lib/models/router.model.mjs +2 -0
- package/esm2020/lib/models/user.model.mjs +2 -0
- package/esm2020/lib/pipes/boolean.pipe.mjs +22 -0
- package/esm2020/lib/pipes/index.mjs +3 -0
- package/esm2020/lib/pipes/property-path.pipe.mjs +36 -0
- package/esm2020/lib/services/action.service.mjs +269 -0
- package/esm2020/lib/services/commons.service.mjs +354 -0
- package/esm2020/lib/services/configuration.service.mjs +78 -0
- package/esm2020/lib/services/index.mjs +5 -0
- package/esm2020/lib/services/navigation.service.mjs +48 -0
- package/esm2020/lib/services/providers/commons-init.provider.mjs +4 -0
- package/esm2020/lib/services/providers/config-service.provider.mjs +20 -0
- package/esm2020/lib/services/providers/formly-config.provider.mjs +31 -0
- package/esm2020/lib/services/providers/index.mjs +4 -0
- package/esm2020/lib/services/tokens/browser-storage.token.mjs +6 -0
- package/esm2020/lib/services/tokens/index.mjs +3 -0
- package/esm2020/lib/services/tokens/module-config.token.mjs +3 -0
- package/esm2020/lib/types/index.mjs +3 -0
- package/esm2020/lib/types/type.decorator.mjs +7 -0
- package/esm2020/lib/types/type.model.mjs +2 -0
- package/esm2020/lib/utils/editor-formly.util.mjs +176 -0
- package/esm2020/lib/utils/i18n.util.mjs +125 -0
- package/esm2020/lib/utils/index.mjs +6 -0
- package/esm2020/lib/utils/model.util.mjs +57 -0
- package/esm2020/lib/utils/toast.util.mjs +39 -0
- package/esm2020/lib/utils/type.util.mjs +39 -0
- package/esm2020/mediusinc-mng-commons.mjs +5 -0
- package/esm2020/public-api.mjs +36 -0
- package/fesm2015/mediusinc-mng-commons.mjs +6252 -0
- package/fesm2015/mediusinc-mng-commons.mjs.map +1 -0
- package/fesm2020/mediusinc-mng-commons.mjs +6177 -0
- package/fesm2020/mediusinc-mng-commons.mjs.map +1 -0
- package/lib/api/models/builders/query-param.builder.d.ts +11 -0
- package/{src/lib/api/models/query-mode.model.ts → lib/api/models/filter-match-type.model.d.ts} +11 -6
- package/lib/api/models/filter-param.model.d.ts +23 -0
- package/{src/lib/api/models/index.ts → lib/api/models/index.d.ts} +0 -2
- package/lib/api/models/mappers.d.ts +6 -0
- package/lib/api/models/query-mode.model.d.ts +16 -0
- package/lib/api/models/query-param.model.d.ts +31 -0
- package/lib/api/models/query-result.model.d.ts +36 -0
- package/{src/lib/api/models/serialization.model.ts → lib/api/models/serialization.model.d.ts} +0 -1
- package/lib/api/services/crud-api.abstract.service.d.ts +23 -0
- package/{src/lib/api/services/index.ts → lib/api/services/index.d.ts} +0 -0
- package/{src/lib/api/utils/index.ts → lib/api/utils/index.d.ts} +0 -0
- package/lib/api/utils/medius-rest.util.d.ts +12 -0
- package/lib/api/utils/object-serializer.util.d.ts +30 -0
- package/lib/components/action/action.component.d.ts +36 -0
- package/lib/components/action/dialog/action-dialog.component.d.ts +46 -0
- package/{src/lib/components/action/index.ts → lib/components/action/index.d.ts} +0 -0
- package/{src/lib/components/action/models/action-confirmation-service.model.ts → lib/components/action/models/action-confirmation-service.model.d.ts} +2 -3
- package/lib/components/action/models/action-execution.model.d.ts +53 -0
- package/{src/lib/components/action/models/index.ts → lib/components/action/models/index.d.ts} +0 -0
- package/lib/components/action/route/action-route.component.d.ts +32 -0
- package/lib/components/form/autocomplete/autocomplete.component.d.ts +36 -0
- package/lib/components/form/dropdown/dropdown.component.d.ts +34 -0
- package/lib/components/form/editor/form-editor.component.d.ts +39 -0
- package/lib/components/form/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.d.ts +11 -0
- package/lib/components/form/formly/fields/formly-field-dropdown/formly-field-dropdown.component.d.ts +11 -0
- package/lib/components/form/formly/fields/formly-field-fieldset/formly-field-fieldset.component.d.ts +6 -0
- package/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.d.ts +12 -0
- package/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.d.ts +17 -0
- package/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.d.ts +36 -0
- package/lib/components/form/formly/fields/formly-field-tabs/formly-field-tabs.component.d.ts +6 -0
- package/{src/lib/components/form/formly/fields/index.ts → lib/components/form/formly/fields/index.d.ts} +0 -0
- package/lib/components/form/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.d.ts +8 -0
- package/lib/components/form/formly/wrappers/formly-table-wrapper/formly-table-wrapper.component.d.ts +8 -0
- package/{src/lib/components/form/formly/wrappers/index.ts → lib/components/form/formly/wrappers/index.d.ts} +0 -0
- package/{src/lib/components/form/index.ts → lib/components/form/index.d.ts} +0 -0
- package/lib/components/form/models/form-editor.event.d.ts +5 -0
- package/{src/lib/components/form/models/index.ts → lib/components/form/models/index.d.ts} +0 -0
- package/lib/components/layout/breadcrumb.component.d.ts +8 -0
- package/lib/components/layout/footer.component.d.ts +9 -0
- package/{src/lib/components/layout/index.ts → lib/components/layout/index.d.ts} +0 -0
- package/lib/components/layout/main-layout.component.d.ts +21 -0
- package/lib/components/layout/menu-item.component.d.ts +29 -0
- package/lib/components/layout/menu.component.d.ts +10 -0
- package/{src/lib/components/layout/services/index.ts → lib/components/layout/services/index.d.ts} +0 -0
- package/lib/components/layout/services/main-layout.component.service.d.ts +65 -0
- package/lib/components/layout/topbar.component.d.ts +25 -0
- package/{src/lib/components/tableview/index.ts → lib/components/tableview/index.d.ts} +0 -0
- package/{src/lib/components/tableview/models/index.ts → lib/components/tableview/models/index.d.ts} +0 -0
- package/lib/components/tableview/models/table.event.d.ts +17 -0
- package/lib/components/tableview/route/tableview-route.abstract.component.d.ts +14 -0
- package/{src/lib/components/tableview/services/index.ts → lib/components/tableview/services/index.d.ts} +0 -0
- package/lib/components/tableview/services/tableview.component.service.d.ts +13 -0
- package/lib/components/tableview/table/column-filter/column-filter.component.d.ts +22 -0
- package/lib/components/tableview/table/column-value/column-value.component.d.ts +12 -0
- package/lib/components/tableview/table/table.component.d.ts +79 -0
- package/lib/components/tableview/tableview.component.d.ts +35 -0
- package/lib/config/formly.config.d.ts +14 -0
- package/{src/lib/config/index.ts → lib/config/index.d.ts} +0 -0
- package/{src/lib/config/models/index.ts → lib/config/models/index.d.ts} +0 -0
- package/{src/lib/config/models/mng-config.model.ts → lib/config/models/mng-config.model.d.ts} +8 -9
- package/lib/data-providers/base.data-provider.d.ts +17 -0
- package/lib/data-providers/editor.data-provider.d.ts +25 -0
- package/{src/lib/data-providers/index.ts → lib/data-providers/index.d.ts} +0 -0
- package/lib/data-providers/lookup.data-provider.d.ts +14 -0
- package/{src/lib/data-providers/table.data-provider.ts → lib/data-providers/table.data-provider.d.ts} +3 -5
- package/lib/data-providers/tableview.data-provider.d.ts +15 -0
- package/lib/descriptors/action.descriptor.d.ts +148 -0
- package/lib/descriptors/editor.descriptor.d.ts +255 -0
- package/lib/descriptors/field.validator.d.ts +18 -0
- package/{src/lib/descriptors/index.ts → lib/descriptors/index.d.ts} +0 -0
- package/{src/lib/descriptors/lookup.descriptor.ts → lib/descriptors/lookup.descriptor.d.ts} +6 -9
- package/lib/descriptors/model.descriptor.d.ts +15 -0
- package/lib/descriptors/table.descriptor.d.ts +164 -0
- package/lib/descriptors/tableview.descriptor.d.ts +39 -0
- package/lib/directives/component.directive.d.ts +11 -0
- package/{src/lib/directives/index.ts → lib/directives/index.d.ts} +0 -0
- package/lib/directives/template.directive.d.ts +13 -0
- package/lib/mng-commons.module.d.ts +79 -0
- package/{src/lib/models/index.ts → lib/models/index.d.ts} +0 -0
- package/lib/models/router.model.d.ts +14 -0
- package/{src/lib/models/user.model.ts → lib/models/user.model.d.ts} +2 -3
- package/lib/pipes/boolean.pipe.d.ts +7 -0
- package/{src/lib/pipes/index.ts → lib/pipes/index.d.ts} +0 -0
- package/lib/pipes/property-path.pipe.d.ts +7 -0
- package/lib/services/action.service.d.ts +92 -0
- package/lib/services/commons.service.d.ts +72 -0
- package/lib/services/configuration.service.d.ts +35 -0
- package/{src/lib/services/index.ts → lib/services/index.d.ts} +0 -0
- package/lib/services/navigation.service.d.ts +14 -0
- package/lib/services/providers/commons-init.provider.d.ts +2 -0
- package/lib/services/providers/config-service.provider.d.ts +5 -0
- package/lib/services/providers/formly-config.provider.d.ts +4 -0
- package/{src/lib/services/providers/index.ts → lib/services/providers/index.d.ts} +0 -0
- package/lib/services/tokens/browser-storage.token.d.ts +2 -0
- package/{src/lib/services/tokens/index.ts → lib/services/tokens/index.d.ts} +0 -0
- package/lib/services/tokens/module-config.token.d.ts +3 -0
- package/{src/lib/types/index.ts → lib/types/index.d.ts} +0 -0
- package/lib/types/type.decorator.d.ts +2 -0
- package/lib/types/type.model.d.ts +10 -0
- package/lib/utils/editor-formly.util.d.ts +9 -0
- package/lib/utils/i18n.util.d.ts +18 -0
- package/{src/lib/utils/index.ts → lib/utils/index.d.ts} +0 -0
- package/lib/utils/model.util.d.ts +7 -0
- package/lib/utils/toast.util.d.ts +13 -0
- package/lib/utils/type.util.d.ts +15 -0
- package/mediusinc-mng-commons.d.ts +5 -0
- package/package.json +27 -6
- package/{src/public-api.ts → public-api.d.ts} +0 -17
- package/.browserslistrc +0 -16
- package/karma.conf.js +0 -51
- package/ng-package.json +0 -14
- package/src/lib/api/models/builders/query-param.builder.ts +0 -54
- package/src/lib/api/models/filter-match-type.model.ts +0 -25
- package/src/lib/api/models/filter-param.model.ts +0 -59
- package/src/lib/api/models/mappers.ts +0 -18
- package/src/lib/api/models/query-param.model.ts +0 -99
- package/src/lib/api/models/query-result.model.ts +0 -77
- package/src/lib/api/services/crud-api.abstract.service.ts +0 -113
- package/src/lib/api/utils/medius-rest.util.ts +0 -146
- package/src/lib/api/utils/object-serializer.util.ts +0 -227
- package/src/lib/components/action/action.component.html +0 -30
- package/src/lib/components/action/action.component.ts +0 -77
- package/src/lib/components/action/dialog/action-dialog.component.html +0 -26
- package/src/lib/components/action/dialog/action-dialog.component.ts +0 -171
- package/src/lib/components/action/models/action-execution.model.ts +0 -81
- package/src/lib/components/action/route/action-route.component.html +0 -1
- package/src/lib/components/action/route/action-route.component.ts +0 -159
- package/src/lib/components/form/autocomplete/autocomplete.component.html +0 -16
- package/src/lib/components/form/autocomplete/autocomplete.component.ts +0 -113
- package/src/lib/components/form/dropdown/dropdown.component.html +0 -29
- package/src/lib/components/form/dropdown/dropdown.component.ts +0 -109
- package/src/lib/components/form/editor/form-editor.component.html +0 -5
- package/src/lib/components/form/editor/form-editor.component.ts +0 -149
- package/src/lib/components/form/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.html +0 -7
- package/src/lib/components/form/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.ts +0 -21
- package/src/lib/components/form/formly/fields/formly-field-dropdown/formly-field-dropdown.component.html +0 -9
- package/src/lib/components/form/formly/fields/formly-field-dropdown/formly-field-dropdown.component.ts +0 -22
- package/src/lib/components/form/formly/fields/formly-field-fieldset/formly-field-fieldset.component.html +0 -8
- package/src/lib/components/form/formly/fields/formly-field-fieldset/formly-field-fieldset.component.ts +0 -10
- package/src/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.html +0 -56
- package/src/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.ts +0 -22
- package/src/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.html +0 -13
- package/src/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.scss +0 -4
- package/src/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.ts +0 -114
- package/src/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.html +0 -37
- package/src/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.ts +0 -133
- package/src/lib/components/form/formly/fields/formly-field-tabs/formly-field-tabs.component.html +0 -10
- package/src/lib/components/form/formly/fields/formly-field-tabs/formly-field-tabs.component.ts +0 -10
- package/src/lib/components/form/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.html +0 -7
- package/src/lib/components/form/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.ts +0 -13
- package/src/lib/components/form/formly/wrappers/formly-table-wrapper/formly-table-wrapper.component.html +0 -6
- package/src/lib/components/form/formly/wrappers/formly-table-wrapper/formly-table-wrapper.component.ts +0 -13
- package/src/lib/components/form/models/form-editor.event.ts +0 -7
- package/src/lib/components/layout/breadcrumb.component.html +0 -5
- package/src/lib/components/layout/breadcrumb.component.ts +0 -12
- package/src/lib/components/layout/footer.component.html +0 -7
- package/src/lib/components/layout/footer.component.ts +0 -15
- package/src/lib/components/layout/main-layout.component.html +0 -26
- package/src/lib/components/layout/main-layout.component.ts +0 -54
- package/src/lib/components/layout/menu-item.component.html +0 -41
- package/src/lib/components/layout/menu-item.component.ts +0 -170
- package/src/lib/components/layout/menu.component.html +0 -27
- package/src/lib/components/layout/menu.component.ts +0 -17
- package/src/lib/components/layout/services/main-layout.component.service.ts +0 -231
- package/src/lib/components/layout/topbar.component.html +0 -38
- package/src/lib/components/layout/topbar.component.ts +0 -62
- package/src/lib/components/tableview/models/table.event.ts +0 -22
- package/src/lib/components/tableview/route/tableview-route.abstract.component.ts +0 -31
- package/src/lib/components/tableview/services/tableview.component.service.ts +0 -22
- package/src/lib/components/tableview/table/column-filter/column-filter.component.html +0 -36
- package/src/lib/components/tableview/table/column-filter/column-filter.component.ts +0 -70
- package/src/lib/components/tableview/table/column-value/column-value.component.html +0 -14
- package/src/lib/components/tableview/table/column-value/column-value.component.ts +0 -19
- package/src/lib/components/tableview/table/table.component.html +0 -110
- package/src/lib/components/tableview/table/table.component.ts +0 -327
- package/src/lib/components/tableview/tableview.component.html +0 -37
- package/src/lib/components/tableview/tableview.component.ts +0 -78
- package/src/lib/config/formly.config.ts +0 -154
- package/src/lib/data-providers/base.data-provider.ts +0 -42
- package/src/lib/data-providers/editor.data-provider.ts +0 -60
- package/src/lib/data-providers/lookup.data-provider.ts +0 -29
- package/src/lib/data-providers/tableview.data-provider.ts +0 -29
- package/src/lib/descriptors/action.descriptor.ts +0 -439
- package/src/lib/descriptors/editor.descriptor.ts +0 -880
- package/src/lib/descriptors/field.validator.ts +0 -35
- package/src/lib/descriptors/model.descriptor.ts +0 -47
- package/src/lib/descriptors/table.descriptor.ts +0 -514
- package/src/lib/descriptors/tableview.descriptor.ts +0 -180
- package/src/lib/directives/component.directive.ts +0 -18
- package/src/lib/directives/template.directive.ts +0 -24
- package/src/lib/mng-commons.module.ts +0 -240
- package/src/lib/models/router.model.ts +0 -16
- package/src/lib/pipes/boolean.pipe.ts +0 -17
- package/src/lib/pipes/property-path.pipe.ts +0 -30
- package/src/lib/services/action.service.ts +0 -310
- package/src/lib/services/commons.service.ts +0 -407
- package/src/lib/services/configuration.service.ts +0 -98
- package/src/lib/services/navigation.service.ts +0 -42
- package/src/lib/services/providers/commons-init.provider.ts +0 -5
- package/src/lib/services/providers/config-service.provider.ts +0 -22
- package/src/lib/services/providers/formly-config.provider.ts +0 -39
- package/src/lib/services/tokens/browser-storage.token.ts +0 -9
- package/src/lib/services/tokens/module-config.token.ts +0 -5
- package/src/lib/types/type.decorator.ts +0 -7
- package/src/lib/types/type.model.ts +0 -12
- package/src/lib/utils/editor-formly.util.ts +0 -193
- package/src/lib/utils/i18n.util.ts +0 -148
- package/src/lib/utils/model.util.ts +0 -66
- package/src/lib/utils/toast.util.ts +0 -49
- package/src/lib/utils/type.util.ts +0 -44
- package/src/test.ts +0 -26
- package/tsconfig.lib.json +0 -15
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -17
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import {ChangeDetectionStrategy, Component, OnDestroy, OnInit} from '@angular/core';
|
|
2
|
-
import {ActivatedRoute, Params, Router} from '@angular/router';
|
|
3
|
-
|
|
4
|
-
import {ConfirmationService, MessageService} from 'primeng/api';
|
|
5
|
-
import {DynamicDialogRef} from 'primeng/dynamicdialog';
|
|
6
|
-
import {Subscription} from 'rxjs';
|
|
7
|
-
import {first} from 'rxjs/operators';
|
|
8
|
-
|
|
9
|
-
import {ActionDescriptor, ActionActivationTriggerEnum} from '../../../descriptors';
|
|
10
|
-
import {IActionConfirmationService, ActionData, ActionRunResult} from '../models';
|
|
11
|
-
import {MngActionService, MngNavigationService} from '../../../services';
|
|
12
|
-
import {TableviewComponentService} from '../../tableview/services';
|
|
13
|
-
|
|
14
|
-
@Component({
|
|
15
|
-
selector: 'mng-action-route',
|
|
16
|
-
templateUrl: './action-route.component.html',
|
|
17
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
18
|
-
providers: [MessageService, ConfirmationService]
|
|
19
|
-
})
|
|
20
|
-
export class MngActionRouteComponent<T, S> implements OnInit, OnDestroy, IActionConfirmationService {
|
|
21
|
-
|
|
22
|
-
private actions: Array<ActionDescriptor<T>> = [];
|
|
23
|
-
private activeAction?: ActionDescriptor<T>;
|
|
24
|
-
|
|
25
|
-
private dialogRef?: DynamicDialogRef;
|
|
26
|
-
private dialogCloseSubscription?: Subscription;
|
|
27
|
-
|
|
28
|
-
private subscriptions: Array<Subscription> = [];
|
|
29
|
-
|
|
30
|
-
public cmpId: string = Math.random().toString(36).substring(2);
|
|
31
|
-
|
|
32
|
-
constructor(
|
|
33
|
-
private router: Router,
|
|
34
|
-
private route: ActivatedRoute,
|
|
35
|
-
private confirmationService: ConfirmationService,
|
|
36
|
-
private navigationService: MngNavigationService,
|
|
37
|
-
private actionService: MngActionService,
|
|
38
|
-
private tableviewService: TableviewComponentService<T, S>
|
|
39
|
-
) {}
|
|
40
|
-
|
|
41
|
-
public ngOnInit() {
|
|
42
|
-
|
|
43
|
-
this.actions = this.tableviewService?.actions.filter(a => a.activationTrigger === ActionActivationTriggerEnum.OnRoute) ?? [];
|
|
44
|
-
const subscription = this.route.params.subscribe(p => {
|
|
45
|
-
const action = this.findActiveAction(p);
|
|
46
|
-
if (action) {
|
|
47
|
-
this.activateAction(action, p, this.route.snapshot.queryParams);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
this.subscriptions.push(subscription);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
public ngOnDestroy() {
|
|
54
|
-
this.subscriptions.forEach(s => s.unsubscribe());
|
|
55
|
-
if (this.dialogRef) {
|
|
56
|
-
this.dialogRef.close();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
public getConfirmationService() {
|
|
61
|
-
return this.confirmationService;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
public getConfirmationServiceInstanceKey(action: ActionDescriptor<any>) {
|
|
65
|
-
return `actionRoute_${this.cmpId}`;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
private activateAction(action: ActionDescriptor<T>, p: Params, qp: Params) {
|
|
69
|
-
this.activeAction = action;
|
|
70
|
-
const itemId = p['itemId'];
|
|
71
|
-
const actionData: ActionData = {};
|
|
72
|
-
for (let key in p) {
|
|
73
|
-
if (key === 'itemId') {
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
actionData[key] = p[key];
|
|
77
|
-
}
|
|
78
|
-
for (let key in qp) {
|
|
79
|
-
actionData[key] = p[key];
|
|
80
|
-
}
|
|
81
|
-
this.actionService.activateAction(action, itemId, undefined, actionData, this.tableviewService, this)
|
|
82
|
-
.pipe(first())
|
|
83
|
-
.subscribe(res => {
|
|
84
|
-
if (res.dialogRef) {
|
|
85
|
-
this.dialogRef = res.dialogRef;
|
|
86
|
-
this.dialogCloseSubscription = this.dialogRef?.onClose.subscribe(e => {
|
|
87
|
-
const actionEv = e as ActionRunResult<T, S, any>;
|
|
88
|
-
if (!actionEv?.error || !actionEv?.error?.dismissed) {
|
|
89
|
-
this.tableviewService.reloadTable(); // reload only if no error in action and
|
|
90
|
-
}
|
|
91
|
-
this.deactivateAction();
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
private deactivateAction() {
|
|
98
|
-
if (this.dialogCloseSubscription) {
|
|
99
|
-
this.dialogCloseSubscription.unsubscribe();
|
|
100
|
-
this.dialogCloseSubscription = undefined;
|
|
101
|
-
}
|
|
102
|
-
if (this.navigationService.getPreviousLocation()) {
|
|
103
|
-
// there are internal history records, so back can be normally called
|
|
104
|
-
this.navigationService.back();
|
|
105
|
-
} else {
|
|
106
|
-
// there is no internal history records, figure out the base url by eliminating action specific url
|
|
107
|
-
let url = this.navigationService.getCurrentLocation();
|
|
108
|
-
if (!url) {
|
|
109
|
-
this.navigationService.back();
|
|
110
|
-
} else {
|
|
111
|
-
if (url.startsWith('/')) {
|
|
112
|
-
url = url.substring(1);
|
|
113
|
-
}
|
|
114
|
-
const urlPathSegments = url.split('?')[0].split('#')[0].split('/');
|
|
115
|
-
let actionUrl = this.activeAction?.routeUrl ?? '';
|
|
116
|
-
if (actionUrl.startsWith('/')) {
|
|
117
|
-
actionUrl = actionUrl.substring(1);
|
|
118
|
-
}
|
|
119
|
-
const actionUrlSegments = actionUrl.split('/');
|
|
120
|
-
const redirectUrl = urlPathSegments.slice(0, urlPathSegments.length - actionUrlSegments.length).join('/');
|
|
121
|
-
this.router.navigateByUrl(`/${redirectUrl}`, { replaceUrl: true });
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
this.activeAction = undefined;
|
|
125
|
-
this.dialogRef = undefined;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
private findActiveAction(params: Params): ActionDescriptor<T>|null {
|
|
129
|
-
const urlSegments = this.route.snapshot.url;
|
|
130
|
-
for (const action of this.actions) {
|
|
131
|
-
let actionUrl = action.routeUrl ?? '';
|
|
132
|
-
// TODO: dont strip '/', but use it accordingly with Angular's router patterns (/, ./, ../)
|
|
133
|
-
if (actionUrl.startsWith('/')) {
|
|
134
|
-
actionUrl = actionUrl.substring(1);
|
|
135
|
-
}
|
|
136
|
-
const actionUrlSegments = actionUrl.split('/');
|
|
137
|
-
if (actionUrlSegments.length !== urlSegments.length) {
|
|
138
|
-
continue;
|
|
139
|
-
}
|
|
140
|
-
let isMatch = true;
|
|
141
|
-
for (let i = 0; i < actionUrlSegments.length; i++) {
|
|
142
|
-
if (actionUrlSegments[i].startsWith(':')) {
|
|
143
|
-
const paramName = actionUrlSegments[i].substring(1);
|
|
144
|
-
if (!params[paramName]) {
|
|
145
|
-
isMatch = false;
|
|
146
|
-
break;
|
|
147
|
-
}
|
|
148
|
-
} else if (actionUrlSegments[i] !== urlSegments[i].path) {
|
|
149
|
-
isMatch = false;
|
|
150
|
-
break;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
if (isMatch) {
|
|
154
|
-
return action;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
return null;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<p-autoComplete [formControl]="autocompleteFormControl"
|
|
2
|
-
[placeholder]="$any(placeholder)"
|
|
3
|
-
[dropdown]="true"
|
|
4
|
-
[dataKey]="$any(dataKeyProperty)"
|
|
5
|
-
[field]="$any(itemsLabelProperty)"
|
|
6
|
-
[suggestions]="(suggestions$ | async) ?? []"
|
|
7
|
-
[multiple]="multiselect"
|
|
8
|
-
[showEmptyMessage]="true"
|
|
9
|
-
[emptyMessage]="'mngAutcomplete.noMatches' | translate"
|
|
10
|
-
[styleClass]="$any(className)"
|
|
11
|
-
[panelStyleClass]="$any(dropdownClassName)"
|
|
12
|
-
(completeMethod)="onSearch($event)"
|
|
13
|
-
(onSelect)="onSelect($event)"
|
|
14
|
-
appendTo="body"
|
|
15
|
-
dropdownMode="current">
|
|
16
|
-
</p-autoComplete>
|
|
@@ -1,113 +0,0 @@
|
|
|
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, Subject, Subscription} from 'rxjs';
|
|
5
|
-
import {finalize, first} from 'rxjs/operators';
|
|
6
|
-
import {AutoComplete} from 'primeng/autocomplete';
|
|
7
|
-
|
|
8
|
-
import {MediusFilterMatchType, MediusQueryParamBuilder} from '../../../api/models';
|
|
9
|
-
import {ILookupDataProvider} from '../../../data-providers';
|
|
10
|
-
|
|
11
|
-
export const MNG_AUTOCOMPLETE_VALUE_ACCESSOR: ExistingProvider = {
|
|
12
|
-
provide: NG_VALUE_ACCESSOR,
|
|
13
|
-
useExisting: forwardRef(() => MngAutocompleteComponent),
|
|
14
|
-
multi: true
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
@Component({
|
|
18
|
-
selector: 'mng-autocomplete',
|
|
19
|
-
templateUrl: './autocomplete.component.html',
|
|
20
|
-
providers: [MNG_AUTOCOMPLETE_VALUE_ACCESSOR],
|
|
21
|
-
changeDetection: ChangeDetectionStrategy.OnPush
|
|
22
|
-
})
|
|
23
|
-
export class MngAutocompleteComponent implements OnInit, ControlValueAccessor {
|
|
24
|
-
|
|
25
|
-
@Input() dataProvider?: ILookupDataProvider<any, any>;
|
|
26
|
-
@Input() dataKeyProperty?: string;
|
|
27
|
-
@Input() itemsLabelProperty?: string;
|
|
28
|
-
@Input() multiselect: boolean = false;
|
|
29
|
-
@Input() placeholder?: string;
|
|
30
|
-
@Input() className: string|null = null;
|
|
31
|
-
@Input() dropdownClassName: string|null = null;
|
|
32
|
-
|
|
33
|
-
@Output() onChange = new EventEmitter();
|
|
34
|
-
|
|
35
|
-
@ViewChild(AutoComplete) private primeAutocomplete?: AutoComplete;
|
|
36
|
-
|
|
37
|
-
private suggestionsSubject: Subject<Array<any>> = new Subject<Array<any>>();
|
|
38
|
-
private searchSubscription: Subscription|null = null;
|
|
39
|
-
private dataProviderService: any = null;
|
|
40
|
-
private onChangeFn: any = () => { };
|
|
41
|
-
private onTouchedFn: any = () => { };
|
|
42
|
-
|
|
43
|
-
public autocompleteFormControl: FormControl = new FormControl();
|
|
44
|
-
public suggestions$: Observable<Array<any>> = this.suggestionsSubject.asObservable();
|
|
45
|
-
public isLoading = false;
|
|
46
|
-
|
|
47
|
-
constructor(private injector: Injector) {
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
ngOnInit() {
|
|
51
|
-
if (this.dataProvider) {
|
|
52
|
-
this.dataProviderService = this.dataProvider.serviceType
|
|
53
|
-
? this.injector.get<any>(this.dataProvider.serviceType)
|
|
54
|
-
: null;
|
|
55
|
-
} else {
|
|
56
|
-
console.warn(`Data provider should be provided for MngAutocompleteComponent.`);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
onSearch(event: any) {
|
|
61
|
-
if (this.searchSubscription) {
|
|
62
|
-
// try to cancel existing HTTP request subscription
|
|
63
|
-
this.searchSubscription.unsubscribe();
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (this.dataProvider) {
|
|
67
|
-
this.isLoading = true;
|
|
68
|
-
const queryParamBuilder = MediusQueryParamBuilder.create();
|
|
69
|
-
if (this.itemsLabelProperty) {
|
|
70
|
-
queryParamBuilder.withSort(this.itemsLabelProperty);
|
|
71
|
-
}
|
|
72
|
-
if (event.query && event.query.length > 0 && this.itemsLabelProperty) {
|
|
73
|
-
queryParamBuilder.withFilter(this.itemsLabelProperty, event.query, undefined, MediusFilterMatchType.StartsWith)
|
|
74
|
-
}
|
|
75
|
-
this.searchSubscription = this.dataProvider.lookup(queryParamBuilder.build(), this.dataProviderService, event.query)
|
|
76
|
-
.pipe(
|
|
77
|
-
first(),
|
|
78
|
-
finalize(() => this.isLoading = false)
|
|
79
|
-
)
|
|
80
|
-
.subscribe((res: any) => {
|
|
81
|
-
this.suggestionsSubject.next(res);
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
onSelect(value: any) {
|
|
87
|
-
this.onChangeFn(value);
|
|
88
|
-
this.onChange.next(value);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
registerOnChange(fn: any): void {
|
|
92
|
-
this.onChangeFn = fn;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
registerOnTouched(fn: any): void {
|
|
96
|
-
this.onTouchedFn = fn;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
setDisabledState(isDisabled: boolean): void {
|
|
100
|
-
if (isDisabled) {
|
|
101
|
-
this.autocompleteFormControl.disable();
|
|
102
|
-
} else {
|
|
103
|
-
this.autocompleteFormControl.enable();
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
writeValue(obj: any): void {
|
|
108
|
-
this.autocompleteFormControl.setValue(obj, { emitEvent: false });
|
|
109
|
-
if (this.primeAutocomplete) {
|
|
110
|
-
this.primeAutocomplete.writeValue(obj);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
<p-dropdown *ngIf="!multiselect; else pMultiselect"
|
|
2
|
-
[formControl]="dropdownFormControl"
|
|
3
|
-
[placeholder]="$any(placeholder)"
|
|
4
|
-
[dataKey]="$any(dataKeyProperty)"
|
|
5
|
-
[optionLabel]="$any(itemsLabelProperty)"
|
|
6
|
-
[optionValue]="$any(itemsValueProperty)"
|
|
7
|
-
[options]="(items$ | async) ?? []"
|
|
8
|
-
[showClear]="showClear"
|
|
9
|
-
[autoDisplayFirst]="false"
|
|
10
|
-
[styleClass]="$any(className)"
|
|
11
|
-
[panelStyleClass]="$any(dropdownClassName)"
|
|
12
|
-
(onChange)="onChange.emit($event.value)"
|
|
13
|
-
appendTo="body">
|
|
14
|
-
</p-dropdown>
|
|
15
|
-
<ng-template #pMultiselect>
|
|
16
|
-
<p-multiSelect display="chip"
|
|
17
|
-
[formControl]="dropdownFormControl"
|
|
18
|
-
[defaultLabel]="$any(placeholder)"
|
|
19
|
-
[dataKey]="$any(dataKeyProperty)"
|
|
20
|
-
[optionLabel]="$any(itemsLabelProperty)"
|
|
21
|
-
[optionValue]="$any(itemsValueProperty)"
|
|
22
|
-
[options]="(items$ | async) ?? []"
|
|
23
|
-
[styleClass]="$any(className)"
|
|
24
|
-
[panelStyleClass]="$any(dropdownClassName)"
|
|
25
|
-
[filter]="false"
|
|
26
|
-
(onChange)="onChange.emit($event.value)"
|
|
27
|
-
appendTo="body">
|
|
28
|
-
</p-multiSelect>
|
|
29
|
-
</ng-template>
|
|
@@ -1,109 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
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>
|
|
@@ -1,149 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
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>
|
|
@@ -1,21 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
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>
|
|
@@ -1,22 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
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>
|
|
@@ -1,10 +0,0 @@
|
|
|
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
|
-
}
|