@mediusinc/mng-commons 5.5.0-rc.4 → 6.0.0-rc.2
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/core/action/action-parameters.model.d.ts +4 -4
- package/core/data-providers/base.data-provider.d.ts +4 -7
- package/core/data-providers/lookup.data-provider.d.ts +2 -2
- package/core/descriptors/model.descriptor.d.ts +1 -7
- package/core/descriptors/tableview.descriptor.d.ts +5 -5
- package/core/helpers/route.d.ts +0 -1
- package/core/helpers/type-helpers.d.ts +8 -0
- package/core/index.d.ts +0 -3
- package/core/models/menu.model.d.ts +0 -4
- package/core/services/commons.service.d.ts +0 -32
- package/core/services/tokens/module-config.token.d.ts +0 -28
- package/esm2022/core/action/action-parameters.model.mjs +1 -1
- package/esm2022/core/data-providers/base.data-provider.mjs +2 -4
- package/esm2022/core/data-providers/lookup.data-provider.mjs +1 -1
- package/esm2022/core/descriptors/model.descriptor.mjs +1 -1
- package/esm2022/core/descriptors/tableview.descriptor.mjs +1 -1
- package/esm2022/core/helpers/type-helpers.mjs +1 -1
- package/esm2022/core/index.mjs +1 -4
- package/esm2022/core/models/menu.model.mjs +1 -1
- package/esm2022/core/services/commons.service.mjs +1 -34
- package/esm2022/core/services/tokens/module-config.token.mjs +1 -1
- package/esm2022/filter/descriptors/filter-lookup.descriptor.mjs +5 -86
- package/esm2022/filter/descriptors/filter.descriptor.mjs +7 -29
- package/esm2022/form/api/data-providers/lookup-data-provider.factory.mjs +14 -41
- package/esm2022/form/api/data-providers/lookup.data-provider.mjs +3 -3
- package/esm2022/model/class/data-providers/base-from-class-data-provider.factory.mjs +5 -0
- package/esm2022/model/class/descriptors/model-class.descriptor.mjs +28 -0
- package/esm2022/model/class/descriptors/type-class.descriptor.mjs +6 -0
- package/esm2022/model/class/helpers/model.mjs +53 -0
- package/esm2022/model/class/index.mjs +8 -0
- package/esm2022/model/class/mediusinc-mng-commons-model-class.mjs +5 -0
- package/esm2022/model/data-providers/base-from-type-data-provider.factory.mjs +11 -6
- package/esm2022/model/descriptors/model.descriptor.mjs +11 -54
- package/esm2022/model/descriptors/type.descriptor.mjs +2 -10
- package/esm2022/model/index.mjs +1 -2
- package/esm2022/table/api/class/class-table-attribute-converter.mjs +80 -0
- package/esm2022/table/api/class/class-table-attribute.model.mjs +2 -0
- package/esm2022/table/api/class/class-table-data-provider.factory.mjs +5 -0
- package/esm2022/table/api/class/class-table-descriptor-helpers.mjs +99 -0
- package/esm2022/table/api/class/class-table-descriptor.factory.mjs +21 -0
- package/esm2022/table/api/class/index.mjs +6 -0
- package/esm2022/table/api/class/mediusinc-mng-commons-table-api-class.mjs +5 -0
- package/esm2022/table/api/data-providers/table-data-provider.factory.mjs +14 -41
- package/esm2022/table/api/data-providers/table.data-provider.mjs +3 -9
- package/esm2022/table/api/descriptors/column.descriptor.mjs +8 -3
- package/esm2022/table/api/descriptors/table-descriptor.factory.mjs +10 -77
- package/esm2022/table/api/descriptors/table.descriptor.mjs +3 -3
- package/esm2022/table/api/helpers/column-converter.mjs +25 -0
- package/esm2022/table/api/helpers/table-data-provider-descriptor-convert.mjs +4 -4
- package/esm2022/table/api/index.mjs +2 -4
- package/esm2022/table/api/models/table-columns.model.mjs +1 -1
- package/esm2022/table/components/column-value/column-value.component.mjs +4 -3
- package/esm2022/table/components/filter/filter-active-tag/filter-active-tag.component.mjs +3 -3
- package/esm2022/table/components/filter/filter-form/filter-form.component.mjs +5 -5
- package/esm2022/table/components/table/table.component.mjs +6 -8
- package/esm2022/tableview/action/components/action/action.component.mjs +1 -1
- package/esm2022/tableview/action/components/editor/injector-context/action-editor-injector-context.component.mjs +10 -6
- package/esm2022/tableview/action/helpers/action-execution.mjs +1 -1
- package/esm2022/tableview/action/models/execution/action-context.model.mjs +1 -1
- package/esm2022/tableview/action/models/execution/action-instance.model.mjs +1 -1
- package/esm2022/tableview/action/services/action-executor.service.mjs +11 -11
- package/esm2022/tableview/action/services/data-provider-executor.service.mjs +18 -3
- package/esm2022/tableview/api/action/descriptors/action-confirmation.descriptor.mjs +1 -1
- package/esm2022/tableview/api/action/descriptors/action-descriptor.factory.mjs +13 -104
- package/esm2022/tableview/api/action/descriptors/action-editor-descriptor.factory.mjs +15 -62
- package/esm2022/tableview/api/action/descriptors/action-editor.descriptor.mjs +3 -63
- package/esm2022/tableview/api/action/descriptors/action-link-descriptor.factory.mjs +17 -30
- package/esm2022/tableview/api/action/descriptors/action-link.descriptor.mjs +1 -1
- package/esm2022/tableview/api/action/descriptors/action.descriptor.mjs +6 -29
- package/esm2022/tableview/api/action/descriptors/editor-action-descriptor.factory.mjs +21 -0
- package/esm2022/tableview/api/action/descriptors/editor-action-editor-descriptor.factory.mjs +21 -0
- package/esm2022/tableview/api/action/descriptors/table-action-descriptor.factory.mjs +37 -0
- package/esm2022/tableview/api/action/descriptors/table-action-editor-descriptor.factory.mjs +40 -0
- package/esm2022/tableview/api/action/helpers/data-provider-executors.mjs +25 -5
- package/esm2022/tableview/api/action/models/action-descriptor.types.mjs +1 -1
- package/esm2022/tableview/api/action/models/action-error.model.mjs +1 -1
- package/esm2022/tableview/api/action/models/execution/action-context-validation.model.mjs +1 -1
- package/esm2022/tableview/api/action/models/execution/action-context.model.mjs +1 -1
- package/esm2022/tableview/api/action/models/execution/action-instance.model.mjs +1 -1
- package/esm2022/tableview/api/action/models/tableview-action-default-categories.model.mjs +6 -6
- package/esm2022/tableview/api/action/services/data-provider-executor.service.mjs +3 -3
- package/esm2022/tableview/api/class/editor/class-editor-attribute-converter.mjs +85 -0
- package/esm2022/tableview/api/class/editor/class-editor-attribute.model.mjs +2 -0
- package/esm2022/tableview/api/class/editor/class-editor-data-provider.factory.mjs +5 -0
- package/esm2022/tableview/api/class/editor/class-editor-descriptor-helpers.mjs +95 -0
- package/esm2022/tableview/api/class/editor/class-editor-descriptor.factory.mjs +21 -0
- package/esm2022/tableview/api/class/index.mjs +13 -0
- package/esm2022/tableview/api/class/mediusinc-mng-commons-tableview-api-class.mjs +5 -0
- package/esm2022/tableview/api/class/tableview/class-tableview-attribute-converter.mjs +35 -0
- package/esm2022/tableview/api/class/tableview/class-tableview-attribute.model.mjs +2 -0
- package/esm2022/tableview/api/class/tableview/class-tableview-data-provider.factory.mjs +5 -0
- package/esm2022/tableview/api/class/tableview/class-tableview-descriptor-helpers.mjs +111 -0
- package/esm2022/tableview/api/class/tableview/class-tableview-descriptor.factory.mjs +26 -0
- package/esm2022/tableview/api/editor/data-providers/editor-data-provider.factory.mjs +14 -32
- package/esm2022/tableview/api/editor/data-providers/editor.data-provider.mjs +40 -7
- package/esm2022/tableview/api/editor/descriptors/editor-descriptor.factory.mjs +7 -73
- package/esm2022/tableview/api/editor/descriptors/editor.descriptor.mjs +49 -134
- package/esm2022/tableview/api/editor/descriptors/field-base.descriptor.mjs +11 -2
- package/esm2022/tableview/api/editor/descriptors/field-lookup.descriptor.mjs +3 -5
- package/esm2022/tableview/api/editor/descriptors/field-many.descriptor.mjs +2 -18
- package/esm2022/tableview/api/editor/descriptors/wrappers/editor-descriptor-nested-object-wrapper.mjs +51 -0
- package/esm2022/tableview/api/editor/models/editor-fields.model.mjs +1 -1
- package/esm2022/tableview/api/editor/models/form-editor.event.mjs +1 -1
- package/esm2022/tableview/api/index.mjs +8 -8
- package/esm2022/tableview/api/tableview/data-providers/tableview-data-provider.factory.mjs +13 -51
- package/esm2022/tableview/api/tableview/data-providers/tableview.data-provider.mjs +19 -11
- package/esm2022/tableview/api/tableview/descriptors/tableview-descriptor.factory.mjs +19 -96
- package/esm2022/tableview/api/tableview/descriptors/tableview.descriptor.mjs +29 -182
- package/esm2022/tableview/api/tableview/helpers/tableview-create.mjs +8 -6
- package/esm2022/tableview/api/tableview/helpers/tableview-data-provider-descriptor-convert.mjs +4 -4
- package/esm2022/tableview/api/tableview/helpers/tableview-default-actions.mjs +117 -99
- package/esm2022/tableview/api/tableview/helpers/tableview-input-builder.mjs +164 -7
- package/esm2022/tableview/api/tableview/models/tableview-descriptor-fields-manage-helper.type.mjs +2 -0
- package/esm2022/tableview/api/tableview/models/tableview-descriptor-helper.type.mjs +2 -0
- package/esm2022/tableview/api/tableview/models/tableview-input.model.mjs +1 -1
- package/esm2022/tableview/api/tableview/models/tableview-route.model.mjs +1 -1
- package/esm2022/tableview/editor/components/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +6 -6
- package/esm2022/tableview/editor/helpers/editor-field.mjs +3 -3
- package/esm2022/tableview/editor/helpers/editor-formly.mjs +4 -4
- package/esm2022/tableview/editor/helpers/field-create.mjs +21 -0
- package/esm2022/tableview/index.mjs +3 -2
- package/esm2022/tableview/tableview/components/route/tableview-route.component.mjs +1 -1
- package/esm2022/tableview/tableview/components/tableview/tableview.component.mjs +3 -1
- package/fesm2022/mediusinc-mng-commons-core.mjs +687 -781
- package/fesm2022/mediusinc-mng-commons-core.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-filter.mjs +10 -113
- package/fesm2022/mediusinc-mng-commons-filter.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-form-api.mjs +15 -42
- package/fesm2022/mediusinc-mng-commons-form-api.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-model-class.mjs +97 -0
- package/fesm2022/mediusinc-mng-commons-model-class.mjs.map +1 -0
- package/fesm2022/mediusinc-mng-commons-model.mjs +23 -137
- package/fesm2022/mediusinc-mng-commons-model.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-table-api-class.mjs +204 -0
- package/fesm2022/mediusinc-mng-commons-table-api-class.mjs.map +1 -0
- package/fesm2022/mediusinc-mng-commons-table-api.mjs +55 -319
- package/fesm2022/mediusinc-mng-commons-table-api.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-table.mjs +14 -15
- package/fesm2022/mediusinc-mng-commons-table.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-tableview-api-class.mjs +367 -0
- package/fesm2022/mediusinc-mng-commons-tableview-api-class.mjs.map +1 -0
- package/fesm2022/mediusinc-mng-commons-tableview-api.mjs +715 -1298
- package/fesm2022/mediusinc-mng-commons-tableview-api.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-tableview.mjs +67 -27
- package/fesm2022/mediusinc-mng-commons-tableview.mjs.map +1 -1
- package/filter/descriptors/filter-lookup.descriptor.d.ts +1 -26
- package/filter/descriptors/filter.descriptor.d.ts +5 -12
- package/form/api/data-providers/lookup-data-provider.factory.d.ts +17 -20
- package/form/api/data-providers/lookup.data-provider.d.ts +3 -3
- package/model/class/README.md +8 -0
- package/model/class/data-providers/base-from-class-data-provider.factory.d.ts +3 -0
- package/model/class/descriptors/model-class.descriptor.d.ts +12 -0
- package/model/class/descriptors/type-class.descriptor.d.ts +3 -0
- package/model/{helpers → class/helpers}/model.d.ts +1 -2
- package/model/class/index.d.ts +4 -0
- package/model/data-providers/base-from-type-data-provider.factory.d.ts +13 -6
- package/model/descriptors/model.descriptor.d.ts +12 -27
- package/model/descriptors/type.descriptor.d.ts +0 -5
- package/model/index.d.ts +0 -1
- package/package.json +25 -7
- package/table/api/class/README.md +10 -0
- package/table/api/{helpers/class-attribute-converter.d.ts → class/class-table-attribute-converter.d.ts} +2 -9
- package/table/api/{models → class}/class-table-attribute.model.d.ts +1 -1
- package/table/api/class/class-table-data-provider.factory.d.ts +4 -0
- package/table/api/{helpers/table-descriptor-helpers.d.ts → class/class-table-descriptor-helpers.d.ts} +2 -4
- package/table/api/class/class-table-descriptor.factory.d.ts +11 -0
- package/table/api/class/index.d.ts +5 -0
- package/table/api/data-providers/table-data-provider.factory.d.ts +17 -20
- package/table/api/data-providers/table.data-provider.d.ts +4 -12
- package/table/api/descriptors/column.descriptor.d.ts +5 -2
- package/table/api/descriptors/table-descriptor.factory.d.ts +3 -39
- package/table/api/descriptors/table.descriptor.d.ts +3 -3
- package/table/api/helpers/column-converter.d.ts +7 -0
- package/table/api/helpers/table-data-provider-descriptor-convert.d.ts +3 -3
- package/table/api/index.d.ts +1 -3
- package/table/api/models/table-columns.model.d.ts +2 -2
- package/table/components/column-value/column-value.component.d.ts +1 -0
- package/table/components/filter/filter-active-tag/filter-active-tag.component.d.ts +1 -1
- package/table/components/filter/filter-form/filter-form.component.d.ts +1 -1
- package/table/components/filter/filter-overlay-with-tag/filter-overlay-with-tag.component.d.ts +1 -1
- package/table/components/table/table.component.d.ts +0 -9
- package/tableview/action/components/action/action.component.d.ts +2 -2
- package/tableview/action/components/editor/action-editor.component.d.ts +1 -1
- package/tableview/action/components/editor/injector-context/action-editor-injector-context.component.d.ts +6 -5
- package/tableview/action/components/localization/data-language-dropdown.component.d.ts +3 -3
- package/tableview/action/components/table/action-table.component.d.ts +3 -3
- package/tableview/action/helpers/action-execution.d.ts +1 -1
- package/tableview/action/models/execution/action-context.model.d.ts +3 -3
- package/tableview/action/models/execution/action-instance.model.d.ts +5 -5
- package/tableview/action/services/action-executor.service.d.ts +7 -7
- package/tableview/action/services/data-provider-executor.service.d.ts +16 -16
- package/tableview/action/services/view-container.service.d.ts +1 -1
- package/tableview/api/action/descriptors/action-confirmation.descriptor.d.ts +1 -1
- package/tableview/api/action/descriptors/action-descriptor.factory.d.ts +20 -31
- package/tableview/api/action/descriptors/action-editor-descriptor.factory.d.ts +18 -25
- package/tableview/api/action/descriptors/action-editor.descriptor.d.ts +22 -40
- package/tableview/api/action/descriptors/action-link-descriptor.factory.d.ts +21 -13
- package/tableview/api/action/descriptors/action-link.descriptor.d.ts +3 -3
- package/tableview/api/action/descriptors/action.descriptor.d.ts +31 -33
- package/tableview/api/action/descriptors/editor-action-descriptor.factory.d.ts +21 -0
- package/tableview/api/action/descriptors/editor-action-editor-descriptor.factory.d.ts +21 -0
- package/tableview/api/action/descriptors/table-action-descriptor.factory.d.ts +36 -0
- package/tableview/api/action/descriptors/table-action-editor-descriptor.factory.d.ts +40 -0
- package/tableview/api/action/helpers/data-provider-executors.d.ts +13 -8
- package/tableview/api/action/models/action-descriptor.types.d.ts +2 -2
- package/tableview/api/action/models/action-error.model.d.ts +1 -1
- package/tableview/api/action/models/execution/action-context-validation.model.d.ts +2 -2
- package/tableview/api/action/models/execution/action-context.model.d.ts +2 -2
- package/tableview/api/action/models/execution/action-instance.model.d.ts +1 -1
- package/tableview/api/action/models/tableview-action-default-categories.model.d.ts +5 -5
- package/tableview/api/action/services/data-provider-executor.service.d.ts +26 -25
- package/tableview/api/class/README.md +13 -0
- package/tableview/api/{editor/helpers/class-attribute-converter.d.ts → class/editor/class-editor-attribute-converter.d.ts} +2 -2
- package/tableview/api/{editor/models/class-tableview-attribute.model.d.ts → class/editor/class-editor-attribute.model.d.ts} +1 -1
- package/tableview/api/class/editor/class-editor-data-provider.factory.d.ts +4 -0
- package/tableview/api/{editor/helpers/editor-descriptor-helpers.d.ts → class/editor/class-editor-descriptor-helpers.d.ts} +2 -5
- package/tableview/api/class/editor/class-editor-descriptor.factory.d.ts +11 -0
- package/tableview/api/class/index.d.ts +10 -0
- package/tableview/api/{tableview/helpers/class-attribute-converter.d.ts → class/tableview/class-tableview-attribute-converter.d.ts} +1 -1
- package/tableview/api/{tableview/models → class/tableview}/class-tableview-attribute.model.d.ts +2 -2
- package/tableview/api/class/tableview/class-tableview-data-provider.factory.d.ts +4 -0
- package/tableview/api/{tableview/helpers/tableview-descriptor-helpers.d.ts → class/tableview/class-tableview-descriptor-helpers.d.ts} +1 -2
- package/tableview/api/class/tableview/class-tableview-descriptor.factory.d.ts +12 -0
- package/tableview/api/editor/data-providers/editor-data-provider.factory.d.ts +17 -16
- package/tableview/api/editor/data-providers/editor.data-provider.d.ts +64 -29
- package/tableview/api/editor/descriptors/editor-descriptor.factory.d.ts +5 -38
- package/tableview/api/editor/descriptors/editor.descriptor.d.ts +48 -112
- package/tableview/api/editor/descriptors/field-base.descriptor.d.ts +8 -1
- package/tableview/api/editor/descriptors/field-lookup.descriptor.d.ts +2 -3
- package/tableview/api/editor/descriptors/field-many.descriptor.d.ts +3 -11
- package/tableview/api/editor/descriptors/wrappers/editor-descriptor-nested-object-wrapper.d.ts +25 -0
- package/tableview/api/editor/models/editor-fields.model.d.ts +25 -21
- package/tableview/api/editor/models/form-editor.event.d.ts +0 -4
- package/tableview/api/index.d.ts +7 -6
- package/tableview/api/tableview/data-providers/tableview-data-provider.factory.d.ts +20 -25
- package/tableview/api/tableview/data-providers/tableview.data-provider.d.ts +22 -22
- package/tableview/api/tableview/descriptors/tableview-descriptor.factory.d.ts +20 -50
- package/tableview/api/tableview/descriptors/tableview.descriptor.d.ts +69 -163
- package/tableview/api/tableview/helpers/tableview-create.d.ts +18 -5
- package/tableview/api/tableview/helpers/tableview-data-provider-descriptor-convert.d.ts +2 -2
- package/tableview/api/tableview/helpers/tableview-default-actions.d.ts +73 -20
- package/tableview/api/tableview/helpers/tableview-input-builder.d.ts +87 -9
- package/tableview/api/tableview/models/tableview-descriptor-fields-manage-helper.type.d.ts +9 -0
- package/tableview/api/tableview/models/tableview-descriptor-helper.type.d.ts +2 -0
- package/tableview/api/tableview/models/tableview-input.model.d.ts +1 -1
- package/tableview/api/tableview/models/tableview-route.model.d.ts +1 -1
- package/tableview/editor/helpers/field-create.d.ts +9 -0
- package/tableview/index.d.ts +2 -1
- package/tableview/tableview/components/route/tableview-route.component.d.ts +1 -1
- package/tableview/tableview/components/tableview/tableview.component.d.ts +6 -6
- package/version-info.json +5 -5
- package/core/components/pages/error/error.page.component.d.ts +0 -11
- package/core/components/pages/not-found/not-found.page.component.d.ts +0 -11
- package/core/data-providers/base-data-provider.factory.d.ts +0 -13
- package/esm2022/core/components/pages/error/error.page.component.mjs +0 -24
- package/esm2022/core/components/pages/not-found/not-found.page.component.mjs +0 -24
- package/esm2022/core/data-providers/base-data-provider.factory.mjs +0 -28
- package/esm2022/model/helpers/model.mjs +0 -71
- package/esm2022/table/api/helpers/class-attribute-converter.mjs +0 -104
- package/esm2022/table/api/helpers/table-descriptor-helpers.mjs +0 -98
- package/esm2022/table/api/models/class-table-attribute.model.mjs +0 -2
- package/esm2022/tableview/api/editor/helpers/class-attribute-converter.mjs +0 -85
- package/esm2022/tableview/api/editor/helpers/editor-descriptor-helpers.mjs +0 -95
- package/esm2022/tableview/api/editor/models/class-tableview-attribute.model.mjs +0 -2
- package/esm2022/tableview/api/tableview/helpers/class-attribute-converter.mjs +0 -34
- package/esm2022/tableview/api/tableview/helpers/tableview-descriptor-helpers.mjs +0 -110
- package/esm2022/tableview/api/tableview/models/class-tableview-attribute.model.mjs +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mediusinc-mng-commons-table-api-class.mjs","sources":["../../table/api/class/src/class-table-attribute-converter.ts","../../table/api/class/src/class-table-data-provider.factory.ts","../../table/api/class/src/class-table-descriptor-helpers.ts","../../table/api/class/src/class-table-descriptor.factory.ts","../../table/api/class/src/mediusinc-mng-commons-table-api-class.ts"],"sourcesContent":["import {ClassAttributeDef, ClassType, CommonsInternalError, EnumType, TypeRegistry} from '@mediusinc/mng-commons/core';\nimport {ColumnDisplayTypeEnum, ColumnTypeEnum} from '@mediusinc/mng-commons/table/api';\n\nimport {TableClassAttributeDef} from './class-table-attribute.model';\n\n/**\n * converts string type to column type enum, default is string\n * @param attributeType\n */\nexport function getColumnTypeFromClassAttributeDefType(attributeType: string): ColumnTypeEnum {\n const typeRegistry = TypeRegistry.get();\n if (typeRegistry.findEnum(attributeType) as EnumType) {\n attributeType = 'enum';\n } else if (typeRegistry.findType(attributeType) as ClassType<any>) {\n attributeType = 'class';\n }\n\n switch (attributeType.toLowerCase()) {\n case 'number':\n case 'currency':\n return ColumnTypeEnum.Number;\n case 'boolean':\n return ColumnTypeEnum.Boolean;\n case 'date':\n return ColumnTypeEnum.Date;\n case 'enum':\n return ColumnTypeEnum.Enum;\n case 'custom':\n return ColumnTypeEnum.Custom;\n case 'class':\n return ColumnTypeEnum.String;\n case 'string':\n default:\n return ColumnTypeEnum.String;\n }\n}\n\nexport function getColumnDisplayTypeFromColumnType(columnType: ColumnTypeEnum, attributeType: string): ColumnDisplayTypeEnum {\n switch (columnType) {\n case ColumnTypeEnum.Number:\n return attributeType === 'currency' ? ColumnDisplayTypeEnum.Currency : ColumnDisplayTypeEnum.Number;\n case ColumnTypeEnum.Boolean:\n return ColumnDisplayTypeEnum.Boolean;\n case ColumnTypeEnum.Date:\n return ColumnDisplayTypeEnum.Date;\n case ColumnTypeEnum.Enum:\n return ColumnDisplayTypeEnum.Enum;\n case ColumnTypeEnum.Custom:\n return ColumnDisplayTypeEnum.Component;\n case ColumnTypeEnum.String:\n default:\n return ColumnDisplayTypeEnum.String;\n }\n}\n\nexport function expandClassAttributeDefWithTableDef(attributes?: Array<ClassAttributeDef> | null): TableClassAttributeDef[] {\n if (!attributes) {\n throw new CommonsInternalError('Class attribute definition is null, problem with TypeRegistry::findAttributesDefinitionByClassType?', {name: 'TableviewUtilsError'});\n }\n\n const typeRegistry = TypeRegistry.get();\n const tableClassAttributeDef: TableClassAttributeDef[] = [];\n for (const attribute of attributes) {\n const enumType = typeRegistry.findEnum(attribute.type);\n const columnType = enumType ? ColumnTypeEnum.Enum : getColumnTypeFromClassAttributeDefType(attribute.type);\n tableClassAttributeDef.push({\n name: attribute.name,\n baseName: attribute.baseName,\n type: attribute.type,\n subtype: attribute.subtype,\n columnType: enumType ? ColumnTypeEnum.Enum : getColumnTypeFromClassAttributeDefType(attribute.type),\n columnDisplayType: getColumnDisplayTypeFromColumnType(columnType, attribute.type),\n enumType: typeRegistry.findEnum(attribute.type) as EnumType,\n classType: typeRegistry.findType(attribute.type) as ClassType<any>\n });\n }\n\n return tableClassAttributeDef;\n}\n\n/**\n * returns attributes from class type and extends to typed def with column and field enum type\n * @param type class type\n */\nexport function getTableClassAttributeDef<T>(type: ClassType<T>): TableClassAttributeDef[] {\n return expandClassAttributeDefWithTableDef(TypeRegistry.get().findAttributesDefinitionByClassType(type));\n}\n","import {ClassType, ServiceClassType} from '@mediusinc/mng-commons/core';\nimport {TableDataProviderInst} from '@mediusinc/mng-commons/table/api';\n\nexport function tableDataProviderFromClass<Model, Sorts = keyof Model, Filters extends keyof any = keyof Model>(\n type: ClassType<Model>\n): TableDataProviderInst<Model, undefined, Sorts, Filters, undefined>;\nexport function tableDataProviderFromClass<Model, Service = any, Sorts = keyof Model, Filters extends keyof any = keyof Model>(\n type: ClassType<Model>,\n serviceType: ServiceClassType<Service>\n): TableDataProviderInst<Model, Service, Sorts, Filters, ServiceClassType<Service>>;\nexport function tableDataProviderFromClass<Model, Service = any, Sorts = keyof Model, Filters extends keyof any = keyof Model, ServiceClass = ServiceClassType<Service>>(\n type: ClassType<Model>,\n serviceType?: ServiceClass\n) {\n return new TableDataProviderInst<Model, Service, Sorts, Filters, ServiceClass>(serviceType as ServiceClass);\n}\n","import {CommonsInternalError, EnumType, ILookupDataProvider, TypeRegistry} from '@mediusinc/mng-commons/core';\nimport {FilterLookupDescriptor} from '@mediusinc/mng-commons/filter';\nimport {EnumDescriptor, enumModelGeneric} from '@mediusinc/mng-commons/model';\nimport {ModelClassDescriptor, findClassTitleAttribute} from '@mediusinc/mng-commons/model/class';\nimport {ColumnDescriptor, ColumnDisplayTypeEnum, ColumnTypeEnum, TableDescriptorInst} from '@mediusinc/mng-commons/table/api';\n\nimport {getTableClassAttributeDef} from './class-table-attribute-converter';\nimport {TableClassAttributeDef} from './class-table-attribute.model';\n\n/**\n * generates column based on attributes\n * @param desc Table descriptor\n * @param attribute attribute map\n * @param column if provided, replaced by new, otherwise new is created\n * @param args additional parameters\n */\nexport function upsertTableColumnFromAttributeDef<ColumnModel, TableModel>(\n desc: TableDescriptorInst<TableModel, any, any>,\n attribute: TableClassAttributeDef,\n column?: ColumnDescriptor<ColumnModel, TableModel>,\n ...args: any[]\n): ColumnDescriptor<ColumnModel, TableModel> {\n if (column == null) {\n column = desc.addColumnUnsafe(attribute.name);\n }\n\n if (attribute.columnType === ColumnTypeEnum.Enum && args.length === 0 && attribute.enumType) {\n args = [enumModelGeneric(attribute.enumType)];\n }\n\n column = column.asType(attribute.columnType, attribute.columnDisplayType, ...args);\n if (attribute.classType) {\n const titleProperty = findClassTitleAttribute(attribute.classType) ?? undefined;\n if (titleProperty) {\n column.withGetter(value => value?.[titleProperty as keyof object]);\n }\n } else {\n desc.addFilterFromColumnDescriptorUnsafe(column, false);\n desc.withSortUnsafe(column.property);\n }\n\n return column;\n}\n\n/**\n * defines modified type of column\n * DO NOT USE with enum (use withCustomEnumType)\n * @param descriptor table descriptor\n * @param property column name\n * @param columnType modified type\n * @param args additional attributes\n * @param columnDisplayType\n */\nexport function modifyTableClassAttributeColumnType<\n TableModel,\n Property extends keyof TableModel,\n ColumnModel = NonNullable<TableModel[Property]>,\n ColumnValue = TableModel[Property]\n>(\n descriptor: TableDescriptorInst<TableModel, any, any>,\n property: Property,\n columnType?: ColumnTypeEnum,\n columnDisplayType?: ColumnDisplayTypeEnum,\n ...args: any[]\n): ColumnDescriptor<ColumnModel, TableModel, ColumnValue> | null {\n return modifyTableClassAttributeColumnTypeUnsafe<TableModel, ColumnModel, ColumnValue>(descriptor, property as string, columnType, columnDisplayType, ...args);\n}\n\nexport function modifyTableClassAttributeColumnTypeUnsafe<TableModel, ColumnModel = any, ColumnValue = ColumnModel>(\n descriptor: TableDescriptorInst<TableModel, any, any>,\n property: string,\n columnType?: ColumnTypeEnum,\n columnDisplayType?: ColumnDisplayTypeEnum,\n ...args: any[]\n): ColumnDescriptor<ColumnModel, TableModel, ColumnValue> | null {\n if (!(descriptor.model instanceof ModelClassDescriptor)) {\n throw new CommonsInternalError(\n `withColumnModifiedType cannot be executed for property ${property}: Model descriptor is not of type 'ModelClassDescriptor' is not defined.`\n );\n }\n\n const attributeDef = getTableClassAttributeDef(descriptor.model.classType).find(attr => attr.name === property);\n\n if (attributeDef != null) {\n attributeDef.columnType = columnType ?? attributeDef.columnType;\n attributeDef.columnDisplayType = columnDisplayType ?? attributeDef.columnDisplayType;\n return upsertTableColumnFromAttributeDef(\n descriptor,\n attributeDef,\n descriptor.columns.find(col => col.property === attributeDef.name),\n ...args\n );\n }\n\n return null;\n}\n\n/**\n * defines custom enum type for column\n * @param descriptor table descriptor\n * @param property column name\n * @param enumDesc Enum descriptor.\n */\nexport function modifyTableClassAttributeColumnEnum<\n TableModel,\n Property extends keyof TableModel,\n Enum extends NonNullable<TableModel[Property]>,\n ColumnModel = NonNullable<TableModel[Property]>,\n ColumnValue = TableModel[Property]\n>(descriptor: TableDescriptorInst<TableModel, any, any>, property: Property, enumDesc?: EnumDescriptor<Enum>): ColumnDescriptor<ColumnModel, TableModel, ColumnValue> | null {\n return tableDescriptorModifyEnumColumnUnsafe<TableModel, Enum, ColumnModel, ColumnValue>(descriptor, property as string, enumDesc);\n}\n\nexport function tableDescriptorModifyEnumColumnUnsafe<TableModel, Enum = any, ColumnModel = any, ColumnValue = ColumnModel>(\n descriptor: TableDescriptorInst<TableModel, any, any>,\n property: string,\n enumDesc?: EnumDescriptor<Enum>\n): ColumnDescriptor<ColumnModel, TableModel, ColumnValue> | null {\n if (!(descriptor.model instanceof ModelClassDescriptor)) {\n throw new CommonsInternalError(\n `withColumnModifiedEnum cannot be executed for property ${property}: Model descriptor is not of type 'ModelClassDescriptor' is not defined.`\n );\n }\n\n const attributeDef = getTableClassAttributeDef(descriptor.model.classType).find(attr => attr.name === property);\n\n if (attributeDef != null) {\n attributeDef.columnType = ColumnTypeEnum.Enum;\n upsertTableColumnFromAttributeDef(\n descriptor,\n attributeDef,\n descriptor.columns.find(col => col.property === property),\n enumDesc ?? enumModelGeneric(TypeRegistry.get().findEnum(attributeDef.type) as EnumType)\n );\n }\n\n return null;\n}\n\n/**\n * modifies column with class and lookup provider\n * @param descriptor table descriptor\n * @param property column name\n * @param lookupProvider lookupProvider for class\n * @param optionsLabelProperty\n * @param filterProperty\n */\nexport function modifyTableColumnFilterLookup<TableModel, Property extends keyof TableModel, Service, ColumnModel = NonNullable<TableModel[Property]>>(\n descriptor: TableDescriptorInst<TableModel, any, any>,\n property: Property,\n lookupProvider?: ILookupDataProvider<ColumnModel, any>,\n optionsLabelProperty?: keyof ColumnModel,\n filterProperty?: keyof ColumnModel\n): FilterLookupDescriptor<ColumnModel, TableModel, Service> | null {\n return modifyTableColumnFilterLookupUnsafe<TableModel, Service, ColumnModel>(\n descriptor,\n property as string,\n lookupProvider,\n optionsLabelProperty as string,\n filterProperty as string\n );\n}\n\nexport function modifyTableColumnFilterLookupUnsafe<TableModel, Service, ColumnModel>(\n descriptor: TableDescriptorInst<TableModel, any, any>,\n property: string,\n lookupProvider?: ILookupDataProvider<ColumnModel, Service>,\n optionsLabelProperty?: string,\n filterProperty?: string\n): FilterLookupDescriptor<ColumnModel, TableModel, Service> | null {\n const column = descriptor.columns.find(col => col.property === property);\n if (column) {\n const filter = descriptor.addFilterLookupUnsafe(column.property, lookupProvider, filterProperty);\n if (optionsLabelProperty) {\n filter.withOptionsLabelPropertyUnsafe(optionsLabelProperty);\n }\n return filter;\n }\n return null;\n}\n","import {ClassType} from '@mediusinc/mng-commons/core';\nimport {modelClass} from '@mediusinc/mng-commons/model/class';\nimport {TableDescriptorCreateOptsType, TableDescriptorInst} from '@mediusinc/mng-commons/table/api';\n\nimport {getTableClassAttributeDef} from './class-table-attribute-converter';\nimport {TableClassAttributeDef} from './class-table-attribute.model';\nimport {upsertTableColumnFromAttributeDef} from './class-table-descriptor-helpers';\n\nexport function tableDescriptorFromClass<TableModel, Sorts = keyof TableModel, Filters = keyof TableModel>(\n type: ClassType<TableModel>,\n opts?: TableDescriptorCreateOptsType<TableModel>\n): TableDescriptorInst<TableModel, Sorts, Filters> {\n return new TableDescriptorInst<TableModel, Sorts, Filters>(modelClass<TableModel>(type as ClassType<TableModel>, opts));\n}\n\n/**\n * generates descriptor based on type attribute definition\n * @param type class type\n * @param attributes\n * @param opts\n */\nexport function tableDescriptorFromClassAttrsDef<TableModel, Sorts = keyof TableModel, Filters = keyof TableModel>(\n type: ClassType<TableModel>,\n attributes?: TableClassAttributeDef[],\n opts?: TableDescriptorCreateOptsType<TableModel>\n): TableDescriptorInst<TableModel, Sorts, Filters> {\n const descriptor = new TableDescriptorInst<TableModel, Sorts, Filters>(modelClass(type, opts), true);\n (attributes ?? getTableClassAttributeDef(type))\n .filter(attr => !attr.type.includes('Set') && !attr.type.includes('Array'))\n .forEach(attr => upsertTableColumnFromAttributeDef(descriptor, attr));\n return descriptor;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAKA;;;AAGG;AACG,SAAU,sCAAsC,CAAC,aAAqB,EAAA;AACxE,IAAA,MAAM,YAAY,GAAG,YAAY,CAAC,GAAG,EAAE;AACvC,IAAA,IAAI,YAAY,CAAC,QAAQ,CAAC,aAAa,CAAa,EAAE;QAClD,aAAa,GAAG,MAAM;;AACnB,SAAA,IAAI,YAAY,CAAC,QAAQ,CAAC,aAAa,CAAmB,EAAE;QAC/D,aAAa,GAAG,OAAO;;AAG3B,IAAA,QAAQ,aAAa,CAAC,WAAW,EAAE;AAC/B,QAAA,KAAK,QAAQ;AACb,QAAA,KAAK,UAAU;YACX,OAAO,cAAc,CAAC,MAAM;AAChC,QAAA,KAAK,SAAS;YACV,OAAO,cAAc,CAAC,OAAO;AACjC,QAAA,KAAK,MAAM;YACP,OAAO,cAAc,CAAC,IAAI;AAC9B,QAAA,KAAK,MAAM;YACP,OAAO,cAAc,CAAC,IAAI;AAC9B,QAAA,KAAK,QAAQ;YACT,OAAO,cAAc,CAAC,MAAM;AAChC,QAAA,KAAK,OAAO;YACR,OAAO,cAAc,CAAC,MAAM;AAChC,QAAA,KAAK,QAAQ;AACb,QAAA;YACI,OAAO,cAAc,CAAC,MAAM;;AAExC;AAEgB,SAAA,kCAAkC,CAAC,UAA0B,EAAE,aAAqB,EAAA;IAChG,QAAQ,UAAU;QACd,KAAK,cAAc,CAAC,MAAM;AACtB,YAAA,OAAO,aAAa,KAAK,UAAU,GAAG,qBAAqB,CAAC,QAAQ,GAAG,qBAAqB,CAAC,MAAM;QACvG,KAAK,cAAc,CAAC,OAAO;YACvB,OAAO,qBAAqB,CAAC,OAAO;QACxC,KAAK,cAA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YAAA,MAAM,CAAC,8BAA8B,CAAC,oBAAoB,CAAC;;AAE/D,QAAA,OAAO,MAAM;;AAEjB,IAAA,OAAO,IAAI;AACf;;AC3KgB,SAAA,wBAAwB,CACpC,IAA2B,EAC3B,IAAgD,EAAA;IAEhD,OAAO,IAAI,mBAAmB,CAA6B,UAAU,CAAa,IAA6B,EAAE,IAAI,CAAC,CAAC;AAC3H;AAEA;;;;;AAKG;SACa,gCAAgC,CAC5C,IAA2B,EAC3B,UAAqC,EACrC,IAAgD,EAAA;AAEhD,IAAA,MAAM,UAAU,GAAG,IAAI,mBAAmB,CAA6B,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC;AACpG,IAAA,CAAC,UAAU,IAAI,yBAAyB,CAAC,IAAI,CAAC;SACzC,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;AACzE,SAAA,OAAO,CAAC,IAAI,IAAI,iCAAiC,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;AACzE,IAAA,OAAO,UAAU;AACrB;;AC/BA;;AAEG;;;;"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Subject } from 'rxjs';
|
|
2
2
|
import { map } from 'rxjs/operators';
|
|
3
|
-
import { DataProviderInst, toObservable,
|
|
3
|
+
import { DataProviderInst, toObservable, CommonsInternalError, flattenObjectKeys } from '@mediusinc/mng-commons/core';
|
|
4
4
|
import { FilterDescriptor, FilterLookupDescriptor, FilterLookupEnumDescriptor, FilterGenericDescriptor, FilterTypeEnum } from '@mediusinc/mng-commons/filter';
|
|
5
|
-
import {
|
|
5
|
+
import { model, ModelDescriptor } from '@mediusinc/mng-commons/model';
|
|
6
6
|
|
|
7
7
|
class TableDataProviderInst extends DataProviderInst {
|
|
8
|
-
constructor(
|
|
9
|
-
super(
|
|
8
|
+
constructor(serviceType) {
|
|
9
|
+
super(serviceType);
|
|
10
10
|
this._reloadTableSubject = new Subject();
|
|
11
11
|
this._isLazy = true;
|
|
12
12
|
this._getAll = () => ({ data: [] });
|
|
@@ -29,57 +29,49 @@ class TableDataProviderInst extends DataProviderInst {
|
|
|
29
29
|
this._isLazy = false;
|
|
30
30
|
return this;
|
|
31
31
|
}
|
|
32
|
-
/**
|
|
33
|
-
* @deprecated Use ${reloadTable} instead.
|
|
34
|
-
*/
|
|
35
|
-
getAllReload(params) {
|
|
36
|
-
this.reloadTable(params ? { params: params } : undefined);
|
|
37
|
-
}
|
|
38
32
|
reloadTable(event) {
|
|
39
33
|
this._reloadTableSubject.next(event ?? {});
|
|
40
34
|
}
|
|
41
35
|
}
|
|
42
36
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Creates and returns an instance of `TableDataProviderInst` with the specified options for managing table data.
|
|
39
|
+
*
|
|
40
|
+
* @param {Object} [opts] - The options object to configure the data provider.
|
|
41
|
+
* @param {TypeDescriptor<Model> | ModelDescriptor<Model>} [opts.type] - The descriptor defining the type of model.
|
|
42
|
+
* @param {ServiceClassType<Service>} [opts.service] - The service class type associated with the data provider.
|
|
43
|
+
* @param {TypeDescriptor<CreateModel> | ModelDescriptor<CreateModel>} [opts.filtersType] - The descriptor defining the filters type.
|
|
44
|
+
* @param {TypeDescriptor<UpdateModel> | ModelDescriptor<UpdateModel>} [opts.sortsType] - The descriptor defining the sorts type.
|
|
45
|
+
* @return {TableDataProviderInst<Model, Service, Sorts, Filters, ServiceClass>} An instance of `TableDataProviderInst` configured according to the provided options.
|
|
46
|
+
*/
|
|
47
|
+
function tableDataProvider(opts) {
|
|
48
|
+
return new TableDataProviderInst(opts?.service);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const dateRegex = /\d{4}-[01]\d-[0-3]\d/;
|
|
52
|
+
const dateTimeRegex = /\d{4}-[01]\d-[0-3]\dT([0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z?)|([0-2]\d:[0-5]\d:[0-5]\d\+[0-2]\d:[0-5]\d))/;
|
|
53
|
+
/**
|
|
54
|
+
* converts column to number or date on value based
|
|
55
|
+
* @param column column to be transformed
|
|
56
|
+
* @param value value to check if applicable
|
|
57
|
+
*/
|
|
58
|
+
function columnToDateNumberOrBoolean(column, value) {
|
|
59
|
+
if (typeof value === 'boolean') {
|
|
60
|
+
return column.asBoolean();
|
|
55
61
|
}
|
|
56
|
-
|
|
57
|
-
return
|
|
62
|
+
else if (!isNaN(value) && typeof value === 'number') {
|
|
63
|
+
return column.asNumber();
|
|
58
64
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
return new TableDataProviderInst(undefined, serviceTypeOrOpts);
|
|
65
|
+
else if (dateRegex.test(value)) {
|
|
66
|
+
if (dateTimeRegex.test(value)) {
|
|
67
|
+
return column.asDate('dd. MMM yyyy HH:mm');
|
|
68
|
+
}
|
|
69
|
+
return column.asDate('dd. MMM yyyy');
|
|
65
70
|
}
|
|
66
71
|
else {
|
|
67
|
-
return
|
|
72
|
+
return column;
|
|
68
73
|
}
|
|
69
74
|
}
|
|
70
|
-
function tableDataProviderWithService(serviceType,
|
|
71
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
72
|
-
opts) {
|
|
73
|
-
return new TableDataProviderInst(undefined, serviceType);
|
|
74
|
-
}
|
|
75
|
-
function tableDataProviderFromClass(type, serviceType) {
|
|
76
|
-
return new TableDataProviderInst(type, serviceType);
|
|
77
|
-
}
|
|
78
|
-
function tableDataProviderFromModel(model, serviceTypeOrOpts, opts) {
|
|
79
|
-
return typeof serviceTypeOrOpts === 'function'
|
|
80
|
-
? new TableDataProviderInst(model.type, serviceTypeOrOpts)
|
|
81
|
-
: new TableDataProviderInst(model.type, undefined);
|
|
82
|
-
}
|
|
83
75
|
|
|
84
76
|
var ColumnTypeEnum;
|
|
85
77
|
(function (ColumnTypeEnum) {
|
|
@@ -102,108 +94,6 @@ var ColumnDisplayTypeEnum;
|
|
|
102
94
|
ColumnDisplayTypeEnum["Html"] = "HTML";
|
|
103
95
|
})(ColumnDisplayTypeEnum || (ColumnDisplayTypeEnum = {}));
|
|
104
96
|
|
|
105
|
-
const dateRegex = /\d{4}-[01]\d-[0-3]\d/;
|
|
106
|
-
const dateTimeRegex = /\d{4}-[01]\d-[0-3]\dT([0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z?)|([0-2]\d:[0-5]\d:[0-5]\d\+[0-2]\d:[0-5]\d))/;
|
|
107
|
-
/**
|
|
108
|
-
* converts column to number or date on value based
|
|
109
|
-
* @param column column to be transformed
|
|
110
|
-
* @param value value to check if applicable
|
|
111
|
-
*/
|
|
112
|
-
function columnToDateNumberOrBoolean(column, value) {
|
|
113
|
-
if (typeof value === 'boolean') {
|
|
114
|
-
return column.asBoolean();
|
|
115
|
-
}
|
|
116
|
-
else if (!isNaN(value) && typeof value === 'number') {
|
|
117
|
-
return column.asNumber();
|
|
118
|
-
}
|
|
119
|
-
else if (dateRegex.test(value)) {
|
|
120
|
-
if (dateTimeRegex.test(value)) {
|
|
121
|
-
return column.asDate('dd. MMM yyyy HH:mm');
|
|
122
|
-
}
|
|
123
|
-
return column.asDate('dd. MMM yyyy');
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
return column;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* converts string type to column type enum, default is string
|
|
131
|
-
* @param attributeType
|
|
132
|
-
*/
|
|
133
|
-
function getColumnTypeFromClassAttributeDefType(attributeType) {
|
|
134
|
-
const typeRegistry = TypeRegistry.get();
|
|
135
|
-
if (typeRegistry.findEnum(attributeType)) {
|
|
136
|
-
attributeType = 'enum';
|
|
137
|
-
}
|
|
138
|
-
else if (typeRegistry.findType(attributeType)) {
|
|
139
|
-
attributeType = 'class';
|
|
140
|
-
}
|
|
141
|
-
switch (attributeType.toLowerCase()) {
|
|
142
|
-
case 'number':
|
|
143
|
-
case 'currency':
|
|
144
|
-
return ColumnTypeEnum.Number;
|
|
145
|
-
case 'boolean':
|
|
146
|
-
return ColumnTypeEnum.Boolean;
|
|
147
|
-
case 'date':
|
|
148
|
-
return ColumnTypeEnum.Date;
|
|
149
|
-
case 'enum':
|
|
150
|
-
return ColumnTypeEnum.Enum;
|
|
151
|
-
case 'custom':
|
|
152
|
-
return ColumnTypeEnum.Custom;
|
|
153
|
-
case 'class':
|
|
154
|
-
return ColumnTypeEnum.String;
|
|
155
|
-
case 'string':
|
|
156
|
-
default:
|
|
157
|
-
return ColumnTypeEnum.String;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
function getColumnDisplayTypeFromColumnType(columnType, attributeType) {
|
|
161
|
-
switch (columnType) {
|
|
162
|
-
case ColumnTypeEnum.Number:
|
|
163
|
-
return attributeType === 'currency' ? ColumnDisplayTypeEnum.Currency : ColumnDisplayTypeEnum.Number;
|
|
164
|
-
case ColumnTypeEnum.Boolean:
|
|
165
|
-
return ColumnDisplayTypeEnum.Boolean;
|
|
166
|
-
case ColumnTypeEnum.Date:
|
|
167
|
-
return ColumnDisplayTypeEnum.Date;
|
|
168
|
-
case ColumnTypeEnum.Enum:
|
|
169
|
-
return ColumnDisplayTypeEnum.Enum;
|
|
170
|
-
case ColumnTypeEnum.Custom:
|
|
171
|
-
return ColumnDisplayTypeEnum.Component;
|
|
172
|
-
case ColumnTypeEnum.String:
|
|
173
|
-
default:
|
|
174
|
-
return ColumnDisplayTypeEnum.String;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
function expandClassAttributeDefWithTableDef(attributes) {
|
|
178
|
-
if (!attributes) {
|
|
179
|
-
throw new CommonsInternalError('Class attribute definition is null, problem with TypeRegistry::findAttributesDefinitionByClassType?', { name: 'TableviewUtilsError' });
|
|
180
|
-
}
|
|
181
|
-
const typeRegistry = TypeRegistry.get();
|
|
182
|
-
const tableClassAttributeDef = [];
|
|
183
|
-
for (const attribute of attributes) {
|
|
184
|
-
const enumType = typeRegistry.findEnum(attribute.type);
|
|
185
|
-
const columnType = enumType ? ColumnTypeEnum.Enum : getColumnTypeFromClassAttributeDefType(attribute.type);
|
|
186
|
-
tableClassAttributeDef.push({
|
|
187
|
-
name: attribute.name,
|
|
188
|
-
baseName: attribute.baseName,
|
|
189
|
-
type: attribute.type,
|
|
190
|
-
subtype: attribute.subtype,
|
|
191
|
-
columnType: enumType ? ColumnTypeEnum.Enum : getColumnTypeFromClassAttributeDefType(attribute.type),
|
|
192
|
-
columnDisplayType: getColumnDisplayTypeFromColumnType(columnType, attribute.type),
|
|
193
|
-
enumType: typeRegistry.findEnum(attribute.type),
|
|
194
|
-
classType: typeRegistry.findType(attribute.type)
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
return tableClassAttributeDef;
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* returns attributes from class type and extends to typed def with column and field enum type
|
|
201
|
-
* @param type class type
|
|
202
|
-
*/
|
|
203
|
-
function getTableClassAttributeDef(type) {
|
|
204
|
-
return expandClassAttributeDefWithTableDef(TypeRegistry.get().findAttributesDefinitionByClassType(type));
|
|
205
|
-
}
|
|
206
|
-
|
|
207
97
|
class ColumnDescriptor {
|
|
208
98
|
constructor(property) {
|
|
209
99
|
this._columnType = ColumnTypeEnum.String;
|
|
@@ -237,6 +127,9 @@ class ColumnDescriptor {
|
|
|
237
127
|
get title() {
|
|
238
128
|
return this._title;
|
|
239
129
|
}
|
|
130
|
+
get titleUseModelBase() {
|
|
131
|
+
return this._titleUseModelBase;
|
|
132
|
+
}
|
|
240
133
|
get displayFormat() {
|
|
241
134
|
return this._displayFormat;
|
|
242
135
|
}
|
|
@@ -476,9 +369,11 @@ class ColumnDescriptor {
|
|
|
476
369
|
* Sets the title for the column. If title is undefined, then the title will be calculated based on table model (i18nBase) and column property.
|
|
477
370
|
*
|
|
478
371
|
* @param title - The title of the column.
|
|
372
|
+
* @param useModelBase - Whether to append title to model's i18n path.
|
|
479
373
|
*/
|
|
480
|
-
withTitle(title) {
|
|
374
|
+
withTitle(title, useModelBase) {
|
|
481
375
|
this._title = title;
|
|
376
|
+
this._titleUseModelBase = useModelBase;
|
|
482
377
|
return this;
|
|
483
378
|
}
|
|
484
379
|
/**
|
|
@@ -1787,7 +1682,7 @@ class TableDynamicDescriptorInst extends TableDescriptorInst {
|
|
|
1787
1682
|
*/
|
|
1788
1683
|
withColumnTitle(property, title) {
|
|
1789
1684
|
const column = this._columns.find(col => property === col.property) ?? this.addColumn(property);
|
|
1790
|
-
column.withTitle(title
|
|
1685
|
+
column.withTitle(title);
|
|
1791
1686
|
return this;
|
|
1792
1687
|
}
|
|
1793
1688
|
/**
|
|
@@ -1869,189 +1764,30 @@ class TableDynamicDescriptorInst extends TableDescriptorInst {
|
|
|
1869
1764
|
}
|
|
1870
1765
|
}
|
|
1871
1766
|
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
* @param column if provided, replaced by new, otherwise new is created
|
|
1877
|
-
* @param args additional parameters
|
|
1878
|
-
*/
|
|
1879
|
-
function upsertTableColumnFromAttributeDef(desc, attribute, column, ...args) {
|
|
1880
|
-
if (column == null) {
|
|
1881
|
-
column = desc.addColumnUnsafe(attribute.name);
|
|
1882
|
-
}
|
|
1883
|
-
if (attribute.columnType === ColumnTypeEnum.Enum && args.length === 0 && attribute.enumType) {
|
|
1884
|
-
args = [enumModelGeneric(attribute.enumType)];
|
|
1885
|
-
}
|
|
1886
|
-
column = column.asType(attribute.columnType, attribute.columnDisplayType, ...args);
|
|
1887
|
-
if (attribute.classType) {
|
|
1888
|
-
const titleProperty = findClassTitleAttribute(attribute.classType) ?? undefined;
|
|
1889
|
-
if (titleProperty) {
|
|
1890
|
-
column.withGetter(value => value?.[titleProperty]);
|
|
1891
|
-
}
|
|
1892
|
-
}
|
|
1893
|
-
else {
|
|
1894
|
-
desc.addFilterFromColumnDescriptorUnsafe(column, false);
|
|
1895
|
-
desc.withSortUnsafe(column.property);
|
|
1896
|
-
}
|
|
1897
|
-
return column;
|
|
1898
|
-
}
|
|
1899
|
-
/**
|
|
1900
|
-
* defines modified type of column
|
|
1901
|
-
* DO NOT USE with enum (use withCustomEnumType)
|
|
1902
|
-
* @param descriptor table descriptor
|
|
1903
|
-
* @param property column name
|
|
1904
|
-
* @param columnType modified type
|
|
1905
|
-
* @param args additional attributes
|
|
1906
|
-
* @param columnDisplayType
|
|
1907
|
-
*/
|
|
1908
|
-
function modifyTableClassAttributeColumnType(descriptor, property, columnType, columnDisplayType, ...args) {
|
|
1909
|
-
return modifyTableClassAttributeColumnTypeUnsafe(descriptor, property, columnType, columnDisplayType, ...args);
|
|
1910
|
-
}
|
|
1911
|
-
function modifyTableClassAttributeColumnTypeUnsafe(descriptor, property, columnType, columnDisplayType, ...args) {
|
|
1912
|
-
if (!descriptor.model.type) {
|
|
1913
|
-
throw new CommonsInternalError(`withColumnModifiedType cannot be executed for property ${property}: Model type is not defined.`);
|
|
1914
|
-
}
|
|
1915
|
-
const attributeDef = getTableClassAttributeDef(descriptor.model.type).find(attr => attr.name === property);
|
|
1916
|
-
if (attributeDef != null) {
|
|
1917
|
-
attributeDef.columnType = columnType ?? attributeDef.columnType;
|
|
1918
|
-
attributeDef.columnDisplayType = columnDisplayType ?? attributeDef.columnDisplayType;
|
|
1919
|
-
return upsertTableColumnFromAttributeDef(descriptor, attributeDef, descriptor.columns.find(col => col.property === attributeDef.name), ...args);
|
|
1920
|
-
}
|
|
1921
|
-
return null;
|
|
1922
|
-
}
|
|
1923
|
-
/**
|
|
1924
|
-
* defines custom enum type for column
|
|
1925
|
-
* @param descriptor table descriptor
|
|
1926
|
-
* @param property column name
|
|
1927
|
-
* @param enumDesc Enum descriptor.
|
|
1928
|
-
*/
|
|
1929
|
-
function modifyTableClassAttributeColumnEnum(descriptor, property, enumDesc) {
|
|
1930
|
-
return tableDescriptorModifyEnumColumnUnsafe(descriptor, property, enumDesc);
|
|
1931
|
-
}
|
|
1932
|
-
function tableDescriptorModifyEnumColumnUnsafe(descriptor, property, enumDesc) {
|
|
1933
|
-
if (!descriptor.model.type) {
|
|
1934
|
-
throw new CommonsInternalError(`withColumnModifiedEnum cannot be executed for property ${property}: Model type is not defined.`);
|
|
1935
|
-
}
|
|
1936
|
-
const attributeDef = getTableClassAttributeDef(descriptor.model.type).find(attr => attr.name === property);
|
|
1937
|
-
if (attributeDef != null) {
|
|
1938
|
-
attributeDef.columnType = ColumnTypeEnum.Enum;
|
|
1939
|
-
upsertTableColumnFromAttributeDef(descriptor, attributeDef, descriptor.columns.find(col => col.property === property), enumDesc ?? enumModelGeneric(TypeRegistry.get().findEnum(attributeDef.type)));
|
|
1940
|
-
}
|
|
1941
|
-
return null;
|
|
1942
|
-
}
|
|
1943
|
-
/**
|
|
1944
|
-
* modifies column with class and lookup provider
|
|
1945
|
-
* @param descriptor table descriptor
|
|
1946
|
-
* @param property column name
|
|
1947
|
-
* @param lookupProvider lookupProvider for class
|
|
1948
|
-
* @param optionsLabelProperty
|
|
1949
|
-
* @param filterProperty
|
|
1950
|
-
*/
|
|
1951
|
-
function modifyTableColumnFilterLookup(descriptor, property, lookupProvider, optionsLabelProperty, filterProperty) {
|
|
1952
|
-
return modifyTableColumnFilterLookupUnsafe(descriptor, property, lookupProvider, optionsLabelProperty, filterProperty);
|
|
1953
|
-
}
|
|
1954
|
-
function modifyTableColumnFilterLookupUnsafe(descriptor, property, lookupProvider, optionsLabelProperty, filterProperty) {
|
|
1955
|
-
const column = descriptor.columns.find(col => col.property === property);
|
|
1956
|
-
if (column) {
|
|
1957
|
-
const filter = descriptor.addFilterLookupUnsafe(column.property, lookupProvider, filterProperty);
|
|
1958
|
-
if (optionsLabelProperty) {
|
|
1959
|
-
filter.withOptionsLabelPropertyUnsafe(optionsLabelProperty);
|
|
1960
|
-
}
|
|
1961
|
-
return filter;
|
|
1962
|
-
}
|
|
1963
|
-
return null;
|
|
1964
|
-
}
|
|
1965
|
-
|
|
1966
|
-
class TableDescriptor extends TableDescriptorInst {
|
|
1967
|
-
constructor() {
|
|
1968
|
-
super(model());
|
|
1969
|
-
}
|
|
1970
|
-
static create(idProperty, titleProperty, i18nBaseKey) {
|
|
1971
|
-
return tableDescriptor({ id: idProperty, title: titleProperty, i18nBase: i18nBaseKey });
|
|
1972
|
-
}
|
|
1973
|
-
static fromClass(type, idProperty, titleProperty, i18nBaseKey) {
|
|
1974
|
-
return tableDescriptorFromClass(type, { id: idProperty, title: titleProperty, i18nBase: i18nBaseKey });
|
|
1975
|
-
}
|
|
1976
|
-
static fromModel(model) {
|
|
1977
|
-
return new TableDescriptorInst(model);
|
|
1978
|
-
}
|
|
1979
|
-
/**
|
|
1980
|
-
* generates descriptor based on type attribute definition
|
|
1981
|
-
* @param type class type
|
|
1982
|
-
* @param idProperty
|
|
1983
|
-
* @param titleProperty
|
|
1984
|
-
*/
|
|
1985
|
-
static fromClassWithAutoAttrsDef(type, idProperty, titleProperty) {
|
|
1986
|
-
return tableDescriptorFromClassAttrsDef(type, undefined, { id: idProperty, title: titleProperty });
|
|
1987
|
-
}
|
|
1988
|
-
/**
|
|
1989
|
-
* generates descriptor base on given attribute definition
|
|
1990
|
-
* @param type class type
|
|
1991
|
-
* @param attributes attributes from which descriptor is generated
|
|
1992
|
-
* @param idProperty
|
|
1993
|
-
* @param titleProperty
|
|
1994
|
-
*/
|
|
1995
|
-
static fromClassWithCustomAttrsDef(type, attributes, idProperty, titleProperty) {
|
|
1996
|
-
return tableDescriptorFromClassAttrsDef(type, attributes, { id: idProperty, title: titleProperty });
|
|
1997
|
-
}
|
|
1998
|
-
}
|
|
1999
|
-
function tableDescriptor(typeOrModelOrClassOrOpts, opts) {
|
|
2000
|
-
if (typeOrModelOrClassOrOpts == null) {
|
|
1767
|
+
function tableDescriptor(modelOrOpts,
|
|
1768
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1769
|
+
opts) {
|
|
1770
|
+
if (modelOrOpts == null) {
|
|
2001
1771
|
return new TableDescriptorInst(model());
|
|
2002
1772
|
}
|
|
2003
|
-
else if (
|
|
2004
|
-
return new TableDescriptorInst(
|
|
2005
|
-
}
|
|
2006
|
-
else if (typeOrModelOrClassOrOpts instanceof ModelDescriptor) {
|
|
2007
|
-
return new TableDescriptorInst(typeOrModelOrClassOrOpts);
|
|
1773
|
+
else if (modelOrOpts instanceof ModelDescriptor) {
|
|
1774
|
+
return new TableDescriptorInst(modelOrOpts);
|
|
2008
1775
|
}
|
|
2009
1776
|
else {
|
|
2010
1777
|
// this could have autoGenerated if model descriptor is class
|
|
2011
|
-
return new TableDescriptorInst(model(
|
|
2012
|
-
}
|
|
2013
|
-
}
|
|
2014
|
-
function tableDescriptorFromClass(type, opts) {
|
|
2015
|
-
return new TableDescriptorInst(model(type, opts));
|
|
2016
|
-
}
|
|
2017
|
-
/**
|
|
2018
|
-
* generates descriptor based on type attribute definition
|
|
2019
|
-
* @param type class type
|
|
2020
|
-
* @param attributes
|
|
2021
|
-
* @param opts
|
|
2022
|
-
*/
|
|
2023
|
-
function tableDescriptorFromClassAttrsDef(type, attributes, opts) {
|
|
2024
|
-
const descriptor = new TableDescriptorInst(model(type, opts), true);
|
|
2025
|
-
(attributes ?? getTableClassAttributeDef(type))
|
|
2026
|
-
.filter(attr => !attr.type.includes('Set') && !attr.type.includes('Array'))
|
|
2027
|
-
.forEach(attr => upsertTableColumnFromAttributeDef(descriptor, attr));
|
|
2028
|
-
return descriptor;
|
|
2029
|
-
}
|
|
2030
|
-
class TableDynamicDescriptor extends TableDynamicDescriptorInst {
|
|
2031
|
-
constructor() {
|
|
2032
|
-
super(ModelDescriptor.create());
|
|
2033
|
-
}
|
|
2034
|
-
static create(idProperty, titleProperty, i18nBaseKey) {
|
|
2035
|
-
return tableDynamicDescriptor({
|
|
2036
|
-
id: idProperty,
|
|
2037
|
-
title: titleProperty,
|
|
2038
|
-
i18nBase: i18nBaseKey
|
|
2039
|
-
});
|
|
2040
|
-
}
|
|
2041
|
-
static fromModel(model) {
|
|
2042
|
-
return tableDynamicDescriptor(model);
|
|
1778
|
+
return new TableDescriptorInst(model(modelOrOpts));
|
|
2043
1779
|
}
|
|
2044
1780
|
}
|
|
2045
1781
|
function tableDynamicDescriptor(modelOrOpts) {
|
|
2046
1782
|
return modelOrOpts instanceof ModelDescriptor
|
|
2047
1783
|
? new TableDynamicDescriptorInst(modelOrOpts)
|
|
2048
|
-
: new TableDynamicDescriptorInst(new ModelDescriptor(
|
|
1784
|
+
: new TableDynamicDescriptorInst(new ModelDescriptor(modelOrOpts?.id, modelOrOpts?.title, modelOrOpts?.i18nBase));
|
|
2049
1785
|
}
|
|
2050
1786
|
|
|
2051
|
-
function
|
|
1787
|
+
function tableDataProviderFromDescriptor(descriptor, serviceType) {
|
|
2052
1788
|
return typeof serviceType !== 'undefined'
|
|
2053
|
-
? new TableDataProviderInst(
|
|
2054
|
-
: new TableDataProviderInst(undefined
|
|
1789
|
+
? new TableDataProviderInst(serviceType)
|
|
1790
|
+
: new TableDataProviderInst(undefined);
|
|
2055
1791
|
}
|
|
2056
1792
|
|
|
2057
1793
|
// data providers
|
|
@@ -2060,5 +1796,5 @@ function tableToDataProvider(descriptor, serviceType) {
|
|
|
2060
1796
|
* Generated bundle index. Do not edit.
|
|
2061
1797
|
*/
|
|
2062
1798
|
|
|
2063
|
-
export { ColumnDescriptor, ColumnDisplayTypeEnum, ColumnDynamicDescriptor, ColumnTypeEnum, SortDescriptor,
|
|
1799
|
+
export { ColumnDescriptor, ColumnDisplayTypeEnum, ColumnDynamicDescriptor, ColumnTypeEnum, SortDescriptor, TableDataProviderInst, TableDescriptorInst, TableDynamicColumnsModeEnum, TableDynamicDescriptorInst, TablePaginationModeEnum, TableSizeEnum, columnToDateNumberOrBoolean, tableDataProvider, tableDataProviderFromDescriptor, tableDescriptor, tableDynamicDescriptor };
|
|
2064
1800
|
//# sourceMappingURL=mediusinc-mng-commons-table-api.mjs.map
|