@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,193 +0,0 @@
|
|
|
1
|
-
import {FormlyFieldConfig} from '@ngx-formly/core';
|
|
2
|
-
|
|
3
|
-
import {FieldLookupDescriptor,
|
|
4
|
-
EditorDescriptor,
|
|
5
|
-
FieldLookupEnumDescriptor,
|
|
6
|
-
AFieldDescriptor,
|
|
7
|
-
FieldTabGroupDescriptor,
|
|
8
|
-
FieldManyEditorDescriptor,
|
|
9
|
-
FieldManyToManyEditorDescriptor,
|
|
10
|
-
FieldInputDescriptor,
|
|
11
|
-
FieldGroupDescriptor
|
|
12
|
-
} from '../descriptors';
|
|
13
|
-
|
|
14
|
-
export class EditorFormlyUtil {
|
|
15
|
-
public static createFormlyConfigFromDescriptor(descriptor: EditorDescriptor<any>): FormlyFieldConfig[] {
|
|
16
|
-
const fields: FormlyFieldConfig[] = [];
|
|
17
|
-
|
|
18
|
-
if (descriptor.tabs.length === 1 && descriptor.tabs[0].default) {
|
|
19
|
-
// dont use tabs
|
|
20
|
-
fields.push(...EditorFormlyUtil.createFormlyGroupType(descriptor.tabs[0].fields));
|
|
21
|
-
} else {
|
|
22
|
-
fields.push(...EditorFormlyUtil.createFormlyTabType(descriptor.tabs));
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return fields;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
public static createFormlyTabType(tabGroups: FieldTabGroupDescriptor<any>[]): FormlyFieldConfig[] {
|
|
29
|
-
const tabsField: FormlyFieldConfig = {
|
|
30
|
-
type: 'tabs',
|
|
31
|
-
fieldGroup: []
|
|
32
|
-
};
|
|
33
|
-
for (const tab of tabGroups) {
|
|
34
|
-
const tabField: FormlyFieldConfig = {
|
|
35
|
-
id: tab.name,
|
|
36
|
-
templateOptions: {},
|
|
37
|
-
fieldGroup: []
|
|
38
|
-
};
|
|
39
|
-
if (tab.title) {
|
|
40
|
-
// @ts-ignore
|
|
41
|
-
tabField.templateOptions.label = tab.title;
|
|
42
|
-
}
|
|
43
|
-
// @ts-ignore
|
|
44
|
-
tabField.fieldGroup.push(...EditorFormlyUtil.createFormlyGroupType(tab.fields));
|
|
45
|
-
// @ts-ignore
|
|
46
|
-
tabsField.fieldGroup.push(tabField);
|
|
47
|
-
}
|
|
48
|
-
return [tabsField];
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
public static createFormlyGroupType(groups: FieldGroupDescriptor<any>[]): FormlyFieldConfig[] {
|
|
52
|
-
if (groups.length === 1 && groups[0].default) {
|
|
53
|
-
// dont use fieldset, just create fields
|
|
54
|
-
return EditorFormlyUtil.createFormlyFields(groups[0]);
|
|
55
|
-
} else {
|
|
56
|
-
const groupsField: FormlyFieldConfig = {
|
|
57
|
-
type: 'fieldset',
|
|
58
|
-
fieldGroup: []
|
|
59
|
-
};
|
|
60
|
-
for (const group of groups) {
|
|
61
|
-
const groupField: FormlyFieldConfig = {
|
|
62
|
-
id: group.name,
|
|
63
|
-
templateOptions: {
|
|
64
|
-
descriptor: group
|
|
65
|
-
},
|
|
66
|
-
fieldGroup: []
|
|
67
|
-
};
|
|
68
|
-
if (group.title) {
|
|
69
|
-
// @ts-ignore
|
|
70
|
-
groupField.templateOptions.label = group.title;
|
|
71
|
-
}
|
|
72
|
-
// @ts-ignore
|
|
73
|
-
groupField.fieldGroup.push(...EditorFormlyUtil.createFormlyFields(group));
|
|
74
|
-
// @ts-ignore
|
|
75
|
-
groupsField.fieldGroup.push(groupField);
|
|
76
|
-
}
|
|
77
|
-
return [groupsField];
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
public static createFormlyFields(descriptor: FieldGroupDescriptor<any>): FormlyFieldConfig[] {
|
|
82
|
-
const fields: FormlyFieldConfig[] = [];
|
|
83
|
-
for (const descriptorField of descriptor.fields) {
|
|
84
|
-
fields.push(EditorFormlyUtil.createFormlyField(descriptorField));
|
|
85
|
-
}
|
|
86
|
-
// wrap in group to be able to use flex grid
|
|
87
|
-
const wrapperGroup = {
|
|
88
|
-
fieldGroupClassName: 'p-fluid formgrid grid',
|
|
89
|
-
fieldGroup: fields,
|
|
90
|
-
validators: {}
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
for (const validator of descriptor.validators) {
|
|
94
|
-
// @ts-ignore
|
|
95
|
-
wrapperGroup.validators[validator.name] = {expression: validator.expression, message: validator.message};
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
return [wrapperGroup];
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
public static createFormlyField(descriptor: AFieldDescriptor<any, any>): FormlyFieldConfig {
|
|
102
|
-
const field: FormlyFieldConfig = {
|
|
103
|
-
key: descriptor.property,
|
|
104
|
-
expressionProperties: {},
|
|
105
|
-
templateOptions: {},
|
|
106
|
-
validators: {}
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
let className = descriptor.className;
|
|
110
|
-
if (!className) {
|
|
111
|
-
// assign default field width through entire row
|
|
112
|
-
className = 'col-12';
|
|
113
|
-
}
|
|
114
|
-
if (className.indexOf('col-') < 0) {
|
|
115
|
-
// class was provided, but does not contain col- definition
|
|
116
|
-
className = `col-12 ${descriptor.className}`;
|
|
117
|
-
}
|
|
118
|
-
field.className = className;
|
|
119
|
-
|
|
120
|
-
// @ts-ignore
|
|
121
|
-
field.templateOptions.descriptor = descriptor;
|
|
122
|
-
if (descriptor instanceof FieldInputDescriptor) {
|
|
123
|
-
switch (descriptor.fieldType) {
|
|
124
|
-
case FieldInputDescriptor.TypeEnum.Textarea:
|
|
125
|
-
field.type = 'textarea';
|
|
126
|
-
break;
|
|
127
|
-
case FieldInputDescriptor.TypeEnum.Number:
|
|
128
|
-
field.type = 'number';
|
|
129
|
-
// @ts-ignore
|
|
130
|
-
field.templateOptions.min = descriptor.numberMin;
|
|
131
|
-
// @ts-ignore
|
|
132
|
-
field.templateOptions.max = descriptor.numberMax;
|
|
133
|
-
break;
|
|
134
|
-
case FieldInputDescriptor.TypeEnum.Switch:
|
|
135
|
-
field.type = 'switch';
|
|
136
|
-
break;
|
|
137
|
-
case FieldInputDescriptor.TypeEnum.Radio:
|
|
138
|
-
field.type = 'radio';
|
|
139
|
-
break;
|
|
140
|
-
case FieldInputDescriptor.TypeEnum.Datepicker:
|
|
141
|
-
field.type = 'datepicker';
|
|
142
|
-
break;
|
|
143
|
-
default:
|
|
144
|
-
field.type = 'input';
|
|
145
|
-
// @ts-ignore
|
|
146
|
-
field.templateOptions.minLength = descriptor.minLength;
|
|
147
|
-
// @ts-ignore
|
|
148
|
-
field.templateOptions.maxLength = descriptor.maxLength;
|
|
149
|
-
// @ts-ignore
|
|
150
|
-
field.templateOptions.pattern = descriptor.pattern;
|
|
151
|
-
break;
|
|
152
|
-
}
|
|
153
|
-
} else if (descriptor instanceof FieldLookupEnumDescriptor) {
|
|
154
|
-
field.type = 'enum';
|
|
155
|
-
} else if (descriptor instanceof FieldLookupDescriptor) {
|
|
156
|
-
switch (descriptor.lookupType) {
|
|
157
|
-
case FieldLookupDescriptor.LookupTypeEnum.Autocomplete:
|
|
158
|
-
field.type = 'autocomplete';
|
|
159
|
-
break;
|
|
160
|
-
case FieldLookupDescriptor.LookupTypeEnum.Dropdown:
|
|
161
|
-
default:
|
|
162
|
-
field.type = 'dropdown';
|
|
163
|
-
break;
|
|
164
|
-
}
|
|
165
|
-
} else if (descriptor instanceof FieldManyToManyEditorDescriptor) {
|
|
166
|
-
field.type = 'table-dialog-multiselect';
|
|
167
|
-
} else if (descriptor instanceof FieldManyEditorDescriptor) {
|
|
168
|
-
field.type = 'table-dialog-form';
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
if (descriptor.label) {
|
|
172
|
-
// @ts-ignore
|
|
173
|
-
field.templateOptions.label = descriptor.label;
|
|
174
|
-
}
|
|
175
|
-
if (descriptor.required) {
|
|
176
|
-
// @ts-ignore
|
|
177
|
-
field.templateOptions.required = true;
|
|
178
|
-
}
|
|
179
|
-
if (descriptor.disabled) {
|
|
180
|
-
// @ts-ignore
|
|
181
|
-
field.templateOptions.disabled = true;
|
|
182
|
-
} else {
|
|
183
|
-
// @ts-ignore
|
|
184
|
-
field.expressionProperties['templateOptions.disabled'] = 'formState.disabled';
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
for (const validator of descriptor.validators) {
|
|
188
|
-
field.validators[validator.name] = {expression: validator.expression, message: validator.message};
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
return field;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import {TranslateService} from '@ngx-translate/core';
|
|
2
|
-
import {Observable} from 'rxjs';
|
|
3
|
-
import {first, map, mergeMap} from 'rxjs/operators';
|
|
4
|
-
|
|
5
|
-
import {ActionDescriptor, ModelDescriptor} from '../descriptors';
|
|
6
|
-
|
|
7
|
-
export class I18nUtil {
|
|
8
|
-
|
|
9
|
-
public static instantModelTranslation(translate: TranslateService, model: ModelDescriptor<any>, keyPath: string, customKey?: string, item?: any,
|
|
10
|
-
fallbackKey?: string, i18nParams?: any): string|null {
|
|
11
|
-
const keys = I18nUtil.getModelKeysByPriority(model, keyPath, customKey, fallbackKey);
|
|
12
|
-
const i18nModelName = I18nUtil.instantModelName(translate, model, true);
|
|
13
|
-
const i18n = translate.instant(keys, I18nUtil.getModelI18nParams(model, item, i18nModelName ?? undefined, i18nParams));
|
|
14
|
-
return I18nUtil.selectKeyByPriority(keys, i18n);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
public static instantActionTranslation(translate: TranslateService, action: ActionDescriptor<any>, keyPath: string, customKey?: string, item?: any,
|
|
18
|
-
fallbackKey?: string, functionNameKey?: string, i18nParams?: any): string|null {
|
|
19
|
-
const keys = I18nUtil.getActionKeysByPriority(action, keyPath, customKey, fallbackKey);
|
|
20
|
-
const i18nModelName = I18nUtil.instantModelName(translate, action?.model, true);
|
|
21
|
-
const i18nFunctionTitle = I18nUtil.getFunctionTitle(translate, functionNameKey);
|
|
22
|
-
const i18n = translate.instant(keys, I18nUtil.getActionI18nParams(action, item, i18nModelName ?? undefined, i18nParams, i18nFunctionTitle));
|
|
23
|
-
return I18nUtil.selectKeyByPriority(keys, i18n);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public static streamActionTranslation(translate: TranslateService, action: ActionDescriptor<any>, keyPath: string, customKey?: string, item?: any, fallbackKey?: string): Observable<string|null> {
|
|
27
|
-
return I18nUtil.getActionTranslation(translate, action, keyPath, customKey, item, fallbackKey, false);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
public static getActionTranslation(translate: TranslateService, action: ActionDescriptor<any>, keyPath: string, customKey?: string, item?: any, fallbackKey?: string, oneTime: boolean = true): Observable<string|null> {
|
|
31
|
-
const keys = I18nUtil.getActionKeysByPriority(action, keyPath, customKey, fallbackKey);
|
|
32
|
-
return I18nUtil.getModelName(translate, action?.model, oneTime, true).pipe(
|
|
33
|
-
mergeMap(i18nModelName => translate.get(keys, I18nUtil.getActionI18nParams(action, item, i18nModelName ?? undefined))),
|
|
34
|
-
map(i18n => I18nUtil.selectKeyByPriority(keys, i18n))
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
private static getModelKeysByPriority(model: ModelDescriptor<any>, keyPath: string, customKey?: string, fallbackKey?: string) {
|
|
39
|
-
const keys = [];
|
|
40
|
-
if (customKey) {
|
|
41
|
-
keys.push(customKey);
|
|
42
|
-
}
|
|
43
|
-
const modelActionKey = `${model.typeName}.${keyPath}`;
|
|
44
|
-
keys.push(modelActionKey);
|
|
45
|
-
if (fallbackKey) {
|
|
46
|
-
keys.push(fallbackKey);
|
|
47
|
-
}
|
|
48
|
-
return keys;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
private static getActionKeysByPriority(action: ActionDescriptor<any>, keyPath: string, customKey?: string, fallbackKey?: string) {
|
|
52
|
-
const keys = [];
|
|
53
|
-
if (customKey) {
|
|
54
|
-
keys.push(customKey);
|
|
55
|
-
}
|
|
56
|
-
const modelActionKey = `${action.i18nModelActionBaseKey}.${keyPath}`;
|
|
57
|
-
const actionKey = `${action.actionName}.${keyPath}`;
|
|
58
|
-
keys.push(modelActionKey, actionKey);
|
|
59
|
-
if (fallbackKey) {
|
|
60
|
-
keys.push(fallbackKey);
|
|
61
|
-
}
|
|
62
|
-
return keys;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
public static getModelI18nParams(model: ModelDescriptor<any>, item: any, i18nModelName?: string, i18nParameters: any = {}) {
|
|
66
|
-
i18nParameters.itemId = ''
|
|
67
|
-
i18nParameters.itemTitle = ''
|
|
68
|
-
|
|
69
|
-
if (i18nModelName) {
|
|
70
|
-
i18nParameters.modelName = i18nModelName;
|
|
71
|
-
}
|
|
72
|
-
if (item) {
|
|
73
|
-
if (model.idPropertyName && item[model.idPropertyName]) {
|
|
74
|
-
i18nParameters.itemId = item[model.idPropertyName];
|
|
75
|
-
}
|
|
76
|
-
if (model.titlePropertyName && item[model.titlePropertyName]) {
|
|
77
|
-
i18nParameters.itemTitle = item[model.titlePropertyName];
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return i18nParameters;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
public static getActionI18nParams(action: ActionDescriptor<any>, item: any, i18nModelName?: string, i18nParameters: any = {}, functionTitle?: string) {
|
|
84
|
-
i18nParameters.itemId = ''
|
|
85
|
-
i18nParameters.itemTitle = ''
|
|
86
|
-
|
|
87
|
-
if (functionTitle) {
|
|
88
|
-
i18nParameters.functionTitle = functionTitle;
|
|
89
|
-
}
|
|
90
|
-
if (i18nModelName) {
|
|
91
|
-
i18nParameters.modelName = i18nModelName;
|
|
92
|
-
}
|
|
93
|
-
if (item) {
|
|
94
|
-
if (action.model.idPropertyName && item[action.model.idPropertyName]) {
|
|
95
|
-
i18nParameters.itemId = item[action.model.idPropertyName];
|
|
96
|
-
}
|
|
97
|
-
if (action.model.titlePropertyName && item[action.model.titlePropertyName]) {
|
|
98
|
-
i18nParameters.itemTitle = item[action.model.titlePropertyName];
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
return i18nParameters;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
public static instantModelName(translate: TranslateService, model: ModelDescriptor<any>, singular?: boolean): string|null {
|
|
105
|
-
const keys = I18nUtil.getModelNameKeys(model, singular);
|
|
106
|
-
const i18n = translate.instant(keys);
|
|
107
|
-
return I18nUtil.selectKeyByPriority(keys, i18n);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
public static getModelName(translate: TranslateService, model: ModelDescriptor<any>, oneTime: boolean = true, singular?: boolean): Observable<string|null> {
|
|
111
|
-
const keys = I18nUtil.getModelNameKeys(model, singular);
|
|
112
|
-
const obs = translate.stream(keys);
|
|
113
|
-
if (oneTime) {
|
|
114
|
-
obs.pipe(first())
|
|
115
|
-
}
|
|
116
|
-
return obs.pipe(map(i18n => I18nUtil.selectKeyByPriority(keys, i18n)));
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
public static getModelNameKeys(model: ModelDescriptor<any>, singular?: boolean) {
|
|
120
|
-
let keys = [];
|
|
121
|
-
if (singular !== undefined) {
|
|
122
|
-
keys.push(singular ? `${model?.typeName}.nameSingular` : `${model?.typeName}.namePlural`);
|
|
123
|
-
}
|
|
124
|
-
keys.push(`${model?.typeName}.name`);
|
|
125
|
-
return keys;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
private static selectKeyByPriority(keys: string[], i18n: any): string|null {
|
|
129
|
-
for (const key of keys) {
|
|
130
|
-
if (key !== i18n[key]) {
|
|
131
|
-
return i18n[key];
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
return null;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
private static getFunctionTitle(translate: TranslateService, functionTitle?: string) {
|
|
138
|
-
if (functionTitle) {
|
|
139
|
-
const translation = translate.instant(`mngAction.functions.${functionTitle}.title`);
|
|
140
|
-
if (translation === functionTitle) {
|
|
141
|
-
return null;
|
|
142
|
-
}
|
|
143
|
-
return translation;
|
|
144
|
-
} else {
|
|
145
|
-
return null;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import {ClassType} from '../types';
|
|
2
|
-
|
|
3
|
-
import {ObjectSerializer} from '../api/utils';
|
|
4
|
-
import {ILookupDescriptor} from '../descriptors';
|
|
5
|
-
|
|
6
|
-
export class ModelUtil {
|
|
7
|
-
public static findIdAttribute<T>(classType: ClassType<T>): string|null {
|
|
8
|
-
const objSerializer = ObjectSerializer.get();
|
|
9
|
-
const attributes = objSerializer.findAttributesDefinitionByClassType(classType);
|
|
10
|
-
if (!attributes) {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
let idAttribute = attributes.find(a => a.name === 'id');
|
|
15
|
-
if (!idAttribute) {
|
|
16
|
-
// if no id, try with code
|
|
17
|
-
idAttribute = attributes.find(a => a.name === 'code');
|
|
18
|
-
if (!idAttribute) {
|
|
19
|
-
// if no id or code, take the first attribute
|
|
20
|
-
idAttribute = attributes[0];
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return idAttribute?.name ?? null;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
public static findTitleAttribute<T>(classType: ClassType<T>): string|null {
|
|
28
|
-
const objSerializer = ObjectSerializer.get();
|
|
29
|
-
const attributes = objSerializer.findAttributesDefinitionByClassType(classType);
|
|
30
|
-
if (!attributes) {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
let titleAttribute = attributes.find(a => a.type === 'string' && a.name === 'name');
|
|
35
|
-
if (!titleAttribute) {
|
|
36
|
-
// if no name, try with title
|
|
37
|
-
titleAttribute = attributes.find(a => a.type === 'string' && a.name === 'title');
|
|
38
|
-
if (!titleAttribute) {
|
|
39
|
-
// if no name or title, take the first attribute
|
|
40
|
-
titleAttribute = attributes[0];
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return titleAttribute?.name ?? null;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
public static trySetLookupItemsProperties<T>(lookup: ILookupDescriptor<T>) {
|
|
48
|
-
if (lookup.modelType) {
|
|
49
|
-
if (!lookup.itemsValueProperty || !lookup.dataKeyProperty) {
|
|
50
|
-
const idProperty = ModelUtil.findIdAttribute(lookup.modelType) ?? undefined;
|
|
51
|
-
if (idProperty && !lookup.itemsValueProperty) {
|
|
52
|
-
lookup.withItemsValueProperty(idProperty);
|
|
53
|
-
}
|
|
54
|
-
if (idProperty && !lookup.dataKeyProperty) {
|
|
55
|
-
lookup.withDataKeyProperty(idProperty);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
if (!lookup.itemsLabelProperty) {
|
|
59
|
-
const labelProperty = ModelUtil.findTitleAttribute(lookup.modelType);
|
|
60
|
-
if (labelProperty) {
|
|
61
|
-
lookup.withItemsLabelProperty(labelProperty);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import {TranslateService} from '@ngx-translate/core';
|
|
2
|
-
import {ActionDescriptor, TableDescriptor} from '../descriptors';
|
|
3
|
-
import {TableviewComponentService} from '../components/tableview/services';
|
|
4
|
-
import {I18nUtil} from './i18n.util';
|
|
5
|
-
|
|
6
|
-
export class ToastUtil {
|
|
7
|
-
|
|
8
|
-
public static tableNotificationError(translationService: TranslateService, table: TableDescriptor<any>, error: any, tableview?: TableviewComponentService<any, any>) {
|
|
9
|
-
const params: any = {}
|
|
10
|
-
if (error?.message) {
|
|
11
|
-
params.errorMessage = `: ${error.message}`;
|
|
12
|
-
} else {
|
|
13
|
-
params.errorMessage = '.';
|
|
14
|
-
}
|
|
15
|
-
console.log(params)
|
|
16
|
-
const tableErrorTitle = I18nUtil.instantModelTranslation(translationService, table.model, 'table.error.title', undefined, undefined, 'general.error', params) ?? undefined;
|
|
17
|
-
const tableErrorMessage = I18nUtil.instantModelTranslation(translationService, table.model, 'table.error.message', undefined, undefined, 'general.errorMessage', params) ?? undefined;
|
|
18
|
-
|
|
19
|
-
tableview?.messageService?.add({severity: 'error', summary: tableErrorTitle, detail: tableErrorMessage});
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
public static actionNotificationSuccess(translationService: TranslateService, action: ActionDescriptor<any>, functionName: string, customTitleKey?: string, customMessageKey?: string, tableview?: TableviewComponentService<any, any>, item?: any) {
|
|
23
|
-
const actionSuccessTitle = I18nUtil.instantActionTranslation(translationService, action, 'success.title', customTitleKey, item, 'general.success', functionName) ?? undefined;
|
|
24
|
-
const actionSuccessMessage = I18nUtil.instantActionTranslation(translationService, action, 'success.message', customMessageKey, item, 'general.successMessage', functionName) ?? undefined;
|
|
25
|
-
|
|
26
|
-
tableview?.messageService?.add({severity: 'success', summary: actionSuccessTitle, detail: actionSuccessMessage});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
public static actionNotificationError(translationService: TranslateService, action: ActionDescriptor<any>, error: any, functionName: string, tableview?: TableviewComponentService<any, any>, item?: any) {
|
|
30
|
-
const params: any = {}
|
|
31
|
-
if (error?.message) {
|
|
32
|
-
params.errorMessage = `: ${error.message}`;
|
|
33
|
-
} else {
|
|
34
|
-
params.errorMessage = '.';
|
|
35
|
-
}
|
|
36
|
-
const actionErrorTitle = I18nUtil.instantActionTranslation(translationService, action, 'error.title', action.runNotificationErrorTitle,
|
|
37
|
-
item, 'general.error', functionName, params) ?? undefined;
|
|
38
|
-
const actionErrorMessage = I18nUtil.instantActionTranslation(translationService, action, 'error.message', action.runNotificationErrorMessage,
|
|
39
|
-
item, 'general.errorMessage', functionName, params) ?? undefined;
|
|
40
|
-
|
|
41
|
-
tableview?.messageService?.add({severity: 'error', summary: actionErrorTitle, detail: actionErrorMessage});
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
public static getFormEditorWarningMessage(translationService: TranslateService, title: string, message: string) {
|
|
45
|
-
const actionErrorTitle = translationService.instant(title) ?? undefined;
|
|
46
|
-
const actionErrorMessage = translationService.instant(message) ?? undefined;
|
|
47
|
-
return {severity:'warn', summary: actionErrorTitle, detail: actionErrorMessage};
|
|
48
|
-
}
|
|
49
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import 'reflect-metadata';
|
|
2
|
-
|
|
3
|
-
import {ClassType, typeNameDecoratorPropertyName} from '../types';
|
|
4
|
-
|
|
5
|
-
export class TypeUtil {
|
|
6
|
-
|
|
7
|
-
public static defineReflectTypeName(targetType: ClassType<any>, typeName?: string) {
|
|
8
|
-
if (!typeName) {
|
|
9
|
-
typeName = TypeUtil.getDecoratorTypeName(targetType);
|
|
10
|
-
if (!typeName) {
|
|
11
|
-
console.warn(`Type name not provided for target ${targetType}, nor could be retrieved from decorator. Type name was not registered to reflect.`);
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (!Reflect.hasOwnMetadata(typeNameDecoratorPropertyName, targetType)) {
|
|
17
|
-
Reflect.defineMetadata(typeNameDecoratorPropertyName, typeName, targetType);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Gets type name from either decorator or reflect metadata.
|
|
23
|
-
* @param type Class.
|
|
24
|
-
*/
|
|
25
|
-
public static findTypeName(type: ClassType<any>): string {
|
|
26
|
-
let decoratorName = TypeUtil.getDecoratorTypeName(type);
|
|
27
|
-
if (decoratorName) {
|
|
28
|
-
return decoratorName;
|
|
29
|
-
}
|
|
30
|
-
decoratorName = Reflect.getMetadata(typeNameDecoratorPropertyName, type);
|
|
31
|
-
if (decoratorName) {
|
|
32
|
-
return decoratorName;
|
|
33
|
-
}
|
|
34
|
-
return type.name;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Get value from decorator defined property name
|
|
39
|
-
* @param type Class.
|
|
40
|
-
*/
|
|
41
|
-
public static getDecoratorTypeName(type: Function): string|undefined {
|
|
42
|
-
return (type as any)[typeNameDecoratorPropertyName];
|
|
43
|
-
}
|
|
44
|
-
}
|
package/src/test.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
|
2
|
-
|
|
3
|
-
import 'zone.js';
|
|
4
|
-
import 'zone.js/testing';
|
|
5
|
-
import { getTestBed } from '@angular/core/testing';
|
|
6
|
-
import {
|
|
7
|
-
BrowserDynamicTestingModule,
|
|
8
|
-
platformBrowserDynamicTesting
|
|
9
|
-
} from '@angular/platform-browser-dynamic/testing';
|
|
10
|
-
|
|
11
|
-
declare const require: {
|
|
12
|
-
context(path: string, deep?: boolean, filter?: RegExp): {
|
|
13
|
-
keys(): string[];
|
|
14
|
-
<T>(id: string): T;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
// First, initialize the Angular testing environment.
|
|
19
|
-
getTestBed().initTestEnvironment(
|
|
20
|
-
BrowserDynamicTestingModule,
|
|
21
|
-
platformBrowserDynamicTesting()
|
|
22
|
-
);
|
|
23
|
-
// Then we find all the tests.
|
|
24
|
-
const context = require.context('./', true, /\.spec\.ts$/);
|
|
25
|
-
// And load the modules.
|
|
26
|
-
context.keys().map(context);
|
package/tsconfig.lib.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
|
2
|
-
{
|
|
3
|
-
"extends": "../../tsconfig.json",
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
"outDir": "../../out-tsc/lib",
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"declarationMap": true,
|
|
8
|
-
"inlineSources": true,
|
|
9
|
-
"types": []
|
|
10
|
-
},
|
|
11
|
-
"exclude": [
|
|
12
|
-
"src/test.ts",
|
|
13
|
-
"**/*.spec.ts"
|
|
14
|
-
]
|
|
15
|
-
}
|
package/tsconfig.lib.prod.json
DELETED
package/tsconfig.spec.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
|
2
|
-
{
|
|
3
|
-
"extends": "../../tsconfig.json",
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
"outDir": "../../out-tsc/spec",
|
|
6
|
-
"types": [
|
|
7
|
-
"jasmine"
|
|
8
|
-
]
|
|
9
|
-
},
|
|
10
|
-
"files": [
|
|
11
|
-
"src/test.ts"
|
|
12
|
-
],
|
|
13
|
-
"include": [
|
|
14
|
-
"**/*.spec.ts",
|
|
15
|
-
"**/*.d.ts"
|
|
16
|
-
]
|
|
17
|
-
}
|