@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,70 +0,0 @@
|
|
|
1
|
-
import {Component, Input, OnInit} from '@angular/core';
|
|
2
|
-
|
|
3
|
-
import {FilterMatchMode} from 'primeng/api';
|
|
4
|
-
|
|
5
|
-
import {FilterDescriptor, FilterLookupDescriptor, TableDescriptor} from '../../../../descriptors';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Cannot be on push change detection strategy because of filter updates triggered from route which causes to force update values in force metadata
|
|
9
|
-
* and these must be propagated through to this component and beyond to primeNG.
|
|
10
|
-
*/
|
|
11
|
-
@Component({
|
|
12
|
-
selector: 'mng-table-column-filter',
|
|
13
|
-
templateUrl: './column-filter.component.html'
|
|
14
|
-
})
|
|
15
|
-
export class MngTableColumnFilterComponent<T> implements OnInit {
|
|
16
|
-
|
|
17
|
-
public readonly lookupTypeDropdown: FilterLookupDescriptor.LookupTypeEnum = FilterLookupDescriptor.LookupTypeEnum.Dropdown;
|
|
18
|
-
public readonly lookupTypeAutocomplete: FilterLookupDescriptor.LookupTypeEnum = FilterLookupDescriptor.LookupTypeEnum.Autocomplete;
|
|
19
|
-
|
|
20
|
-
@Input() descriptor!: FilterDescriptor<T>;
|
|
21
|
-
@Input() display!: TableDescriptor.FilterDisplayEnum;
|
|
22
|
-
|
|
23
|
-
public lookupDescriptor?: FilterLookupDescriptor<T>;
|
|
24
|
-
|
|
25
|
-
public primeField!: string;
|
|
26
|
-
public primeType: string = 'text';
|
|
27
|
-
public primeDefaultMatchMode: string = FilterMatchMode.EQUALS;
|
|
28
|
-
public primeDisplay: string = 'row';
|
|
29
|
-
|
|
30
|
-
ngOnInit() {
|
|
31
|
-
switch (this.descriptor.filterType) {
|
|
32
|
-
case FilterDescriptor.TypeEnum.Boolean:
|
|
33
|
-
this.primeType = 'boolean';
|
|
34
|
-
break;
|
|
35
|
-
case FilterDescriptor.TypeEnum.Number:
|
|
36
|
-
this.primeType = 'numeric';
|
|
37
|
-
break;
|
|
38
|
-
case FilterDescriptor.TypeEnum.Date:
|
|
39
|
-
this.primeType = 'date';
|
|
40
|
-
break;
|
|
41
|
-
case FilterDescriptor.TypeEnum.Lookup:
|
|
42
|
-
this.primeType = 'lookup';
|
|
43
|
-
this.lookupDescriptor = this.descriptor as FilterLookupDescriptor<T>;
|
|
44
|
-
this.primeField = `${this.descriptor.property}${this.lookupDescriptor.itemsValueProperty ? `.${this.lookupDescriptor.itemsValueProperty}` : ''}`;
|
|
45
|
-
break;
|
|
46
|
-
case FilterDescriptor.TypeEnum.String:
|
|
47
|
-
this.primeType = 'text';
|
|
48
|
-
this.primeDefaultMatchMode = FilterMatchMode.CONTAINS;
|
|
49
|
-
break;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
switch (this.display) {
|
|
53
|
-
case TableDescriptor.FilterDisplayEnum.Menu:
|
|
54
|
-
this.primeDisplay = 'menu';
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
autocompleteFilter(value: T, filterCallback: Function) {
|
|
60
|
-
if (value) {
|
|
61
|
-
let filterValue: any = value;
|
|
62
|
-
if (this.lookupDescriptor!.itemsValueProperty) {
|
|
63
|
-
filterValue = filterValue[this.lookupDescriptor!.itemsValueProperty];
|
|
64
|
-
}
|
|
65
|
-
filterCallback(filterValue);
|
|
66
|
-
} else {
|
|
67
|
-
filterCallback(value);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<ng-container [ngSwitch]="descriptor.columnType">
|
|
2
|
-
<ng-container *ngSwitchCase="columnTypeString">
|
|
3
|
-
{{ descriptor.displayPropertyPath ? (item | propertyPath: descriptor.displayPropertyPath) : item[descriptor.property] }}
|
|
4
|
-
</ng-container>
|
|
5
|
-
<ng-container *ngSwitchCase="columnTypeNumber">
|
|
6
|
-
{{ (descriptor.displayPropertyPath ? (item | propertyPath: descriptor.displayPropertyPath) : item[descriptor.property]) | number: descriptor.displayFormat }}
|
|
7
|
-
</ng-container>
|
|
8
|
-
<ng-container *ngSwitchCase="columnTypeDate">
|
|
9
|
-
{{ (descriptor.displayPropertyPath ? (item | propertyPath: descriptor.displayPropertyPath) : item[descriptor.property]) | date: descriptor.displayFormat }}
|
|
10
|
-
</ng-container>
|
|
11
|
-
<ng-container *ngSwitchCase="columnTypeBoolean">
|
|
12
|
-
{{ (descriptor.displayPropertyPath ? (item | propertyPath: descriptor.displayPropertyPath) : item[descriptor.property]) | boolean }}
|
|
13
|
-
</ng-container>
|
|
14
|
-
</ng-container>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import {ChangeDetectionStrategy, Component, Input} from '@angular/core';
|
|
2
|
-
|
|
3
|
-
import {ColumnDescriptor} from '../../../../descriptors';
|
|
4
|
-
|
|
5
|
-
@Component({
|
|
6
|
-
selector: 'mng-table-column-value',
|
|
7
|
-
templateUrl: './column-value.component.html',
|
|
8
|
-
changeDetection: ChangeDetectionStrategy.OnPush
|
|
9
|
-
})
|
|
10
|
-
export class MngTableColumnValueComponent<T, TT> {
|
|
11
|
-
|
|
12
|
-
public readonly columnTypeString: ColumnDescriptor.TypeEnum = ColumnDescriptor.TypeEnum.String;
|
|
13
|
-
public readonly columnTypeNumber: ColumnDescriptor.TypeEnum = ColumnDescriptor.TypeEnum.Number;
|
|
14
|
-
public readonly columnTypeBoolean: ColumnDescriptor.TypeEnum = ColumnDescriptor.TypeEnum.Boolean;
|
|
15
|
-
public readonly columnTypeDate: ColumnDescriptor.TypeEnum = ColumnDescriptor.TypeEnum.Date;
|
|
16
|
-
|
|
17
|
-
@Input() descriptor!: ColumnDescriptor<T, TT>;
|
|
18
|
-
@Input() item!: any;
|
|
19
|
-
}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
<div [style.height]="scrollHeight === 'flex' ? 'calc(100vh - ' + descriptor.tableFullHeightOffset + 'px)' : null">
|
|
2
|
-
<!-- MUST NOT use observable for value when using virtual scroll - does not work for some reason -->
|
|
3
|
-
<p-table *ngIf="!useQueryParams || useQueryParamsInitialized"
|
|
4
|
-
[value]="infiniteScroll ? dataProviderInfiniteScrollItems : ((queryResult$ | async)?.pageData ?? [])"
|
|
5
|
-
[dataKey]="$any(descriptor.dataKeyProperty)"
|
|
6
|
-
[lazy]="useDataProvider"
|
|
7
|
-
[loading]="(loading$ | async) ?? false"
|
|
8
|
-
[paginator]="useDataProvider && !infiniteScroll"
|
|
9
|
-
[rows]="$any(infiniteScroll ? 20 : rows)"
|
|
10
|
-
[first]="$any(infiniteScroll ? 0 : offset)"
|
|
11
|
-
[totalRecords]="$any(infiniteScroll ? null : (queryResult$ | async)?.allDataCount ?? 0)"
|
|
12
|
-
[rowsPerPageOptions]="$any(infiniteScroll ? null : rowsPerPageOptions)"
|
|
13
|
-
[showCurrentPageReport]="!infiniteScroll"
|
|
14
|
-
[currentPageReportTemplate]="'mngTable.paginationMsg' | translate"
|
|
15
|
-
[multiSortMeta]="$any(multiSortMeta)"
|
|
16
|
-
[filters]="filterMetadata"
|
|
17
|
-
[(selection)]="selection"
|
|
18
|
-
(selectionChange)="onSelectionChange($event)"
|
|
19
|
-
[scrollable]="infiniteScroll"
|
|
20
|
-
[virtualScroll]="infiniteScroll"
|
|
21
|
-
[virtualRowHeight]="$any(rowHeight)"
|
|
22
|
-
[scrollHeight]="$any(scrollHeight)"
|
|
23
|
-
[rowHover]="true"
|
|
24
|
-
(onLazyLoad)="onTableLazyLoad($event)"
|
|
25
|
-
(onSort)="onTableSort($event)"
|
|
26
|
-
(onFilter)="onTableFilter($event)"
|
|
27
|
-
sortMode="multiple"
|
|
28
|
-
responsiveLayout="scroll">
|
|
29
|
-
|
|
30
|
-
<ng-template *ngIf="captionTemplate || descriptor.title" pTemplate="caption">
|
|
31
|
-
<ng-container *ngIf="captionTemplate; else defaultCaption">
|
|
32
|
-
<ng-container *ngTemplateOutlet="captionTemplate"></ng-container>
|
|
33
|
-
</ng-container>
|
|
34
|
-
<ng-template #defaultCaption>
|
|
35
|
-
<h5 class="p-m-0">{{ descriptor.title }}</h5>
|
|
36
|
-
</ng-template>
|
|
37
|
-
</ng-template>
|
|
38
|
-
|
|
39
|
-
<ng-template pTemplate="header">
|
|
40
|
-
<tr>
|
|
41
|
-
<th *ngIf="selectionEnabled">
|
|
42
|
-
<p-tableHeaderCheckbox></p-tableHeaderCheckbox>
|
|
43
|
-
</th>
|
|
44
|
-
<ng-container *ngFor="let col of descriptor.columns">
|
|
45
|
-
<th *ngIf="col.isSortEnabled" [pSortableColumn]="col.property">
|
|
46
|
-
<div class="flex justify-content-between align-items-center">
|
|
47
|
-
{{ descriptor.model.typeName + ".properties." + col.property | translate }}
|
|
48
|
-
<p-sortIcon [field]="col.property"></p-sortIcon>
|
|
49
|
-
<mng-table-column-filter *ngIf="col.filterDescriptor && descriptor.filterDisplay === filterDisplayMenu"
|
|
50
|
-
class="ml-auto"
|
|
51
|
-
[display]="descriptor.filterDisplay"
|
|
52
|
-
[descriptor]="col.filterDescriptor">
|
|
53
|
-
</mng-table-column-filter>
|
|
54
|
-
</div>
|
|
55
|
-
</th>
|
|
56
|
-
<th *ngIf="!col.isSortEnabled">
|
|
57
|
-
{{ descriptor.model.typeName + ".properties." + col.property | translate }}
|
|
58
|
-
<ng-container>
|
|
59
|
-
<mng-table-column-filter *ngIf="col.filterDescriptor && descriptor.filterDisplay === filterDisplayMenu"
|
|
60
|
-
class="ml-auto"
|
|
61
|
-
[display]="descriptor.filterDisplay"
|
|
62
|
-
[descriptor]="col.filterDescriptor">
|
|
63
|
-
</mng-table-column-filter>
|
|
64
|
-
</ng-container>
|
|
65
|
-
</th>
|
|
66
|
-
</ng-container>
|
|
67
|
-
<th *ngIf="columnActionTemplate"></th>
|
|
68
|
-
</tr>
|
|
69
|
-
<tr *ngIf="descriptor.filterDisplay === filterDisplayRow">
|
|
70
|
-
<th *ngFor="let col of descriptor.columns">
|
|
71
|
-
<div class="flex" *ngIf="col.filterDescriptor">
|
|
72
|
-
<mng-table-column-filter [display]="descriptor.filterDisplay" [descriptor]="col.filterDescriptor"></mng-table-column-filter>
|
|
73
|
-
</div>
|
|
74
|
-
</th>
|
|
75
|
-
<th *ngIf="columnActionTemplate"></th>
|
|
76
|
-
</tr>
|
|
77
|
-
</ng-template>
|
|
78
|
-
|
|
79
|
-
<ng-template pTemplate="body" let-item let-idx="rowIndex">
|
|
80
|
-
<tr [style.height.px]="descriptor.rowHeight">
|
|
81
|
-
<td *ngIf="selectionEnabled">
|
|
82
|
-
<p-tableCheckbox [value]="item"></p-tableCheckbox>
|
|
83
|
-
</td>
|
|
84
|
-
<td *ngFor="let col of descriptor.columns" (click)="onCellClick(col, item, idx)" class="clickable">
|
|
85
|
-
<mng-table-column-value [descriptor]="col" [item]="item"></mng-table-column-value>
|
|
86
|
-
</td>
|
|
87
|
-
<td *ngIf="columnActionTemplate" class="text-right">
|
|
88
|
-
<ng-container *ngTemplateOutlet="columnActionTemplate; context: { rowItem: item, rowIndex: idx }"></ng-container>
|
|
89
|
-
</td>
|
|
90
|
-
</tr>
|
|
91
|
-
</ng-template>
|
|
92
|
-
|
|
93
|
-
<ng-template pTemplate="loadingbody">
|
|
94
|
-
<tr [style.height.px]="descriptor.rowHeight">
|
|
95
|
-
<td [attr.colspan]="descriptor.columns.length + (columnActionTemplate ? 1 : 0) + (selectionEnabled ? 1 : 0)">
|
|
96
|
-
<div class="loading-text"></div>
|
|
97
|
-
<p-skeleton [ngStyle]="{'width': '100%'}"></p-skeleton>
|
|
98
|
-
</td>
|
|
99
|
-
</tr>
|
|
100
|
-
</ng-template>
|
|
101
|
-
|
|
102
|
-
<ng-template pTemplate="emptymessage">
|
|
103
|
-
<tr [style.height.px]="rowHeight">
|
|
104
|
-
<td [attr.colspan]="descriptor.columns.length + (columnActionTemplate ? 1 : 0) + (selectionEnabled ? 1 : 0)">
|
|
105
|
-
{{ 'mngTable.noItems' | translate }}
|
|
106
|
-
</td>
|
|
107
|
-
</tr>
|
|
108
|
-
</ng-template>
|
|
109
|
-
</p-table>
|
|
110
|
-
</div>
|
|
@@ -1,327 +0,0 @@
|
|
|
1
|
-
import {AfterContentInit, ChangeDetectionStrategy, Component, ContentChildren, EventEmitter, Injector, Input, OnDestroy, OnInit, Optional, Output, QueryList, TemplateRef, ViewChild} from '@angular/core';
|
|
2
|
-
import {ActivatedRoute, Params, Router} from '@angular/router';
|
|
3
|
-
|
|
4
|
-
import {Table} from 'primeng/table';
|
|
5
|
-
import {LazyLoadEvent, SortMeta} from 'primeng/api';
|
|
6
|
-
import {FilterMetadata} from 'primeng/api/filtermetadata';
|
|
7
|
-
import {Observable, of, ReplaySubject, Subscription} from 'rxjs';
|
|
8
|
-
import {finalize, first, map} from 'rxjs/operators';
|
|
9
|
-
import {TranslateService} from '@ngx-translate/core';
|
|
10
|
-
|
|
11
|
-
import {MediusQueryParam, MediusQueryParamBuilder, MediusQueryResult} from '../../../api/models';
|
|
12
|
-
import {MediusRestUtil} from '../../../api/utils';
|
|
13
|
-
import {ColumnDescriptor, FilterDescriptor, TableDescriptor} from '../../../descriptors';
|
|
14
|
-
import {ITableDataProvider} from '../../../data-providers';
|
|
15
|
-
import {MngTableCellClickEvent, MngTableLoadEvent} from '../models';
|
|
16
|
-
import {MngTemplateDirective} from '../../../directives';
|
|
17
|
-
import {ToastUtil} from '../../../utils';
|
|
18
|
-
import {TableviewComponentService} from '../services';
|
|
19
|
-
|
|
20
|
-
import TypeEnum = FilterDescriptor.TypeEnum;
|
|
21
|
-
import PaginationModeEnum = TableDescriptor.PaginationModeEnum;
|
|
22
|
-
|
|
23
|
-
@Component({
|
|
24
|
-
selector: 'mng-table',
|
|
25
|
-
templateUrl: './table.component.html',
|
|
26
|
-
changeDetection: ChangeDetectionStrategy.OnPush
|
|
27
|
-
})
|
|
28
|
-
export class MngTableComponent<T, S> implements OnInit, AfterContentInit, OnDestroy {
|
|
29
|
-
|
|
30
|
-
public readonly filterDisplayRow: TableDescriptor.FilterDisplayEnum = TableDescriptor.FilterDisplayEnum.Row;
|
|
31
|
-
public readonly filterDisplayMenu: TableDescriptor.FilterDisplayEnum = TableDescriptor.FilterDisplayEnum.Menu;
|
|
32
|
-
|
|
33
|
-
// metadata input
|
|
34
|
-
@Input() public descriptor!: TableDescriptor<T>;
|
|
35
|
-
|
|
36
|
-
// data source inputs
|
|
37
|
-
@Input() public items?: Observable<Array<T>>|Array<T>;
|
|
38
|
-
@Input() public queryResult?: Observable<MediusQueryResult<T>>|MediusQueryResult<T>;
|
|
39
|
-
@Input() public loading?: Observable<boolean>|boolean;
|
|
40
|
-
@Input() public dataProvider?: ITableDataProvider<T, any>;
|
|
41
|
-
@Input() public useQueryParams = false;
|
|
42
|
-
|
|
43
|
-
// extra features input
|
|
44
|
-
@Input() public selectionEnabled: boolean = false;
|
|
45
|
-
|
|
46
|
-
// event outputs
|
|
47
|
-
@Output('onLoad') private loadEventEmitter = new EventEmitter<MngTableLoadEvent>();
|
|
48
|
-
@Output('onCellClick') private cellClickEventEmitter = new EventEmitter<MngTableCellClickEvent<T>>();
|
|
49
|
-
@Output('onSelectionChange') private selectionChangeEventEmitter = new EventEmitter<Array<T>>();
|
|
50
|
-
|
|
51
|
-
// content and view queries
|
|
52
|
-
@ContentChildren(MngTemplateDirective) templates!: QueryList<MngTemplateDirective>;
|
|
53
|
-
@ViewChild(Table) private primeTable!: Table;
|
|
54
|
-
|
|
55
|
-
// templates
|
|
56
|
-
public captionTemplate?: TemplateRef<any>;
|
|
57
|
-
public columnActionTemplate?: TemplateRef<any>;
|
|
58
|
-
|
|
59
|
-
// data provider and items
|
|
60
|
-
public useDataProvider: boolean = false;
|
|
61
|
-
public useQueryParamsInitialized: boolean = false;
|
|
62
|
-
public queryResult$?: Observable<MediusQueryResult<T>>;
|
|
63
|
-
public loading$?: Observable<boolean>;
|
|
64
|
-
public dataProviderInfiniteScrollItems: Array<T> = [];
|
|
65
|
-
private dataProviderService: any = null;
|
|
66
|
-
private dataProviderQueryResultSubject = new ReplaySubject<MediusQueryResult<T>>(1);
|
|
67
|
-
private dataProviderLoadingSubject = new ReplaySubject<boolean>(1);
|
|
68
|
-
private dataProviderLatestLazyLoadEvent?: LazyLoadEvent;
|
|
69
|
-
private dataProviderLatestLazyLoadEventVersion: number = 0;
|
|
70
|
-
private dataProviderLatestQueryParam?: MediusQueryParam;
|
|
71
|
-
private dataProviderLatestQueryParamVersion: number = 0;
|
|
72
|
-
private dataProviderSubscription?: Subscription;
|
|
73
|
-
|
|
74
|
-
// pagination, sort and filters
|
|
75
|
-
public readonly rowsPerPageOptions = [25, 50, 100];
|
|
76
|
-
public rows = this.rowsPerPageOptions[0];
|
|
77
|
-
public offset = 0;
|
|
78
|
-
public multiSortMeta: SortMeta[]|null = null;
|
|
79
|
-
public filterMetadata: { [s: string]: FilterMetadata | FilterMetadata[] } = {};
|
|
80
|
-
private isFilterChanged = false;
|
|
81
|
-
private isSortChanged = false;
|
|
82
|
-
|
|
83
|
-
// infinite scroll
|
|
84
|
-
public infiniteScroll = false;
|
|
85
|
-
public scrollHeight: 'flex'|null = null;
|
|
86
|
-
public rowHeight: number|null = null;
|
|
87
|
-
|
|
88
|
-
public selection: Array<T> = [];
|
|
89
|
-
private subscriptions: Subscription[] = [];
|
|
90
|
-
private filterDescriptors: Array<FilterDescriptor<any>> = [];
|
|
91
|
-
|
|
92
|
-
constructor(private injector: Injector,
|
|
93
|
-
private router: Router,
|
|
94
|
-
private activatedRoute: ActivatedRoute,
|
|
95
|
-
private translate: TranslateService,
|
|
96
|
-
@Optional() private tableviewService: TableviewComponentService<T, S>
|
|
97
|
-
) { }
|
|
98
|
-
|
|
99
|
-
public ngOnInit() {
|
|
100
|
-
|
|
101
|
-
// @ts-ignore
|
|
102
|
-
this.filterDescriptors = this.descriptor.columns.filter(c => typeof c.filterDescriptor !== 'undefined').map(c => c.filterDescriptor);
|
|
103
|
-
|
|
104
|
-
if (this.descriptor.paginationMode === PaginationModeEnum.InfiniteScroll) {
|
|
105
|
-
this.infiniteScroll = true;
|
|
106
|
-
this.scrollHeight = 'flex';
|
|
107
|
-
this.rowHeight = this.descriptor.rowHeight;
|
|
108
|
-
this.useQueryParams = false;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// check if data provider is supplied, if is, use it primarily
|
|
112
|
-
if (this.dataProvider) {
|
|
113
|
-
// map subjects to observables and initiate data
|
|
114
|
-
this.useDataProvider = true;
|
|
115
|
-
this.queryResult$ = this.dataProviderQueryResultSubject.asObservable();
|
|
116
|
-
this.loading$ = this.dataProviderLoadingSubject.asObservable();
|
|
117
|
-
const emptyQueryResult = new MediusQueryResult<T>();
|
|
118
|
-
emptyQueryResult.pageData = [];
|
|
119
|
-
emptyQueryResult.allDataCount = 0;
|
|
120
|
-
this.dataProviderLoadingSubject.next(false);
|
|
121
|
-
this.dataProviderQueryResultSubject.next(emptyQueryResult)
|
|
122
|
-
|
|
123
|
-
// inject service
|
|
124
|
-
if (this.dataProvider.serviceType) {
|
|
125
|
-
this.dataProviderService = this.injector.get<any>(this.dataProvider.serviceType);
|
|
126
|
-
}
|
|
127
|
-
} else {
|
|
128
|
-
// if query result is provided, use it as secondary source or else try to use items
|
|
129
|
-
if (this.queryResult) {
|
|
130
|
-
this.queryResult$ = this.queryResult instanceof Observable ? this.queryResult : of(this.queryResult);
|
|
131
|
-
} else if (!this.queryResult && this.items) {
|
|
132
|
-
this.queryResult$ = (this.items instanceof Observable ? this.items : of(this.items)).pipe(
|
|
133
|
-
// distinctUntilChanged((v1, v2) => v1.length === v2.length &&
|
|
134
|
-
// v1.every((v1i, idx) => v1i[this.descriptor.dataKeyProperty] === v2[idx][this.descriptor.dataKeyProperty])),
|
|
135
|
-
map(items => {
|
|
136
|
-
const queryResult = new MediusQueryResult<T>();
|
|
137
|
-
queryResult.pageData = items;
|
|
138
|
-
queryResult.allDataCount = items.length;
|
|
139
|
-
return queryResult;
|
|
140
|
-
}));
|
|
141
|
-
}
|
|
142
|
-
if (typeof this.loading !== 'undefined') {
|
|
143
|
-
this.loading$ = this.loading instanceof Observable ? this.loading : of(this.loading);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
if (this.useQueryParams) {
|
|
148
|
-
const subscription = this.activatedRoute.queryParams.subscribe(qp => {
|
|
149
|
-
this.loadTableFromRouteUpdate(qp);
|
|
150
|
-
});
|
|
151
|
-
this.subscriptions.push(subscription);
|
|
152
|
-
} else {
|
|
153
|
-
// initialize default sort if present
|
|
154
|
-
const defaultSort = this.getDefaultSortMeta();
|
|
155
|
-
if (defaultSort.length > 0) {
|
|
156
|
-
this.multiSortMeta = defaultSort;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
public ngAfterContentInit() {
|
|
162
|
-
this.templates.forEach(template => {
|
|
163
|
-
switch(template.getType()) {
|
|
164
|
-
case 'caption':
|
|
165
|
-
this.captionTemplate = template.template;
|
|
166
|
-
break;
|
|
167
|
-
case 'columnAction':
|
|
168
|
-
this.columnActionTemplate = template.template;
|
|
169
|
-
break;
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
public ngOnDestroy() {
|
|
175
|
-
this.subscriptions.forEach(s => s.unsubscribe());
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
public reload(emitEvent: boolean = false, resetParams: boolean = false) {
|
|
179
|
-
this.loadTableWithDataProvider(resetParams
|
|
180
|
-
? MediusQueryParamBuilder.create(this.rowsPerPageOptions[0], 0).build()
|
|
181
|
-
: (this.dataProviderLatestQueryParam ?? new MediusQueryParam()), emitEvent);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
public onTableLazyLoad(event: LazyLoadEvent) {
|
|
185
|
-
this.dataProviderLatestLazyLoadEvent = event;
|
|
186
|
-
this.dataProviderLatestLazyLoadEventVersion++;
|
|
187
|
-
|
|
188
|
-
if (this.useQueryParams) {
|
|
189
|
-
if (!event.multiSortMeta || event.multiSortMeta.length === 0) {
|
|
190
|
-
// add default sort meta to event if not multisort meta is present
|
|
191
|
-
event.multiSortMeta = this.getDefaultSortMeta();
|
|
192
|
-
}
|
|
193
|
-
this.router.navigate([], {
|
|
194
|
-
relativeTo: this.activatedRoute,
|
|
195
|
-
replaceUrl: true,
|
|
196
|
-
queryParams: MediusRestUtil.fromPrimeLazyLoadEventToAngularQueryParams(event, this.rowsPerPageOptions[0])
|
|
197
|
-
});
|
|
198
|
-
} else {
|
|
199
|
-
const mediusQueryParams = event ? MediusRestUtil.fromPrimeLazyLoadEventToMediusQueryParams(event) : new MediusQueryParam();
|
|
200
|
-
this.loadTableWithDataProvider(mediusQueryParams);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
public onTableSort(event: any) {
|
|
205
|
-
this.isSortChanged = true;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
public onTableFilter(event: any) {
|
|
209
|
-
this.isFilterChanged = true;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
public onCellClick(col: ColumnDescriptor<any, T>, item: T, idx: number) {
|
|
213
|
-
const mngEvent = new MngTableCellClickEvent<T>(col, item, idx);
|
|
214
|
-
this.cellClickEventEmitter.next(mngEvent);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
public onSelectionChange(event: Array<T>) {
|
|
218
|
-
this.selectionChangeEventEmitter.emit(event);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
private loadTableWithDataProvider(queryParam: MediusQueryParam|null = null, emitEvent: boolean = true) {
|
|
222
|
-
if (!this.useDataProvider) {
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
if (this.dataProviderSubscription) {
|
|
226
|
-
this.dataProviderSubscription.unsubscribe();
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
this.dataProviderLoadingSubject.next(true);
|
|
230
|
-
|
|
231
|
-
if (!queryParam) {
|
|
232
|
-
queryParam = MediusQueryParamBuilder.create(this.rowsPerPageOptions[0]).build();
|
|
233
|
-
}
|
|
234
|
-
this.dataProviderLatestQueryParam = queryParam;
|
|
235
|
-
this.dataProviderLatestQueryParamVersion++;
|
|
236
|
-
|
|
237
|
-
this.dataProviderSubscription = this.dataProvider?.getAll(queryParam, this.dataProviderService)
|
|
238
|
-
.pipe(
|
|
239
|
-
first(),
|
|
240
|
-
finalize(() => this.dataProviderLoadingSubject.next(false))
|
|
241
|
-
)
|
|
242
|
-
.subscribe((res) => {
|
|
243
|
-
if (this.infiniteScroll) {
|
|
244
|
-
if (this.isFilterChanged || this.isSortChanged) {
|
|
245
|
-
this.dataProviderInfiniteScrollItems = [];
|
|
246
|
-
}
|
|
247
|
-
// @ts-ignore
|
|
248
|
-
this.dataProviderInfiniteScrollItems.splice(queryParam.itemsOffset ?? 0, queryParam.itemsPerPage ?? this.rows, ...res.pageData)
|
|
249
|
-
this.dataProviderInfiniteScrollItems = [...this.dataProviderInfiniteScrollItems];
|
|
250
|
-
} else {
|
|
251
|
-
this.dataProviderQueryResultSubject.next(res);
|
|
252
|
-
}
|
|
253
|
-
this.isFilterChanged = false;
|
|
254
|
-
this.isSortChanged = false;
|
|
255
|
-
}, err => {
|
|
256
|
-
ToastUtil.tableNotificationError(this.translate, this.descriptor, err, this.tableviewService);
|
|
257
|
-
const emptyQueryResult = new MediusQueryResult<T>();
|
|
258
|
-
emptyQueryResult.pageData = [];
|
|
259
|
-
emptyQueryResult.allDataCount = 0;
|
|
260
|
-
this.dataProviderQueryResultSubject.next(emptyQueryResult);
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
if (emitEvent) {
|
|
264
|
-
const mngEvent = new MngTableLoadEvent();
|
|
265
|
-
mngEvent.originalEvent = this.dataProviderLatestLazyLoadEvent ?? undefined;
|
|
266
|
-
mngEvent.queryParam = queryParam;
|
|
267
|
-
this.loadEventEmitter.next(mngEvent);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
private loadTableFromRouteUpdate(params: Params) {
|
|
272
|
-
const mediusQueryParam = MediusRestUtil.fromAngularQueryParamsToMediusQueryParams(params, this.filterDescriptors, this.rowsPerPageOptions[0]);
|
|
273
|
-
if (this.dataProviderLatestLazyLoadEventVersion < this.dataProviderLatestQueryParamVersion + 1) {
|
|
274
|
-
// update only if new version from query params will be higher
|
|
275
|
-
this.updatePrimeSortAndFilter(mediusQueryParam);
|
|
276
|
-
}
|
|
277
|
-
this.useQueryParamsInitialized = true;
|
|
278
|
-
this.loadTableWithDataProvider(mediusQueryParam);
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
private updatePrimeSortAndFilter(mediusQueryParam: MediusQueryParam) {
|
|
282
|
-
const primeSortMeta: SortMeta[] = [];
|
|
283
|
-
const primeFilterMeta: { [s: string]: FilterMetadata | FilterMetadata[] } = {};
|
|
284
|
-
|
|
285
|
-
this.filterDescriptors.forEach(f => {
|
|
286
|
-
// @ts-ignore
|
|
287
|
-
primeFilterMeta[f.property] = {
|
|
288
|
-
value: null,
|
|
289
|
-
matchMode: f.filterType === TypeEnum.String ? 'contains' : 'equals'
|
|
290
|
-
};
|
|
291
|
-
});
|
|
292
|
-
|
|
293
|
-
mediusQueryParam?.sortProperty?.forEach((s, idx) => {
|
|
294
|
-
primeSortMeta.push({
|
|
295
|
-
field: s,
|
|
296
|
-
order: (mediusQueryParam?.sortAsc?.[idx] ?? true) ? 1 : -1
|
|
297
|
-
});
|
|
298
|
-
});
|
|
299
|
-
|
|
300
|
-
mediusQueryParam?.filterParams?.forEach((f, idx) => {
|
|
301
|
-
const descriptor = this.filterDescriptors.find(fd => fd.filterProperty === f.property || fd.property === f.property);
|
|
302
|
-
const operator = MediusRestUtil.matchModeMapping.find(mapping => mapping[2] === f.filterMatchType);
|
|
303
|
-
if (descriptor && operator) {
|
|
304
|
-
primeFilterMeta[descriptor.property] = {
|
|
305
|
-
value: f.filterValue,
|
|
306
|
-
matchMode: operator[0]
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
|
-
});
|
|
310
|
-
|
|
311
|
-
this.multiSortMeta = primeSortMeta;
|
|
312
|
-
this.filterMetadata = primeFilterMeta;
|
|
313
|
-
this.rows = mediusQueryParam?.itemsPerPage ?? this.rowsPerPageOptions[0];
|
|
314
|
-
this.offset = mediusQueryParam?.itemsOffset ?? 0;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
private getDefaultSortMeta(): SortMeta[] {
|
|
318
|
-
if (this.descriptor.hasDefaultSort) {
|
|
319
|
-
return this.descriptor.defaultSortProperty.map((p, idx) => <SortMeta>{
|
|
320
|
-
field: p,
|
|
321
|
-
order: this.descriptor.defaultSortAsc[idx] ? 1 : -1
|
|
322
|
-
});
|
|
323
|
-
} else {
|
|
324
|
-
return [];
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
<div class="mng-tableview">
|
|
2
|
-
<p-toast></p-toast>
|
|
3
|
-
|
|
4
|
-
<div class="card">
|
|
5
|
-
<p-toolbar styleClass="mb-4" *ngIf="toolbarLeftActions.length > 0 || toolbarRightActions.length > 0">
|
|
6
|
-
<ng-template pTemplate="left">
|
|
7
|
-
<mng-action *ngFor="let action of toolbarLeftActions"
|
|
8
|
-
[action]="action">
|
|
9
|
-
</mng-action>
|
|
10
|
-
</ng-template>
|
|
11
|
-
|
|
12
|
-
<ng-template pTemplate="right">
|
|
13
|
-
<mng-action *ngFor="let action of toolbarRightActions"
|
|
14
|
-
[action]="action">
|
|
15
|
-
</mng-action>
|
|
16
|
-
</ng-template>
|
|
17
|
-
</p-toolbar>
|
|
18
|
-
|
|
19
|
-
<mng-table [descriptor]="descriptor.table"
|
|
20
|
-
[dataProvider]="dataProvider"
|
|
21
|
-
[useQueryParams]="true"
|
|
22
|
-
(onCellClick)="onTableCellClick($event)">
|
|
23
|
-
<ng-template mngTemplate="caption">
|
|
24
|
-
<div class="flex flex-column md:flex-row md:justify-content-between table-header">
|
|
25
|
-
<h5 class="p-m-0">{{ descriptor.tableTitle | translate }}</h5>
|
|
26
|
-
</div>
|
|
27
|
-
</ng-template>
|
|
28
|
-
<ng-template mngTemplate="columnAction" let-item="rowItem">
|
|
29
|
-
<mng-action *ngFor="let action of rowInlineActions"
|
|
30
|
-
[action]="action" [item]="item" [itemId]="descriptor.model.idPropertyName ? item[descriptor.model.idPropertyName] : null">
|
|
31
|
-
</mng-action>
|
|
32
|
-
</ng-template>
|
|
33
|
-
</mng-table>
|
|
34
|
-
</div>
|
|
35
|
-
|
|
36
|
-
<router-outlet></router-outlet>
|
|
37
|
-
</div>
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import {Component, Input, OnInit, ViewChild} from '@angular/core';
|
|
2
|
-
import {ActivatedRoute} from '@angular/router';
|
|
3
|
-
|
|
4
|
-
import {TranslateService} from '@ngx-translate/core';
|
|
5
|
-
import {ConfirmationService, MessageService} from 'primeng/api';
|
|
6
|
-
import {DialogService} from 'primeng/dynamicdialog';
|
|
7
|
-
|
|
8
|
-
import {MngActionService} from '../../services';
|
|
9
|
-
import {TableviewDescriptor, ActionDescriptor, ActionPositionEnum} from '../../descriptors';
|
|
10
|
-
import {ITableviewDataProvider} from '../../data-providers';
|
|
11
|
-
import {MngTableCellClickEvent} from './models';
|
|
12
|
-
import {TableviewComponentService} from './services';
|
|
13
|
-
import {MngTableComponent} from './table/table.component';
|
|
14
|
-
|
|
15
|
-
@Component({
|
|
16
|
-
selector: 'mng-tableview',
|
|
17
|
-
templateUrl: './tableview.component.html',
|
|
18
|
-
providers: [MessageService, ConfirmationService, TableviewComponentService]
|
|
19
|
-
})
|
|
20
|
-
export class MngTableviewComponent<T, S> implements OnInit {
|
|
21
|
-
|
|
22
|
-
@Input() descriptor!: TableviewDescriptor<T>;
|
|
23
|
-
@Input() dataProvider?: ITableviewDataProvider<T, S>;
|
|
24
|
-
@Input() actions: Array<ActionDescriptor<T>> = [];
|
|
25
|
-
|
|
26
|
-
@ViewChild(MngTableComponent) tableComponent: MngTableComponent<T, S>|null = null;
|
|
27
|
-
|
|
28
|
-
public rowClickActions: ActionDescriptor<T>[] = [];
|
|
29
|
-
public rowInlineActions: ActionDescriptor<T>[] = [];
|
|
30
|
-
public toolbarLeftActions: ActionDescriptor<T>[] = [];
|
|
31
|
-
public toolbarRightActions: ActionDescriptor<T>[] = [];
|
|
32
|
-
|
|
33
|
-
constructor(
|
|
34
|
-
private route: ActivatedRoute,
|
|
35
|
-
private messageService: MessageService,
|
|
36
|
-
private translateService: TranslateService,
|
|
37
|
-
private dialogService: DialogService,
|
|
38
|
-
private confirmationService: ConfirmationService,
|
|
39
|
-
private actionService: MngActionService,
|
|
40
|
-
private tableviewService: TableviewComponentService<T, S>
|
|
41
|
-
) {
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
ngOnInit() {
|
|
45
|
-
|
|
46
|
-
this.tableviewService.actions = this.actions;
|
|
47
|
-
this.tableviewService.dataProvider = this.dataProvider;
|
|
48
|
-
this.tableviewService.messageService = this.messageService;
|
|
49
|
-
for (const action of this.actions) {
|
|
50
|
-
switch (action.position) {
|
|
51
|
-
case ActionPositionEnum.RowClick:
|
|
52
|
-
this.rowClickActions.push(action);
|
|
53
|
-
break;
|
|
54
|
-
case ActionPositionEnum.RowInline:
|
|
55
|
-
this.rowInlineActions.push(action);
|
|
56
|
-
break;
|
|
57
|
-
case ActionPositionEnum.ToolbarLeft:
|
|
58
|
-
this.toolbarLeftActions.push(action);
|
|
59
|
-
break;
|
|
60
|
-
case ActionPositionEnum.ToolbarRight:
|
|
61
|
-
this.toolbarRightActions.push(action);
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
public reloadTable() {
|
|
68
|
-
this.tableComponent?.reload();
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
public onTableCellClick(event: MngTableCellClickEvent<T>) {
|
|
72
|
-
if (this.rowClickActions.length) {
|
|
73
|
-
for (const action of this.rowClickActions) {
|
|
74
|
-
this.actionService.triggerRowClickAction(action, event, this.route);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|