@mediusinc/mng-commons 4.1.0 → 5.0.0-rc.0-c31d5206
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/assets/i18n/en.json +13 -66
- package/assets/i18n/sl.json +12 -67
- package/data-api/README.md +3 -0
- package/data-api/class-dto/README.md +3 -0
- package/data-api/class-dto/helpers/tableview-crud-create.d.ts +40 -0
- package/data-api/class-dto/index.d.ts +7 -0
- package/data-api/class-dto/models/query-result.model.d.ts +13 -0
- package/data-api/class-dto/obsolete/README.md +3 -0
- package/data-api/class-dto/obsolete/helpers/query-param-convert.d.ts +23 -0
- package/data-api/class-dto/obsolete/helpers/tableview-crud-create.d.ts +22 -0
- package/data-api/class-dto/obsolete/index.d.ts +14 -0
- package/data-api/class-dto/obsolete/models/builders/query-param.builder.d.ts +36 -0
- package/{lib/api → data-api/class-dto/obsolete}/models/filter-param.model.d.ts +1 -1
- package/{lib/api → data-api/class-dto/obsolete}/models/query-param.model.d.ts +1 -1
- package/{lib/api → data-api/class-dto/obsolete}/models/query-result.model.d.ts +1 -1
- package/data-api/class-dto/obsolete/provide.d.ts +9 -0
- package/data-api/class-dto/obsolete/services/api.abstract.service.d.ts +36 -0
- package/{lib/api → data-api/class-dto/obsolete}/services/crud-api.abstract.service.d.ts +20 -5
- package/data-api/class-dto/obsolete/services/get-all-api.abstract.service.d.ts +30 -0
- package/data-api/class-dto/obsolete/tableview/tableview-crud.data-provider.d.ts +28 -0
- package/data-api/class-dto/obsolete/utils/query-param-map.util.d.ts +22 -0
- package/{lib/api/utils/object-serializer.util.d.ts → data-api/class-dto/serder/object-serializer.d.ts} +1 -1
- package/{lib/api → data-api/class-dto}/services/api.abstract.service.d.ts +2 -4
- package/data-api/class-dto/services/crud-api.abstract.service.d.ts +25 -0
- package/data-api/class-dto/services/get-all-api.abstract.service.d.ts +14 -0
- package/data-api/class-dto/tableview/tableview-crud.data-provider.d.ts +17 -0
- package/data-api/helpers/get-all-params.d.ts +69 -0
- package/data-api/helpers/tableview-get-all-params-create.d.ts +14 -0
- package/data-api/index.d.ts +5 -0
- package/data-api/models/request-params.model.d.ts +61 -0
- package/data-api/rxjs/map-to-data-list.operator.d.ts +9 -0
- package/data-api/types/extract-get-all-params.type.d.ts +14 -0
- package/esm2022/data-api/class-dto/helpers/tableview-crud-create.mjs +40 -0
- package/esm2022/data-api/class-dto/index.mjs +13 -0
- package/esm2022/data-api/class-dto/mediusinc-mng-commons-data-api-class-dto.mjs +5 -0
- package/esm2022/data-api/class-dto/models/query-result.model.mjs +24 -0
- package/esm2022/data-api/class-dto/obsolete/helpers/query-param-convert.mjs +103 -0
- package/esm2022/data-api/class-dto/obsolete/helpers/tableview-crud-create.mjs +21 -0
- package/esm2022/data-api/class-dto/obsolete/index.mjs +21 -0
- package/esm2022/data-api/class-dto/obsolete/mediusinc-mng-commons-data-api-class-dto-obsolete.mjs +5 -0
- package/esm2022/data-api/class-dto/obsolete/models/builders/query-param.builder.mjs +83 -0
- package/esm2022/data-api/class-dto/obsolete/models/filter-match-type.model.mjs +27 -0
- package/esm2022/data-api/class-dto/obsolete/models/filter-param.model.mjs +33 -0
- package/esm2022/data-api/class-dto/obsolete/models/query-mode.model.mjs +18 -0
- package/esm2022/data-api/class-dto/obsolete/models/query-param.model.mjs +68 -0
- package/esm2022/data-api/class-dto/obsolete/models/query-result.model.mjs +24 -0
- package/esm2022/data-api/class-dto/obsolete/provide.mjs +40 -0
- package/esm2022/data-api/class-dto/obsolete/services/api.abstract.service.mjs +70 -0
- package/esm2022/data-api/class-dto/obsolete/services/crud-api.abstract.service.mjs +83 -0
- package/esm2022/data-api/class-dto/obsolete/services/get-all-api.abstract.service.mjs +38 -0
- package/esm2022/data-api/class-dto/obsolete/tableview/tableview-crud.data-provider.mjs +51 -0
- package/esm2022/data-api/class-dto/obsolete/utils/query-param-map.util.mjs +57 -0
- package/esm2022/data-api/class-dto/serder/object-serializer.mjs +184 -0
- package/esm2022/data-api/class-dto/services/api.abstract.service.mjs +55 -0
- package/esm2022/data-api/class-dto/services/crud-api.abstract.service.mjs +82 -0
- package/esm2022/data-api/class-dto/services/get-all-api.abstract.service.mjs +49 -0
- package/esm2022/data-api/class-dto/tableview/tableview-crud.data-provider.mjs +49 -0
- package/esm2022/data-api/helpers/get-all-params.mjs +180 -0
- package/esm2022/data-api/helpers/tableview-get-all-params-create.mjs +18 -0
- package/esm2022/data-api/index.mjs +10 -0
- package/esm2022/data-api/mediusinc-mng-commons-data-api.mjs +5 -0
- package/esm2022/data-api/models/request-params.model.mjs +2 -0
- package/esm2022/data-api/rxjs/map-to-data-list.operator.mjs +19 -0
- package/esm2022/data-api/types/extract-get-all-params.type.mjs +2 -0
- package/esm2022/index.mjs +3 -6
- package/esm2022/lib/components/action/action.component.mjs +4 -5
- package/esm2022/lib/components/action/editor/injector-context/action-editor-injector-context.component.mjs +2 -2
- package/esm2022/lib/components/action/models/action-execution.model.mjs +5 -4
- package/esm2022/lib/components/action/route/action-route.component.mjs +1 -2
- package/esm2022/lib/components/action/table/action-table.component.mjs +4 -6
- package/esm2022/lib/components/form/autocomplete/autocomplete.component.mjs +29 -17
- package/esm2022/lib/components/form/dropdown/dropdown.component.mjs +3 -7
- package/esm2022/lib/components/form/formly/fields/formly-field-lookup-dialog/formly-field-lookup-dialog.component.mjs +20 -18
- package/esm2022/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +2 -2
- package/esm2022/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.mjs +23 -12
- package/esm2022/lib/components/table/column-filter-full/column-filter-full.component.mjs +162 -33
- package/esm2022/lib/components/table/column-value/column-value.component.mjs +3 -3
- package/esm2022/lib/components/table/models/table.event.mjs +1 -1
- package/esm2022/lib/components/table/models/table.interface.mjs +1 -1
- package/esm2022/lib/components/table/table-column-filter-class/table-column-filter-class.pipe.mjs +4 -4
- package/esm2022/lib/components/table/table.component.mjs +117 -191
- package/esm2022/lib/components/tableview/actions/tableview-default-actions.mjs +215 -0
- package/esm2022/lib/components/tableview/builders/tableview-builder.mjs +162 -0
- package/esm2022/lib/components/tableview/helpers/tableview-create.mjs +24 -0
- package/esm2022/lib/components/tableview/index.mjs +5 -2
- package/esm2022/lib/components/tableview/models/tableview.model.mjs +2 -0
- package/esm2022/lib/components/tableview/route/tableview-route.component.mjs +7 -39
- package/esm2022/lib/components/tableview/tableview.component.mjs +4 -4
- package/esm2022/lib/data-providers/editor.data-provider.mjs +13 -13
- package/esm2022/lib/data-providers/index.mjs +1 -2
- package/esm2022/lib/data-providers/lookup.data-provider.mjs +1 -1
- package/esm2022/lib/data-providers/table.data-provider.mjs +4 -5
- package/esm2022/lib/data-providers/tableview.data-provider.mjs +1 -1
- package/esm2022/lib/descriptors/action/action-confirmation.descriptor.mjs +1 -1
- package/esm2022/lib/descriptors/action/action-editor.descriptor.mjs +10 -6
- package/esm2022/lib/descriptors/action/action.descriptor.mjs +2 -3
- package/esm2022/lib/descriptors/editor/editor.descriptor.mjs +13 -17
- package/esm2022/lib/descriptors/editor/field-lookup.descriptor.mjs +12 -17
- package/esm2022/lib/descriptors/editor/field.descriptor.mjs +5 -8
- package/esm2022/lib/descriptors/editor/internal/editor-fields.model.mjs +1 -1
- package/esm2022/lib/descriptors/filter/filter-lookup.descriptor.mjs +28 -52
- package/esm2022/lib/descriptors/filter/filter.descriptor.mjs +40 -23
- package/esm2022/lib/descriptors/model/enum.descriptor.mjs +31 -0
- package/esm2022/lib/descriptors/model/index.mjs +3 -1
- package/esm2022/lib/descriptors/model/model.descriptor.mjs +10 -1
- package/esm2022/lib/descriptors/model/type.descriptor.mjs +11 -0
- package/esm2022/lib/descriptors/table/column.descriptor.mjs +12 -107
- package/esm2022/lib/descriptors/table/index.mjs +2 -1
- package/esm2022/lib/descriptors/table/internal/table-columns.model.mjs +1 -1
- package/esm2022/lib/descriptors/table/internal/table.model.mjs +1 -1
- package/esm2022/lib/descriptors/table/sort.descriptor.mjs +45 -0
- package/esm2022/lib/descriptors/table/table.descriptor.mjs +208 -57
- package/esm2022/lib/descriptors/tableview/internal/tableview.model.mjs +1 -1
- package/esm2022/lib/descriptors/tableview/tableview.descriptor.mjs +114 -17
- package/esm2022/lib/descriptors/types/filter.type.mjs +1 -19
- package/esm2022/lib/descriptors/types/table.type.mjs +1 -5
- package/esm2022/lib/error/error.handler.mjs +1 -1
- package/esm2022/lib/helpers/data-provider-executors.mjs +80 -0
- package/esm2022/lib/models/data-list.model.mjs +2 -0
- package/esm2022/lib/models/filter-match.model.mjs +105 -0
- package/esm2022/lib/models/index.mjs +3 -1
- package/esm2022/lib/models/view-container.model.mjs +1 -1
- package/esm2022/lib/pipes/enum.pipe.mjs +6 -6
- package/esm2022/lib/provide.mjs +101 -0
- package/esm2022/lib/registry/type.registry.mjs +3 -10
- package/esm2022/lib/router/models/router.model.mjs +1 -1
- package/esm2022/lib/router/tableview-route-builder.mjs +1 -1
- package/esm2022/lib/services/action/action-executor.service.mjs +54 -32
- package/esm2022/lib/services/commons.service.mjs +1 -37
- package/esm2022/lib/services/data-provider-executor.service.mjs +52 -0
- package/esm2022/lib/services/index.mjs +2 -1
- package/esm2022/lib/services/view/view-container.service.mjs +1 -1
- package/esm2022/lib/types/action-descriptor.types.mjs +1 -1
- package/esm2022/lib/types/type.model.mjs +1 -1
- package/esm2022/lib/utils/data-list-params.util.mjs +416 -0
- package/esm2022/lib/utils/date.util.mjs +8 -2
- package/esm2022/lib/utils/enum.util.mjs +2 -1
- package/esm2022/lib/utils/error.util.mjs +3 -3
- package/esm2022/lib/utils/export.util.mjs +1 -1
- package/esm2022/lib/utils/index.mjs +2 -2
- package/esm2022/lib/utils/route.util.mjs +1 -2
- package/fesm2022/mediusinc-mng-commons-data-api-class-dto-obsolete.mjs +698 -0
- package/fesm2022/mediusinc-mng-commons-data-api-class-dto-obsolete.mjs.map +1 -0
- package/fesm2022/mediusinc-mng-commons-data-api-class-dto.mjs +480 -0
- package/fesm2022/mediusinc-mng-commons-data-api-class-dto.mjs.map +1 -0
- package/fesm2022/mediusinc-mng-commons-data-api.mjs +224 -0
- package/fesm2022/mediusinc-mng-commons-data-api.mjs.map +1 -0
- package/fesm2022/mediusinc-mng-commons.mjs +2634 -2549
- package/fesm2022/mediusinc-mng-commons.mjs.map +1 -1
- package/index.d.ts +2 -4
- package/lib/components/action/action.component.d.ts +13 -13
- package/lib/components/action/models/action-execution.model.d.ts +47 -46
- package/lib/components/action/table/action-table.component.d.ts +15 -16
- package/lib/components/form/autocomplete/autocomplete.component.d.ts +1 -1
- package/lib/components/form/formly/fields/formly-field-lookup-dialog/formly-field-lookup-dialog.component.d.ts +3 -5
- package/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.d.ts +10 -10
- package/lib/components/table/column-filter-full/column-filter-full.component.d.ts +25 -9
- package/lib/components/table/models/table.event.d.ts +2 -2
- package/lib/components/table/models/table.interface.d.ts +4 -1
- package/lib/components/table/table-column-filter-class/table-column-filter-class.pipe.d.ts +2 -2
- package/lib/components/table/table.component.d.ts +19 -18
- package/lib/components/tableview/actions/tableview-default-actions.d.ts +36 -0
- package/lib/components/tableview/builders/tableview-builder.d.ts +115 -0
- package/lib/components/tableview/helpers/tableview-create.d.ts +16 -0
- package/lib/components/tableview/index.d.ts +4 -1
- package/lib/components/tableview/models/tableview.model.d.ts +8 -0
- package/lib/components/tableview/route/tableview-route.component.d.ts +5 -14
- package/lib/components/tableview/tableview.component.d.ts +12 -12
- package/lib/data-providers/editor.data-provider.d.ts +12 -12
- package/lib/data-providers/index.d.ts +0 -1
- package/lib/data-providers/lookup.data-provider.d.ts +2 -2
- package/lib/data-providers/table.data-provider.d.ts +25 -25
- package/lib/data-providers/tableview.data-provider.d.ts +18 -18
- package/lib/descriptors/action/action-confirmation.descriptor.d.ts +1 -1
- package/lib/descriptors/action/action-editor.descriptor.d.ts +20 -17
- package/lib/descriptors/editor/editor.descriptor.d.ts +8 -12
- package/lib/descriptors/editor/field-base.descriptor.d.ts +3 -3
- package/lib/descriptors/editor/field-lookup.descriptor.d.ts +11 -11
- package/lib/descriptors/editor/field-many.descriptor.d.ts +4 -4
- package/lib/descriptors/editor/field.descriptor.d.ts +2 -2
- package/lib/descriptors/editor/internal/editor-fields.model.d.ts +6 -5
- package/lib/descriptors/filter/filter-lookup.descriptor.d.ts +15 -14
- package/lib/descriptors/filter/filter.descriptor.d.ts +17 -18
- package/lib/descriptors/model/enum.descriptor.d.ts +14 -0
- package/lib/descriptors/model/index.d.ts +2 -0
- package/lib/descriptors/model/model.descriptor.d.ts +9 -0
- package/lib/descriptors/model/type.descriptor.d.ts +5 -0
- package/lib/descriptors/table/column.descriptor.d.ts +10 -24
- package/lib/descriptors/table/index.d.ts +1 -0
- package/lib/descriptors/table/internal/table-columns.model.d.ts +36 -5
- package/lib/descriptors/table/internal/table.model.d.ts +5 -2
- package/lib/descriptors/table/sort.descriptor.d.ts +17 -0
- package/lib/descriptors/table/table.descriptor.d.ts +57 -33
- package/lib/descriptors/tableview/internal/tableview.model.d.ts +3 -3
- package/lib/descriptors/tableview/tableview.descriptor.d.ts +49 -19
- package/lib/descriptors/types/filter.type.d.ts +0 -17
- package/lib/descriptors/types/table.type.d.ts +0 -3
- package/lib/error/error.handler.d.ts +1 -1
- package/lib/helpers/data-provider-executors.d.ts +19 -0
- package/lib/models/data-list.model.d.ts +27 -0
- package/lib/models/filter-match.model.d.ts +36 -0
- package/lib/models/index.d.ts +2 -0
- package/lib/models/view-container.model.d.ts +2 -2
- package/lib/pipes/enum.pipe.d.ts +2 -2
- package/lib/provide.d.ts +10 -0
- package/lib/router/models/router.model.d.ts +1 -1
- package/lib/router/tableview-route-builder.d.ts +1 -2
- package/lib/services/action/action-executor.service.d.ts +18 -16
- package/lib/services/data-provider-executor.service.d.ts +60 -0
- package/lib/services/index.d.ts +1 -0
- package/lib/services/view/view-container.service.d.ts +11 -11
- package/lib/types/action-descriptor.types.d.ts +2 -2
- package/lib/types/type.model.d.ts +1 -3
- package/lib/utils/data-list-params.util.d.ts +84 -0
- package/lib/utils/date.util.d.ts +3 -1
- package/lib/utils/enum.util.d.ts +4 -3
- package/lib/utils/export.util.d.ts +1 -1
- package/lib/utils/index.d.ts +1 -1
- package/openapi/angular/modelEnum.mustache +0 -3
- package/package.json +20 -2
- package/esm2022/lib/api/models/builders/query-param.builder.mjs +0 -59
- package/esm2022/lib/api/models/filter-match-type.model.mjs +0 -27
- package/esm2022/lib/api/models/filter-param.model.mjs +0 -33
- package/esm2022/lib/api/models/index.mjs +0 -7
- package/esm2022/lib/api/models/query-mode.model.mjs +0 -18
- package/esm2022/lib/api/models/query-param.model.mjs +0 -68
- package/esm2022/lib/api/models/query-result.model.mjs +0 -35
- package/esm2022/lib/api/services/api.abstract.service.mjs +0 -58
- package/esm2022/lib/api/services/crud-api.abstract.service.mjs +0 -75
- package/esm2022/lib/api/services/get-all-api.abstract.service.mjs +0 -30
- package/esm2022/lib/api/services/index.mjs +0 -4
- package/esm2022/lib/api/utils/index.mjs +0 -3
- package/esm2022/lib/api/utils/medius-rest.util.mjs +0 -293
- package/esm2022/lib/api/utils/object-serializer.util.mjs +0 -185
- package/esm2022/lib/components/tableview/route/tableview-route.abstract.component.mjs +0 -158
- package/esm2022/lib/data-providers/tableview-crud.data-provider.mjs +0 -32
- package/esm2022/lib/provide-commons.mjs +0 -88
- package/esm2022/lib/utils/action-data-provider.util.mjs +0 -171
- package/lib/api/models/builders/query-param.builder.d.ts +0 -13
- package/lib/api/models/index.d.ts +0 -6
- package/lib/api/services/get-all-api.abstract.service.d.ts +0 -14
- package/lib/api/services/index.d.ts +0 -3
- package/lib/api/utils/index.d.ts +0 -2
- package/lib/api/utils/medius-rest.util.d.ts +0 -32
- package/lib/components/tableview/route/tableview-route.abstract.component.d.ts +0 -35
- package/lib/data-providers/tableview-crud.data-provider.d.ts +0 -12
- package/lib/provide-commons.d.ts +0 -3
- package/lib/utils/action-data-provider.util.d.ts +0 -35
- package/templates/tableview-route.component.html +0 -5
- /package/{lib/api → data-api/class-dto/obsolete}/models/filter-match-type.model.d.ts +0 -0
- /package/{lib/api → data-api/class-dto/obsolete}/models/query-mode.model.d.ts +0 -0
|
@@ -0,0 +1,698 @@
|
|
|
1
|
+
import { map } from 'rxjs/operators';
|
|
2
|
+
import { MngInternalError, FilterMatchMode, TableviewDataProviderInst, ModelUtil, TableviewBuilder, TableviewDescriptor, TypeRegistry, CommonsFeatureTypeEnum } from '@mediusinc/mng-commons';
|
|
3
|
+
import { inject, Injector, APP_INITIALIZER } from '@angular/core';
|
|
4
|
+
import { HttpClient, HttpParams } from '@angular/common/http';
|
|
5
|
+
import { ObjectSerializer } from '@mediusinc/mng-commons/data-api/class-dto';
|
|
6
|
+
import { of } from 'rxjs';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Generated API
|
|
10
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
11
|
+
*
|
|
12
|
+
* The version of the OpenAPI document: 1.0
|
|
13
|
+
*
|
|
14
|
+
*
|
|
15
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
16
|
+
* https://openapi-generator.tech
|
|
17
|
+
* Do not edit the class manually.
|
|
18
|
+
*/
|
|
19
|
+
var MediusFilterMatchType;
|
|
20
|
+
(function (MediusFilterMatchType) {
|
|
21
|
+
MediusFilterMatchType["Equals"] = "EQUALS";
|
|
22
|
+
MediusFilterMatchType["NotEquals"] = "NOT_EQUALS";
|
|
23
|
+
MediusFilterMatchType["FromTo"] = "FROM_TO";
|
|
24
|
+
MediusFilterMatchType["Contains"] = "CONTAINS";
|
|
25
|
+
MediusFilterMatchType["StartsWith"] = "STARTS_WITH";
|
|
26
|
+
MediusFilterMatchType["EndsWith"] = "ENDS_WITH";
|
|
27
|
+
MediusFilterMatchType["In"] = "IN";
|
|
28
|
+
MediusFilterMatchType["NotIn"] = "NOT_IN";
|
|
29
|
+
MediusFilterMatchType["SmallerThan"] = "SMALLER_THAN";
|
|
30
|
+
MediusFilterMatchType["GreaterThan"] = "GREATER_THAN";
|
|
31
|
+
MediusFilterMatchType["Exists"] = "EXISTS";
|
|
32
|
+
MediusFilterMatchType["DoesNotExist"] = "DOES_NOT_EXIST";
|
|
33
|
+
})(MediusFilterMatchType || (MediusFilterMatchType = {}));
|
|
34
|
+
|
|
35
|
+
class MediusFilterParam {
|
|
36
|
+
static { this.attributeTypeMap = [
|
|
37
|
+
{
|
|
38
|
+
name: 'property',
|
|
39
|
+
baseName: 'property',
|
|
40
|
+
type: 'string'
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'filterValue',
|
|
44
|
+
baseName: 'filter_value',
|
|
45
|
+
type: 'object'
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: 'filterValueTo',
|
|
49
|
+
baseName: 'filter_value_to',
|
|
50
|
+
type: 'object'
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'filterMatchType',
|
|
54
|
+
baseName: 'filter_match_type',
|
|
55
|
+
type: 'FilterMatchType'
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'filterMatchCaseSensitive',
|
|
59
|
+
baseName: 'filter_match_case_sensitive',
|
|
60
|
+
type: 'boolean'
|
|
61
|
+
}
|
|
62
|
+
]; }
|
|
63
|
+
static getAttributeTypeMap() {
|
|
64
|
+
return MediusFilterParam.attributeTypeMap;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Generated API
|
|
70
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
71
|
+
*
|
|
72
|
+
* The version of the OpenAPI document: 1.0
|
|
73
|
+
*
|
|
74
|
+
*
|
|
75
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
76
|
+
* https://openapi-generator.tech
|
|
77
|
+
* Do not edit the class manually.
|
|
78
|
+
*/
|
|
79
|
+
var MediusQueryMode;
|
|
80
|
+
(function (MediusQueryMode) {
|
|
81
|
+
MediusQueryMode["Count"] = "COUNT";
|
|
82
|
+
MediusQueryMode["Data"] = "DATA";
|
|
83
|
+
MediusQueryMode["All"] = "ALL";
|
|
84
|
+
})(MediusQueryMode || (MediusQueryMode = {}));
|
|
85
|
+
|
|
86
|
+
class MediusQueryParam {
|
|
87
|
+
static { this.attributeTypeMap = [
|
|
88
|
+
{
|
|
89
|
+
name: 'sortProperty',
|
|
90
|
+
baseName: 'sort_property',
|
|
91
|
+
type: 'Array<string>'
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: 'sortAsc',
|
|
95
|
+
baseName: 'sort_asc',
|
|
96
|
+
type: 'Array<boolean>'
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: 'itemsOffset',
|
|
100
|
+
baseName: 'items_offset',
|
|
101
|
+
type: 'number'
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: 'itemsPerPage',
|
|
105
|
+
baseName: 'items_per_page',
|
|
106
|
+
type: 'number'
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: 'filterParams',
|
|
110
|
+
baseName: 'filter_params',
|
|
111
|
+
type: 'Array<FilterParam>'
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: 'filterAllParam',
|
|
115
|
+
baseName: 'filter_all_param',
|
|
116
|
+
type: 'string'
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: 'filterAllProperties',
|
|
120
|
+
baseName: 'filter_all_properties',
|
|
121
|
+
type: 'Array<string>'
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
name: 'validateProperties',
|
|
125
|
+
baseName: 'validate_properties',
|
|
126
|
+
type: 'Array<string>'
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: 'selectInTwoSteps',
|
|
130
|
+
baseName: 'select_in_two_steps',
|
|
131
|
+
type: 'boolean'
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
name: 'sortEnumByOrdinal',
|
|
135
|
+
baseName: 'sort_enum_by_ordinal',
|
|
136
|
+
type: 'boolean'
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: 'groupByProperties',
|
|
140
|
+
baseName: 'group_by_properties',
|
|
141
|
+
type: 'Array<string>'
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: 'queryMode',
|
|
145
|
+
baseName: 'query_mode',
|
|
146
|
+
type: 'QueryMode'
|
|
147
|
+
}
|
|
148
|
+
]; }
|
|
149
|
+
static getAttributeTypeMap() {
|
|
150
|
+
return MediusQueryParam.attributeTypeMap;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
class MediusQueryParamBuilder {
|
|
155
|
+
constructor(queryParam) {
|
|
156
|
+
this.queryParam = queryParam;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Creates a new instance of `MediusQueryParamBuilder` with the specified `itemsPerPage` and `itemsOffset` values.
|
|
160
|
+
*
|
|
161
|
+
* @param {number} [itemsPerPage=50] - The number of items per page.
|
|
162
|
+
* @param {number} [itemsOffset=0] - The offset value for the items.
|
|
163
|
+
*
|
|
164
|
+
* @returns {MediusQueryParamBuilder} A new instance of `MediusQueryParamBuilder`.
|
|
165
|
+
*
|
|
166
|
+
* @deprecated
|
|
167
|
+
*/
|
|
168
|
+
static create(itemsPerPage = 50, itemsOffset = 0) {
|
|
169
|
+
const queryParam = new MediusQueryParam();
|
|
170
|
+
queryParam.itemsPerPage = itemsPerPage;
|
|
171
|
+
queryParam.itemsOffset = itemsOffset;
|
|
172
|
+
queryParam.queryMode = MediusQueryMode.All;
|
|
173
|
+
return new MediusQueryParamBuilder(queryParam);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Creates a new instance of MediusQueryParamBuilder based on an existing MediusQueryParam object.
|
|
177
|
+
*
|
|
178
|
+
* @param {MediusQueryParam} queryParam - The existing MediusQueryParam object to create from.
|
|
179
|
+
* @param {number} [itemsPerPage] - The number of items per page for the new instance. If not provided, default value is used.
|
|
180
|
+
* @param {number} [itemsOffset] - The offset for the new instance. If not provided, default value is used.
|
|
181
|
+
*
|
|
182
|
+
* @returns {MediusQueryParamBuilder} - A new instance of MediusQueryParamBuilder.
|
|
183
|
+
*
|
|
184
|
+
* @deprecated
|
|
185
|
+
*/
|
|
186
|
+
static createFromExisting(queryParam, itemsPerPage, itemsOffset) {
|
|
187
|
+
queryParam.itemsPerPage = itemsPerPage ?? queryParam.itemsPerPage ?? 50;
|
|
188
|
+
queryParam.itemsOffset = itemsOffset ?? queryParam.itemsOffset ?? 0;
|
|
189
|
+
queryParam.queryMode = queryParam.queryMode ?? MediusQueryMode.All;
|
|
190
|
+
return new MediusQueryParamBuilder(queryParam);
|
|
191
|
+
}
|
|
192
|
+
withItemsPerPage(itemsPerPage) {
|
|
193
|
+
this.queryParam.itemsPerPage = itemsPerPage;
|
|
194
|
+
return this;
|
|
195
|
+
}
|
|
196
|
+
withItemsOffset(itemsOffset) {
|
|
197
|
+
this.queryParam.itemsOffset = itemsOffset;
|
|
198
|
+
return this;
|
|
199
|
+
}
|
|
200
|
+
withQueryMode(queryMode) {
|
|
201
|
+
this.queryParam.queryMode = queryMode;
|
|
202
|
+
return this;
|
|
203
|
+
}
|
|
204
|
+
withSort(property, asc = true) {
|
|
205
|
+
if (!this.queryParam.sortProperty || !this.queryParam.sortAsc) {
|
|
206
|
+
this.queryParam.sortProperty = [];
|
|
207
|
+
this.queryParam.sortAsc = [];
|
|
208
|
+
}
|
|
209
|
+
this.queryParam.sortProperty.push(property);
|
|
210
|
+
this.queryParam.sortAsc.push(asc);
|
|
211
|
+
return this;
|
|
212
|
+
}
|
|
213
|
+
withFilter(property, value, valueTo = undefined, matchType = MediusFilterMatchType.Contains, matchCaseSensitive = false) {
|
|
214
|
+
if (!this.queryParam.filterParams) {
|
|
215
|
+
this.queryParam.filterParams = [];
|
|
216
|
+
}
|
|
217
|
+
const filterParam = new MediusFilterParam();
|
|
218
|
+
filterParam.property = property;
|
|
219
|
+
filterParam.filterValue = value;
|
|
220
|
+
filterParam.filterValueTo = valueTo;
|
|
221
|
+
filterParam.filterMatchType = matchType;
|
|
222
|
+
filterParam.filterMatchCaseSensitive = matchCaseSensitive;
|
|
223
|
+
this.queryParam.filterParams.push(filterParam);
|
|
224
|
+
return this;
|
|
225
|
+
}
|
|
226
|
+
build() {
|
|
227
|
+
const queryParam = this.queryParam;
|
|
228
|
+
this.queryParam = new MediusQueryParam();
|
|
229
|
+
return queryParam;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Converts the given DataListParams object to an ObsoleteV1QueryParam object.
|
|
235
|
+
*
|
|
236
|
+
* @param {DataListParams} params - The object to convert.
|
|
237
|
+
* @param {QueryParamMap} map - The configuration object used to map sort and filter properties.
|
|
238
|
+
*
|
|
239
|
+
* @returns The converted ObsoleteV1QueryParam object if params is not null or undefined, otherwise returns undefined.
|
|
240
|
+
*
|
|
241
|
+
* @deprecated
|
|
242
|
+
*/
|
|
243
|
+
function toObsoleteV1QueryParam(params, map) {
|
|
244
|
+
if (!params)
|
|
245
|
+
return undefined;
|
|
246
|
+
const builder = MediusQueryParamBuilder.create();
|
|
247
|
+
if (params.offset !== undefined) {
|
|
248
|
+
builder.withItemsOffset(params.offset);
|
|
249
|
+
}
|
|
250
|
+
if (params.limit !== undefined) {
|
|
251
|
+
builder.withItemsPerPage(params.limit);
|
|
252
|
+
}
|
|
253
|
+
if (Array.isArray(params.sort)) {
|
|
254
|
+
params.sort.forEach(s => builder.withSort(map?.mapSort(s.property) ?? s.property, s.ascending));
|
|
255
|
+
}
|
|
256
|
+
if (typeof params.filters === 'object') {
|
|
257
|
+
Object.entries(params.filters).forEach(([key, value]) => {
|
|
258
|
+
const filter = value;
|
|
259
|
+
if (filter.value != null) {
|
|
260
|
+
const matchMode = filter.matchMode ? toObsoleteV1FilterMatchType(filter.matchMode) : MediusFilterMatchType.Equals;
|
|
261
|
+
let value = undefined;
|
|
262
|
+
let valueTo = undefined;
|
|
263
|
+
if (matchMode === MediusFilterMatchType.FromTo) {
|
|
264
|
+
if (Array.isArray(filter.value)) {
|
|
265
|
+
if (filter.value.length > 0)
|
|
266
|
+
value = filter.value[0];
|
|
267
|
+
if (filter.value.length > 1)
|
|
268
|
+
valueTo = filter.value[1];
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
value = filter.value;
|
|
273
|
+
}
|
|
274
|
+
builder.withFilter(map?.mapFilter(key) ?? key, value, valueTo, matchMode, filter.caseSensitive);
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
return builder.build();
|
|
279
|
+
}
|
|
280
|
+
function toObsoleteV1FilterMatchType(match) {
|
|
281
|
+
switch (match) {
|
|
282
|
+
case FilterMatchMode.Equals:
|
|
283
|
+
return MediusFilterMatchType.Equals;
|
|
284
|
+
case FilterMatchMode.NotEquals:
|
|
285
|
+
return MediusFilterMatchType.NotEquals;
|
|
286
|
+
case FilterMatchMode.Contains:
|
|
287
|
+
return MediusFilterMatchType.Contains;
|
|
288
|
+
case FilterMatchMode.In:
|
|
289
|
+
return MediusFilterMatchType.In;
|
|
290
|
+
case FilterMatchMode.NotIn:
|
|
291
|
+
return MediusFilterMatchType.NotIn;
|
|
292
|
+
case FilterMatchMode.StartsWith:
|
|
293
|
+
return MediusFilterMatchType.StartsWith;
|
|
294
|
+
case FilterMatchMode.EndsWith:
|
|
295
|
+
return MediusFilterMatchType.EndsWith;
|
|
296
|
+
case FilterMatchMode.LessThan:
|
|
297
|
+
return MediusFilterMatchType.SmallerThan;
|
|
298
|
+
case FilterMatchMode.GreaterThan:
|
|
299
|
+
return MediusFilterMatchType.GreaterThan;
|
|
300
|
+
case FilterMatchMode.Between:
|
|
301
|
+
return MediusFilterMatchType.FromTo;
|
|
302
|
+
case FilterMatchMode.Exists:
|
|
303
|
+
return MediusFilterMatchType.Exists;
|
|
304
|
+
case FilterMatchMode.DoesNotExist:
|
|
305
|
+
return MediusFilterMatchType.DoesNotExist;
|
|
306
|
+
case FilterMatchMode.NotContains:
|
|
307
|
+
case FilterMatchMode.LessThanOrEqualTo:
|
|
308
|
+
case FilterMatchMode.GreaterThanOrEqualTo:
|
|
309
|
+
default:
|
|
310
|
+
throw new MngInternalError(`Filter match type '${match}' not supported.`);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Convert a query result from an obsolete API version 1 to a `DataListResult`
|
|
315
|
+
*
|
|
316
|
+
* @param {DataListParams} params - The data list parameters for the query
|
|
317
|
+
* @param {Service} service - The service object used to make the API call
|
|
318
|
+
* @param {function} apiOperation - The API operation function that returns an `Observable<MediusQueryResult<Item>>`
|
|
319
|
+
* @param {any} additionalParams - Additional parameters to pass to the API operation function (optional)
|
|
320
|
+
*
|
|
321
|
+
* @returns {Observable<DataListResult<Item>>} - An observable that emits a `DataListResult` object
|
|
322
|
+
*
|
|
323
|
+
* @deprecated
|
|
324
|
+
*/
|
|
325
|
+
function toObsoleteV1QueryResult(params, service, apiOperation, additionalParams) {
|
|
326
|
+
const queryParam = toObsoleteV1QueryParam(params);
|
|
327
|
+
return apiOperation
|
|
328
|
+
.bind(service)(queryParam, ...(additionalParams ?? []))
|
|
329
|
+
.pipe(map(res => ({ data: res.pageData ?? [], totalCount: res.allDataCount })));
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* A data provider for a CRUD table view that uses an obsolete version 1 API service.
|
|
334
|
+
*
|
|
335
|
+
* @typeparam Model - The type of the data model.
|
|
336
|
+
* @typeparam Service - The type of the API service.
|
|
337
|
+
* @typeparam Sorts - The type for available sort keys on get all operation.
|
|
338
|
+
* @typeparam Filters - The type for available sort keys on get all operation.
|
|
339
|
+
*
|
|
340
|
+
* @deprecated
|
|
341
|
+
*/
|
|
342
|
+
class TableviewCrudObsoleteV1DataProviderInst extends TableviewDataProviderInst {
|
|
343
|
+
constructor(type, serviceType, idPropertyName, useGetAllForFetch = false) {
|
|
344
|
+
super(type, serviceType);
|
|
345
|
+
this.withGetAll((params, service, locale) => service
|
|
346
|
+
.getAllPost(toObsoleteV1QueryParam(params), undefined, locale)
|
|
347
|
+
.pipe(map(res => ({ data: res.pageData ?? [], totalCount: res.allDataCount ?? res.pageData?.length ?? 0 }))));
|
|
348
|
+
if (useGetAllForFetch) {
|
|
349
|
+
const selectedIdPropertyName = idPropertyName ?? ModelUtil.findIdAttribute(type) ?? 'id';
|
|
350
|
+
this.withFetch((id, service) => {
|
|
351
|
+
const qp = MediusQueryParamBuilder.create(10, 0).withFilter(selectedIdPropertyName, id, id, MediusFilterMatchType.Equals, true).build();
|
|
352
|
+
return service.getAllPost(qp).pipe(map(res => res.pageData[0]));
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
else {
|
|
356
|
+
this.withFetch((id, service, locale) => service.getByIdGet(id, undefined, locale));
|
|
357
|
+
}
|
|
358
|
+
this.withCreate((item, service) => service.createPost(item));
|
|
359
|
+
this.withUpdate((id, item, service) => service.updatePut(id, item));
|
|
360
|
+
this.withDelete((id, item, service) => service.removeDelete(id, item));
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
class TableviewCrudObsoleteV1DataProvider extends TableviewCrudObsoleteV1DataProviderInst {
|
|
364
|
+
/**
|
|
365
|
+
* @deprecated
|
|
366
|
+
*/
|
|
367
|
+
static create(type, serviceType, idProperty, useGetAllForFetch = false) {
|
|
368
|
+
return TableviewCrudObsoleteV1DataProvider.createUnsafe(type, serviceType, idProperty, useGetAllForFetch);
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* @deprecated
|
|
372
|
+
*/
|
|
373
|
+
static createUnsafe(type, serviceType, idProperty, useGetAllForFetch = false) {
|
|
374
|
+
return new TableviewCrudObsoleteV1DataProviderInst(type, serviceType, idProperty, useGetAllForFetch);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Creates a tableview with the given class, service based on data API v1 (obsolete) and optional class/model configuration.
|
|
380
|
+
*
|
|
381
|
+
* @param {ClassType<Model>} type - The class representing the model.
|
|
382
|
+
* @param {ServiceClassType<Service>} service - The class type of the service implementing `IMngCrudObsoleteV1ApiService` and `IMngGetAllObsoleteV1ApiService`.
|
|
383
|
+
* @param {{ idProperty?: keyof Model; titleProperty?: keyof Model; i18nBaseKey?: ClassType<any> | string; }} [modelConfig] - Additional optional model configuration.
|
|
384
|
+
* @param {(builder: TableviewBuilder) => void} [buildFn] - The optional callback function to customize the tableview using the prepared builder.
|
|
385
|
+
*
|
|
386
|
+
* @returns {Tableview} - The built table view.
|
|
387
|
+
*
|
|
388
|
+
* @deprecated
|
|
389
|
+
*/
|
|
390
|
+
function tableviewCrudObsoleteV1(type, service, modelConfig, buildFn) {
|
|
391
|
+
const builder = new TableviewBuilder(TableviewDescriptor.fromClass(type, modelConfig?.idProperty, modelConfig?.titleProperty, modelConfig?.i18nBaseKey), TableviewCrudObsoleteV1DataProvider.create(type, service, modelConfig?.idProperty), inject(Injector));
|
|
392
|
+
buildFn?.(builder);
|
|
393
|
+
return builder.build();
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
class MediusQueryResult {
|
|
397
|
+
static fromArray(pageData, allDataCount) {
|
|
398
|
+
const mqr = new MediusQueryResult();
|
|
399
|
+
mqr.allDataCount = allDataCount ?? pageData.length;
|
|
400
|
+
mqr.pageData = pageData;
|
|
401
|
+
return mqr;
|
|
402
|
+
}
|
|
403
|
+
static { this.attributeTypeMap = [
|
|
404
|
+
{
|
|
405
|
+
name: 'allDataCount',
|
|
406
|
+
baseName: 'all_data_count',
|
|
407
|
+
type: 'number'
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
name: 'pageData',
|
|
411
|
+
baseName: 'page_data',
|
|
412
|
+
type: 'Array<T>'
|
|
413
|
+
}
|
|
414
|
+
]; }
|
|
415
|
+
static getAttributeTypeMap() {
|
|
416
|
+
return MediusQueryResult.attributeTypeMap;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* This is an abstract class that provides base functionality for API services.
|
|
422
|
+
*
|
|
423
|
+
* @deprecated
|
|
424
|
+
*/
|
|
425
|
+
class AMngBaseObsoleteV1ApiService {
|
|
426
|
+
constructor() {
|
|
427
|
+
this.objectSerializer = ObjectSerializer.get();
|
|
428
|
+
this.http = inject(HttpClient);
|
|
429
|
+
}
|
|
430
|
+
getUrl(...pathSegments) {
|
|
431
|
+
let baseUrl = this.getBasePath();
|
|
432
|
+
if (baseUrl.endsWith('/')) {
|
|
433
|
+
baseUrl = baseUrl.substring(0, baseUrl.length - 1);
|
|
434
|
+
}
|
|
435
|
+
const serviceBasePath = this.getServiceBasePath();
|
|
436
|
+
let path = [serviceBasePath, ...pathSegments].filter(s => s && s.length).join('/');
|
|
437
|
+
// omit first and last '/'
|
|
438
|
+
if (path.startsWith('/')) {
|
|
439
|
+
path = path.substring(1);
|
|
440
|
+
}
|
|
441
|
+
if (path.endsWith('/')) {
|
|
442
|
+
path = path.substring(0, path.length - 1);
|
|
443
|
+
}
|
|
444
|
+
// replace any double '//' from path that could come from joining paths
|
|
445
|
+
path = path.replace('//', '/');
|
|
446
|
+
return `${baseUrl}/${path}`;
|
|
447
|
+
}
|
|
448
|
+
serializeQueryParam(queryParam, type = 'QueryParam') {
|
|
449
|
+
return this.objectSerializer.serialize(queryParam, type);
|
|
450
|
+
}
|
|
451
|
+
deserializeQueryResult(item, qrType) {
|
|
452
|
+
return this.deserializeClass(item, qrType);
|
|
453
|
+
}
|
|
454
|
+
deserializeClass(item, type) {
|
|
455
|
+
return this.objectSerializer.deserializeClass(item, type);
|
|
456
|
+
}
|
|
457
|
+
deserializeClassArray(item, type) {
|
|
458
|
+
return this.objectSerializer.deserializeClassArray(item, type);
|
|
459
|
+
}
|
|
460
|
+
serializeClass(item, type) {
|
|
461
|
+
return this.objectSerializer.serializeClass(item, type);
|
|
462
|
+
}
|
|
463
|
+
serializeClassArray(item, type) {
|
|
464
|
+
return this.objectSerializer.serializeClassArray(item, type);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Represents an abstract base class for the AMngObsoleteV1ApiService.
|
|
469
|
+
*
|
|
470
|
+
* @typeparam T The main type of data to be handled by the service.
|
|
471
|
+
*
|
|
472
|
+
* @deprecated
|
|
473
|
+
*/
|
|
474
|
+
class AMngObsoleteV1ApiService extends AMngBaseObsoleteV1ApiService {
|
|
475
|
+
constructor(type) {
|
|
476
|
+
super();
|
|
477
|
+
this.type = type;
|
|
478
|
+
}
|
|
479
|
+
deserialize(item) {
|
|
480
|
+
return this.deserializeClass(item, this.type);
|
|
481
|
+
}
|
|
482
|
+
serialize(item) {
|
|
483
|
+
return this.serializeClass(item, this.type);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* An abstract class representing a service for retrieving all obsolete entities.
|
|
489
|
+
*
|
|
490
|
+
* @typeparam T The main type of data to be handled by the service.
|
|
491
|
+
* @typeparam QRT The type of the query result in get all operation.
|
|
492
|
+
*
|
|
493
|
+
* @deprecated
|
|
494
|
+
*/
|
|
495
|
+
class AMngGetAllObsoleteV1ApiService extends AMngObsoleteV1ApiService {
|
|
496
|
+
constructor(type, queryResultType) {
|
|
497
|
+
super(type);
|
|
498
|
+
this.queryResultType = queryResultType;
|
|
499
|
+
}
|
|
500
|
+
getAllPost(queryParamBody, params, locale) {
|
|
501
|
+
const url = this.getUrl(this.getGetAllPostPath());
|
|
502
|
+
if (params && locale) {
|
|
503
|
+
params = params.set('lang', locale);
|
|
504
|
+
}
|
|
505
|
+
else if (locale) {
|
|
506
|
+
params = new HttpParams().set('lang', locale);
|
|
507
|
+
}
|
|
508
|
+
return this.http
|
|
509
|
+
.post(url, queryParamBody ? this.serializeQueryParam(queryParamBody) : undefined, {
|
|
510
|
+
withCredentials: true,
|
|
511
|
+
observe: 'body',
|
|
512
|
+
reportProgress: false,
|
|
513
|
+
params: params
|
|
514
|
+
})
|
|
515
|
+
.pipe(map(res => this.deserializeQueryResult(res, this.queryResultType)));
|
|
516
|
+
}
|
|
517
|
+
getGetAllPostPath() {
|
|
518
|
+
return '/get-all';
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* Abstract class for creating CRUD API service implementation.
|
|
524
|
+
*
|
|
525
|
+
* @typeparam T The type of the entity.
|
|
526
|
+
* @typeparam QRT The type of the query result.
|
|
527
|
+
*
|
|
528
|
+
* @deprecated
|
|
529
|
+
*/
|
|
530
|
+
class AMngCrudObsoleteV1ApiService extends AMngGetAllObsoleteV1ApiService {
|
|
531
|
+
constructor(type, queryResultType) {
|
|
532
|
+
super(type, queryResultType);
|
|
533
|
+
}
|
|
534
|
+
createPost(item, params) {
|
|
535
|
+
const url = this.getUrl(this.getCreatePostPath(item));
|
|
536
|
+
return this.http
|
|
537
|
+
.post(url, this.serialize(item), {
|
|
538
|
+
withCredentials: true,
|
|
539
|
+
observe: 'body',
|
|
540
|
+
reportProgress: false,
|
|
541
|
+
params: params
|
|
542
|
+
})
|
|
543
|
+
.pipe(map(res => this.deserialize(res)));
|
|
544
|
+
}
|
|
545
|
+
getByIdGet(id, params, locale) {
|
|
546
|
+
const url = this.getUrl(this.getGetByIdGetPath(id));
|
|
547
|
+
if (params && locale) {
|
|
548
|
+
params = params.set('lang', locale);
|
|
549
|
+
}
|
|
550
|
+
else if (locale) {
|
|
551
|
+
params = new HttpParams().set('lang', locale);
|
|
552
|
+
}
|
|
553
|
+
return this.http
|
|
554
|
+
.get(url, {
|
|
555
|
+
withCredentials: true,
|
|
556
|
+
observe: 'body',
|
|
557
|
+
reportProgress: false,
|
|
558
|
+
params: params
|
|
559
|
+
})
|
|
560
|
+
.pipe(map(res => this.deserialize(res)));
|
|
561
|
+
}
|
|
562
|
+
updatePut(id, item, params) {
|
|
563
|
+
const url = this.getUrl(this.getUpdatePutPath(id, item));
|
|
564
|
+
return this.http
|
|
565
|
+
.put(url, this.serialize(item), {
|
|
566
|
+
withCredentials: true,
|
|
567
|
+
observe: 'body',
|
|
568
|
+
reportProgress: false,
|
|
569
|
+
params: params
|
|
570
|
+
})
|
|
571
|
+
.pipe(map(res => this.deserialize(res)));
|
|
572
|
+
}
|
|
573
|
+
removeDelete(id, item, params) {
|
|
574
|
+
const url = this.getUrl(this.getRemoveDeletePath(id, item));
|
|
575
|
+
return this.http
|
|
576
|
+
.request('delete', url, {
|
|
577
|
+
withCredentials: true,
|
|
578
|
+
observe: 'body',
|
|
579
|
+
reportProgress: false,
|
|
580
|
+
body: item ? this.serialize(item) : undefined,
|
|
581
|
+
params: params
|
|
582
|
+
})
|
|
583
|
+
.pipe(map(res => (res ? this.deserialize(res) : null)));
|
|
584
|
+
}
|
|
585
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
586
|
+
getCreatePostPath(item) {
|
|
587
|
+
return '';
|
|
588
|
+
}
|
|
589
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
590
|
+
getUpdatePutPath(id, item) {
|
|
591
|
+
return `/${id}`;
|
|
592
|
+
}
|
|
593
|
+
getGetByIdGetPath(id) {
|
|
594
|
+
return `/${id}`;
|
|
595
|
+
}
|
|
596
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
597
|
+
getRemoveDeletePath(id, item) {
|
|
598
|
+
return `/${id}`;
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* A class representing a mapping of query parameters.
|
|
604
|
+
*
|
|
605
|
+
* @typeparam Sorts - The type for available sort keys on get all operation.
|
|
606
|
+
* @typeparam Filters - The type for available sort keys on get all operation.
|
|
607
|
+
*
|
|
608
|
+
* @deprecated
|
|
609
|
+
*/
|
|
610
|
+
class QueryParamMap {
|
|
611
|
+
constructor(_params) {
|
|
612
|
+
this._params = _params;
|
|
613
|
+
this._sorts = {};
|
|
614
|
+
this._filters = {};
|
|
615
|
+
// empty line
|
|
616
|
+
}
|
|
617
|
+
static create() {
|
|
618
|
+
return new QueryParamMap();
|
|
619
|
+
}
|
|
620
|
+
static forParams(params) {
|
|
621
|
+
return new QueryParamMap(params);
|
|
622
|
+
}
|
|
623
|
+
withSortMap(sort, mapTo) {
|
|
624
|
+
this._sorts[sort] = mapTo;
|
|
625
|
+
return this;
|
|
626
|
+
}
|
|
627
|
+
withFilterMap(filter, mapTo) {
|
|
628
|
+
this._filters[filter] = mapTo;
|
|
629
|
+
return this;
|
|
630
|
+
}
|
|
631
|
+
mapSort(sort) {
|
|
632
|
+
return this._sorts[sort] ?? sort;
|
|
633
|
+
}
|
|
634
|
+
mapFilter(filter) {
|
|
635
|
+
return this._filters[filter] ?? filter;
|
|
636
|
+
}
|
|
637
|
+
mapParams() {
|
|
638
|
+
if (!this._params) {
|
|
639
|
+
return undefined;
|
|
640
|
+
}
|
|
641
|
+
const params = {
|
|
642
|
+
offset: this._params.offset,
|
|
643
|
+
limit: this._params.limit,
|
|
644
|
+
search: this._params.search,
|
|
645
|
+
sort: this._params.sort?.map(s => ({ property: this.mapSort(s.property), ascending: s.ascending }))
|
|
646
|
+
};
|
|
647
|
+
if (this._params.filters) {
|
|
648
|
+
params.filters = {};
|
|
649
|
+
Object.entries(this._params.filters).forEach(([key, value]) => {
|
|
650
|
+
params.filters[this.mapFilter(key)] = {
|
|
651
|
+
...value
|
|
652
|
+
};
|
|
653
|
+
});
|
|
654
|
+
}
|
|
655
|
+
return params;
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
function initializeDataApiObsolete(config) {
|
|
660
|
+
return () => {
|
|
661
|
+
const typeRegistry = TypeRegistry.get();
|
|
662
|
+
typeRegistry.registerType(MediusFilterParam, 'FilterParam');
|
|
663
|
+
typeRegistry.registerType(MediusQueryParam, 'QueryParam');
|
|
664
|
+
typeRegistry.registerEnum(MediusFilterMatchType, 'FilterMatchType');
|
|
665
|
+
typeRegistry.registerEnum(MediusQueryMode, 'QueryMode');
|
|
666
|
+
ObjectSerializer.get().configure({ ...(config?.serialization ?? {}) });
|
|
667
|
+
return of(void 0);
|
|
668
|
+
};
|
|
669
|
+
}
|
|
670
|
+
/**
|
|
671
|
+
* Prepares providers for usage of the Obsolete Data API functionalities.
|
|
672
|
+
*
|
|
673
|
+
* @returns {CommonsFeature} The `CommonsFeature` object with the Data API Obsolete configuration.
|
|
674
|
+
*
|
|
675
|
+
* @deprecated.
|
|
676
|
+
*/
|
|
677
|
+
function withDataApiObsolete() {
|
|
678
|
+
return {
|
|
679
|
+
type: CommonsFeatureTypeEnum.DataApiObsolete,
|
|
680
|
+
providers: [
|
|
681
|
+
{
|
|
682
|
+
provide: APP_INITIALIZER,
|
|
683
|
+
useFactory: initializeDataApiObsolete,
|
|
684
|
+
deps: [],
|
|
685
|
+
multi: true
|
|
686
|
+
}
|
|
687
|
+
]
|
|
688
|
+
};
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
// helpers
|
|
692
|
+
|
|
693
|
+
/**
|
|
694
|
+
* Generated bundle index. Do not edit.
|
|
695
|
+
*/
|
|
696
|
+
|
|
697
|
+
export { AMngBaseObsoleteV1ApiService, AMngCrudObsoleteV1ApiService, AMngGetAllObsoleteV1ApiService, AMngObsoleteV1ApiService, MediusFilterMatchType, MediusFilterParam, MediusQueryMode, MediusQueryParam, MediusQueryParamBuilder, MediusQueryResult, QueryParamMap, TableviewCrudObsoleteV1DataProvider, TableviewCrudObsoleteV1DataProviderInst, tableviewCrudObsoleteV1, toObsoleteV1FilterMatchType, toObsoleteV1QueryParam, toObsoleteV1QueryResult, withDataApiObsolete };
|
|
698
|
+
//# sourceMappingURL=mediusinc-mng-commons-data-api-class-dto-obsolete.mjs.map
|