@mediusinc/mng-commons 6.0.0-rc.5 → 6.0.0-rc.6
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/components/notification/notification-wrapper.component.d.ts +4 -4
- package/core/error/error.model.d.ts +4 -4
- package/core/helpers/notification.d.ts +2 -2
- package/core/provide.d.ts +3 -3
- package/core/styles/style-constants.d.ts +9 -8
- package/core/styles/style.model.d.ts +2 -1
- package/fesm2022/mediusinc-mng-commons-core.mjs +91 -104
- package/fesm2022/mediusinc-mng-commons-core.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-form-api.mjs +8 -9
- package/fesm2022/mediusinc-mng-commons-form-api.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-form.mjs +149 -49
- package/fesm2022/mediusinc-mng-commons-form.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-table-column-toggle.component-DTSBP9WQ.mjs +31 -0
- package/fesm2022/mediusinc-mng-commons-table-column-toggle.component-DTSBP9WQ.mjs.map +1 -0
- package/fesm2022/mediusinc-mng-commons-table-mediusinc-mng-commons-table-JZpyiDIL.mjs +2118 -0
- package/fesm2022/mediusinc-mng-commons-table-mediusinc-mng-commons-table-JZpyiDIL.mjs.map +1 -0
- package/fesm2022/mediusinc-mng-commons-table.mjs +1 -2154
- package/fesm2022/mediusinc-mng-commons-table.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-tableview-api.mjs +97 -49
- package/fesm2022/mediusinc-mng-commons-tableview-api.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-tableview.mjs +326 -290
- package/fesm2022/mediusinc-mng-commons-tableview.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons.mjs.map +1 -1
- package/form/api/index.d.ts +1 -0
- package/form/api/models/empty-value.model.d.ts +7 -0
- package/form/components/autocomplete/autocomplete.component.d.ts +1 -2
- package/form/components/date-range/date-range.component.d.ts +4 -3
- package/form/components/dropdown/dropdown.component.d.ts +3 -2
- package/form/components/number-range/number-range.component.d.ts +3 -2
- package/form/directives/input-empty-value.directive.d.ts +40 -0
- package/form/directives/input-trim.directive.d.ts +3 -5
- package/form/index.d.ts +1 -0
- package/i18n/en.json +57 -8
- package/i18n/sl.json +1 -3
- package/package.json +16 -42
- package/provide.d.ts +2 -2
- package/table/components/column-toggle/column-toggle.component.d.ts +12 -0
- package/table/components/filter/filter-form/filter-form.component.d.ts +2 -2
- package/table/components/table/table.component.d.ts +0 -1
- package/table/helpers/filters.d.ts +3 -2
- package/table/helpers/notification.d.ts +2 -2
- package/table/services/table-metadata.service.d.ts +3 -3
- package/tableview/action/components/action/action.component.d.ts +1 -0
- package/tableview/action/components/editor/action-editor.component.d.ts +1 -1
- package/tableview/action/components/table/action-table.component.d.ts +2 -1
- package/tableview/action/helpers/notification.d.ts +3 -3
- package/tableview/action/models/execution/action-context.model.d.ts +2 -2
- package/tableview/action/services/action-executor.service.d.ts +1 -1
- package/tableview/api/action/models/execution/action-context.model.d.ts +2 -2
- package/tableview/api/editor/descriptors/editor.descriptor.d.ts +5 -0
- package/tableview/api/editor/descriptors/field-base.descriptor.d.ts +14 -10
- package/tableview/api/editor/descriptors/field-group.descriptor.d.ts +10 -0
- package/tableview/api/editor/descriptors/field.descriptor.d.ts +36 -9
- package/tableview/api/editor/descriptors/wrappers/editor-descriptor-nested-object-wrapper.d.ts +1 -1
- package/tableview/api/editor/models/field-action-context.model.d.ts +1 -1
- package/tableview/api/editor/models/field.model.d.ts +1 -2
- package/tableview/api/editor/models/form-editor.interface.d.ts +2 -2
- package/tableview/api/editor/models/formly-custom-field.model.d.ts +1 -1
- package/tableview/api/editor/models/formly-field.model.d.ts +2 -2
- package/tableview/editor/components/editor/form-editor.component.d.ts +2 -2
- package/tableview/editor/components/formly/fields/formly-field-action/formly-field-action.component.d.ts +1 -1
- package/tableview/editor/components/formly/fields/formly-field-datepicker/formly-field-datepicker.component.d.ts +2 -1
- package/tableview/editor/components/formly/fields/formly-field-fieldset/formly-field-fieldset.component.d.ts +4 -6
- package/tableview/editor/components/formly/fields/formly-field-lookup-dialog/formly-field-lookup-dialog.component.d.ts +0 -2
- package/tableview/editor/components/formly/fields/formly-field-tabs/formly-field-tabs.component.d.ts +2 -2
- package/tableview/editor/components/formly/fields/formly-field-type.abstract.component.d.ts +8 -15
- package/tableview/editor/components/formly/fields/formly-group-type.abstract.component.d.ts +7 -0
- package/tableview/editor/components/formly/fields/formly-type.abstract.component.d.ts +20 -0
- package/tableview/editor/components/formly/wrappers/formly-field-no-label-wrapper/formly-field-no-label-wrapper.component.d.ts +11 -4
- package/tableview/editor/components/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.d.ts +2 -1
- package/tableview/editor/helpers/formly-config.d.ts +1 -1
- package/tableview/editor/helpers/notification.d.ts +3 -3
- package/tableview/editor/models/formly-config.model.d.ts +10 -1
- package/tableview/editor/models/formly.model.d.ts +23 -0
- package/tableview/editor/services/form-editor.service.d.ts +2 -2
- package/tableview/tableview/router/tableview-route-builder.d.ts +10 -3
- package/tableview/tableview/services/tableview-feature-config.token.d.ts +1 -1
- package/version-info.json +3 -3
- package/esm2022/core/action/action-data.model.mjs +0 -2
- package/esm2022/core/action/action-parameters.model.mjs +0 -2
- package/esm2022/core/components/notification/notification-wrapper.component.mjs +0 -50
- package/esm2022/core/data-list/data-list-params-helpers.mjs +0 -465
- package/esm2022/core/data-list/data-list.model.mjs +0 -2
- package/esm2022/core/data-list/filter-match.model.mjs +0 -105
- package/esm2022/core/data-list/filter-metadata.model.mjs +0 -2
- package/esm2022/core/data-providers/base.data-provider.mjs +0 -16
- package/esm2022/core/data-providers/lookup.data-provider.mjs +0 -2
- package/esm2022/core/descriptors/action.descriptor.mjs +0 -2
- package/esm2022/core/descriptors/column.descriptor.mjs +0 -2
- package/esm2022/core/descriptors/editor.descriptor.mjs +0 -2
- package/esm2022/core/descriptors/enum.descriptor.mjs +0 -2
- package/esm2022/core/descriptors/filter.descriptor.mjs +0 -2
- package/esm2022/core/descriptors/lookup.descriptor.mjs +0 -2
- package/esm2022/core/descriptors/model.descriptor.mjs +0 -2
- package/esm2022/core/descriptors/table.descriptor.mjs +0 -2
- package/esm2022/core/descriptors/tableview.descriptor.mjs +0 -2
- package/esm2022/core/directives/component.directive.mjs +0 -75
- package/esm2022/core/directives/rerender.directive.mjs +0 -25
- package/esm2022/core/directives/template.directive.mjs +0 -29
- package/esm2022/core/enum/enum-helpers.mjs +0 -90
- package/esm2022/core/enum/enum.model.mjs +0 -2
- package/esm2022/core/error/error-handler.mjs +0 -20
- package/esm2022/core/error/error-helpers.mjs +0 -273
- package/esm2022/core/error/error.model.mjs +0 -33
- package/esm2022/core/helpers/coercion.mjs +0 -55
- package/esm2022/core/helpers/date.mjs +0 -119
- package/esm2022/core/helpers/notification.mjs +0 -21
- package/esm2022/core/helpers/number.mjs +0 -19
- package/esm2022/core/helpers/object.mjs +0 -152
- package/esm2022/core/helpers/route.mjs +0 -58
- package/esm2022/core/helpers/string.mjs +0 -57
- package/esm2022/core/helpers/templates.mjs +0 -4
- package/esm2022/core/helpers/type-helpers.mjs +0 -2
- package/esm2022/core/i18n/i18n-common.mjs +0 -24
- package/esm2022/core/i18n/i18n-error.mjs +0 -29
- package/esm2022/core/i18n/i18n-type.mjs +0 -46
- package/esm2022/core/index.mjs +0 -107
- package/esm2022/core/log/log-publisher-console.service.mjs +0 -40
- package/esm2022/core/log/log.model.mjs +0 -10
- package/esm2022/core/log/logger.service.mjs +0 -131
- package/esm2022/core/mediusinc-mng-commons-core.mjs +0 -5
- package/esm2022/core/models/class-attribute.model.mjs +0 -2
- package/esm2022/core/models/class-service.model.mjs +0 -2
- package/esm2022/core/models/getter.model.mjs +0 -2
- package/esm2022/core/models/i18n.model.mjs +0 -2
- package/esm2022/core/models/menu.model.mjs +0 -2
- package/esm2022/core/models/user.model.mjs +0 -2
- package/esm2022/core/models/version.model.mjs +0 -2
- package/esm2022/core/pipes/boolean.pipe.mjs +0 -34
- package/esm2022/core/pipes/class-map.pipe.mjs +0 -23
- package/esm2022/core/pipes/enum.pipe.mjs +0 -38
- package/esm2022/core/pipes/enumerate-async.pipe.mjs +0 -36
- package/esm2022/core/pipes/enumerate.pipe.mjs +0 -49
- package/esm2022/core/pipes/getter.pipe.mjs +0 -21
- package/esm2022/core/pipes/i18n-property.pipe.mjs +0 -19
- package/esm2022/core/pipes/json-path.pipe.mjs +0 -25
- package/esm2022/core/pipes/parametrize.pipe.mjs +0 -86
- package/esm2022/core/pipes/template.pipe.mjs +0 -25
- package/esm2022/core/provide.mjs +0 -79
- package/esm2022/core/reactivity/effect.mjs +0 -22
- package/esm2022/core/reflect/type-enum-decorator.mjs +0 -12
- package/esm2022/core/reflect/type-enum-metadata.mjs +0 -62
- package/esm2022/core/registry/registry.model.mjs +0 -2
- package/esm2022/core/registry/type-registry.mjs +0 -106
- package/esm2022/core/router/route-builder.mjs +0 -431
- package/esm2022/core/router/router.model.mjs +0 -2
- package/esm2022/core/router/routes-builder.mjs +0 -52
- package/esm2022/core/rxjs/map-data-list-result-operator.mjs +0 -22
- package/esm2022/core/security/permission-helpers.mjs +0 -14
- package/esm2022/core/security/permission.guard.mjs +0 -15
- package/esm2022/core/security/permission.service.mjs +0 -101
- package/esm2022/core/security/permissions.model.mjs +0 -93
- package/esm2022/core/services/commons-configuration.service.mjs +0 -189
- package/esm2022/core/services/commons-init.service.mjs +0 -111
- package/esm2022/core/services/commons-router.service.mjs +0 -181
- package/esm2022/core/services/commons-storage.service.mjs +0 -31
- package/esm2022/core/services/commons.service.mjs +0 -324
- package/esm2022/core/services/providers/commons-init.provider.mjs +0 -4
- package/esm2022/core/services/tokens/browser-storage.token.mjs +0 -3
- package/esm2022/core/services/tokens/commons-init.token.mjs +0 -3
- package/esm2022/core/services/tokens/log-publisher.token.mjs +0 -3
- package/esm2022/core/services/tokens/module-config.token.mjs +0 -3
- package/esm2022/core/styles/style-constants.mjs +0 -11
- package/esm2022/core/styles/style.model.mjs +0 -20
- package/esm2022/filter/descriptors/filter-generic.descriptor.mjs +0 -31
- package/esm2022/filter/descriptors/filter-lookup.descriptor.mjs +0 -168
- package/esm2022/filter/descriptors/filter.descriptor.mjs +0 -421
- package/esm2022/filter/index.mjs +0 -8
- package/esm2022/filter/mediusinc-mng-commons-filter.mjs +0 -5
- package/esm2022/filter/models/filter-generic-property.model.mjs +0 -2
- package/esm2022/filter/models/filter.model.mjs +0 -20
- package/esm2022/form/api/data-providers/lookup-data-provider.factory.mjs +0 -15
- package/esm2022/form/api/data-providers/lookup.data-provider.mjs +0 -15
- package/esm2022/form/api/descriptors/action-button.descriptor.mjs +0 -56
- package/esm2022/form/api/descriptors/button-style.builder.mjs +0 -153
- package/esm2022/form/api/index.mjs +0 -10
- package/esm2022/form/api/mediusinc-mng-commons-form-api.mjs +0 -5
- package/esm2022/form/api/models/button.model.mjs +0 -2
- package/esm2022/form/api/models/trim.model.mjs +0 -2
- package/esm2022/form/components/autocomplete/autocomplete.component.mjs +0 -436
- package/esm2022/form/components/date-range/date-range.component.mjs +0 -147
- package/esm2022/form/components/dropdown/dropdown.component.mjs +0 -372
- package/esm2022/form/components/number-range/number-range.component.mjs +0 -123
- package/esm2022/form/directives/input-trim.directive.mjs +0 -50
- package/esm2022/form/index.mjs +0 -8
- package/esm2022/form/mediusinc-mng-commons-form.mjs +0 -5
- package/esm2022/index.mjs +0 -2
- package/esm2022/mediusinc-mng-commons.mjs +0 -5
- package/esm2022/model/class/data-providers/base-from-class-data-provider.factory.mjs +0 -5
- package/esm2022/model/class/descriptors/model-class.descriptor.mjs +0 -28
- package/esm2022/model/class/descriptors/type-class.descriptor.mjs +0 -6
- package/esm2022/model/class/helpers/model.mjs +0 -53
- package/esm2022/model/class/index.mjs +0 -8
- package/esm2022/model/class/mediusinc-mng-commons-model-class.mjs +0 -5
- package/esm2022/model/data-providers/base-from-type-data-provider.factory.mjs +0 -13
- package/esm2022/model/descriptors/enum.descriptor.mjs +0 -28
- package/esm2022/model/descriptors/model.descriptor.mjs +0 -53
- package/esm2022/model/descriptors/type.descriptor.mjs +0 -7
- package/esm2022/model/helpers/i18n.mjs +0 -47
- package/esm2022/model/index.mjs +0 -9
- package/esm2022/model/mediusinc-mng-commons-model.mjs +0 -5
- package/esm2022/provide.mjs +0 -6
- package/esm2022/table/api/class/class-table-attribute-converter.mjs +0 -80
- package/esm2022/table/api/class/class-table-attribute.model.mjs +0 -2
- package/esm2022/table/api/class/class-table-data-provider.factory.mjs +0 -5
- package/esm2022/table/api/class/class-table-descriptor-helpers.mjs +0 -99
- package/esm2022/table/api/class/class-table-descriptor.factory.mjs +0 -21
- package/esm2022/table/api/class/index.mjs +0 -6
- package/esm2022/table/api/class/mediusinc-mng-commons-table-api-class.mjs +0 -5
- package/esm2022/table/api/data-providers/table-data-provider.factory.mjs +0 -15
- package/esm2022/table/api/data-providers/table.data-provider.mjs +0 -33
- package/esm2022/table/api/descriptors/column.descriptor.mjs +0 -475
- package/esm2022/table/api/descriptors/sort.descriptor.mjs +0 -67
- package/esm2022/table/api/descriptors/table-descriptor.factory.mjs +0 -22
- package/esm2022/table/api/descriptors/table.descriptor.mjs +0 -1116
- package/esm2022/table/api/helpers/column-converter.mjs +0 -25
- package/esm2022/table/api/helpers/table-data-provider-descriptor-convert.mjs +0 -7
- package/esm2022/table/api/index.mjs +0 -19
- package/esm2022/table/api/mediusinc-mng-commons-table-api.mjs +0 -5
- package/esm2022/table/api/models/column-value.model.mjs +0 -2
- package/esm2022/table/api/models/column.model.mjs +0 -21
- package/esm2022/table/api/models/row-expandable-component.model.mjs +0 -2
- package/esm2022/table/api/models/table-columns.model.mjs +0 -2
- package/esm2022/table/api/models/table-event.model.mjs +0 -2
- package/esm2022/table/api/models/table.model.mjs +0 -21
- package/esm2022/table/components/column-filter/column-filter.component.mjs +0 -389
- package/esm2022/table/components/column-value/column-value.component.mjs +0 -78
- package/esm2022/table/components/filter/filter-active-tag/filter-active-tag.component.mjs +0 -55
- package/esm2022/table/components/filter/filter-form/filter-form.component.mjs +0 -226
- package/esm2022/table/components/filter/filter-overlay-with-tag/filter-overlay-with-tag.component.mjs +0 -219
- package/esm2022/table/components/table/table.component.mjs +0 -319
- package/esm2022/table/helpers/filters.mjs +0 -312
- package/esm2022/table/helpers/notification.mjs +0 -21
- package/esm2022/table/helpers/table-layout-prefs.mjs +0 -10
- package/esm2022/table/helpers/table.mjs +0 -24
- package/esm2022/table/index.mjs +0 -24
- package/esm2022/table/mediusinc-mng-commons-table.mjs +0 -5
- package/esm2022/table/models/column-preferences.model.mjs +0 -2
- package/esm2022/table/models/filter.model.mjs +0 -2
- package/esm2022/table/pipes/filter-value.pipe.mjs +0 -77
- package/esm2022/table/pipes/locale-default-row-class.pipe.mjs +0 -27
- package/esm2022/table/pipes/table-column-filter-class.pipe.mjs +0 -25
- package/esm2022/table/provide.mjs +0 -19
- package/esm2022/table/services/table-data.service.mjs +0 -194
- package/esm2022/table/services/table-feature-config.token.mjs +0 -3
- package/esm2022/table/services/table-metadata.service.mjs +0 -136
- package/esm2022/table/services/table-preferences.service.mjs +0 -142
- package/esm2022/tableview/action/components/action/action.component.mjs +0 -277
- package/esm2022/tableview/action/components/editor/action-editor.component.mjs +0 -86
- package/esm2022/tableview/action/components/editor/injector-context/action-editor-injector-context.component.mjs +0 -428
- package/esm2022/tableview/action/components/localization/data-language-dropdown.component.mjs +0 -35
- package/esm2022/tableview/action/components/route/action-route.component.mjs +0 -146
- package/esm2022/tableview/action/components/table/action-table.component.mjs +0 -102
- package/esm2022/tableview/action/guards/unsaved-changes.guard.mjs +0 -4
- package/esm2022/tableview/action/helpers/action-execution.mjs +0 -25
- package/esm2022/tableview/action/helpers/i18n.mjs +0 -102
- package/esm2022/tableview/action/helpers/notification.mjs +0 -78
- package/esm2022/tableview/action/helpers/styles.mjs +0 -32
- package/esm2022/tableview/action/models/action-editor-dialog-data.model.mjs +0 -2
- package/esm2022/tableview/action/models/can-component-deactivate.model.mjs +0 -2
- package/esm2022/tableview/action/models/execution/action-context.model.mjs +0 -64
- package/esm2022/tableview/action/models/execution/action-instance.model.mjs +0 -169
- package/esm2022/tableview/action/services/action-error-mapper.service.mjs +0 -20
- package/esm2022/tableview/action/services/action-executor.service.mjs +0 -772
- package/esm2022/tableview/action/services/component-action-executor.service.mjs +0 -19
- package/esm2022/tableview/action/services/data-provider-executor.service.mjs +0 -41
- package/esm2022/tableview/action/services/navigation.service.mjs +0 -53
- package/esm2022/tableview/action/services/providers/provide-action-executor.mjs +0 -9
- package/esm2022/tableview/action/services/providers/provide-view-container.mjs +0 -17
- package/esm2022/tableview/action/services/root-action-executor.service.mjs +0 -18
- package/esm2022/tableview/action/services/tokens/action-editor.token.mjs +0 -3
- package/esm2022/tableview/action/services/view-container.service.mjs +0 -40
- package/esm2022/tableview/api/action/descriptors/action-descriptor.factory.mjs +0 -28
- package/esm2022/tableview/api/action/descriptors/action-editor-descriptor.factory.mjs +0 -30
- package/esm2022/tableview/api/action/descriptors/action-editor.descriptor.mjs +0 -223
- package/esm2022/tableview/api/action/descriptors/action-link-descriptor.factory.mjs +0 -32
- package/esm2022/tableview/api/action/descriptors/action-link.descriptor.mjs +0 -74
- package/esm2022/tableview/api/action/descriptors/action.descriptor.mjs +0 -302
- package/esm2022/tableview/api/action/descriptors/editor-action-descriptor.factory.mjs +0 -21
- package/esm2022/tableview/api/action/descriptors/editor-action-editor-descriptor.factory.mjs +0 -21
- package/esm2022/tableview/api/action/descriptors/table-action-descriptor.factory.mjs +0 -37
- package/esm2022/tableview/api/action/descriptors/table-action-editor-descriptor.factory.mjs +0 -40
- package/esm2022/tableview/api/action/helpers/data-provider-executors.mjs +0 -100
- package/esm2022/tableview/api/action/models/action-component.model.mjs +0 -2
- package/esm2022/tableview/api/action/models/action-confirmation.model.mjs +0 -2
- package/esm2022/tableview/api/action/models/action-descriptor.types.mjs +0 -2
- package/esm2022/tableview/api/action/models/action-editor.model.mjs +0 -2
- package/esm2022/tableview/api/action/models/action-error.model.mjs +0 -14
- package/esm2022/tableview/api/action/models/action.type.mjs +0 -26
- package/esm2022/tableview/api/action/models/execution/action-context-validation.model.mjs +0 -2
- package/esm2022/tableview/api/action/models/execution/action-context.model.mjs +0 -2
- package/esm2022/tableview/api/action/models/execution/action-execution-error.model.mjs +0 -2
- package/esm2022/tableview/api/action/models/execution/action-instance-state.model.mjs +0 -32
- package/esm2022/tableview/api/action/models/execution/action-instance.model.mjs +0 -2
- package/esm2022/tableview/api/action/models/execution/view-container.model.mjs +0 -2
- package/esm2022/tableview/api/action/models/tableview-action-default-categories.model.mjs +0 -11
- package/esm2022/tableview/api/action/services/data-provider-executor.service.mjs +0 -28
- package/esm2022/tableview/api/action/services/tokens/data-language-dropdown.token.mjs +0 -3
- package/esm2022/tableview/api/class/editor/class-editor-attribute-converter.mjs +0 -85
- package/esm2022/tableview/api/class/editor/class-editor-attribute.model.mjs +0 -2
- package/esm2022/tableview/api/class/editor/class-editor-data-provider.factory.mjs +0 -5
- package/esm2022/tableview/api/class/editor/class-editor-descriptor-helpers.mjs +0 -95
- package/esm2022/tableview/api/class/editor/class-editor-descriptor.factory.mjs +0 -21
- package/esm2022/tableview/api/class/index.mjs +0 -13
- package/esm2022/tableview/api/class/mediusinc-mng-commons-tableview-api-class.mjs +0 -5
- package/esm2022/tableview/api/class/tableview/class-tableview-attribute-converter.mjs +0 -35
- package/esm2022/tableview/api/class/tableview/class-tableview-attribute.model.mjs +0 -2
- package/esm2022/tableview/api/class/tableview/class-tableview-data-provider.factory.mjs +0 -5
- package/esm2022/tableview/api/class/tableview/class-tableview-descriptor-helpers.mjs +0 -111
- package/esm2022/tableview/api/class/tableview/class-tableview-descriptor.factory.mjs +0 -26
- package/esm2022/tableview/api/editor/data-providers/editor-data-provider.factory.mjs +0 -15
- package/esm2022/tableview/api/editor/data-providers/editor.data-provider.mjs +0 -114
- package/esm2022/tableview/api/editor/descriptors/editor-descriptor.factory.mjs +0 -15
- package/esm2022/tableview/api/editor/descriptors/editor.descriptor.mjs +0 -437
- package/esm2022/tableview/api/editor/descriptors/field-action.descriptor.mjs +0 -51
- package/esm2022/tableview/api/editor/descriptors/field-base.descriptor.mjs +0 -314
- package/esm2022/tableview/api/editor/descriptors/field-group.descriptor.mjs +0 -103
- package/esm2022/tableview/api/editor/descriptors/field-lookup.descriptor.mjs +0 -211
- package/esm2022/tableview/api/editor/descriptors/field-many.descriptor.mjs +0 -142
- package/esm2022/tableview/api/editor/descriptors/field-validation.descriptor.mjs +0 -25
- package/esm2022/tableview/api/editor/descriptors/field.descriptor.mjs +0 -402
- package/esm2022/tableview/api/editor/descriptors/wrappers/editor-descriptor-nested-object-wrapper.mjs +0 -51
- package/esm2022/tableview/api/editor/models/editor-fields.model.mjs +0 -2
- package/esm2022/tableview/api/editor/models/editor.model.mjs +0 -9
- package/esm2022/tableview/api/editor/models/field-action-context.model.mjs +0 -2
- package/esm2022/tableview/api/editor/models/field-image-preview.model.mjs +0 -2
- package/esm2022/tableview/api/editor/models/field-validation.model.mjs +0 -2
- package/esm2022/tableview/api/editor/models/field.model.mjs +0 -57
- package/esm2022/tableview/api/editor/models/form-editor.event.mjs +0 -28
- package/esm2022/tableview/api/editor/models/form-editor.interface.mjs +0 -2
- package/esm2022/tableview/api/editor/models/formly-custom-field.model.mjs +0 -70
- package/esm2022/tableview/api/editor/models/formly-field.model.mjs +0 -2
- package/esm2022/tableview/api/editor/models/formly-options.model.mjs +0 -2
- package/esm2022/tableview/api/editor/models/radio.model.mjs +0 -2
- package/esm2022/tableview/api/index.mjs +0 -76
- package/esm2022/tableview/api/mediusinc-mng-commons-tableview-api.mjs +0 -5
- package/esm2022/tableview/api/tableview/data-providers/tableview-data-provider.factory.mjs +0 -18
- package/esm2022/tableview/api/tableview/data-providers/tableview.data-provider.mjs +0 -84
- package/esm2022/tableview/api/tableview/descriptors/tableview-descriptor.factory.mjs +0 -34
- package/esm2022/tableview/api/tableview/descriptors/tableview.descriptor.mjs +0 -377
- package/esm2022/tableview/api/tableview/helpers/files-export.mjs +0 -34
- package/esm2022/tableview/api/tableview/helpers/tableview-create.mjs +0 -26
- package/esm2022/tableview/api/tableview/helpers/tableview-data-provider-descriptor-convert.mjs +0 -7
- package/esm2022/tableview/api/tableview/helpers/tableview-default-actions.mjs +0 -324
- package/esm2022/tableview/api/tableview/helpers/tableview-input-builder.mjs +0 -319
- package/esm2022/tableview/api/tableview/models/tableview-descriptor-fields-manage-helper.type.mjs +0 -2
- package/esm2022/tableview/api/tableview/models/tableview-descriptor-helper.type.mjs +0 -2
- package/esm2022/tableview/api/tableview/models/tableview-input.model.mjs +0 -2
- package/esm2022/tableview/api/tableview/models/tableview-route.model.mjs +0 -2
- package/esm2022/tableview/editor/components/editor/auto-save-status/auto-save-status.component.mjs +0 -82
- package/esm2022/tableview/editor/components/editor/form-editor.component.mjs +0 -480
- package/esm2022/tableview/editor/components/formly/constants.mjs +0 -2
- package/esm2022/tableview/editor/components/formly/fields/formly-field-action/formly-field-action.component.mjs +0 -66
- package/esm2022/tableview/editor/components/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.mjs +0 -47
- package/esm2022/tableview/editor/components/formly/fields/formly-field-custom/formly-field-custom.component.mjs +0 -39
- package/esm2022/tableview/editor/components/formly/fields/formly-field-datepicker/formly-field-datepicker.component.mjs +0 -165
- package/esm2022/tableview/editor/components/formly/fields/formly-field-dropdown/formly-field-dropdown.component.mjs +0 -42
- package/esm2022/tableview/editor/components/formly/fields/formly-field-fieldset/formly-field-fieldset.component.mjs +0 -34
- package/esm2022/tableview/editor/components/formly/fields/formly-field-input/formly-field-input.component.mjs +0 -211
- package/esm2022/tableview/editor/components/formly/fields/formly-field-label/formly-field-label.component.mjs +0 -23
- package/esm2022/tableview/editor/components/formly/fields/formly-field-lookup-dialog/formly-field-lookup-dialog.component.mjs +0 -195
- package/esm2022/tableview/editor/components/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +0 -239
- package/esm2022/tableview/editor/components/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.mjs +0 -205
- package/esm2022/tableview/editor/components/formly/fields/formly-field-tabs/formly-field-tabs.component.mjs +0 -28
- package/esm2022/tableview/editor/components/formly/fields/formly-field-type.abstract.component.mjs +0 -46
- package/esm2022/tableview/editor/components/formly/pipes/formly-field-label.pipe.mjs +0 -19
- package/esm2022/tableview/editor/components/formly/wrappers/formly-field-no-label-wrapper/formly-field-no-label-wrapper.component.mjs +0 -33
- package/esm2022/tableview/editor/components/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.mjs +0 -59
- package/esm2022/tableview/editor/helpers/editor-autosave.mjs +0 -49
- package/esm2022/tableview/editor/helpers/editor-field.mjs +0 -39
- package/esm2022/tableview/editor/helpers/editor-formly.mjs +0 -388
- package/esm2022/tableview/editor/helpers/editor-validators.mjs +0 -25
- package/esm2022/tableview/editor/helpers/field-create.mjs +0 -21
- package/esm2022/tableview/editor/helpers/formly-config.mjs +0 -260
- package/esm2022/tableview/editor/helpers/notification.mjs +0 -11
- package/esm2022/tableview/editor/models/editor-auto-save-preview.model.mjs +0 -2
- package/esm2022/tableview/editor/models/formly-config.model.mjs +0 -2
- package/esm2022/tableview/editor/services/form-editor.service.mjs +0 -96
- package/esm2022/tableview/editor/services/formly-config.provider.mjs +0 -31
- package/esm2022/tableview/index.mjs +0 -67
- package/esm2022/tableview/mediusinc-mng-commons-tableview.mjs +0 -5
- package/esm2022/tableview/provide.mjs +0 -105
- package/esm2022/tableview/tableview/components/route/tableview-route.component.mjs +0 -15
- package/esm2022/tableview/tableview/components/tableview/tableview.component.mjs +0 -59
- package/esm2022/tableview/tableview/router/tableview-route-builder.mjs +0 -175
- package/esm2022/tableview/tableview/services/tableview-feature-config.token.mjs +0 -3
|
@@ -1,2155 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { NgClass, NgTemplateOutlet, DecimalPipe, CurrencyPipe, DatePipe, AsyncPipe, NgStyle } from '@angular/common';
|
|
3
|
-
import * as i0 from '@angular/core';
|
|
4
|
-
import { InjectionToken, inject, Injector, signal, computed, Injectable, ElementRef, Renderer2, ChangeDetectorRef, DestroyRef, input, viewChild, effect, untracked, Component, ViewEncapsulation, ChangeDetectionStrategy, LOCALE_ID, Pipe, output, booleanAttribute, contentChildren, viewChildren, afterNextRender } from '@angular/core';
|
|
5
|
-
import { toSignal, toObservable, takeUntilDestroyed, outputFromObservable } from '@angular/core/rxjs-interop';
|
|
6
|
-
import * as i1 from '@angular/forms';
|
|
7
|
-
import { FormsModule } from '@angular/forms';
|
|
8
|
-
import * as i2 from '@ngx-translate/core';
|
|
9
|
-
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
|
10
|
-
import * as i2$3 from 'primeng/api';
|
|
11
|
-
import { PrimeNGConfig, OverlayService, TranslationKeys, MessageService } from 'primeng/api';
|
|
12
|
-
import * as i2$1 from 'primeng/calendar';
|
|
13
|
-
import { CalendarModule } from 'primeng/calendar';
|
|
14
|
-
import * as i6 from 'primeng/checkbox';
|
|
15
|
-
import { CheckboxModule } from 'primeng/checkbox';
|
|
16
|
-
import { DomHandler, ConnectedOverlayScrollHandler } from 'primeng/dom';
|
|
17
|
-
import { FilterIcon } from 'primeng/icons/filter';
|
|
18
|
-
import { FilterSlashIcon } from 'primeng/icons/filterslash';
|
|
19
|
-
import * as i4 from 'primeng/inputnumber';
|
|
20
|
-
import { InputNumberModule } from 'primeng/inputnumber';
|
|
21
|
-
import * as i5 from 'primeng/inputtext';
|
|
22
|
-
import { InputTextModule } from 'primeng/inputtext';
|
|
23
|
-
import * as i1$3 from 'primeng/table';
|
|
24
|
-
import { Table, TableModule } from 'primeng/table';
|
|
25
|
-
import { ZIndexUtils } from 'primeng/utils';
|
|
26
|
-
import { combineLatest, switchMap, of, Subject, debounceTime, distinctUntilChanged, ReplaySubject, NEVER, BehaviorSubject, skip, filter } from 'rxjs';
|
|
27
|
-
import { FilterMatchMode, dateToIsoString, angularDateFormatHasTime, fromAngularDateFormatToPrime, angularDateFormatHasSeconds, fromAngularNumberFormatToFractions, COMMONS_MODULE_CONFIG_IT, effectWithDeps, toObservable as toObservable$1, CommonsService, RerenderDirective, GetterPipe, TemplatePipe, JsonPathPipe, BooleanPipe, EnumPipe, ComponentDirective, getI18nTypePropertyKey, TemplateDirective, findTemplateByName, getI18nForError, getI18nErrorParams, toastMessage, CommonsStorageService, LoggerService, booleanOrUndefinedAttribute, mergeDataListParamsWithDefaults, fromTableLoadToDataListParams, dataListParamsToUrlQuery, fromSubscribeError, getErrorLogLevel, fromUrlQueryToDataListParams, I18nPropertyPipe, ClassMapPipe, CommonsFeatureTypeEnum } from '@mediusinc/mng-commons/core';
|
|
28
|
-
import { FilterTypeEnum, FilterDescriptor, FilterDisplayTypeEnum, FilterLookupTypeEnum, FilterLookupDescriptor } from '@mediusinc/mng-commons/filter';
|
|
29
|
-
import { DateRangeComponent, AutocompleteComponent, DropdownComponent, InputTrimDirective, NumberRangeComponent } from '@mediusinc/mng-commons/form';
|
|
30
|
-
import { tableDescriptor, TableDynamicDescriptorInst, TablePaginationModeEnum, ColumnDisplayTypeEnum, TableSizeEnum } from '@mediusinc/mng-commons/table/api';
|
|
31
|
-
import * as i4$1 from 'primeng/button';
|
|
32
|
-
import { ButtonModule, Button } from 'primeng/button';
|
|
33
|
-
import * as i4$2 from 'primeng/ripple';
|
|
34
|
-
import { RippleModule } from 'primeng/ripple';
|
|
35
|
-
import * as i1$1 from 'primeng/tooltip';
|
|
36
|
-
import { TooltipModule } from 'primeng/tooltip';
|
|
37
|
-
import * as i2$2 from 'primeng/tag';
|
|
38
|
-
import { TagModule } from 'primeng/tag';
|
|
39
|
-
import { DropdownModule } from 'primeng/dropdown';
|
|
40
|
-
import * as i7 from 'primeng/messages';
|
|
41
|
-
import { MessagesModule } from 'primeng/messages';
|
|
42
|
-
import * as i9 from 'primeng/togglebutton';
|
|
43
|
-
import { ToggleButtonModule } from 'primeng/togglebutton';
|
|
44
|
-
import { lookupDataProvider } from '@mediusinc/mng-commons/form/api';
|
|
45
|
-
import { InputGroupModule } from 'primeng/inputgroup';
|
|
46
|
-
import { InputGroupAddonModule } from 'primeng/inputgroupaddon';
|
|
47
|
-
import * as i1$2 from 'primeng/overlaypanel';
|
|
48
|
-
import { OverlayPanel, OverlayPanelModule } from 'primeng/overlaypanel';
|
|
49
|
-
import { PaginatorModule } from 'primeng/paginator';
|
|
50
|
-
import { Router, ActivatedRoute, NavigationStart, NavigationEnd, NavigationCancel, NavigationError } from '@angular/router';
|
|
51
|
-
import * as i3 from 'primeng/multiselect';
|
|
52
|
-
import { MultiSelectModule } from 'primeng/multiselect';
|
|
53
|
-
import { getI18nForModel } from '@mediusinc/mng-commons/model';
|
|
54
|
-
|
|
55
|
-
function filterGenerateMatchModeOptions(primeConfig, descriptor, cmpSerCfg) {
|
|
56
|
-
let options = undefined;
|
|
57
|
-
if (descriptor == null || descriptor.filterType === FilterTypeEnum.String) {
|
|
58
|
-
options = [
|
|
59
|
-
{ value: FilterMatchMode.Contains, label: primeConfig.getTranslation(FilterMatchMode.Contains) },
|
|
60
|
-
{ value: FilterMatchMode.NotContains, label: primeConfig.getTranslation(FilterMatchMode.NotContains) },
|
|
61
|
-
{ value: FilterMatchMode.Equals, label: primeConfig.getTranslation(FilterMatchMode.Equals) },
|
|
62
|
-
{ value: FilterMatchMode.NotEquals, label: primeConfig.getTranslation(FilterMatchMode.NotEquals) },
|
|
63
|
-
{ value: FilterMatchMode.StartsWith, label: primeConfig.getTranslation(FilterMatchMode.StartsWith) },
|
|
64
|
-
{ value: FilterMatchMode.EndsWith, label: primeConfig.getTranslation(FilterMatchMode.EndsWith) }
|
|
65
|
-
];
|
|
66
|
-
}
|
|
67
|
-
else if (descriptor.filterType === FilterTypeEnum.Boolean) {
|
|
68
|
-
options = [{ value: FilterMatchMode.Equals, label: primeConfig.getTranslation(FilterMatchMode.Equals) }];
|
|
69
|
-
}
|
|
70
|
-
else if (descriptor.filterType === FilterTypeEnum.Number) {
|
|
71
|
-
options = [
|
|
72
|
-
{ value: FilterMatchMode.Equals, label: primeConfig.getTranslation(FilterMatchMode.Equals) },
|
|
73
|
-
{ value: FilterMatchMode.NotEquals, label: primeConfig.getTranslation(FilterMatchMode.NotEquals) },
|
|
74
|
-
{ value: FilterMatchMode.LessThan, label: primeConfig.getTranslation(FilterMatchMode.LessThan) },
|
|
75
|
-
{ value: FilterMatchMode.LessThanOrEqualTo, label: primeConfig.getTranslation(FilterMatchMode.LessThanOrEqualTo) },
|
|
76
|
-
{ value: FilterMatchMode.GreaterThan, label: primeConfig.getTranslation(FilterMatchMode.GreaterThan) },
|
|
77
|
-
{ value: FilterMatchMode.GreaterThanOrEqualTo, label: primeConfig.getTranslation(FilterMatchMode.GreaterThanOrEqualTo) },
|
|
78
|
-
{ value: FilterMatchMode.Between, label: primeConfig.getTranslation(FilterMatchMode.Between) }
|
|
79
|
-
];
|
|
80
|
-
}
|
|
81
|
-
else if (descriptor.filterType === FilterTypeEnum.Lookup || descriptor.filterType === FilterTypeEnum.LookupEnum) {
|
|
82
|
-
options = [
|
|
83
|
-
{ value: FilterMatchMode.Equals, label: primeConfig.getTranslation(FilterMatchMode.Equals) },
|
|
84
|
-
{ value: FilterMatchMode.NotEquals, label: primeConfig.getTranslation(FilterMatchMode.NotEquals) },
|
|
85
|
-
{ value: FilterMatchMode.In, label: primeConfig.getTranslation(FilterMatchMode.In) },
|
|
86
|
-
{ value: FilterMatchMode.NotIn, label: primeConfig.getTranslation(FilterMatchMode.NotIn) }
|
|
87
|
-
];
|
|
88
|
-
}
|
|
89
|
-
else if (descriptor.filterType === FilterTypeEnum.Date) {
|
|
90
|
-
if (!descriptor.datePickerShowTime && !descriptor.dateValueNoTime && !cmpSerCfg?.filtersDateOnlyDisabled) {
|
|
91
|
-
options = [
|
|
92
|
-
{ value: FilterMatchMode.Equals, label: primeConfig.getTranslation(FilterMatchMode.Equals) },
|
|
93
|
-
{ value: FilterMatchMode.NotEquals, label: primeConfig.getTranslation(FilterMatchMode.NotEquals) },
|
|
94
|
-
{ value: FilterMatchMode.LessThanOrEqualTo, label: primeConfig.getTranslation(FilterMatchMode.LessThanOrEqualTo) },
|
|
95
|
-
{ value: FilterMatchMode.GreaterThanOrEqualTo, label: primeConfig.getTranslation(FilterMatchMode.GreaterThanOrEqualTo) },
|
|
96
|
-
{ value: FilterMatchMode.Between, label: primeConfig.getTranslation(FilterMatchMode.Between) }
|
|
97
|
-
];
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
options = [
|
|
101
|
-
{ value: FilterMatchMode.Equals, label: primeConfig.getTranslation(FilterMatchMode.Equals) },
|
|
102
|
-
{ value: FilterMatchMode.LessThanOrEqualTo, label: primeConfig.getTranslation(FilterMatchMode.LessThanOrEqualTo) },
|
|
103
|
-
{ value: FilterMatchMode.GreaterThanOrEqualTo, label: primeConfig.getTranslation(FilterMatchMode.GreaterThanOrEqualTo) },
|
|
104
|
-
{ value: FilterMatchMode.Between, label: primeConfig.getTranslation(FilterMatchMode.Between) }
|
|
105
|
-
];
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
options?.push({ value: FilterMatchMode.Exists, label: primeConfig.getTranslation(FilterMatchMode.Exists) }, { value: FilterMatchMode.DoesNotExist, label: primeConfig.getTranslation(FilterMatchMode.DoesNotExist) });
|
|
109
|
-
if (descriptor?.matchModes) {
|
|
110
|
-
options = descriptor.matchModes.map(mm => ({ value: mm, label: primeConfig.getTranslation(mm) }));
|
|
111
|
-
}
|
|
112
|
-
return options || [];
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Gets the default match mode for a filter.
|
|
116
|
-
*
|
|
117
|
-
* @param {FilterDescriptor<any, any>} [descriptor] - The filter descriptor.
|
|
118
|
-
* @param {SelectItem[]} [matchModes=[]] - The available match modes options.
|
|
119
|
-
*
|
|
120
|
-
* @return {FilterMatchModeExtendedType} The default match mode for the filter.
|
|
121
|
-
*/
|
|
122
|
-
function filterGetDefaultMatchMode(descriptor, matchModes = []) {
|
|
123
|
-
let defaultMatchMode = FilterMatchMode.Equals;
|
|
124
|
-
if (descriptor?.filterType === FilterTypeEnum.String)
|
|
125
|
-
defaultMatchMode = FilterMatchMode.StartsWith;
|
|
126
|
-
// overwrite type default set in descriptor
|
|
127
|
-
if (descriptor?.defaultMatchMode) {
|
|
128
|
-
defaultMatchMode = descriptor.defaultMatchMode;
|
|
129
|
-
}
|
|
130
|
-
// check if default mode exists!
|
|
131
|
-
if (matchModes.length > 0 && !matchModes.some(m => m.value === defaultMatchMode)) {
|
|
132
|
-
defaultMatchMode = matchModes[0].value;
|
|
133
|
-
}
|
|
134
|
-
return defaultMatchMode;
|
|
135
|
-
}
|
|
136
|
-
function filterSetMetadataOnChange(filter, matchMode, value, filterType, filterDateCfg) {
|
|
137
|
-
let displayValue = filter?.displayValue ?? value;
|
|
138
|
-
let displayMatchMode = filter?.displayMatchMode ?? matchMode;
|
|
139
|
-
// when equals is used on dates with time, the actual filter will be between, but displayed as equals
|
|
140
|
-
if (filterType === FilterTypeEnum.Date && !filterDateCfg?.valueNoTime) {
|
|
141
|
-
if (matchMode === FilterMatchMode.Between &&
|
|
142
|
-
Array.isArray(value) &&
|
|
143
|
-
value.length === 2 &&
|
|
144
|
-
value.every(v => v instanceof Date || typeof v === 'string' || typeof v === 'number')) {
|
|
145
|
-
if (filterAreDatesEqual(value[0], value[1], filterDateCfg)) {
|
|
146
|
-
displayMatchMode = FilterMatchMode.Equals;
|
|
147
|
-
displayValue = new Date(value[0]);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
else if (matchMode === FilterMatchMode.Equals && !value) {
|
|
151
|
-
matchMode = FilterMatchMode.Between;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
if (filterType === FilterTypeEnum.Date && displayValue) {
|
|
155
|
-
// display value for calendar cannot be string, convert to date
|
|
156
|
-
displayValue = Array.isArray(displayValue)
|
|
157
|
-
? displayValue.map(v => (!(v instanceof Date) ? new Date(v) : v))
|
|
158
|
-
: displayValue instanceof Date
|
|
159
|
-
? displayValue
|
|
160
|
-
: new Date(displayValue);
|
|
161
|
-
}
|
|
162
|
-
if (filterType === FilterTypeEnum.Boolean && displayValue != null && typeof displayValue !== 'boolean') {
|
|
163
|
-
displayValue = (typeof displayValue === 'string' && displayValue.toLowerCase() === 'true') || displayValue === 1;
|
|
164
|
-
}
|
|
165
|
-
if (filterType === FilterTypeEnum.Number && displayValue != null && typeof displayValue !== 'number') {
|
|
166
|
-
const numValue = +displayValue;
|
|
167
|
-
if (!isNaN(numValue)) {
|
|
168
|
-
displayValue = numValue;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
return {
|
|
172
|
-
...filter,
|
|
173
|
-
matchMode,
|
|
174
|
-
value: value,
|
|
175
|
-
displayMatchMode,
|
|
176
|
-
displayValue
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
function filterSetMetadataOnDisplayChange(filter, displayMatchMode, displayValue, filterType, filterDateCfg) {
|
|
180
|
-
let matchMode = displayMatchMode;
|
|
181
|
-
let value = displayValue;
|
|
182
|
-
if (filterType === FilterTypeEnum.Date) {
|
|
183
|
-
if (!filterDateCfg?.valueNoTime && displayValue !== null) {
|
|
184
|
-
if (displayMatchMode === FilterMatchMode.Equals) {
|
|
185
|
-
if (value instanceof Date || typeof value === 'string' || typeof value === 'number') {
|
|
186
|
-
const fromDate = new Date(value);
|
|
187
|
-
const toDate = new Date(value);
|
|
188
|
-
if (filterDateCfg?.showTime) {
|
|
189
|
-
if (filterDateCfg?.showSeconds) {
|
|
190
|
-
fromDate.setMilliseconds(0);
|
|
191
|
-
toDate.setMilliseconds(999);
|
|
192
|
-
}
|
|
193
|
-
else {
|
|
194
|
-
fromDate.setSeconds(0, 0);
|
|
195
|
-
toDate.setSeconds(59, 999);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
else {
|
|
199
|
-
fromDate.setHours(0, 0, 0, 0);
|
|
200
|
-
toDate.setHours(23, 59, 59, 999);
|
|
201
|
-
}
|
|
202
|
-
value = [fromDate, toDate];
|
|
203
|
-
matchMode = FilterMatchMode.Between;
|
|
204
|
-
}
|
|
205
|
-
else {
|
|
206
|
-
value = null;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
else if (displayMatchMode === FilterMatchMode.Between) {
|
|
210
|
-
if (Array.isArray(value) && value.length === 2 && value.every(i => i instanceof Date || typeof i === 'string' || typeof i === 'number')) {
|
|
211
|
-
const fromDate = new Date(value[0]);
|
|
212
|
-
let toDate = new Date(value[1]);
|
|
213
|
-
if (filterAreDatesEqual(fromDate, toDate, filterDateCfg)) {
|
|
214
|
-
toDate = new Date(fromDate);
|
|
215
|
-
if (filterDateCfg?.showTime) {
|
|
216
|
-
if (filterDateCfg?.showSeconds) {
|
|
217
|
-
toDate.setSeconds(toDate.getSeconds() + 1);
|
|
218
|
-
}
|
|
219
|
-
else {
|
|
220
|
-
toDate.setMinutes(toDate.getMinutes() + 1);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
else {
|
|
224
|
-
toDate.setDate(toDate.getDate() + 1);
|
|
225
|
-
}
|
|
226
|
-
value = [fromDate, toDate];
|
|
227
|
-
matchMode = FilterMatchMode.Between;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
else {
|
|
231
|
-
value = null;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
const convertDateType = filterDateCfg?.valueNoTime ? 'date' : 'date-time';
|
|
236
|
-
const convertDateTimeOpts = {
|
|
237
|
-
utc: filterDateCfg?.valueUtc,
|
|
238
|
-
noMillis: filterDateCfg?.valueNoMillis,
|
|
239
|
-
noTimezone: filterDateCfg?.valueNoTimezone
|
|
240
|
-
};
|
|
241
|
-
value =
|
|
242
|
-
value == null
|
|
243
|
-
? value
|
|
244
|
-
: Array.isArray(value)
|
|
245
|
-
? value.filter(i => i != null).map(i => dateToIsoString(i, convertDateType, convertDateTimeOpts))
|
|
246
|
-
: dateToIsoString(value, convertDateType, convertDateTimeOpts);
|
|
247
|
-
}
|
|
248
|
-
if (matchMode === FilterMatchMode.Exists || matchMode === FilterMatchMode.DoesNotExist) {
|
|
249
|
-
value = null;
|
|
250
|
-
}
|
|
251
|
-
return {
|
|
252
|
-
...filter,
|
|
253
|
-
displayMatchMode: displayMatchMode,
|
|
254
|
-
matchMode: matchMode,
|
|
255
|
-
displayValue: displayValue,
|
|
256
|
-
value: value,
|
|
257
|
-
caseSensitive: filterType === FilterTypeEnum.String ? filter?.caseSensitive : undefined
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
function filterAreDatesEqual(fromDate, toDate, filterDateCfg) {
|
|
261
|
-
const startDate = dateToIsoString(fromDate);
|
|
262
|
-
const endDate = dateToIsoString(toDate);
|
|
263
|
-
// 2020-11-02T11:12:12.000
|
|
264
|
-
const cmpLength = filterDateCfg?.showTime ? (filterDateCfg?.showSeconds ? 19 : 16) : 10;
|
|
265
|
-
return startDate.substring(0, cmpLength) === endDate.substring(0, cmpLength);
|
|
266
|
-
}
|
|
267
|
-
function filterApplySerializationConfigToCmp(config, cmpSerCfg) {
|
|
268
|
-
// set default
|
|
269
|
-
cmpSerCfg.dateTimeInUtc = false;
|
|
270
|
-
cmpSerCfg.dateTimeWithTimezone = true;
|
|
271
|
-
cmpSerCfg.dateTimeWithMillis = true;
|
|
272
|
-
cmpSerCfg.filtersDateOnlyDisabled = false;
|
|
273
|
-
// set customizations
|
|
274
|
-
if (config?.serialization) {
|
|
275
|
-
if (config.serialization.dateTimeInUtc !== undefined)
|
|
276
|
-
cmpSerCfg.dateTimeInUtc = config.serialization.dateTimeInUtc;
|
|
277
|
-
if (config.serialization.dateTimeWithTimezone !== undefined)
|
|
278
|
-
cmpSerCfg.dateTimeWithTimezone = config.serialization.dateTimeWithTimezone;
|
|
279
|
-
if (config.serialization.dateTimeWithMillis !== undefined)
|
|
280
|
-
cmpSerCfg.dateTimeWithMillis = config.serialization.dateTimeWithMillis;
|
|
281
|
-
if (config.serialization.filtersDateOnlyDisabled !== undefined)
|
|
282
|
-
cmpSerCfg.filtersDateOnlyDisabled = config.serialization.filtersDateOnlyDisabled;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
function filterAdjustDisplayValueOnMatchModeChange(matchMode, value) {
|
|
286
|
-
if (matchMode == null || matchMode === FilterMatchMode.Exists || matchMode === FilterMatchMode.DoesNotExist) {
|
|
287
|
-
return value; // never change, only change later if something else changes here
|
|
288
|
-
}
|
|
289
|
-
if (matchMode === FilterMatchMode.Between) {
|
|
290
|
-
if (!Array.isArray(value)) {
|
|
291
|
-
return value != null ? [value, value] : [];
|
|
292
|
-
}
|
|
293
|
-
else if (value.length === 0 || value.length === 2) {
|
|
294
|
-
return value;
|
|
295
|
-
}
|
|
296
|
-
else if (value.length === 1) {
|
|
297
|
-
return [value[0], value[0]];
|
|
298
|
-
}
|
|
299
|
-
else {
|
|
300
|
-
return [value[0], value[1]];
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
if (matchMode === FilterMatchMode.In || matchMode === FilterMatchMode.NotIn) {
|
|
304
|
-
return Array.isArray(value) ? value : value == null ? [] : [value];
|
|
305
|
-
}
|
|
306
|
-
return Array.isArray(value) && value.length > 0 ? value[0] : value;
|
|
307
|
-
}
|
|
308
|
-
function filterGetDateConfig(descriptor, serCfg) {
|
|
309
|
-
if (!descriptor || descriptor.filterType !== FilterTypeEnum.Date) {
|
|
310
|
-
return undefined;
|
|
311
|
-
}
|
|
312
|
-
const showTime = descriptor.datePickerShowTime ?? (descriptor.displayFormatApplyToField && descriptor.displayFormat ? angularDateFormatHasTime(descriptor.displayFormat) : false);
|
|
313
|
-
return {
|
|
314
|
-
valueNoTime: descriptor.dateValueNoTime || (!serCfg?.filtersDateOnlyDisabled && !showTime),
|
|
315
|
-
valueUtc: descriptor.dateValueUtc ?? serCfg?.dateTimeInUtc,
|
|
316
|
-
valueNoTimezone: descriptor.dateValueNoTimezone ?? !serCfg?.dateTimeWithTimezone,
|
|
317
|
-
valueNoMillis: !serCfg?.dateTimeWithMillis,
|
|
318
|
-
format: descriptor.datePickerFormat ?? (descriptor.displayFormatApplyToField && descriptor.displayFormat ? fromAngularDateFormatToPrime(descriptor.displayFormat) : undefined),
|
|
319
|
-
showTime: showTime,
|
|
320
|
-
showSeconds: showTime &&
|
|
321
|
-
(descriptor.datePickerShowSeconds ?? (descriptor.displayFormatApplyToField && descriptor.displayFormat ? angularDateFormatHasSeconds(descriptor.displayFormat) : false))
|
|
322
|
-
};
|
|
323
|
-
}
|
|
324
|
-
function filterGetNumberConfig(descriptor) {
|
|
325
|
-
if (!descriptor || descriptor.filterType !== FilterTypeEnum.Number) {
|
|
326
|
-
return undefined;
|
|
327
|
-
}
|
|
328
|
-
const displayCfg = descriptor.displayFormatApplyToField && descriptor.displayFormat ? fromAngularNumberFormatToFractions(descriptor.displayFormat) : undefined;
|
|
329
|
-
return {
|
|
330
|
-
fractionsMin: descriptor.numberMinFractionDigits ?? displayCfg?.fractionsMin,
|
|
331
|
-
fractionsMax: descriptor.numberMaxFractionDigits ?? displayCfg?.fractionsMax
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
|
-
/**
|
|
335
|
-
* Creates an array of filter descriptors from an array of generic filter properties.
|
|
336
|
-
*
|
|
337
|
-
* @param {FilterGenericProperty[]} properties - The array of filterable properties, their types and options.
|
|
338
|
-
* @param {LookupDataProviderInst<string, any, any, 'field'>} [valueLookup] - The lookup data provider for value suggestions.
|
|
339
|
-
*/
|
|
340
|
-
function createFilterDescriptorsFromGeneric(properties, valueLookup) {
|
|
341
|
-
return properties.reduce((createdFilterDescriptors, genericFilter) => {
|
|
342
|
-
// when no generic value lookup is provided, lookup enum filters are treated as string filters
|
|
343
|
-
const filterType = genericFilter.type === FilterTypeEnum.LookupEnum && valueLookup === undefined ? FilterTypeEnum.String : genericFilter.type;
|
|
344
|
-
const filterDescriptor = new FilterDescriptor(genericFilter.property).asFilterType(filterType).asGenericFilter();
|
|
345
|
-
if ((genericFilter.type === FilterTypeEnum.String || genericFilter.type === FilterTypeEnum.LookupEnum) && valueLookup) {
|
|
346
|
-
filterDescriptor.withGenericValueProvider(valueLookup);
|
|
347
|
-
}
|
|
348
|
-
if (filterDescriptor && genericFilter.opts !== undefined) {
|
|
349
|
-
switch (genericFilter.type) {
|
|
350
|
-
case FilterTypeEnum.Number:
|
|
351
|
-
filterDescriptor.asNumber(genericFilter.opts);
|
|
352
|
-
break;
|
|
353
|
-
case FilterTypeEnum.Date:
|
|
354
|
-
filterDescriptor.asDate(genericFilter.opts);
|
|
355
|
-
break;
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
if (filterDescriptor) {
|
|
359
|
-
createdFilterDescriptors.push(filterDescriptor);
|
|
360
|
-
}
|
|
361
|
-
return createdFilterDescriptors;
|
|
362
|
-
}, []);
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
function tableCreateFilterMeta(paramsWithDefaults) {
|
|
366
|
-
const primeFilterMeta = {};
|
|
367
|
-
// if any filter is present, no default filters should be applied!
|
|
368
|
-
if (paramsWithDefaults?.filters) {
|
|
369
|
-
Object.entries(paramsWithDefaults.filters).forEach(([key, value]) => {
|
|
370
|
-
primeFilterMeta[key] = {
|
|
371
|
-
value: value?.value,
|
|
372
|
-
matchMode: value?.matchMode,
|
|
373
|
-
caseSensitive: value?.caseSensitive
|
|
374
|
-
};
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
return primeFilterMeta;
|
|
378
|
-
}
|
|
379
|
-
function tableCreateSortMeta(paramsWithDefaults) {
|
|
380
|
-
if (paramsWithDefaults?.sort !== undefined && Array.isArray(paramsWithDefaults?.sort) && paramsWithDefaults?.sort.length > 0) {
|
|
381
|
-
return paramsWithDefaults?.sort.map(s => ({
|
|
382
|
-
field: s.property,
|
|
383
|
-
order: s.ascending ? 1 : -1
|
|
384
|
-
}));
|
|
385
|
-
}
|
|
386
|
-
return undefined;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
const COMMONS_TABLE_FEATURE_CONFIG_IT = new InjectionToken('COMMONS_TABLE_FEATURE_CONFIG');
|
|
390
|
-
|
|
391
|
-
class TableMetadataService {
|
|
392
|
-
static { this.cmpTypeName = 'TableComponent'; }
|
|
393
|
-
#injector;
|
|
394
|
-
#translationObserver;
|
|
395
|
-
// signal sources
|
|
396
|
-
#signalSources;
|
|
397
|
-
#descriptor;
|
|
398
|
-
#updateDescriptorFromSourceEffect;
|
|
399
|
-
#genericFilters;
|
|
400
|
-
// search
|
|
401
|
-
#searchFieldsFromSignalSource;
|
|
402
|
-
#searchFields;
|
|
403
|
-
#searchFieldsEffect;
|
|
404
|
-
constructor() {
|
|
405
|
-
this.#injector = inject(Injector);
|
|
406
|
-
this.primeConfig = inject(PrimeNGConfig);
|
|
407
|
-
this.moduleConfig = inject(COMMONS_MODULE_CONFIG_IT, { optional: true });
|
|
408
|
-
this.tableModuleConfig = inject(COMMONS_TABLE_FEATURE_CONFIG_IT, { optional: true });
|
|
409
|
-
this.serializationCfg = {};
|
|
410
|
-
this.#translationObserver = toSignal(this.primeConfig.translationObserver);
|
|
411
|
-
this.defaultFilterDisplayType = this.tableModuleConfig?.filterDisplayType ?? FilterDisplayTypeEnum.Column;
|
|
412
|
-
// signal sources
|
|
413
|
-
this.#signalSources = signal({});
|
|
414
|
-
// descriptors
|
|
415
|
-
this.descriptorFromSource = computed(() => this.#signalSources().descriptor?.());
|
|
416
|
-
this.#descriptor = signal(tableDescriptor());
|
|
417
|
-
this.descriptor = this.#descriptor.asReadonly();
|
|
418
|
-
this.#updateDescriptorFromSourceEffect = effectWithDeps([this.descriptorFromSource], ([d]) => {
|
|
419
|
-
if (d != null) {
|
|
420
|
-
this.#descriptor.set(d);
|
|
421
|
-
}
|
|
422
|
-
});
|
|
423
|
-
// pagination
|
|
424
|
-
this.rowsPerPageOptions = computed(() => {
|
|
425
|
-
const descriptor = this.descriptor();
|
|
426
|
-
if (Array.isArray(descriptor.rowsPerPageOptions) && descriptor.rowsPerPageOptions.length > 0) {
|
|
427
|
-
return descriptor.rowsPerPageOptions;
|
|
428
|
-
}
|
|
429
|
-
else {
|
|
430
|
-
return [25, 50, 100];
|
|
431
|
-
}
|
|
432
|
-
});
|
|
433
|
-
// filters
|
|
434
|
-
this.filterDescriptors = computed(() => this.descriptor().filters);
|
|
435
|
-
this.filters = computed(() => {
|
|
436
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
437
|
-
const observer = this.#translationObserver(); // need this one to track language changes
|
|
438
|
-
return this.filterDescriptors().map(d => this.mapDescriptorToMetadata(d));
|
|
439
|
-
});
|
|
440
|
-
this.genericFilterDescriptor = computed(() => this.descriptor().genericFilter);
|
|
441
|
-
this.#genericFilters = signal([]);
|
|
442
|
-
this.genericFilters = this.#genericFilters.asReadonly();
|
|
443
|
-
// search
|
|
444
|
-
this.#searchFieldsFromSignalSource = computed(() => this.#signalSources().searchFields?.());
|
|
445
|
-
this.#searchFields = signal([]);
|
|
446
|
-
this.searchFields = this.#searchFields.asReadonly();
|
|
447
|
-
this.#searchFieldsEffect = effectWithDeps([this.descriptor, this.#searchFieldsFromSignalSource], ([descriptor, searchFieldsFromSignalSource]) => {
|
|
448
|
-
this.#searchFields.set(searchFieldsFromSignalSource ?? (descriptor.search && descriptor.searchFields ? descriptor.searchFields : this.descriptor().columns.map(c => c.property)));
|
|
449
|
-
});
|
|
450
|
-
// params
|
|
451
|
-
this.defaultParams = computed(() => {
|
|
452
|
-
const params = {
|
|
453
|
-
offset: 0,
|
|
454
|
-
limit: this.rowsPerPageOptions()[0],
|
|
455
|
-
sort: this.descriptor()
|
|
456
|
-
.sorts.filter(s => s.defaultIsEnabled)
|
|
457
|
-
.sort((s1, s2) => (s1.defaultOrder ?? 1000) - (s2.defaultOrder ?? 1000))
|
|
458
|
-
.map(s => ({
|
|
459
|
-
property: s.property,
|
|
460
|
-
ascending: s.defaultIsAscending
|
|
461
|
-
})),
|
|
462
|
-
filters: {}
|
|
463
|
-
};
|
|
464
|
-
this.filters()
|
|
465
|
-
.filter(f => f.descriptor.hasDefaultValue)
|
|
466
|
-
.forEach(f => {
|
|
467
|
-
params.filters[f.descriptor.property] = {
|
|
468
|
-
value: f.descriptor.defaultValue,
|
|
469
|
-
matchMode: f.defaultMatchMode
|
|
470
|
-
};
|
|
471
|
-
});
|
|
472
|
-
return params;
|
|
473
|
-
});
|
|
474
|
-
filterApplySerializationConfigToCmp(this.moduleConfig, this.serializationCfg);
|
|
475
|
-
combineLatest([toObservable(this.genericFilterDescriptor), toObservable(this.#translationObserver)])
|
|
476
|
-
.pipe(switchMap(([genericFilterDescriptor]) => {
|
|
477
|
-
if (genericFilterDescriptor) {
|
|
478
|
-
const dataProvider = this.genericFilterDescriptor()?.propertyLookup;
|
|
479
|
-
const genericFilterService = dataProvider?.serviceType ? this.#injector.get(dataProvider.serviceType) : null;
|
|
480
|
-
// fetch filterable properties
|
|
481
|
-
return toObservable$1(genericFilterDescriptor.propertyLookup.lookup({}, genericFilterService));
|
|
482
|
-
}
|
|
483
|
-
return of([]);
|
|
484
|
-
}), takeUntilDestroyed())
|
|
485
|
-
.subscribe({
|
|
486
|
-
next: genericFilters => {
|
|
487
|
-
// set descriptors from generic filter data
|
|
488
|
-
this.#genericFilters.set(createFilterDescriptorsFromGeneric(genericFilters, this.genericFilterDescriptor()?.valueLookup).map(d => this.mapDescriptorToMetadata(d)));
|
|
489
|
-
}
|
|
490
|
-
});
|
|
491
|
-
}
|
|
492
|
-
setSignalSources(descriptor, searchFields) {
|
|
493
|
-
this.#signalSources.set({ descriptor, searchFields });
|
|
494
|
-
}
|
|
495
|
-
setDescriptor(descriptor) {
|
|
496
|
-
if (this.descriptorFromSource() instanceof TableDynamicDescriptorInst) {
|
|
497
|
-
this.#descriptor.set(descriptor);
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
mapDescriptorToMetadata(descriptor) {
|
|
501
|
-
const matchModes = filterGenerateMatchModeOptions(this.primeConfig, descriptor, this.serializationCfg);
|
|
502
|
-
return {
|
|
503
|
-
descriptor: descriptor,
|
|
504
|
-
matchModes: matchModes,
|
|
505
|
-
defaultMatchMode: filterGetDefaultMatchMode(descriptor, matchModes),
|
|
506
|
-
dateConfig: filterGetDateConfig(descriptor, this.serializationCfg),
|
|
507
|
-
numberConfig: filterGetNumberConfig(descriptor)
|
|
508
|
-
};
|
|
509
|
-
}
|
|
510
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableMetadataService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
511
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableMetadataService }); }
|
|
512
|
-
}
|
|
513
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableMetadataService, decorators: [{
|
|
514
|
-
type: Injectable
|
|
515
|
-
}], ctorParameters: () => [] });
|
|
516
|
-
|
|
517
|
-
class TableDataService {
|
|
518
|
-
constructor() {
|
|
519
|
-
this.#injector = inject(Injector);
|
|
520
|
-
this.#commons = inject(CommonsService);
|
|
521
|
-
this.#metadata = inject(TableMetadataService);
|
|
522
|
-
// signal sources
|
|
523
|
-
this.#dataSources = signal({});
|
|
524
|
-
// data sources
|
|
525
|
-
this.#manualLoading = computed(() => this.#dataSources()?.manualLoading?.());
|
|
526
|
-
// results that are set directly via input and are not result of a asynchronous operation (aka data provider)
|
|
527
|
-
this.#synchronousResult = computed(() => {
|
|
528
|
-
const dataSources = this.#dataSources();
|
|
529
|
-
if (dataSources?.dataProvider?.() !== undefined) {
|
|
530
|
-
return undefined;
|
|
531
|
-
}
|
|
532
|
-
if (dataSources?.dataListResult?.() !== undefined) {
|
|
533
|
-
return dataSources?.dataListResult();
|
|
534
|
-
}
|
|
535
|
-
if (dataSources?.arrayItems?.() !== undefined) {
|
|
536
|
-
return { data: dataSources.arrayItems(), totalCount: dataSources.arrayItems()?.length ?? 0 };
|
|
537
|
-
}
|
|
538
|
-
return undefined;
|
|
539
|
-
});
|
|
540
|
-
this.#dataProvider = computed(() => this.#dataSources()?.dataProvider?.());
|
|
541
|
-
this.#dataProviderService = computed(() => {
|
|
542
|
-
const dataProvider = this.#dataProvider();
|
|
543
|
-
return dataProvider?.serviceType ? this.#injector.get(dataProvider.serviceType) : null;
|
|
544
|
-
});
|
|
545
|
-
this.#synchronousResultEffect = effectWithDeps([this.#synchronousResult], ([res]) => {
|
|
546
|
-
if (res != null) {
|
|
547
|
-
this.#setData(res.data ?? [], res.totalCount);
|
|
548
|
-
}
|
|
549
|
-
});
|
|
550
|
-
this.#synchronousLoadingEffect = effectWithDeps([this.#synchronousResult, this.#manualLoading], ([res, manualLoading]) => {
|
|
551
|
-
if (res != null && manualLoading == null) {
|
|
552
|
-
this.#loading.set(false);
|
|
553
|
-
}
|
|
554
|
-
});
|
|
555
|
-
this.#manualLoadingEffect = effectWithDeps([this.#manualLoading], ([manualLoading]) => {
|
|
556
|
-
if (manualLoading != null) {
|
|
557
|
-
this.#loading.set(manualLoading);
|
|
558
|
-
}
|
|
559
|
-
});
|
|
560
|
-
// pagination
|
|
561
|
-
this.#params = signal(undefined);
|
|
562
|
-
this.params = this.#params.asReadonly();
|
|
563
|
-
this.#sortMeta = signal(undefined);
|
|
564
|
-
this.sortMeta = this.#sortMeta.asReadonly();
|
|
565
|
-
this.#filterMeta = signal({});
|
|
566
|
-
this.filterMeta = this.#filterMeta.asReadonly();
|
|
567
|
-
this.#isSortAndFilterMetaInitialized = signal(false);
|
|
568
|
-
this.#defaultParamsEffect = effectWithDeps([this.#metadata.defaultParams], ([defaultParams]) => {
|
|
569
|
-
this.#sortMeta.set(tableCreateSortMeta(defaultParams));
|
|
570
|
-
this.#filterMeta.set(tableCreateFilterMeta(defaultParams));
|
|
571
|
-
this.#isSortAndFilterMetaInitialized.set(true);
|
|
572
|
-
}, { firstOnly: true });
|
|
573
|
-
this.#isSearchMetaInitialized = signal(false);
|
|
574
|
-
this.#searchMeta = signal(undefined);
|
|
575
|
-
this.searchMeta = this.#searchMeta.asReadonly();
|
|
576
|
-
this.isAllPaginationMetaInitialized = computed(() => this.#isSortAndFilterMetaInitialized() && this.#isSortAndFilterMetaInitialized());
|
|
577
|
-
this.paginationMode = computed(() => {
|
|
578
|
-
const descriptor = this.#metadata.descriptor();
|
|
579
|
-
if (descriptor.paginationMode != null) {
|
|
580
|
-
// descriptor choice is the strongest - if defined, use this value
|
|
581
|
-
return descriptor.paginationMode;
|
|
582
|
-
}
|
|
583
|
-
else if (this.#dataProvider() != null) {
|
|
584
|
-
// when data provider is used, use pagination
|
|
585
|
-
return TablePaginationModeEnum.Pagination;
|
|
586
|
-
}
|
|
587
|
-
else {
|
|
588
|
-
return TablePaginationModeEnum.None;
|
|
589
|
-
}
|
|
590
|
-
});
|
|
591
|
-
this.offset = computed(() => this.params()?.offset ?? 0);
|
|
592
|
-
this.rows = computed(() => {
|
|
593
|
-
if (this.params()?.limit) {
|
|
594
|
-
return this.params()?.limit;
|
|
595
|
-
}
|
|
596
|
-
const descriptor = this.#metadata.descriptor();
|
|
597
|
-
const rowsPerPageOptions = this.#metadata.rowsPerPageOptions();
|
|
598
|
-
if (descriptor.defaultNumRows && rowsPerPageOptions.includes(descriptor.defaultNumRows)) {
|
|
599
|
-
return descriptor.defaultNumRows;
|
|
600
|
-
}
|
|
601
|
-
return rowsPerPageOptions[0];
|
|
602
|
-
});
|
|
603
|
-
// data
|
|
604
|
-
this.#data = signal([]);
|
|
605
|
-
this.data = this.#data.asReadonly();
|
|
606
|
-
this.#count = signal(0);
|
|
607
|
-
this.count = this.#count.asReadonly();
|
|
608
|
-
this.#loading = signal(true);
|
|
609
|
-
this.loading = this.#loading.asReadonly();
|
|
610
|
-
}
|
|
611
|
-
#injector;
|
|
612
|
-
#commons;
|
|
613
|
-
#metadata;
|
|
614
|
-
// signal sources
|
|
615
|
-
#dataSources;
|
|
616
|
-
// data sources
|
|
617
|
-
#manualLoading;
|
|
618
|
-
// results that are set directly via input and are not result of a asynchronous operation (aka data provider)
|
|
619
|
-
#synchronousResult;
|
|
620
|
-
#dataProvider;
|
|
621
|
-
#dataProviderService;
|
|
622
|
-
#synchronousResultEffect;
|
|
623
|
-
#synchronousLoadingEffect;
|
|
624
|
-
#manualLoadingEffect;
|
|
625
|
-
#dataProviderSubscription;
|
|
626
|
-
// pagination
|
|
627
|
-
#params;
|
|
628
|
-
#sortMeta;
|
|
629
|
-
#filterMeta;
|
|
630
|
-
#isSortAndFilterMetaInitialized;
|
|
631
|
-
#defaultParamsEffect;
|
|
632
|
-
#isSearchMetaInitialized;
|
|
633
|
-
#searchMeta;
|
|
634
|
-
// data
|
|
635
|
-
#data;
|
|
636
|
-
#count;
|
|
637
|
-
#loading;
|
|
638
|
-
setDataSources(arrayItems, dataListResult, dataProvider, manualLoading) {
|
|
639
|
-
this.#dataSources.set({ arrayItems, dataListResult, dataProvider, manualLoading });
|
|
640
|
-
}
|
|
641
|
-
fetchWithDataProvider(params, onErrorFn) {
|
|
642
|
-
const dataProvider = this.#dataProvider();
|
|
643
|
-
if (!dataProvider || params.limit === 0) {
|
|
644
|
-
return false;
|
|
645
|
-
}
|
|
646
|
-
this.#dataProviderSubscription?.unsubscribe();
|
|
647
|
-
this.#loading.set(true);
|
|
648
|
-
this.#dataProviderSubscription = toObservable$1(dataProvider.getAll(params, this.#dataProviderService(), this.#metadata.descriptor().isLocalized ? (this.#commons.appDataLocale() ?? undefined) : undefined)).subscribe({
|
|
649
|
-
next: res => {
|
|
650
|
-
const descriptorInput = this.#metadata.descriptorFromSource();
|
|
651
|
-
if (descriptorInput instanceof TableDynamicDescriptorInst) {
|
|
652
|
-
this.#metadata.setDescriptor(descriptorInput.toTableDescriptorFromData(res));
|
|
653
|
-
}
|
|
654
|
-
this.#setData(res?.data ?? [], res?.totalCount);
|
|
655
|
-
this.#loading.set(false);
|
|
656
|
-
},
|
|
657
|
-
error: err => {
|
|
658
|
-
onErrorFn(err);
|
|
659
|
-
this.#setData([]);
|
|
660
|
-
this.#loading.set(false);
|
|
661
|
-
}
|
|
662
|
-
});
|
|
663
|
-
return true;
|
|
664
|
-
}
|
|
665
|
-
setParams(params, fromQueryParams = false) {
|
|
666
|
-
if (!fromQueryParams && this.compareWithCurrentParams(params)) {
|
|
667
|
-
return;
|
|
668
|
-
}
|
|
669
|
-
this.#params.set(params);
|
|
670
|
-
this.#sortMeta.set(tableCreateSortMeta(params));
|
|
671
|
-
this.#filterMeta.set(tableCreateFilterMeta(params));
|
|
672
|
-
this.#isSortAndFilterMetaInitialized.set(true);
|
|
673
|
-
if (fromQueryParams && !this.#isSearchMetaInitialized() && params?.search) {
|
|
674
|
-
this.#searchMeta.set({ value: params.search, caseSensitive: params.filters?.['global']?.caseSensitive ?? false });
|
|
675
|
-
}
|
|
676
|
-
this.#isSearchMetaInitialized.set(true);
|
|
677
|
-
}
|
|
678
|
-
/**
|
|
679
|
-
* Compare the given params with the stored params in the DataListService.
|
|
680
|
-
*
|
|
681
|
-
* @param {DataListParams} params - The params to compare with the stored params.
|
|
682
|
-
*
|
|
683
|
-
* @return {boolean} - True if the given params match the stored params, otherwise false.
|
|
684
|
-
*/
|
|
685
|
-
compareWithCurrentParams(params) {
|
|
686
|
-
return (params.offset === this.offset() &&
|
|
687
|
-
params.limit === this.rows() &&
|
|
688
|
-
JSON.stringify(tableCreateSortMeta(params)) === JSON.stringify(this.#sortMeta()) &&
|
|
689
|
-
JSON.stringify(tableCreateFilterMeta(params)) === JSON.stringify(this.#filterMeta()));
|
|
690
|
-
}
|
|
691
|
-
#setData(data, count) {
|
|
692
|
-
this.#data.set([...data]);
|
|
693
|
-
this.#count.set(count ?? data.length);
|
|
694
|
-
}
|
|
695
|
-
ngOnDestroy() {
|
|
696
|
-
this.#dataProviderSubscription?.unsubscribe();
|
|
697
|
-
}
|
|
698
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableDataService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
699
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableDataService }); }
|
|
700
|
-
}
|
|
701
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableDataService, decorators: [{
|
|
702
|
-
type: Injectable
|
|
703
|
-
}] });
|
|
704
|
-
|
|
705
|
-
/**
|
|
706
|
-
* Cannot be on push change detection strategy because of filter updates triggered from route which causes to force update values in force metadata
|
|
707
|
-
* and these must be propagated through to this component and beyond to primeNG.
|
|
708
|
-
*/
|
|
709
|
-
class TableColumnFilterComponent {
|
|
710
|
-
constructor() {
|
|
711
|
-
this.lookupTypeDropdown = FilterLookupTypeEnum.Dropdown;
|
|
712
|
-
this.lookupTypeAutocomplete = FilterLookupTypeEnum.Autocomplete;
|
|
713
|
-
this.FilterTypeEnum = FilterTypeEnum;
|
|
714
|
-
this.FilterMatchMode = FilterMatchMode;
|
|
715
|
-
this.el = inject(ElementRef);
|
|
716
|
-
this.primeTable = inject(Table);
|
|
717
|
-
this.renderer = inject(Renderer2);
|
|
718
|
-
this.overlayService = inject(OverlayService);
|
|
719
|
-
this.cd = inject(ChangeDetectorRef);
|
|
720
|
-
this.destroyRef = inject(DestroyRef);
|
|
721
|
-
this.tableData = inject((TableDataService));
|
|
722
|
-
this.tableMetadata = inject(TableMetadataService);
|
|
723
|
-
this.document = window.document;
|
|
724
|
-
this.metadata = input.required();
|
|
725
|
-
this.descriptorAsLookup = computed(() => this.metadata().descriptor instanceof FilterLookupDescriptor ? this.metadata().descriptor : undefined);
|
|
726
|
-
this.icon = viewChild('icon');
|
|
727
|
-
this.matchModes = computed(() => this.metadata().matchModes);
|
|
728
|
-
this.filterConstraint = signal(undefined);
|
|
729
|
-
this.isFilterSet = computed(() => this.filterConstraint()?.matchMode === FilterMatchMode.Exists ||
|
|
730
|
-
this.filterConstraint()?.matchMode === FilterMatchMode.DoesNotExist ||
|
|
731
|
-
!this.primeTable.isFilterBlank(this.filterConstraint()?.value));
|
|
732
|
-
this.isInputDisabled = computed(() => this.filterConstraint()?.matchMode === FilterMatchMode.Exists || this.filterConstraint()?.matchMode === FilterMatchMode.DoesNotExist);
|
|
733
|
-
this.overlayVisible = signal(false);
|
|
734
|
-
// display configs
|
|
735
|
-
this.isMultiselect = computed(() => {
|
|
736
|
-
const ft = this.filterConstraint();
|
|
737
|
-
const matchMode = ft?.displayMatchMode ?? this.metadata().defaultMatchMode;
|
|
738
|
-
return (matchMode === FilterMatchMode.In || matchMode === FilterMatchMode.NotIn) && (ft?.displayValue == null || Array.isArray(ft.displayValue));
|
|
739
|
-
});
|
|
740
|
-
this.window = this.document.defaultView;
|
|
741
|
-
this.numericValueFromModelChange = null;
|
|
742
|
-
this.dateDebounceSubject = new Subject();
|
|
743
|
-
this.dateDebounceSubject.pipe(debounceTime(500), distinctUntilChanged(), takeUntilDestroyed()).subscribe(v => this.updateFilterOnDisplayValueChange(v));
|
|
744
|
-
effect(() => {
|
|
745
|
-
const fieldFilterMeta = this.tableData.filterMeta()?.[this.metadata().descriptor.property];
|
|
746
|
-
const filterConstraint = untracked(() => this.filterConstraint());
|
|
747
|
-
if (fieldFilterMeta && (!filterConstraint || filterConstraint.value !== fieldFilterMeta.value || filterConstraint.matchMode !== fieldFilterMeta.matchMode)) {
|
|
748
|
-
this.setFilterConstraint(filterSetMetadataOnChange(fieldFilterMeta, fieldFilterMeta.matchMode, fieldFilterMeta.value, untracked(() => this.metadata().descriptor.filterType), untracked(() => this.metadata().dateConfig)));
|
|
749
|
-
}
|
|
750
|
-
}, { allowSignalWrites: true });
|
|
751
|
-
}
|
|
752
|
-
ngOnDestroy() {
|
|
753
|
-
if (this.overlay) {
|
|
754
|
-
this.renderer.appendChild(this.el.nativeElement, this.overlay);
|
|
755
|
-
ZIndexUtils.clear(this.overlay);
|
|
756
|
-
this.onOverlayHide();
|
|
757
|
-
}
|
|
758
|
-
this.resetSubscription?.unsubscribe();
|
|
759
|
-
this.overlaySubscription?.unsubscribe();
|
|
760
|
-
}
|
|
761
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
762
|
-
onTextModelChange(event) {
|
|
763
|
-
const value = event.target.value;
|
|
764
|
-
if (value === '') {
|
|
765
|
-
this.updateFilterOnDisplayValueChange(value);
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
769
|
-
onTextInputEnterKeyDown(event) {
|
|
770
|
-
const value = event.target.value;
|
|
771
|
-
this.updateFilterOnDisplayValueChange(value);
|
|
772
|
-
event.preventDefault();
|
|
773
|
-
}
|
|
774
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
775
|
-
onNumericModelChange(value) {
|
|
776
|
-
this.numericValueFromModelChange = value;
|
|
777
|
-
if (value === null) {
|
|
778
|
-
this.updateFilterOnDisplayValueChange(value);
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
782
|
-
onNumericInputKeyDown(event) {
|
|
783
|
-
if (event.key === 'Enter') {
|
|
784
|
-
if (this.filterConstraint()?.displayMatchMode === FilterMatchMode.Between && Array.isArray(this.numericValueFromModelChange)) {
|
|
785
|
-
const numberValues = this.numericValueFromModelChange.filter(v => typeof v === 'number');
|
|
786
|
-
if (numberValues.length !== 2) {
|
|
787
|
-
return;
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
this.updateFilterOnDisplayValueChange(this.numericValueFromModelChange);
|
|
791
|
-
event.preventDefault();
|
|
792
|
-
}
|
|
793
|
-
}
|
|
794
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
795
|
-
onCheckboxModelChange(value) {
|
|
796
|
-
this.updateFilterOnDisplayValueChange(value);
|
|
797
|
-
}
|
|
798
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
799
|
-
onDateFilterModelChange(value) {
|
|
800
|
-
if (this.filterConstraint()?.displayMatchMode === FilterMatchMode.Between && Array.isArray(value)) {
|
|
801
|
-
const dateValues = value.filter(v => v instanceof Date);
|
|
802
|
-
if (dateValues.length !== 2) {
|
|
803
|
-
return;
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
this.dateDebounceSubject.next(value);
|
|
807
|
-
}
|
|
808
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
809
|
-
autocompleteFilter(value) {
|
|
810
|
-
this.updateFilterOnDisplayValueChange(value);
|
|
811
|
-
}
|
|
812
|
-
// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any
|
|
813
|
-
dropdownFilter(value) {
|
|
814
|
-
this.updateFilterOnDisplayValueChange(value);
|
|
815
|
-
}
|
|
816
|
-
onMatchModeChange(displayMatchMode) {
|
|
817
|
-
if (this.filterConstraint()?.displayMatchMode === displayMatchMode) {
|
|
818
|
-
return;
|
|
819
|
-
}
|
|
820
|
-
this.setFilterConstraint(filterSetMetadataOnDisplayChange(this.filterConstraint(), displayMatchMode, filterAdjustDisplayValueOnMatchModeChange(displayMatchMode, this.filterConstraint()?.displayValue), this.metadata().descriptor.filterType, this.metadata().dateConfig));
|
|
821
|
-
this.hideOverlay();
|
|
822
|
-
}
|
|
823
|
-
onMatchModeKeyDown(event) {
|
|
824
|
-
const item = event.target;
|
|
825
|
-
switch (event.key) {
|
|
826
|
-
case 'ArrowDown':
|
|
827
|
-
// eslint-disable-next-line no-case-declarations
|
|
828
|
-
const nextItem = this.findNextMenuModeItem(item);
|
|
829
|
-
if (nextItem) {
|
|
830
|
-
item.removeAttribute('tabindex');
|
|
831
|
-
nextItem.tabIndex = '0';
|
|
832
|
-
nextItem.focus();
|
|
833
|
-
}
|
|
834
|
-
event.preventDefault();
|
|
835
|
-
break;
|
|
836
|
-
case 'ArrowUp':
|
|
837
|
-
// eslint-disable-next-line no-case-declarations
|
|
838
|
-
const prevItem = this.findPrevMenuModeItem(item);
|
|
839
|
-
if (prevItem) {
|
|
840
|
-
item.removeAttribute('tabindex');
|
|
841
|
-
prevItem.tabIndex = '0';
|
|
842
|
-
prevItem.focus();
|
|
843
|
-
}
|
|
844
|
-
event.preventDefault();
|
|
845
|
-
break;
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
onRowClearItemClick() {
|
|
849
|
-
this.clearFilter();
|
|
850
|
-
this.hideOverlay();
|
|
851
|
-
}
|
|
852
|
-
toggleMenu(event) {
|
|
853
|
-
this.overlayVisible.set(!this.overlayVisible());
|
|
854
|
-
event.stopPropagation();
|
|
855
|
-
}
|
|
856
|
-
onToggleButtonKeyDown(event) {
|
|
857
|
-
switch (event.key) {
|
|
858
|
-
case 'Escape':
|
|
859
|
-
case 'Tab':
|
|
860
|
-
this.overlayVisible.set(false);
|
|
861
|
-
break;
|
|
862
|
-
case 'ArrowDown':
|
|
863
|
-
if (this.overlayVisible()) {
|
|
864
|
-
const focusable = DomHandler.getFocusableElements(this.overlay);
|
|
865
|
-
if (focusable) {
|
|
866
|
-
focusable[0].focus();
|
|
867
|
-
}
|
|
868
|
-
event.preventDefault();
|
|
869
|
-
}
|
|
870
|
-
else if (event.altKey) {
|
|
871
|
-
this.overlayVisible.set(true);
|
|
872
|
-
event.preventDefault();
|
|
873
|
-
}
|
|
874
|
-
break;
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
onEscape() {
|
|
878
|
-
this.overlayVisible.set(false);
|
|
879
|
-
}
|
|
880
|
-
onContentClick() {
|
|
881
|
-
this.selfClick = true;
|
|
882
|
-
}
|
|
883
|
-
// onOverlayAnimationStart(event: AnimationEvent) {
|
|
884
|
-
onOverlayAnimationStart(event) {
|
|
885
|
-
switch (event.toState) {
|
|
886
|
-
case 'visible':
|
|
887
|
-
this.overlay = event.element;
|
|
888
|
-
this.renderer.appendChild(this.document.body, this.overlay);
|
|
889
|
-
ZIndexUtils.set('overlay', this.overlay, this.tableMetadata.primeConfig.zIndex.overlay);
|
|
890
|
-
DomHandler.absolutePosition(this.overlay, this.icon()?.nativeElement);
|
|
891
|
-
this.bindDocumentClickListener();
|
|
892
|
-
this.bindDocumentResizeListener();
|
|
893
|
-
this.bindScrollListener();
|
|
894
|
-
this.overlayEventListener = (e) => {
|
|
895
|
-
if (this.overlay && this.overlay.contains(e.target)) {
|
|
896
|
-
this.selfClick = true;
|
|
897
|
-
}
|
|
898
|
-
};
|
|
899
|
-
this.overlaySubscription = this.overlayService.clickObservable.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(this.overlayEventListener);
|
|
900
|
-
break;
|
|
901
|
-
case 'void':
|
|
902
|
-
this.onOverlayHide();
|
|
903
|
-
this.overlaySubscription?.unsubscribe();
|
|
904
|
-
break;
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
// onOverlayAnimationEnd(event: AnimationEvent) {
|
|
908
|
-
onOverlayAnimationEnd(event) {
|
|
909
|
-
switch (event.toState) {
|
|
910
|
-
case 'void':
|
|
911
|
-
ZIndexUtils.clear(event.element);
|
|
912
|
-
break;
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
get noFilterLabel() {
|
|
916
|
-
return this.tableMetadata.primeConfig.getTranslation(TranslationKeys.NO_FILTER);
|
|
917
|
-
}
|
|
918
|
-
clearFilter() {
|
|
919
|
-
this.initFilterConstraint(true);
|
|
920
|
-
this.primeTable._filter();
|
|
921
|
-
this.hideOverlay();
|
|
922
|
-
}
|
|
923
|
-
findNextMenuModeItem(item) {
|
|
924
|
-
const nextItem = item.nextElementSibling;
|
|
925
|
-
if (nextItem)
|
|
926
|
-
return DomHandler.hasClass(nextItem, 'p-column-filter-separator') ? this.findNextMenuModeItem(nextItem) : nextItem;
|
|
927
|
-
else
|
|
928
|
-
return item.parentElement?.firstElementChild;
|
|
929
|
-
}
|
|
930
|
-
findPrevMenuModeItem(item) {
|
|
931
|
-
const prevItem = item.previousElementSibling;
|
|
932
|
-
if (prevItem)
|
|
933
|
-
return DomHandler.hasClass(prevItem, 'p-column-filter-separator') ? this.findPrevMenuModeItem(prevItem) : prevItem;
|
|
934
|
-
else
|
|
935
|
-
return item.parentElement?.lastElementChild;
|
|
936
|
-
}
|
|
937
|
-
isOutsideClicked(event) {
|
|
938
|
-
return !(this.overlay?.isSameNode(event.target) ||
|
|
939
|
-
this.overlay?.contains(event.target) ||
|
|
940
|
-
this.icon()?.nativeElement.isSameNode(event.target) ||
|
|
941
|
-
this.icon()?.nativeElement.contains(event.target) ||
|
|
942
|
-
DomHandler.hasClass(event.target, 'p-column-filter-add-button') ||
|
|
943
|
-
DomHandler.hasClass(event.target.parentElement, 'p-column-filter-add-button') ||
|
|
944
|
-
DomHandler.hasClass(event.target, 'p-column-filter-remove-button') ||
|
|
945
|
-
DomHandler.hasClass(event.target.parentElement, 'p-column-filter-remove-button'));
|
|
946
|
-
}
|
|
947
|
-
bindDocumentClickListener() {
|
|
948
|
-
if (!this.documentClickListener) {
|
|
949
|
-
const documentTarget = this.el ? this.el.nativeElement.ownerDocument : 'document';
|
|
950
|
-
this.documentClickListener = this.renderer.listen(documentTarget, 'click', event => {
|
|
951
|
-
if (this.overlayVisible() && !this.selfClick && this.isOutsideClicked(event)) {
|
|
952
|
-
this.hideOverlay();
|
|
953
|
-
}
|
|
954
|
-
this.selfClick = false;
|
|
955
|
-
});
|
|
956
|
-
}
|
|
957
|
-
}
|
|
958
|
-
unbindDocumentClickListener() {
|
|
959
|
-
if (this.documentClickListener) {
|
|
960
|
-
this.documentClickListener();
|
|
961
|
-
this.documentClickListener = null;
|
|
962
|
-
this.selfClick = false;
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
|
-
bindDocumentResizeListener() {
|
|
966
|
-
if (!this.documentResizeListener) {
|
|
967
|
-
this.documentResizeListener = this.renderer.listen(this.window, 'resize', () => {
|
|
968
|
-
if (this.overlayVisible() && !DomHandler.isTouchDevice()) {
|
|
969
|
-
this.hideOverlay();
|
|
970
|
-
}
|
|
971
|
-
});
|
|
972
|
-
}
|
|
973
|
-
}
|
|
974
|
-
unbindDocumentResizeListener() {
|
|
975
|
-
if (this.documentResizeListener) {
|
|
976
|
-
this.documentResizeListener();
|
|
977
|
-
this.documentResizeListener = null;
|
|
978
|
-
}
|
|
979
|
-
}
|
|
980
|
-
bindScrollListener() {
|
|
981
|
-
if (!this.scrollHandler) {
|
|
982
|
-
this.scrollHandler = new ConnectedOverlayScrollHandler(this.icon()?.nativeElement, () => {
|
|
983
|
-
if (this.overlayVisible()) {
|
|
984
|
-
this.hideOverlay();
|
|
985
|
-
}
|
|
986
|
-
});
|
|
987
|
-
}
|
|
988
|
-
this.scrollHandler.bindScrollListener();
|
|
989
|
-
}
|
|
990
|
-
unbindScrollListener() {
|
|
991
|
-
if (this.scrollHandler) {
|
|
992
|
-
this.scrollHandler.unbindScrollListener();
|
|
993
|
-
}
|
|
994
|
-
}
|
|
995
|
-
hideOverlay() {
|
|
996
|
-
this.overlayVisible.set(false);
|
|
997
|
-
this.cd.markForCheck();
|
|
998
|
-
}
|
|
999
|
-
onOverlayHide() {
|
|
1000
|
-
this.unbindDocumentClickListener();
|
|
1001
|
-
this.unbindDocumentResizeListener();
|
|
1002
|
-
this.unbindScrollListener();
|
|
1003
|
-
this.overlay = null;
|
|
1004
|
-
}
|
|
1005
|
-
updateFilterOnDisplayValueChange(displayValue) {
|
|
1006
|
-
this.setFilterConstraint(filterSetMetadataOnDisplayChange(this.filterConstraint(), this.filterConstraint()?.displayMatchMode ?? this.metadata().defaultMatchMode, displayValue, this.metadata().descriptor.filterType, this.metadata().dateConfig));
|
|
1007
|
-
}
|
|
1008
|
-
initFilterConstraint(reset = false) {
|
|
1009
|
-
if (reset) {
|
|
1010
|
-
this.primeTable.filters[this.metadata().descriptor.property] = { value: null, matchMode: this.metadata().defaultMatchMode };
|
|
1011
|
-
}
|
|
1012
|
-
// set internal filter constraint
|
|
1013
|
-
let metadata = this.primeTable.filters[this.metadata().descriptor.property];
|
|
1014
|
-
if (Array.isArray(metadata)) {
|
|
1015
|
-
metadata = metadata[0];
|
|
1016
|
-
}
|
|
1017
|
-
this.setFilterConstraint(filterSetMetadataOnChange(metadata, metadata?.matchMode, metadata?.value, this.metadata().descriptor.filterType, this.metadata().dateConfig));
|
|
1018
|
-
}
|
|
1019
|
-
setFilterConstraint(metadata) {
|
|
1020
|
-
if (metadata && !metadata.displayMatchMode)
|
|
1021
|
-
metadata.displayMatchMode = metadata.matchMode;
|
|
1022
|
-
if (metadata && !metadata.displayValue)
|
|
1023
|
-
metadata.displayValue = metadata.value;
|
|
1024
|
-
this.filterConstraint.set(metadata);
|
|
1025
|
-
this.primeTable.filters[this.metadata().descriptor.property] = this.filterConstraint();
|
|
1026
|
-
this.primeTable._filter();
|
|
1027
|
-
}
|
|
1028
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableColumnFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1029
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.12", type: TableColumnFilterComponent, isStandalone: true, selector: "mng-table-column-filter", inputs: { metadata: { classPropertyName: "metadata", publicName: "metadata", isSignal: true, isRequired: true, transformFunction: null } }, viewQueries: [{ propertyName: "icon", first: true, predicate: ["icon"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"p-column-filter p-column-filter-row\">\n @switch (metadata().descriptor.filterType) {\n @case (FilterTypeEnum.Number) {\n @if (filterConstraint()?.displayMatchMode === 'between') {\n <mng-number-range\n className=\"mng-column-filter-number-input\"\n [ngModel]=\"filterConstraint()?.displayValue\"\n (ngModelChange)=\"onNumericModelChange($event)\"\n (keyDown)=\"onNumericInputKeyDown($event)\"\n [placeholder]=\"metadata().descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [useGrouping]=\"metadata().descriptor.numberUseGrouping\"\n [minFractionDigits]=\"metadata().numberConfig?.fractionsMin\"\n [maxFractionDigits]=\"metadata().numberConfig?.fractionsMax\"\n [disabled]=\"isInputDisabled()\" />\n } @else {\n <p-inputNumber\n inputStyleClass=\"mng-column-filter-number-input\"\n [ngModel]=\"filterConstraint()?.displayValue\"\n (ngModelChange)=\"onNumericModelChange($event)\"\n (onKeyDown)=\"onNumericInputKeyDown($event)\"\n [placeholder]=\"metadata().descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [useGrouping]=\"metadata().descriptor.numberUseGrouping\"\n [minFractionDigits]=\"metadata().numberConfig?.fractionsMin\"\n [maxFractionDigits]=\"metadata().numberConfig?.fractionsMax\"\n [disabled]=\"isInputDisabled()\" />\n }\n }\n\n @case (FilterTypeEnum.Boolean) {\n <p-checkbox [ngModel]=\"filterConstraint()?.displayValue\" binary=\"true\" (ngModelChange)=\"onCheckboxModelChange($event)\"></p-checkbox>\n }\n @case (FilterTypeEnum.Date) {\n @if (filterConstraint()?.displayMatchMode === FilterMatchMode.Between) {\n <mng-date-range\n [ngModel]=\"filterConstraint()?.displayValue\"\n (ngModelChange)=\"onDateFilterModelChange($event)\"\n [showTime]=\"metadata().dateConfig?.showTime ?? false\"\n [showSeconds]=\"metadata().dateConfig?.showSeconds ?? false\"\n [dateFormat]=\"metadata().dateConfig?.format\"\n [placeholder]=\"metadata().descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [disabled]=\"isInputDisabled()\"></mng-date-range>\n } @else {\n <p-calendar\n appendTo=\"body\"\n [ngModel]=\"filterConstraint()?.displayValue\"\n (ngModelChange)=\"onDateFilterModelChange($event)\"\n [placeholder]=\"metadata().descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [showIcon]=\"true\"\n [showTime]=\"metadata().dateConfig?.showTime ?? false\"\n [showSeconds]=\"metadata().dateConfig?.showSeconds ?? false\"\n [dateFormat]=\"metadata().dateConfig?.format\"\n [firstDayOfWeek]=\"1\">\n </p-calendar>\n }\n }\n @case (FilterTypeEnum.Lookup) {\n <ng-container *ngTemplateOutlet=\"lookupFilter\" />\n }\n @case (FilterTypeEnum.LookupEnum) {\n <ng-container *ngTemplateOutlet=\"lookupFilter\" />\n }\n @default {\n <input\n type=\"text\"\n pInputText\n class=\"mng-column-filter-string-input\"\n [value]=\"filterConstraint()?.displayValue\"\n [disabled]=\"isInputDisabled()\"\n (input)=\"onTextModelChange($event)\"\n (keydown.enter)=\"onTextInputEnterKeyDown($event)\"\n [attr.placeholder]=\"metadata().descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [mngInputTrim]=\"metadata().descriptor.trimOption\" />\n }\n }\n\n <ng-template #lookupFilter>\n @if (descriptorAsLookup(); as lookup) {\n @switch (lookup.lookupType) {\n @case (lookupTypeAutocomplete) {\n <mng-autocomplete\n *mngRerender=\"isMultiselect()\"\n [ngModel]=\"filterConstraint()?.displayValue\"\n [dataProvider]=\"lookup.dataProvider\"\n [optionsTrackProperty]=\"lookup.optionsValueProperty\"\n [optionsValueProperty]=\"lookup.optionsValueProperty\"\n [optionsLabelProperty]=\"lookup.optionsLabelProperty\"\n [optionsLabelTranslate]=\"lookup.optionsLabelTranslate\"\n [multiselect]=\"isMultiselect()\"\n [autoClear]=\"lookup.autocompleteAutoClear ?? false\"\n [openOnFocus]=\"lookup.autocompleteAutoClear ?? true\"\n [inlineSearch]=\"lookup.autocompleteInlineSearch ?? false\"\n [placeholder]=\"metadata().descriptor.placeholder ?? 'mngTable.searchToFilter' | translate\"\n [className]=\"lookup.className\"\n [dropdownClassName]=\"lookup.dropdownClassName\"\n [disabled]=\"isInputDisabled()\"\n (valueChange)=\"autocompleteFilter($event)\"\n [searchTrim]=\"metadata().descriptor.trimOption\">\n </mng-autocomplete>\n }\n @case (lookupTypeDropdown) {\n <mng-dropdown\n *mngRerender=\"isMultiselect()\"\n [ngModel]=\"filterConstraint()?.displayValue\"\n [dataProvider]=\"lookup.dataProvider\"\n [optionsValueProperty]=\"lookup.optionsValueProperty\"\n [optionsLabelProperty]=\"lookup.optionsLabelProperty\"\n [optionsLabelTranslate]=\"lookup.optionsLabelTranslate\"\n [multiselect]=\"isMultiselect()\"\n [placeholder]=\"metadata().descriptor.placeholder ?? 'mngTable.selectToFilter' | translate\"\n [className]=\"lookup.className\"\n [dropdownClassName]=\"lookup.dropdownClassName\"\n [showClear]=\"false\"\n [changeValueOnBlur]=\"isMultiselect()\"\n [disabled]=\"isInputDisabled()\"\n (valueChange)=\"dropdownFilter($event)\">\n </mng-dropdown>\n }\n }\n }\n </ng-template>\n\n @if (matchModes().length > 1) {\n <button\n #icon\n type=\"button\"\n class=\"p-column-filter-menu-button p-link\"\n aria-haspopup=\"true\"\n [attr.aria-expanded]=\"overlayVisible()\"\n [ngClass]=\"{'p-column-filter-menu-button-open': overlayVisible(), 'p-column-filter-menu-button-active': isFilterSet()}\"\n (click)=\"toggleMenu($event)\"\n (keydown)=\"onToggleButtonKeyDown($event)\">\n <FilterIcon [styleClass]=\"'pi-filter-icon'\" />\n </button>\n }\n <button #icon [ngClass]=\"{'p-hidden-space': !isFilterSet()}\" type=\"button\" class=\"p-column-filter-clear-button p-link\" (click)=\"clearFilter()\">\n <FilterSlashIcon />\n </button>\n @if (overlayVisible()) {\n <div\n class=\"p-column-filter-overlay p-component p-fluid\"\n (click)=\"onContentClick()\"\n [@overlayAnimation]=\"'visible'\"\n (@overlayAnimation.start)=\"onOverlayAnimationStart($event)\"\n (@overlayAnimation.done)=\"onOverlayAnimationEnd($event)\"\n (keydown.escape)=\"onEscape()\">\n <ul class=\"p-column-filter-row-items\">\n @for (matchMode of matchModes(); track matchMode; let i = $index) {\n <li\n class=\"p-column-filter-row-item\"\n (click)=\"onMatchModeChange(matchMode.value)\"\n (keydown)=\"onMatchModeKeyDown($event)\"\n (keydown.enter)=\"this.onMatchModeChange(matchMode.value)\"\n [ngClass]=\"{'p-highlight': matchMode.value === filterConstraint()?.displayMatchMode}\"\n [attr.tabindex]=\"i === 0 ? '0' : null\">\n {{ matchMode.label }}\n </li>\n }\n <li class=\"p-column-filter-separator\"></li>\n <li class=\"p-column-filter-row-item\" (click)=\"onRowClearItemClick()\" (keydown)=\"onMatchModeKeyDown($event)\" (keydown.enter)=\"onRowClearItemClick()\">\n {{ noFilterLabel }}\n </li>\n </ul>\n </div>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: TableModule }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "component", type: DateRangeComponent, selector: "mng-date-range", inputs: ["placeholder", "showTime", "showSeconds", "dateFormat", "className", "required", "disabled"] }, { kind: "ngmodule", type: CalendarModule }, { kind: "component", type: i2$1.Calendar, selector: "p-calendar", inputs: ["iconDisplay", "style", "styleClass", "inputStyle", "inputId", "name", "inputStyleClass", "placeholder", "ariaLabelledBy", "ariaLabel", "iconAriaLabel", "disabled", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "icon", "appendTo", "readonlyInput", "shortYearCutoff", "monthNavigator", "yearNavigator", "hourFormat", "timeOnly", "stepYearPicker", "stepHour", "stepMinute", "stepSecond", "showSeconds", "required", "showOnFocus", "showWeek", "startWeekFromFirstDayOfYear", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autofocus", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "variant", "minDate", "maxDate", "disabledDates", "disabledDays", "yearRange", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "locale", "view", "defaultDate"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: AutocompleteComponent, selector: "mng-autocomplete", inputs: ["dataProvider", "optionsTrackProperty", "optionsValueProperty", "optionsLabelProperty", "optionsLabelTranslate", "inlineSearch", "openOnFocus", "multiselect", "placeholder", "className", "dropdownClassName", "showClear", "autoClear", "selectFirst", "searchTrim", "disabled"], outputs: ["valueChange", "blur"] }, { kind: "component", type: DropdownComponent, selector: "mng-dropdown", inputs: ["dataProvider", "options", "optionsTrackProperty", "optionsLabelProperty", "optionsLabelTranslate", "optionsValueProperty", "optionsDisabledProperty", "multiselect", "placeholder", "showClear", "selectFirstItem", "className", "dropdownClassName", "changeValueOnBlur", "loading", "disabled", "allowInput", "appendTo", "inlineSearch", "searchTrim"], outputs: ["valueChange", "blur"] }, { kind: "ngmodule", type: InputNumberModule }, { kind: "component", type: i4.InputNumber, selector: "p-inputNumber", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "style", "placeholder", "size", "maxlength", "tabindex", "title", "ariaLabelledBy", "ariaLabel", "ariaRequired", "name", "required", "autocomplete", "min", "max", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "step", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "variant", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "showClear", "autofocus", "disabled"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown", "onClear"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i5.InputText, selector: "[pInputText]", inputs: ["variant"] }, { kind: "component", type: FilterIcon, selector: "FilterIcon" }, { kind: "component", type: FilterSlashIcon, selector: "FilterSlashIcon" }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: InputTrimDirective, selector: "[mngInputTrim]", inputs: ["mngInputTrim"] }, { kind: "component", type: NumberRangeComponent, selector: "mng-number-range", inputs: ["placeholder", "useGrouping", "minFractionDigits", "maxFractionDigits", "required", "disabled"], outputs: ["keyDown"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i6.Checkbox, selector: "p-checkbox", inputs: ["value", "name", "disabled", "binary", "label", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "style", "styleClass", "labelStyleClass", "formControl", "checkboxIcon", "readonly", "required", "autofocus", "trueValue", "falseValue", "variant"], outputs: ["onChange", "onFocus", "onBlur"] }, { kind: "directive", type: RerenderDirective, selector: "[mngRerender]", inputs: ["mngRerender"] }], animations: [
|
|
1030
|
-
trigger('overlayAnimation', [
|
|
1031
|
-
transition(':enter', [style({ opacity: 0, transform: 'scaleY(0.8)' }), animate('.12s cubic-bezier(0, 0, 0.2, 1)')]),
|
|
1032
|
-
transition(':leave', [animate('.1s linear', style({ opacity: 0 }))])
|
|
1033
|
-
])
|
|
1034
|
-
], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1035
|
-
}
|
|
1036
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableColumnFilterComponent, decorators: [{
|
|
1037
|
-
type: Component,
|
|
1038
|
-
args: [{ standalone: true, selector: 'mng-table-column-filter', imports: [
|
|
1039
|
-
TableModule,
|
|
1040
|
-
TranslateModule,
|
|
1041
|
-
DateRangeComponent,
|
|
1042
|
-
CalendarModule,
|
|
1043
|
-
FormsModule,
|
|
1044
|
-
AutocompleteComponent,
|
|
1045
|
-
DropdownComponent,
|
|
1046
|
-
InputNumberModule,
|
|
1047
|
-
InputTextModule,
|
|
1048
|
-
FilterIcon,
|
|
1049
|
-
FilterSlashIcon,
|
|
1050
|
-
NgClass,
|
|
1051
|
-
InputTrimDirective,
|
|
1052
|
-
NumberRangeComponent,
|
|
1053
|
-
NgTemplateOutlet,
|
|
1054
|
-
CheckboxModule,
|
|
1055
|
-
RerenderDirective
|
|
1056
|
-
], animations: [
|
|
1057
|
-
trigger('overlayAnimation', [
|
|
1058
|
-
transition(':enter', [style({ opacity: 0, transform: 'scaleY(0.8)' }), animate('.12s cubic-bezier(0, 0, 0.2, 1)')]),
|
|
1059
|
-
transition(':leave', [animate('.1s linear', style({ opacity: 0 }))])
|
|
1060
|
-
])
|
|
1061
|
-
], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"p-column-filter p-column-filter-row\">\n @switch (metadata().descriptor.filterType) {\n @case (FilterTypeEnum.Number) {\n @if (filterConstraint()?.displayMatchMode === 'between') {\n <mng-number-range\n className=\"mng-column-filter-number-input\"\n [ngModel]=\"filterConstraint()?.displayValue\"\n (ngModelChange)=\"onNumericModelChange($event)\"\n (keyDown)=\"onNumericInputKeyDown($event)\"\n [placeholder]=\"metadata().descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [useGrouping]=\"metadata().descriptor.numberUseGrouping\"\n [minFractionDigits]=\"metadata().numberConfig?.fractionsMin\"\n [maxFractionDigits]=\"metadata().numberConfig?.fractionsMax\"\n [disabled]=\"isInputDisabled()\" />\n } @else {\n <p-inputNumber\n inputStyleClass=\"mng-column-filter-number-input\"\n [ngModel]=\"filterConstraint()?.displayValue\"\n (ngModelChange)=\"onNumericModelChange($event)\"\n (onKeyDown)=\"onNumericInputKeyDown($event)\"\n [placeholder]=\"metadata().descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [useGrouping]=\"metadata().descriptor.numberUseGrouping\"\n [minFractionDigits]=\"metadata().numberConfig?.fractionsMin\"\n [maxFractionDigits]=\"metadata().numberConfig?.fractionsMax\"\n [disabled]=\"isInputDisabled()\" />\n }\n }\n\n @case (FilterTypeEnum.Boolean) {\n <p-checkbox [ngModel]=\"filterConstraint()?.displayValue\" binary=\"true\" (ngModelChange)=\"onCheckboxModelChange($event)\"></p-checkbox>\n }\n @case (FilterTypeEnum.Date) {\n @if (filterConstraint()?.displayMatchMode === FilterMatchMode.Between) {\n <mng-date-range\n [ngModel]=\"filterConstraint()?.displayValue\"\n (ngModelChange)=\"onDateFilterModelChange($event)\"\n [showTime]=\"metadata().dateConfig?.showTime ?? false\"\n [showSeconds]=\"metadata().dateConfig?.showSeconds ?? false\"\n [dateFormat]=\"metadata().dateConfig?.format\"\n [placeholder]=\"metadata().descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [disabled]=\"isInputDisabled()\"></mng-date-range>\n } @else {\n <p-calendar\n appendTo=\"body\"\n [ngModel]=\"filterConstraint()?.displayValue\"\n (ngModelChange)=\"onDateFilterModelChange($event)\"\n [placeholder]=\"metadata().descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [showIcon]=\"true\"\n [showTime]=\"metadata().dateConfig?.showTime ?? false\"\n [showSeconds]=\"metadata().dateConfig?.showSeconds ?? false\"\n [dateFormat]=\"metadata().dateConfig?.format\"\n [firstDayOfWeek]=\"1\">\n </p-calendar>\n }\n }\n @case (FilterTypeEnum.Lookup) {\n <ng-container *ngTemplateOutlet=\"lookupFilter\" />\n }\n @case (FilterTypeEnum.LookupEnum) {\n <ng-container *ngTemplateOutlet=\"lookupFilter\" />\n }\n @default {\n <input\n type=\"text\"\n pInputText\n class=\"mng-column-filter-string-input\"\n [value]=\"filterConstraint()?.displayValue\"\n [disabled]=\"isInputDisabled()\"\n (input)=\"onTextModelChange($event)\"\n (keydown.enter)=\"onTextInputEnterKeyDown($event)\"\n [attr.placeholder]=\"metadata().descriptor.placeholder ?? 'mngTable.typeToFilter' | translate\"\n [mngInputTrim]=\"metadata().descriptor.trimOption\" />\n }\n }\n\n <ng-template #lookupFilter>\n @if (descriptorAsLookup(); as lookup) {\n @switch (lookup.lookupType) {\n @case (lookupTypeAutocomplete) {\n <mng-autocomplete\n *mngRerender=\"isMultiselect()\"\n [ngModel]=\"filterConstraint()?.displayValue\"\n [dataProvider]=\"lookup.dataProvider\"\n [optionsTrackProperty]=\"lookup.optionsValueProperty\"\n [optionsValueProperty]=\"lookup.optionsValueProperty\"\n [optionsLabelProperty]=\"lookup.optionsLabelProperty\"\n [optionsLabelTranslate]=\"lookup.optionsLabelTranslate\"\n [multiselect]=\"isMultiselect()\"\n [autoClear]=\"lookup.autocompleteAutoClear ?? false\"\n [openOnFocus]=\"lookup.autocompleteAutoClear ?? true\"\n [inlineSearch]=\"lookup.autocompleteInlineSearch ?? false\"\n [placeholder]=\"metadata().descriptor.placeholder ?? 'mngTable.searchToFilter' | translate\"\n [className]=\"lookup.className\"\n [dropdownClassName]=\"lookup.dropdownClassName\"\n [disabled]=\"isInputDisabled()\"\n (valueChange)=\"autocompleteFilter($event)\"\n [searchTrim]=\"metadata().descriptor.trimOption\">\n </mng-autocomplete>\n }\n @case (lookupTypeDropdown) {\n <mng-dropdown\n *mngRerender=\"isMultiselect()\"\n [ngModel]=\"filterConstraint()?.displayValue\"\n [dataProvider]=\"lookup.dataProvider\"\n [optionsValueProperty]=\"lookup.optionsValueProperty\"\n [optionsLabelProperty]=\"lookup.optionsLabelProperty\"\n [optionsLabelTranslate]=\"lookup.optionsLabelTranslate\"\n [multiselect]=\"isMultiselect()\"\n [placeholder]=\"metadata().descriptor.placeholder ?? 'mngTable.selectToFilter' | translate\"\n [className]=\"lookup.className\"\n [dropdownClassName]=\"lookup.dropdownClassName\"\n [showClear]=\"false\"\n [changeValueOnBlur]=\"isMultiselect()\"\n [disabled]=\"isInputDisabled()\"\n (valueChange)=\"dropdownFilter($event)\">\n </mng-dropdown>\n }\n }\n }\n </ng-template>\n\n @if (matchModes().length > 1) {\n <button\n #icon\n type=\"button\"\n class=\"p-column-filter-menu-button p-link\"\n aria-haspopup=\"true\"\n [attr.aria-expanded]=\"overlayVisible()\"\n [ngClass]=\"{'p-column-filter-menu-button-open': overlayVisible(), 'p-column-filter-menu-button-active': isFilterSet()}\"\n (click)=\"toggleMenu($event)\"\n (keydown)=\"onToggleButtonKeyDown($event)\">\n <FilterIcon [styleClass]=\"'pi-filter-icon'\" />\n </button>\n }\n <button #icon [ngClass]=\"{'p-hidden-space': !isFilterSet()}\" type=\"button\" class=\"p-column-filter-clear-button p-link\" (click)=\"clearFilter()\">\n <FilterSlashIcon />\n </button>\n @if (overlayVisible()) {\n <div\n class=\"p-column-filter-overlay p-component p-fluid\"\n (click)=\"onContentClick()\"\n [@overlayAnimation]=\"'visible'\"\n (@overlayAnimation.start)=\"onOverlayAnimationStart($event)\"\n (@overlayAnimation.done)=\"onOverlayAnimationEnd($event)\"\n (keydown.escape)=\"onEscape()\">\n <ul class=\"p-column-filter-row-items\">\n @for (matchMode of matchModes(); track matchMode; let i = $index) {\n <li\n class=\"p-column-filter-row-item\"\n (click)=\"onMatchModeChange(matchMode.value)\"\n (keydown)=\"onMatchModeKeyDown($event)\"\n (keydown.enter)=\"this.onMatchModeChange(matchMode.value)\"\n [ngClass]=\"{'p-highlight': matchMode.value === filterConstraint()?.displayMatchMode}\"\n [attr.tabindex]=\"i === 0 ? '0' : null\">\n {{ matchMode.label }}\n </li>\n }\n <li class=\"p-column-filter-separator\"></li>\n <li class=\"p-column-filter-row-item\" (click)=\"onRowClearItemClick()\" (keydown)=\"onMatchModeKeyDown($event)\" (keydown.enter)=\"onRowClearItemClick()\">\n {{ noFilterLabel }}\n </li>\n </ul>\n </div>\n }\n</div>\n" }]
|
|
1062
|
-
}], ctorParameters: () => [] });
|
|
1063
|
-
|
|
1064
|
-
class TableColumnValueComponent {
|
|
1065
|
-
constructor() {
|
|
1066
|
-
this.columnDisplayTypeString = ColumnDisplayTypeEnum.String;
|
|
1067
|
-
this.columnDisplayTypeNumber = ColumnDisplayTypeEnum.Number;
|
|
1068
|
-
this.columnDisplayTypeCurrency = ColumnDisplayTypeEnum.Currency;
|
|
1069
|
-
this.columnDisplayTypeBoolean = ColumnDisplayTypeEnum.Boolean;
|
|
1070
|
-
this.columnDisplayTypeDate = ColumnDisplayTypeEnum.Date;
|
|
1071
|
-
this.columnDisplayTypeEnum = ColumnDisplayTypeEnum.Enum;
|
|
1072
|
-
this.columnDisplayTypeComponent = ColumnDisplayTypeEnum.Component;
|
|
1073
|
-
this.columnDisplayTypeHtml = ColumnDisplayTypeEnum.Html;
|
|
1074
|
-
this.elementRef = inject(ElementRef);
|
|
1075
|
-
this.messageService = inject(MessageService);
|
|
1076
|
-
this.translate = inject(TranslateService);
|
|
1077
|
-
this.getterPipe = new GetterPipe();
|
|
1078
|
-
this.templatePipe = new TemplatePipe();
|
|
1079
|
-
this.jsonPathPipe = new JsonPathPipe();
|
|
1080
|
-
this.descriptor = input.required();
|
|
1081
|
-
this.item = input.required();
|
|
1082
|
-
this.styleMaxWidth = computed(() => this.descriptor().maxWidth ?? null);
|
|
1083
|
-
this.className = computed(() => {
|
|
1084
|
-
let className = 'nowrap';
|
|
1085
|
-
if (this.descriptor().columnDisplayType === ColumnDisplayTypeEnum.String && this.descriptor().isMultiline) {
|
|
1086
|
-
className += ' multiline';
|
|
1087
|
-
}
|
|
1088
|
-
return className;
|
|
1089
|
-
});
|
|
1090
|
-
this.value = computed(() => {
|
|
1091
|
-
let value = this.jsonPathPipe.transform(this.item(), `$.${this.descriptor().property}`);
|
|
1092
|
-
if (typeof this.descriptor().getter === 'function') {
|
|
1093
|
-
value = this.getterPipe.transform(value, this.descriptor().getter, this.item());
|
|
1094
|
-
}
|
|
1095
|
-
if (this.descriptor().template) {
|
|
1096
|
-
value = this.templatePipe.transform(value, this.descriptor().template);
|
|
1097
|
-
}
|
|
1098
|
-
return value;
|
|
1099
|
-
});
|
|
1100
|
-
this.currency = computed(() => {
|
|
1101
|
-
if (this.descriptor().columnDisplayType === ColumnDisplayTypeEnum.Currency) {
|
|
1102
|
-
return this.descriptor().currencyProperty ? this.item()[this.descriptor().currencyProperty] : (this.descriptor().currencyCode ?? 'EUR');
|
|
1103
|
-
}
|
|
1104
|
-
return;
|
|
1105
|
-
});
|
|
1106
|
-
this.hasCopyToClipboard = computed(() => this.descriptor().hasCopyToClipboard && this.value() != null);
|
|
1107
|
-
}
|
|
1108
|
-
copyToClipboard(event) {
|
|
1109
|
-
event.stopPropagation();
|
|
1110
|
-
let value = this.elementRef.nativeElement.innerText.trim();
|
|
1111
|
-
const clipboardValueGetter = this.descriptor().clipboardValueGetter;
|
|
1112
|
-
if (clipboardValueGetter) {
|
|
1113
|
-
value = clipboardValueGetter(this.value(), this.item());
|
|
1114
|
-
}
|
|
1115
|
-
navigator.clipboard.writeText(value);
|
|
1116
|
-
const title = this.translate.instant('mngTable.copyNotificationTitle');
|
|
1117
|
-
const message = this.translate.instant('mngTable.copyNotificationMessage', { value });
|
|
1118
|
-
this.messageService.add({ severity: 'info', summary: title, detail: message });
|
|
1119
|
-
}
|
|
1120
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableColumnValueComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1121
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.12", type: TableColumnValueComponent, isStandalone: true, selector: "mng-table-column-value", inputs: { descriptor: { classPropertyName: "descriptor", publicName: "descriptor", isSignal: true, isRequired: true, transformFunction: null }, item: { classPropertyName: "item", publicName: "item", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "class": "className()", "style.max-width.px": "styleMaxWidth()" } }, ngImport: i0, template: "@if (descriptor().localizationExistsProperty && !item()[descriptor().localizationExistsProperty!]) {\n <i class=\"pi pi-exclamation-circle\" [pTooltip]=\"'mngTable.translationMissing' | translate\"></i>\n}\n@switch (descriptor().columnDisplayType) {\n @case (columnDisplayTypeString) {\n @if (descriptor().hasValueAsTooltip) {\n <span [pTooltip]=\"value()\" tooltipPosition=\"left\">{{ value() }}</span>\n } @else {\n {{ value() }}\n }\n }\n @case (columnDisplayTypeHtml) {\n <span [innerHTML]=\"value()\"></span>\n }\n @case (columnDisplayTypeNumber) {\n {{ value() | number: descriptor().displayFormat : descriptor().locale }}\n }\n @case (columnDisplayTypeCurrency) {\n {{ value() | currency: currency() : descriptor().currencyDisplay : descriptor().displayFormat : descriptor().locale }}\n }\n @case (columnDisplayTypeDate) {\n {{ value() | date: descriptor().displayFormat }}\n }\n @case (columnDisplayTypeBoolean) {\n @if (descriptor().booleanAsIcon) {\n <i [class]=\"value() | mngBoolean: descriptor().booleanYes : descriptor().booleanNo : true\"></i>\n } @else {\n {{ value() | mngBoolean: descriptor().booleanYes : descriptor().booleanNo | translate }}\n }\n }\n @case (columnDisplayTypeEnum) {\n {{ value() | mngEnum: descriptor().enum | translate }}\n }\n @case (columnDisplayTypeComponent) {\n <ng-container\n [mngComponent]=\"descriptor().customComponentType!\"\n [inputs]=\"{\n value: value(),\n item: item(),\n descriptor: descriptor()\n }\"></ng-container>\n }\n}\n@if (hasCopyToClipboard()) {\n <div class=\"help-buttons\">\n <button pButton pRipple type=\"button\" icon=\"pi pi-copy\" class=\"p-button-rounded p-button-info p-button-sm\" (click)=\"copyToClipboard($event)\"></button>\n </div>\n}\n", styles: [":host{display:inline-block;overflow:hidden}:host.nowrap{white-space:nowrap;text-overflow:ellipsis}:host.multiline{white-space:pre-wrap;word-wrap:break-word}.help-buttons{display:none;position:absolute;right:0;top:50%;transform:translateY(-50%)}.help-buttons .p-button{height:1.9rem;width:1.9rem;padding:0}\n"], dependencies: [{ kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i1$1.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "pipe", type: BooleanPipe, name: "mngBoolean" }, { kind: "pipe", type: EnumPipe, name: "mngEnum" }, { kind: "directive", type: ComponentDirective, selector: "[mngComponent]", inputs: ["mngComponent", "injectionToken", "inputs", "attachToHost", "parentInjector"], outputs: ["instanceCreated"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i4$1.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain"] }, { kind: "ngmodule", type: RippleModule }, { kind: "directive", type: i4$2.Ripple, selector: "[pRipple]" }, { kind: "pipe", type: DecimalPipe, name: "number" }, { kind: "pipe", type: CurrencyPipe, name: "currency" }, { kind: "pipe", type: DatePipe, name: "date" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1122
|
-
}
|
|
1123
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableColumnValueComponent, decorators: [{
|
|
1124
|
-
type: Component,
|
|
1125
|
-
args: [{ standalone: true, selector: 'mng-table-column-value', imports: [TooltipModule, TranslateModule, BooleanPipe, EnumPipe, ComponentDirective, ButtonModule, RippleModule, DecimalPipe, CurrencyPipe, DatePipe], changeDetection: ChangeDetectionStrategy.OnPush, host: { '[class]': 'className()', '[style.max-width.px]': 'styleMaxWidth()' }, template: "@if (descriptor().localizationExistsProperty && !item()[descriptor().localizationExistsProperty!]) {\n <i class=\"pi pi-exclamation-circle\" [pTooltip]=\"'mngTable.translationMissing' | translate\"></i>\n}\n@switch (descriptor().columnDisplayType) {\n @case (columnDisplayTypeString) {\n @if (descriptor().hasValueAsTooltip) {\n <span [pTooltip]=\"value()\" tooltipPosition=\"left\">{{ value() }}</span>\n } @else {\n {{ value() }}\n }\n }\n @case (columnDisplayTypeHtml) {\n <span [innerHTML]=\"value()\"></span>\n }\n @case (columnDisplayTypeNumber) {\n {{ value() | number: descriptor().displayFormat : descriptor().locale }}\n }\n @case (columnDisplayTypeCurrency) {\n {{ value() | currency: currency() : descriptor().currencyDisplay : descriptor().displayFormat : descriptor().locale }}\n }\n @case (columnDisplayTypeDate) {\n {{ value() | date: descriptor().displayFormat }}\n }\n @case (columnDisplayTypeBoolean) {\n @if (descriptor().booleanAsIcon) {\n <i [class]=\"value() | mngBoolean: descriptor().booleanYes : descriptor().booleanNo : true\"></i>\n } @else {\n {{ value() | mngBoolean: descriptor().booleanYes : descriptor().booleanNo | translate }}\n }\n }\n @case (columnDisplayTypeEnum) {\n {{ value() | mngEnum: descriptor().enum | translate }}\n }\n @case (columnDisplayTypeComponent) {\n <ng-container\n [mngComponent]=\"descriptor().customComponentType!\"\n [inputs]=\"{\n value: value(),\n item: item(),\n descriptor: descriptor()\n }\"></ng-container>\n }\n}\n@if (hasCopyToClipboard()) {\n <div class=\"help-buttons\">\n <button pButton pRipple type=\"button\" icon=\"pi pi-copy\" class=\"p-button-rounded p-button-info p-button-sm\" (click)=\"copyToClipboard($event)\"></button>\n </div>\n}\n", styles: [":host{display:inline-block;overflow:hidden}:host.nowrap{white-space:nowrap;text-overflow:ellipsis}:host.multiline{white-space:pre-wrap;word-wrap:break-word}.help-buttons{display:none;position:absolute;right:0;top:50%;transform:translateY(-50%)}.help-buttons .p-button{height:1.9rem;width:1.9rem;padding:0}\n"] }]
|
|
1126
|
-
}] });
|
|
1127
|
-
|
|
1128
|
-
class FilterValuePipe {
|
|
1129
|
-
constructor() {
|
|
1130
|
-
this.locale = inject(LOCALE_ID);
|
|
1131
|
-
this.translate = inject(TranslateService);
|
|
1132
|
-
this.enumPipe = new EnumPipe();
|
|
1133
|
-
this.subject = new ReplaySubject(1);
|
|
1134
|
-
}
|
|
1135
|
-
transform(value, descriptor) {
|
|
1136
|
-
const valTransform = this.prepareValueTransform(value, descriptor);
|
|
1137
|
-
this.subscription?.unsubscribe();
|
|
1138
|
-
if (valTransform.translate) {
|
|
1139
|
-
this.subscription = this.translate.stream(valTransform.valueArr).subscribe(i18n => {
|
|
1140
|
-
this.subject.next(valTransform.valueArr.map(k => i18n[k]).join(', '));
|
|
1141
|
-
});
|
|
1142
|
-
}
|
|
1143
|
-
else {
|
|
1144
|
-
this.subject.next(valTransform.valueArr.join(', '));
|
|
1145
|
-
}
|
|
1146
|
-
return this.subject.asObservable();
|
|
1147
|
-
}
|
|
1148
|
-
/**
|
|
1149
|
-
* If returns a string, this represents i18n key that must go through translation. If translation is not needed, undefined is returned.
|
|
1150
|
-
*/
|
|
1151
|
-
prepareValueTransform(value, descriptor) {
|
|
1152
|
-
const result = {
|
|
1153
|
-
translate: false,
|
|
1154
|
-
valueArr: Array.isArray(value) ? value : [value]
|
|
1155
|
-
};
|
|
1156
|
-
switch (descriptor?.filterType) {
|
|
1157
|
-
case FilterTypeEnum.Date:
|
|
1158
|
-
// eslint-disable-next-line no-case-declarations
|
|
1159
|
-
const datePipe = new DatePipe(this.locale);
|
|
1160
|
-
result.valueArr = result.valueArr.map(v => datePipe.transform(v, descriptor.displayFormat, descriptor.locale));
|
|
1161
|
-
break;
|
|
1162
|
-
case FilterTypeEnum.Number:
|
|
1163
|
-
// eslint-disable-next-line no-case-declarations
|
|
1164
|
-
const decimalPipe = new DecimalPipe(this.locale);
|
|
1165
|
-
result.valueArr = result.valueArr.map(v => decimalPipe.transform(v, descriptor.displayFormat, descriptor.locale));
|
|
1166
|
-
break;
|
|
1167
|
-
case FilterTypeEnum.Boolean:
|
|
1168
|
-
// eslint-disable-next-line no-case-declarations
|
|
1169
|
-
const booleanPipe = new BooleanPipe();
|
|
1170
|
-
result.valueArr = result.valueArr.map(v => booleanPipe.transform(v));
|
|
1171
|
-
result.translate = true;
|
|
1172
|
-
break;
|
|
1173
|
-
case FilterTypeEnum.LookupEnum:
|
|
1174
|
-
// eslint-disable-next-line no-case-declarations
|
|
1175
|
-
const enumPipe = new EnumPipe();
|
|
1176
|
-
result.valueArr = result.valueArr.map(v => enumPipe.transform(v, descriptor.enum));
|
|
1177
|
-
result.translate = true;
|
|
1178
|
-
break;
|
|
1179
|
-
}
|
|
1180
|
-
return result;
|
|
1181
|
-
}
|
|
1182
|
-
ngOnDestroy() {
|
|
1183
|
-
this.subscription?.unsubscribe();
|
|
1184
|
-
this.subject.complete();
|
|
1185
|
-
}
|
|
1186
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: FilterValuePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1187
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.12", ngImport: i0, type: FilterValuePipe, isStandalone: true, name: "mngFilterValue" }); }
|
|
1188
|
-
}
|
|
1189
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: FilterValuePipe, decorators: [{
|
|
1190
|
-
type: Pipe,
|
|
1191
|
-
args: [{
|
|
1192
|
-
name: 'mngFilterValue',
|
|
1193
|
-
standalone: true,
|
|
1194
|
-
pure: true
|
|
1195
|
-
}]
|
|
1196
|
-
}] });
|
|
1197
|
-
|
|
1198
|
-
class TableFilterActiveTagComponent {
|
|
1199
|
-
constructor() {
|
|
1200
|
-
this.FilterMatchMode = FilterMatchMode;
|
|
1201
|
-
this.model = input.required();
|
|
1202
|
-
this.filter = input.required();
|
|
1203
|
-
this.edit = output();
|
|
1204
|
-
this.remove = output();
|
|
1205
|
-
this.label = computed(() => this.getPropertyLabelKey(this.filter().metadata.descriptor));
|
|
1206
|
-
this.matchMode = computed(() => this.filter().displayMatchMode);
|
|
1207
|
-
this.matchModeSymbol = computed(() => `mngFilterActiveTag.matchMode.${this.matchMode()}`);
|
|
1208
|
-
this.value = computed(() => this.filter().displayValue);
|
|
1209
|
-
}
|
|
1210
|
-
onRemove(event) {
|
|
1211
|
-
event.stopPropagation();
|
|
1212
|
-
this.remove.emit({
|
|
1213
|
-
filter: this.filter(),
|
|
1214
|
-
event: event
|
|
1215
|
-
});
|
|
1216
|
-
}
|
|
1217
|
-
onEdit(event) {
|
|
1218
|
-
this.edit.emit({
|
|
1219
|
-
filter: this.filter(),
|
|
1220
|
-
event: event
|
|
1221
|
-
});
|
|
1222
|
-
}
|
|
1223
|
-
getPropertyLabelKey(filterDescriptor) {
|
|
1224
|
-
if (filterDescriptor.isGenericFilter) {
|
|
1225
|
-
return filterDescriptor.property;
|
|
1226
|
-
}
|
|
1227
|
-
let labelKey;
|
|
1228
|
-
if (filterDescriptor.title !== undefined && !filterDescriptor.titleUseModelBase) {
|
|
1229
|
-
labelKey = filterDescriptor.title;
|
|
1230
|
-
}
|
|
1231
|
-
else {
|
|
1232
|
-
labelKey = getI18nTypePropertyKey(this.model().i18nBaseKey, filterDescriptor.title ?? filterDescriptor.property);
|
|
1233
|
-
}
|
|
1234
|
-
return labelKey;
|
|
1235
|
-
}
|
|
1236
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableFilterActiveTagComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1237
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.12", type: TableFilterActiveTagComponent, isStandalone: true, selector: "mng-table-filter-active-tag", inputs: { model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: true, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { edit: "edit", remove: "remove" }, ngImport: i0, template: "<p-tag severity=\"secondary\" styleClass=\"mr-1 p-tag-outlined\">\n <div class=\"flex align-items-center gap-2 p-1 cursor-pointer\" (click)=\"onEdit($event)\">\n <span>{{ label() | translate }}</span>\n @if (matchMode() === FilterMatchMode.Between) {\n <span class=\"font-semibold\">{{ value()?.[0] | mngFilterValue: filter().metadata.descriptor | async }}</span>\n <span class=\"text-primary\">{{ matchModeSymbol() | translate }}</span>\n <span class=\"font-semibold\">{{ value()?.[1] | mngFilterValue: filter().metadata.descriptor | async }}</span>\n } @else {\n <span class=\"text-primary\">{{ matchModeSymbol() | translate }}</span>\n <span class=\"font-semibold\">{{ value() | mngFilterValue: filter().metadata.descriptor | async }}</span>\n @if (filter().caseSensitive) {\n <small class=\"border-solid border-1 border-round-sm px-1 text-primary-400\">Aa</small>\n }\n }\n <span class=\"pi pi-times text-xs\" (click)=\"onRemove($event)\"></span>\n </div>\n</p-tag>\n", dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: TagModule }, { kind: "component", type: i2$2.Tag, selector: "p-tag", inputs: ["style", "styleClass", "severity", "value", "icon", "rounded"] }, { kind: "pipe", type: FilterValuePipe, name: "mngFilterValue" }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1238
|
-
}
|
|
1239
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableFilterActiveTagComponent, decorators: [{
|
|
1240
|
-
type: Component,
|
|
1241
|
-
args: [{ standalone: true, selector: 'mng-table-filter-active-tag', imports: [TranslateModule, TagModule, FilterValuePipe, AsyncPipe], changeDetection: ChangeDetectionStrategy.OnPush, template: "<p-tag severity=\"secondary\" styleClass=\"mr-1 p-tag-outlined\">\n <div class=\"flex align-items-center gap-2 p-1 cursor-pointer\" (click)=\"onEdit($event)\">\n <span>{{ label() | translate }}</span>\n @if (matchMode() === FilterMatchMode.Between) {\n <span class=\"font-semibold\">{{ value()?.[0] | mngFilterValue: filter().metadata.descriptor | async }}</span>\n <span class=\"text-primary\">{{ matchModeSymbol() | translate }}</span>\n <span class=\"font-semibold\">{{ value()?.[1] | mngFilterValue: filter().metadata.descriptor | async }}</span>\n } @else {\n <span class=\"text-primary\">{{ matchModeSymbol() | translate }}</span>\n <span class=\"font-semibold\">{{ value() | mngFilterValue: filter().metadata.descriptor | async }}</span>\n @if (filter().caseSensitive) {\n <small class=\"border-solid border-1 border-round-sm px-1 text-primary-400\">Aa</small>\n }\n }\n <span class=\"pi pi-times text-xs\" (click)=\"onRemove($event)\"></span>\n </div>\n</p-tag>\n" }]
|
|
1242
|
-
}] });
|
|
1243
|
-
|
|
1244
|
-
class TableFilterFormComponent {
|
|
1245
|
-
constructor() {
|
|
1246
|
-
this.lookupTypeDropdown = FilterLookupTypeEnum.Dropdown;
|
|
1247
|
-
this.lookupTypeAutocomplete = FilterLookupTypeEnum.Autocomplete;
|
|
1248
|
-
this.FilterTypeEnum = FilterTypeEnum;
|
|
1249
|
-
this.FilterMatchMode = FilterMatchMode;
|
|
1250
|
-
this.elementRef = inject(ElementRef);
|
|
1251
|
-
this.translate = inject(TranslateService);
|
|
1252
|
-
this.title = input();
|
|
1253
|
-
this.metadata = input.required();
|
|
1254
|
-
this.genericDescriptor = input();
|
|
1255
|
-
this.model = input.required();
|
|
1256
|
-
this.filter = input();
|
|
1257
|
-
this.overlay = input();
|
|
1258
|
-
this.disabledProperties = input([]);
|
|
1259
|
-
this.enableCaseSensitive = input(true);
|
|
1260
|
-
this.propertySearch = input(false, { transform: booleanAttribute });
|
|
1261
|
-
this.apply = output();
|
|
1262
|
-
this.propertyOptionsWithTranslations = computed(() => {
|
|
1263
|
-
const disabledProperties = this.disabledProperties();
|
|
1264
|
-
const filter = this.filter();
|
|
1265
|
-
return (this.metadata()?.map(d => {
|
|
1266
|
-
return {
|
|
1267
|
-
property: d.descriptor.property,
|
|
1268
|
-
label: d.descriptor.isGenericFilter ? d.descriptor.property : this.getPropertyLabelKey(d.descriptor),
|
|
1269
|
-
disabled: !filter && disabledProperties.includes(d.descriptor.property)
|
|
1270
|
-
};
|
|
1271
|
-
}) ?? []);
|
|
1272
|
-
});
|
|
1273
|
-
this.selectedFilterMetadata = computed(() => {
|
|
1274
|
-
const property = this.propertyModel();
|
|
1275
|
-
return this.metadata().find(d => d.descriptor.property === property);
|
|
1276
|
-
});
|
|
1277
|
-
// change value lookup function to include the property name of the generic filter
|
|
1278
|
-
this.genericValueDataProvider = computed(() => {
|
|
1279
|
-
const genericValueProvider = this.genericDescriptor()?.valueLookup;
|
|
1280
|
-
if (genericValueProvider && genericValueProvider.serviceType) {
|
|
1281
|
-
const lookupFn = genericValueProvider.lookup;
|
|
1282
|
-
return lookupDataProvider({ service: genericValueProvider.serviceType }).withLookup((params, service, search) => {
|
|
1283
|
-
params = {
|
|
1284
|
-
...params,
|
|
1285
|
-
filters: {
|
|
1286
|
-
...params?.filters,
|
|
1287
|
-
field: {
|
|
1288
|
-
value: this.selectedFilterMetadata()?.descriptor.property,
|
|
1289
|
-
matchMode: this.selectedFilterMetadata()?.descriptor.filterType === FilterTypeEnum.LookupEnum ? FilterMatchMode.In : FilterMatchMode.StartsWith
|
|
1290
|
-
}
|
|
1291
|
-
}
|
|
1292
|
-
};
|
|
1293
|
-
return lookupFn(params, service, search);
|
|
1294
|
-
});
|
|
1295
|
-
}
|
|
1296
|
-
return;
|
|
1297
|
-
});
|
|
1298
|
-
this.selectedDescriptorAsLookup = computed(() => {
|
|
1299
|
-
const filterDescriptor = this.selectedFilterMetadata()?.descriptor;
|
|
1300
|
-
return filterDescriptor !== undefined &&
|
|
1301
|
-
!filterDescriptor.isGenericFilter &&
|
|
1302
|
-
(filterDescriptor.filterType === FilterTypeEnum.Lookup || filterDescriptor.filterType === FilterTypeEnum.LookupEnum)
|
|
1303
|
-
? filterDescriptor
|
|
1304
|
-
: undefined;
|
|
1305
|
-
});
|
|
1306
|
-
this.isEdit = computed(() => this.filter() != null);
|
|
1307
|
-
this.formSubmitted = signal(false);
|
|
1308
|
-
this.formErrorMessage = signal([]);
|
|
1309
|
-
// UI utilities
|
|
1310
|
-
this.filterForm = viewChild.required('filterForm');
|
|
1311
|
-
// Filter form model and form utilities
|
|
1312
|
-
this.propertyModel = signal(null);
|
|
1313
|
-
this.matchModeModel = signal(null);
|
|
1314
|
-
this.valueModel = signal(null);
|
|
1315
|
-
this.caseSensitiveModel = signal(false);
|
|
1316
|
-
this.isMultiselect = computed(() => this.matchModeModel() === FilterMatchMode.In || this.matchModeModel() === FilterMatchMode.NotIn);
|
|
1317
|
-
effect(() => {
|
|
1318
|
-
const edit = this.filter();
|
|
1319
|
-
if (edit) {
|
|
1320
|
-
this.resetForm({
|
|
1321
|
-
property: edit.metadata.descriptor.property,
|
|
1322
|
-
matchMode: edit.displayMatchMode ?? edit.matchMode ?? null,
|
|
1323
|
-
value: edit.displayValue ?? edit.value,
|
|
1324
|
-
caseSensitive: edit.caseSensitive ?? false
|
|
1325
|
-
});
|
|
1326
|
-
}
|
|
1327
|
-
else {
|
|
1328
|
-
this.resetForm();
|
|
1329
|
-
}
|
|
1330
|
-
}, { allowSignalWrites: true });
|
|
1331
|
-
effect(() => {
|
|
1332
|
-
const descriptor = this.selectedFilterMetadata()?.descriptor;
|
|
1333
|
-
const value = untracked(() => this.valueModel());
|
|
1334
|
-
if (value != null) {
|
|
1335
|
-
// reset value if filter type and value type mismatch
|
|
1336
|
-
if ((descriptor?.filterType === FilterTypeEnum.String &&
|
|
1337
|
-
(value === true || value === false || value === 'true' || value === 'false' || value instanceof Date)) ||
|
|
1338
|
-
(descriptor?.filterType === FilterTypeEnum.Number && typeof value !== 'number' && isNaN(+value)) ||
|
|
1339
|
-
(descriptor?.filterType === FilterTypeEnum.Date && !(value instanceof Date)) ||
|
|
1340
|
-
descriptor?.filterType === FilterTypeEnum.Lookup ||
|
|
1341
|
-
descriptor?.filterType === FilterTypeEnum.LookupEnum) {
|
|
1342
|
-
this.valueModel.set(null);
|
|
1343
|
-
}
|
|
1344
|
-
else if (descriptor?.filterType === FilterTypeEnum.Boolean && typeof value !== 'boolean') {
|
|
1345
|
-
this.valueModel.set(false);
|
|
1346
|
-
}
|
|
1347
|
-
}
|
|
1348
|
-
}, { allowSignalWrites: true });
|
|
1349
|
-
effect(() => {
|
|
1350
|
-
const matchModeOptions = this.selectedFilterMetadata()?.matchModes ?? [];
|
|
1351
|
-
const matchMode = untracked(() => this.matchModeModel());
|
|
1352
|
-
const filterForm = untracked(() => this.filterForm());
|
|
1353
|
-
if (matchModeOptions.length > 0 &&
|
|
1354
|
-
(!matchMode || filterForm.controls['matchMode']?.pristine || filterForm.controls['matchMode']?.untouched || !matchModeOptions.find(o => o.value === matchMode))) {
|
|
1355
|
-
this.matchModeModel.set(filterGetDefaultMatchMode(this.selectedFilterMetadata()?.descriptor, matchModeOptions));
|
|
1356
|
-
}
|
|
1357
|
-
}, { allowSignalWrites: true });
|
|
1358
|
-
effect(() => {
|
|
1359
|
-
const currentValue = untracked(() => this.valueModel());
|
|
1360
|
-
this.valueModel.set(filterAdjustDisplayValueOnMatchModeChange(this.matchModeModel() ?? undefined, currentValue));
|
|
1361
|
-
}, { allowSignalWrites: true });
|
|
1362
|
-
toObservable(this.overlay)
|
|
1363
|
-
.pipe(switchMap(o => (o ? o.onShow : NEVER)), takeUntilDestroyed())
|
|
1364
|
-
.subscribe(() => {
|
|
1365
|
-
const formFields = this.elementRef.nativeElement.querySelectorAll('input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [role="combobox"]:not([disabled])');
|
|
1366
|
-
const activeEl = document.activeElement;
|
|
1367
|
-
const activeInputIdx = activeEl ? [...formFields].findIndex(el => activeEl.isEqualNode(el)) : 0;
|
|
1368
|
-
if (activeInputIdx <= 0) {
|
|
1369
|
-
formFields[0].focus();
|
|
1370
|
-
}
|
|
1371
|
-
});
|
|
1372
|
-
}
|
|
1373
|
-
onFormSubmit(form) {
|
|
1374
|
-
this.formSubmitted.set(true);
|
|
1375
|
-
// mark all as dirty
|
|
1376
|
-
for (const key in form.controls) {
|
|
1377
|
-
form.controls[key].markAsDirty();
|
|
1378
|
-
}
|
|
1379
|
-
const property = this.propertyModel();
|
|
1380
|
-
const matchMode = this.matchModeModel();
|
|
1381
|
-
if (form.invalid || !property || !matchMode) {
|
|
1382
|
-
this.formErrorMessage.set([
|
|
1383
|
-
{
|
|
1384
|
-
severity: 'warn',
|
|
1385
|
-
summary: this.translate.instant('mngFilter.messages.invalidFormTitle'),
|
|
1386
|
-
detail: this.translate.instant('mngFilter.messages.invalidFormMessage')
|
|
1387
|
-
}
|
|
1388
|
-
]);
|
|
1389
|
-
return;
|
|
1390
|
-
}
|
|
1391
|
-
this.apply.emit({
|
|
1392
|
-
property: property,
|
|
1393
|
-
matchMode: matchMode,
|
|
1394
|
-
value: this.valueModel(),
|
|
1395
|
-
caseSensitive: this.caseSensitiveModel()
|
|
1396
|
-
});
|
|
1397
|
-
// resetting the form is done from the parent component (filter-overlay-with-tag) for smoother animations
|
|
1398
|
-
}
|
|
1399
|
-
resetForm(value) {
|
|
1400
|
-
this.filterForm().resetForm(value);
|
|
1401
|
-
// somehow have to set case sensitivity manually
|
|
1402
|
-
this.caseSensitiveModel.set(value?.caseSensitive ?? false);
|
|
1403
|
-
this.formSubmitted.set(false);
|
|
1404
|
-
}
|
|
1405
|
-
getPropertyLabelKey(filterDescriptor) {
|
|
1406
|
-
let labelKey;
|
|
1407
|
-
if (filterDescriptor.title !== undefined && !filterDescriptor.titleUseModelBase) {
|
|
1408
|
-
labelKey = filterDescriptor.title;
|
|
1409
|
-
}
|
|
1410
|
-
else {
|
|
1411
|
-
labelKey = getI18nTypePropertyKey(this.model().i18nBaseKey, filterDescriptor.title ?? filterDescriptor.property);
|
|
1412
|
-
}
|
|
1413
|
-
return labelKey;
|
|
1414
|
-
}
|
|
1415
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableFilterFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1416
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.12", type: TableFilterFormComponent, isStandalone: true, selector: "mng-table-filter-form", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, metadata: { classPropertyName: "metadata", publicName: "metadata", isSignal: true, isRequired: true, transformFunction: null }, genericDescriptor: { classPropertyName: "genericDescriptor", publicName: "genericDescriptor", isSignal: true, isRequired: false, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: true, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: false, transformFunction: null }, overlay: { classPropertyName: "overlay", publicName: "overlay", isSignal: true, isRequired: false, transformFunction: null }, disabledProperties: { classPropertyName: "disabledProperties", publicName: "disabledProperties", isSignal: true, isRequired: false, transformFunction: null }, enableCaseSensitive: { classPropertyName: "enableCaseSensitive", publicName: "enableCaseSensitive", isSignal: true, isRequired: false, transformFunction: null }, propertySearch: { classPropertyName: "propertySearch", publicName: "propertySearch", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { apply: "apply" }, host: { classAttribute: "flex flex-grow-1" }, viewQueries: [{ propertyName: "filterForm", first: true, predicate: ["filterForm"], descendants: true, isSignal: true }], ngImport: i0, template: "<div>\n <div>\n <h5>{{ filter() ? ('mngFilter.titleEdit' | translate) : ('mngFilter.titleAdd' | translate) }}</h5>\n </div>\n <form #filterForm=\"ngForm\" (ngSubmit)=\"onFormSubmit(filterForm)\" class=\"flex flex-column align-items-center lg:flex-row gap-3\">\n <div class=\"w-full lg:w-auto\">\n <mng-dropdown\n name=\"property\"\n id=\"property\"\n tabindex=\"1\"\n #propertyControl=\"ngModel\"\n [(ngModel)]=\"propertyModel\"\n [options]=\"propertyOptionsWithTranslations()\"\n optionsValueProperty=\"property\"\n optionsDisabledProperty=\"disabled\"\n optionsLabelProperty=\"label\"\n [placeholder]=\"'mngFilter.property' | translate\"\n [optionsLabelTranslate]=\"!propertySearch()\"\n [inlineSearch]=\"propertySearch()\"\n required=\"true\"\n className=\"w-full\"\n [disabled]=\"isEdit()\"\n [appendTo]=\"null\" />\n </div>\n <div class=\"w-full lg:w-auto\">\n <mng-dropdown\n name=\"matchMode\"\n id=\"matchMode\"\n [(ngModel)]=\"matchModeModel\"\n className=\"w-full\"\n [options]=\"selectedFilterMetadata()?.matchModes ?? []\"\n [placeholder]=\"'mngFilter.matchMode' | translate\"\n [disabled]=\"!propertyControl.value\"\n class=\"align-self-end\"\n required=\"true\"\n [appendTo]=\"null\" />\n </div>\n @if (!(matchModeModel() === FilterMatchMode.Exists || matchModeModel() === FilterMatchMode.DoesNotExist)) {\n <div class=\"w-full lg:w-auto flex flex-column\">\n @switch (selectedFilterMetadata()?.descriptor?.filterType) {\n @case (FilterTypeEnum.Number) {\n @if (matchModeModel() === FilterMatchMode.Between) {\n <mng-number-range\n className=\"mng-column-filter-number-input\"\n name=\"value\"\n [(ngModel)]=\"valueModel\"\n [placeholder]=\"'mngFilter.value' | translate\"\n [useGrouping]=\"selectedFilterMetadata()?.descriptor?.numberUseGrouping ?? false\"\n [minFractionDigits]=\"selectedFilterMetadata()?.numberConfig?.fractionsMin\"\n [maxFractionDigits]=\"selectedFilterMetadata()?.numberConfig?.fractionsMax\"\n required=\"true\" />\n } @else {\n <p-inputNumber\n inputStyleClass=\"mng-column-filter-number-input\"\n name=\"value\"\n [(ngModel)]=\"valueModel\"\n [styleClass]=\"'w-full'\"\n [placeholder]=\"'mngFilter.value' | translate\"\n [useGrouping]=\"selectedFilterMetadata()?.descriptor?.numberUseGrouping\"\n [minFractionDigits]=\"selectedFilterMetadata()?.numberConfig?.fractionsMin\"\n [maxFractionDigits]=\"selectedFilterMetadata()?.numberConfig?.fractionsMax\"\n [disabled]=\"!matchModeModel()\"\n required=\"true\" />\n }\n }\n\n @case (FilterTypeEnum.Boolean) {\n <p-checkbox [(ngModel)]=\"valueModel\" [disabled]=\"!matchModeModel()\" name=\"value\" binary=\"true\" required=\"true\" />\n }\n @case (FilterTypeEnum.Date) {\n @if (matchModeModel() === FilterMatchMode.Between) {\n <mng-date-range\n [(ngModel)]=\"valueModel\"\n name=\"value\"\n [showTime]=\"selectedFilterMetadata()?.dateConfig?.showTime ?? false\"\n [showSeconds]=\"selectedFilterMetadata()?.dateConfig?.showSeconds ?? false\"\n [dateFormat]=\"selectedFilterMetadata()?.dateConfig?.format\"\n [placeholder]=\"'mngFilter.value' | translate\"\n required=\"true\"></mng-date-range>\n } @else {\n <p-calendar\n appendTo=\"body\"\n name=\"value\"\n [(ngModel)]=\"valueModel\"\n [styleClass]=\"'w-full'\"\n [placeholder]=\"'mngFilter.value' | translate\"\n [showIcon]=\"true\"\n [showTime]=\"selectedFilterMetadata()?.dateConfig?.showTime ?? false\"\n [showSeconds]=\"selectedFilterMetadata()?.dateConfig?.showSeconds ?? false\"\n [dateFormat]=\"selectedFilterMetadata()?.dateConfig?.format\"\n [firstDayOfWeek]=\"1\"\n [disabled]=\"!matchModeModel()\"\n required=\"true\">\n </p-calendar>\n }\n }\n @case (FilterTypeEnum.Lookup) {\n <ng-container *ngTemplateOutlet=\"lookupFilter\"></ng-container>\n }\n @case (FilterTypeEnum.LookupEnum) {\n <ng-container *ngTemplateOutlet=\"lookupFilter\"></ng-container>\n }\n @default {\n @if (selectedFilterMetadata()?.descriptor?.genericValueProvider && genericValueDataProvider()) {\n <!-- conditional rendering on the placeholder is there because of styling issues with PrimeNG -->\n <!-- (PrimeNG applies the .p-placeholder class to programmatically set values, making them greyed out) -->\n <span class=\"flex align-items-center\">\n <mng-dropdown\n [(ngModel)]=\"valueModel\"\n name=\"value\"\n [dataProvider]=\"genericValueDataProvider()\"\n [className]=\"selectedFilterMetadata()?.descriptor?.className\"\n [dropdownClassName]=\"selectedFilterMetadata()?.descriptor?.dropdownClassName\"\n [placeholder]=\"valueModel() ? undefined : ('mngFilter.value' | translate)\"\n allowInput=\"true\"\n [disabled]=\"!matchModeModel()\"\n [appendTo]=\"null\"\n required=\"true\"></mng-dropdown>\n @if (enableCaseSensitive()) {\n <p-toggleButton [(ngModel)]=\"caseSensitiveModel\" name=\"caseSensitive\" styleClass=\"ml-2 p-1 p-button\" onLabel=\"Aa\" offLabel=\"Aa\" />\n }\n </span>\n } @else {\n <span class=\"p-input-icon-right\">\n <input\n [(ngModel)]=\"valueModel\"\n name=\"value\"\n type=\"text\"\n pInputText\n class=\"mng-column-filter-string-input w-full\"\n [attr.placeholder]=\"'mngFilter.value' | translate\"\n [mngInputTrim]=\"selectedFilterMetadata()?.descriptor?.trimOption\"\n [disabled]=\"!matchModeModel()\"\n [placeholder]=\"'mngFilter.value' | translate\"\n required=\"true\" />\n @if (enableCaseSensitive()) {\n <span class=\"toggle-button-input\">\n <p-toggleButton [(ngModel)]=\"caseSensitiveModel\" name=\"caseSensitive\" styleClass=\"ml-1 p-1 p-button-sm\" onLabel=\"Aa\" offLabel=\"Aa\" />\n </span>\n }\n </span>\n }\n }\n }\n <ng-template #lookupFilter>\n @if (selectedDescriptorAsLookup(); as lookupFilterDescriptor) {\n @switch (lookupFilterDescriptor.lookupType) {\n @case (lookupTypeAutocomplete) {\n <mng-autocomplete\n [(ngModel)]=\"valueModel\"\n name=\"value\"\n [dataProvider]=\"lookupFilterDescriptor.dataProvider\"\n [optionsTrackProperty]=\"lookupFilterDescriptor.optionsValueProperty\"\n [optionsValueProperty]=\"lookupFilterDescriptor.optionsValueProperty\"\n [optionsLabelProperty]=\"lookupFilterDescriptor.optionsLabelProperty\"\n [optionsLabelTranslate]=\"lookupFilterDescriptor.optionsLabelTranslate\"\n [multiselect]=\"isMultiselect()\"\n [autoClear]=\"lookupFilterDescriptor.autocompleteAutoClear ?? false\"\n [openOnFocus]=\"lookupFilterDescriptor.autocompleteAutoClear ?? true\"\n [inlineSearch]=\"lookupFilterDescriptor.autocompleteInlineSearch ?? false\"\n [placeholder]=\"'mngFilter.value' | translate\"\n [className]=\"lookupFilterDescriptor.className\"\n [dropdownClassName]=\"lookupFilterDescriptor.dropdownClassName\"\n [searchTrim]=\"selectedFilterMetadata()?.descriptor?.trimOption\"\n [disabled]=\"!matchModeModel()\"\n required=\"true\">\n </mng-autocomplete>\n }\n @case (lookupTypeDropdown) {\n <mng-dropdown\n [(ngModel)]=\"valueModel\"\n name=\"value\"\n [dataProvider]=\"lookupFilterDescriptor.dataProvider\"\n [optionsValueProperty]=\"lookupFilterDescriptor.optionsValueProperty\"\n [optionsLabelProperty]=\"lookupFilterDescriptor.optionsLabelProperty\"\n [optionsLabelTranslate]=\"lookupFilterDescriptor.optionsLabelTranslate\"\n [multiselect]=\"isMultiselect()\"\n [placeholder]=\"'mngFilter.value' | translate\"\n [className]=\"lookupFilterDescriptor.className + ' w-full'\"\n [dropdownClassName]=\"lookupFilterDescriptor.dropdownClassName\"\n showClear=\"false\"\n [disabled]=\"!matchModeModel()\"\n [appendTo]=\"null\"\n required=\"true\">\n </mng-dropdown>\n }\n }\n } @else if (selectedFilterMetadata()?.descriptor?.isGenericFilter && genericValueDataProvider()) {\n <mng-dropdown\n [(ngModel)]=\"valueModel\"\n name=\"value\"\n [dataProvider]=\"genericValueDataProvider()\"\n [placeholder]=\"'mngFilter.value' | translate\"\n showClear=\"false\"\n [disabled]=\"!matchModeModel()\"\n [appendTo]=\"null\"\n required=\"true\">\n </mng-dropdown>\n }\n </ng-template>\n </div>\n }\n <div class=\"flex justify-content-end\">\n <button pButton type=\"submit\" class=\"align-self-end\">\n {{ (filter() ? 'general.apply' : 'general.add') | translate }}\n </button>\n </div>\n </form>\n @if (formSubmitted() && filterForm.invalid) {\n <p-messages [value]=\"formErrorMessage()\" class=\"w-full\"></p-messages>\n }\n</div>\n", styles: [".toggle-button-input{position:absolute;right:.25rem;top:50%;transform:translateY(-50%)}\n"], dependencies: [{ kind: "component", type: DropdownComponent, selector: "mng-dropdown", inputs: ["dataProvider", "options", "optionsTrackProperty", "optionsLabelProperty", "optionsLabelTranslate", "optionsValueProperty", "optionsDisabledProperty", "multiselect", "placeholder", "showClear", "selectFirstItem", "className", "dropdownClassName", "changeValueOnBlur", "loading", "disabled", "allowInput", "appendTo", "inlineSearch", "searchTrim"], outputs: ["valueChange", "blur"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "directive", type: InputTrimDirective, selector: "[mngInputTrim]", inputs: ["mngInputTrim"] }, { kind: "component", type: NumberRangeComponent, selector: "mng-number-range", inputs: ["placeholder", "useGrouping", "minFractionDigits", "maxFractionDigits", "required", "disabled"], outputs: ["keyDown"] }, { kind: "ngmodule", type: InputNumberModule }, { kind: "component", type: i4.InputNumber, selector: "p-inputNumber", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "style", "placeholder", "size", "maxlength", "tabindex", "title", "ariaLabelledBy", "ariaLabel", "ariaRequired", "name", "required", "autocomplete", "min", "max", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "step", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "variant", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "showClear", "autofocus", "disabled"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown", "onClear"] }, { kind: "component", type: DateRangeComponent, selector: "mng-date-range", inputs: ["placeholder", "showTime", "showSeconds", "dateFormat", "className", "required", "disabled"] }, { kind: "ngmodule", type: CalendarModule }, { kind: "component", type: i2$1.Calendar, selector: "p-calendar", inputs: ["iconDisplay", "style", "styleClass", "inputStyle", "inputId", "name", "inputStyleClass", "placeholder", "ariaLabelledBy", "ariaLabel", "iconAriaLabel", "disabled", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "icon", "appendTo", "readonlyInput", "shortYearCutoff", "monthNavigator", "yearNavigator", "hourFormat", "timeOnly", "stepYearPicker", "stepHour", "stepMinute", "stepSecond", "showSeconds", "required", "showOnFocus", "showWeek", "startWeekFromFirstDayOfYear", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autofocus", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "variant", "minDate", "maxDate", "disabledDates", "disabledDays", "yearRange", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "locale", "view", "defaultDate"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { kind: "directive", type: i4$1.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain"] }, { kind: "component", type: AutocompleteComponent, selector: "mng-autocomplete", inputs: ["dataProvider", "optionsTrackProperty", "optionsValueProperty", "optionsLabelProperty", "optionsLabelTranslate", "inlineSearch", "openOnFocus", "multiselect", "placeholder", "className", "dropdownClassName", "showClear", "autoClear", "selectFirst", "searchTrim", "disabled"], outputs: ["valueChange", "blur"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i6.Checkbox, selector: "p-checkbox", inputs: ["value", "name", "disabled", "binary", "label", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "style", "styleClass", "labelStyleClass", "formControl", "checkboxIcon", "readonly", "required", "autofocus", "trueValue", "falseValue", "variant"], outputs: ["onChange", "onFocus", "onBlur"] }, { kind: "ngmodule", type: MessagesModule }, { kind: "component", type: i7.Messages, selector: "p-messages", inputs: ["value", "closable", "style", "styleClass", "enableService", "key", "escape", "severity", "showTransitionOptions", "hideTransitionOptions"], outputs: ["valueChange", "onClose"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i5.InputText, selector: "[pInputText]", inputs: ["variant"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: DropdownModule }, { kind: "ngmodule", type: ToggleButtonModule }, { kind: "component", type: i9.ToggleButton, selector: "p-toggleButton", inputs: ["onLabel", "offLabel", "onIcon", "offIcon", "ariaLabel", "ariaLabelledBy", "disabled", "style", "styleClass", "inputId", "tabindex", "iconPos", "autofocus"], outputs: ["onChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1417
|
-
}
|
|
1418
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableFilterFormComponent, decorators: [{
|
|
1419
|
-
type: Component,
|
|
1420
|
-
args: [{ standalone: true, selector: 'mng-table-filter-form', imports: [
|
|
1421
|
-
DropdownComponent,
|
|
1422
|
-
FormsModule,
|
|
1423
|
-
NgClass,
|
|
1424
|
-
TranslateModule,
|
|
1425
|
-
InputTrimDirective,
|
|
1426
|
-
NumberRangeComponent,
|
|
1427
|
-
InputNumberModule,
|
|
1428
|
-
DateRangeComponent,
|
|
1429
|
-
CalendarModule,
|
|
1430
|
-
AutocompleteComponent,
|
|
1431
|
-
CheckboxModule,
|
|
1432
|
-
MessagesModule,
|
|
1433
|
-
InputTextModule,
|
|
1434
|
-
NgTemplateOutlet,
|
|
1435
|
-
DropdownModule,
|
|
1436
|
-
ToggleButtonModule
|
|
1437
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1438
|
-
class: 'flex flex-grow-1'
|
|
1439
|
-
}, template: "<div>\n <div>\n <h5>{{ filter() ? ('mngFilter.titleEdit' | translate) : ('mngFilter.titleAdd' | translate) }}</h5>\n </div>\n <form #filterForm=\"ngForm\" (ngSubmit)=\"onFormSubmit(filterForm)\" class=\"flex flex-column align-items-center lg:flex-row gap-3\">\n <div class=\"w-full lg:w-auto\">\n <mng-dropdown\n name=\"property\"\n id=\"property\"\n tabindex=\"1\"\n #propertyControl=\"ngModel\"\n [(ngModel)]=\"propertyModel\"\n [options]=\"propertyOptionsWithTranslations()\"\n optionsValueProperty=\"property\"\n optionsDisabledProperty=\"disabled\"\n optionsLabelProperty=\"label\"\n [placeholder]=\"'mngFilter.property' | translate\"\n [optionsLabelTranslate]=\"!propertySearch()\"\n [inlineSearch]=\"propertySearch()\"\n required=\"true\"\n className=\"w-full\"\n [disabled]=\"isEdit()\"\n [appendTo]=\"null\" />\n </div>\n <div class=\"w-full lg:w-auto\">\n <mng-dropdown\n name=\"matchMode\"\n id=\"matchMode\"\n [(ngModel)]=\"matchModeModel\"\n className=\"w-full\"\n [options]=\"selectedFilterMetadata()?.matchModes ?? []\"\n [placeholder]=\"'mngFilter.matchMode' | translate\"\n [disabled]=\"!propertyControl.value\"\n class=\"align-self-end\"\n required=\"true\"\n [appendTo]=\"null\" />\n </div>\n @if (!(matchModeModel() === FilterMatchMode.Exists || matchModeModel() === FilterMatchMode.DoesNotExist)) {\n <div class=\"w-full lg:w-auto flex flex-column\">\n @switch (selectedFilterMetadata()?.descriptor?.filterType) {\n @case (FilterTypeEnum.Number) {\n @if (matchModeModel() === FilterMatchMode.Between) {\n <mng-number-range\n className=\"mng-column-filter-number-input\"\n name=\"value\"\n [(ngModel)]=\"valueModel\"\n [placeholder]=\"'mngFilter.value' | translate\"\n [useGrouping]=\"selectedFilterMetadata()?.descriptor?.numberUseGrouping ?? false\"\n [minFractionDigits]=\"selectedFilterMetadata()?.numberConfig?.fractionsMin\"\n [maxFractionDigits]=\"selectedFilterMetadata()?.numberConfig?.fractionsMax\"\n required=\"true\" />\n } @else {\n <p-inputNumber\n inputStyleClass=\"mng-column-filter-number-input\"\n name=\"value\"\n [(ngModel)]=\"valueModel\"\n [styleClass]=\"'w-full'\"\n [placeholder]=\"'mngFilter.value' | translate\"\n [useGrouping]=\"selectedFilterMetadata()?.descriptor?.numberUseGrouping\"\n [minFractionDigits]=\"selectedFilterMetadata()?.numberConfig?.fractionsMin\"\n [maxFractionDigits]=\"selectedFilterMetadata()?.numberConfig?.fractionsMax\"\n [disabled]=\"!matchModeModel()\"\n required=\"true\" />\n }\n }\n\n @case (FilterTypeEnum.Boolean) {\n <p-checkbox [(ngModel)]=\"valueModel\" [disabled]=\"!matchModeModel()\" name=\"value\" binary=\"true\" required=\"true\" />\n }\n @case (FilterTypeEnum.Date) {\n @if (matchModeModel() === FilterMatchMode.Between) {\n <mng-date-range\n [(ngModel)]=\"valueModel\"\n name=\"value\"\n [showTime]=\"selectedFilterMetadata()?.dateConfig?.showTime ?? false\"\n [showSeconds]=\"selectedFilterMetadata()?.dateConfig?.showSeconds ?? false\"\n [dateFormat]=\"selectedFilterMetadata()?.dateConfig?.format\"\n [placeholder]=\"'mngFilter.value' | translate\"\n required=\"true\"></mng-date-range>\n } @else {\n <p-calendar\n appendTo=\"body\"\n name=\"value\"\n [(ngModel)]=\"valueModel\"\n [styleClass]=\"'w-full'\"\n [placeholder]=\"'mngFilter.value' | translate\"\n [showIcon]=\"true\"\n [showTime]=\"selectedFilterMetadata()?.dateConfig?.showTime ?? false\"\n [showSeconds]=\"selectedFilterMetadata()?.dateConfig?.showSeconds ?? false\"\n [dateFormat]=\"selectedFilterMetadata()?.dateConfig?.format\"\n [firstDayOfWeek]=\"1\"\n [disabled]=\"!matchModeModel()\"\n required=\"true\">\n </p-calendar>\n }\n }\n @case (FilterTypeEnum.Lookup) {\n <ng-container *ngTemplateOutlet=\"lookupFilter\"></ng-container>\n }\n @case (FilterTypeEnum.LookupEnum) {\n <ng-container *ngTemplateOutlet=\"lookupFilter\"></ng-container>\n }\n @default {\n @if (selectedFilterMetadata()?.descriptor?.genericValueProvider && genericValueDataProvider()) {\n <!-- conditional rendering on the placeholder is there because of styling issues with PrimeNG -->\n <!-- (PrimeNG applies the .p-placeholder class to programmatically set values, making them greyed out) -->\n <span class=\"flex align-items-center\">\n <mng-dropdown\n [(ngModel)]=\"valueModel\"\n name=\"value\"\n [dataProvider]=\"genericValueDataProvider()\"\n [className]=\"selectedFilterMetadata()?.descriptor?.className\"\n [dropdownClassName]=\"selectedFilterMetadata()?.descriptor?.dropdownClassName\"\n [placeholder]=\"valueModel() ? undefined : ('mngFilter.value' | translate)\"\n allowInput=\"true\"\n [disabled]=\"!matchModeModel()\"\n [appendTo]=\"null\"\n required=\"true\"></mng-dropdown>\n @if (enableCaseSensitive()) {\n <p-toggleButton [(ngModel)]=\"caseSensitiveModel\" name=\"caseSensitive\" styleClass=\"ml-2 p-1 p-button\" onLabel=\"Aa\" offLabel=\"Aa\" />\n }\n </span>\n } @else {\n <span class=\"p-input-icon-right\">\n <input\n [(ngModel)]=\"valueModel\"\n name=\"value\"\n type=\"text\"\n pInputText\n class=\"mng-column-filter-string-input w-full\"\n [attr.placeholder]=\"'mngFilter.value' | translate\"\n [mngInputTrim]=\"selectedFilterMetadata()?.descriptor?.trimOption\"\n [disabled]=\"!matchModeModel()\"\n [placeholder]=\"'mngFilter.value' | translate\"\n required=\"true\" />\n @if (enableCaseSensitive()) {\n <span class=\"toggle-button-input\">\n <p-toggleButton [(ngModel)]=\"caseSensitiveModel\" name=\"caseSensitive\" styleClass=\"ml-1 p-1 p-button-sm\" onLabel=\"Aa\" offLabel=\"Aa\" />\n </span>\n }\n </span>\n }\n }\n }\n <ng-template #lookupFilter>\n @if (selectedDescriptorAsLookup(); as lookupFilterDescriptor) {\n @switch (lookupFilterDescriptor.lookupType) {\n @case (lookupTypeAutocomplete) {\n <mng-autocomplete\n [(ngModel)]=\"valueModel\"\n name=\"value\"\n [dataProvider]=\"lookupFilterDescriptor.dataProvider\"\n [optionsTrackProperty]=\"lookupFilterDescriptor.optionsValueProperty\"\n [optionsValueProperty]=\"lookupFilterDescriptor.optionsValueProperty\"\n [optionsLabelProperty]=\"lookupFilterDescriptor.optionsLabelProperty\"\n [optionsLabelTranslate]=\"lookupFilterDescriptor.optionsLabelTranslate\"\n [multiselect]=\"isMultiselect()\"\n [autoClear]=\"lookupFilterDescriptor.autocompleteAutoClear ?? false\"\n [openOnFocus]=\"lookupFilterDescriptor.autocompleteAutoClear ?? true\"\n [inlineSearch]=\"lookupFilterDescriptor.autocompleteInlineSearch ?? false\"\n [placeholder]=\"'mngFilter.value' | translate\"\n [className]=\"lookupFilterDescriptor.className\"\n [dropdownClassName]=\"lookupFilterDescriptor.dropdownClassName\"\n [searchTrim]=\"selectedFilterMetadata()?.descriptor?.trimOption\"\n [disabled]=\"!matchModeModel()\"\n required=\"true\">\n </mng-autocomplete>\n }\n @case (lookupTypeDropdown) {\n <mng-dropdown\n [(ngModel)]=\"valueModel\"\n name=\"value\"\n [dataProvider]=\"lookupFilterDescriptor.dataProvider\"\n [optionsValueProperty]=\"lookupFilterDescriptor.optionsValueProperty\"\n [optionsLabelProperty]=\"lookupFilterDescriptor.optionsLabelProperty\"\n [optionsLabelTranslate]=\"lookupFilterDescriptor.optionsLabelTranslate\"\n [multiselect]=\"isMultiselect()\"\n [placeholder]=\"'mngFilter.value' | translate\"\n [className]=\"lookupFilterDescriptor.className + ' w-full'\"\n [dropdownClassName]=\"lookupFilterDescriptor.dropdownClassName\"\n showClear=\"false\"\n [disabled]=\"!matchModeModel()\"\n [appendTo]=\"null\"\n required=\"true\">\n </mng-dropdown>\n }\n }\n } @else if (selectedFilterMetadata()?.descriptor?.isGenericFilter && genericValueDataProvider()) {\n <mng-dropdown\n [(ngModel)]=\"valueModel\"\n name=\"value\"\n [dataProvider]=\"genericValueDataProvider()\"\n [placeholder]=\"'mngFilter.value' | translate\"\n showClear=\"false\"\n [disabled]=\"!matchModeModel()\"\n [appendTo]=\"null\"\n required=\"true\">\n </mng-dropdown>\n }\n </ng-template>\n </div>\n }\n <div class=\"flex justify-content-end\">\n <button pButton type=\"submit\" class=\"align-self-end\">\n {{ (filter() ? 'general.apply' : 'general.add') | translate }}\n </button>\n </div>\n </form>\n @if (formSubmitted() && filterForm.invalid) {\n <p-messages [value]=\"formErrorMessage()\" class=\"w-full\"></p-messages>\n }\n</div>\n", styles: [".toggle-button-input{position:absolute;right:.25rem;top:50%;transform:translateY(-50%)}\n"] }]
|
|
1440
|
-
}], ctorParameters: () => [] });
|
|
1441
|
-
|
|
1442
|
-
class TableFilterOverlayWithTagComponent {
|
|
1443
|
-
static { this.SEARCH_WORD_LIMIT_MAX = 4; }
|
|
1444
|
-
constructor() {
|
|
1445
|
-
this.primeTable = inject(Table);
|
|
1446
|
-
this.tableData = inject((TableDataService));
|
|
1447
|
-
this.tableConfig = inject(COMMONS_TABLE_FEATURE_CONFIG_IT, { optional: true });
|
|
1448
|
-
this.metadata = input.required();
|
|
1449
|
-
this.genericFilterDescriptor = input();
|
|
1450
|
-
this.model = input.required();
|
|
1451
|
-
this.enableSearch = input(false, { transform: booleanAttribute });
|
|
1452
|
-
this.search = input();
|
|
1453
|
-
this.searchLimitWordMax = input(undefined);
|
|
1454
|
-
this.enableCaseSensitive = input(true, { transform: booleanAttribute });
|
|
1455
|
-
this.filterOverlay = viewChild.required(OverlayPanel);
|
|
1456
|
-
this.filterFormComponent = viewChild(TableFilterFormComponent);
|
|
1457
|
-
this.templates = contentChildren(TemplateDirective);
|
|
1458
|
-
this.titleTemplate = computed(() => findTemplateByName([...this.templates()], 'title'));
|
|
1459
|
-
this.filters = computed(() => {
|
|
1460
|
-
return this.getInitialFilters(this.tableData.filterMeta(), this.metadata());
|
|
1461
|
-
});
|
|
1462
|
-
this.showFilterButton = computed(() => this.metadata().length > 0);
|
|
1463
|
-
this.activeFilters = computed(() => {
|
|
1464
|
-
const filterEntry = this.filters();
|
|
1465
|
-
return this.metadata()
|
|
1466
|
-
.filter(d => {
|
|
1467
|
-
const filter = filterEntry[d.descriptor.property];
|
|
1468
|
-
return (filter &&
|
|
1469
|
-
filter.matchMode !== undefined &&
|
|
1470
|
-
filter.displayMatchMode !== undefined &&
|
|
1471
|
-
(filter.matchMode === FilterMatchMode.Exists ||
|
|
1472
|
-
filter.matchMode === FilterMatchMode.DoesNotExist ||
|
|
1473
|
-
(filter.value !== undefined && filter.displayValue !== undefined)));
|
|
1474
|
-
})
|
|
1475
|
-
.map(d => filterEntry[d.descriptor.property]);
|
|
1476
|
-
});
|
|
1477
|
-
this.activeFilterProperties = computed(() => this.activeFilters().map(f => f.metadata.descriptor.property));
|
|
1478
|
-
this.filterEdit = signal(undefined);
|
|
1479
|
-
// global search model
|
|
1480
|
-
this.searchValue = computed(() => this.search()?.value);
|
|
1481
|
-
this.searchCaseSensitive = computed(() => this.search()?.caseSensitive);
|
|
1482
|
-
this.searchWordLimitMaxError = signal(false);
|
|
1483
|
-
this.searchWordLimitMaxCmp = computed(() => {
|
|
1484
|
-
const inputLimit = this.searchLimitWordMax();
|
|
1485
|
-
if (inputLimit !== undefined) {
|
|
1486
|
-
return inputLimit;
|
|
1487
|
-
}
|
|
1488
|
-
return this.tableConfig?.searchLimitMaxWords !== undefined ? this.tableConfig?.searchLimitMaxWords : TableFilterOverlayWithTagComponent.SEARCH_WORD_LIMIT_MAX;
|
|
1489
|
-
});
|
|
1490
|
-
this.searchValueSubject = new BehaviorSubject(undefined);
|
|
1491
|
-
this.searchCaseSensitiveSubject = new BehaviorSubject(undefined);
|
|
1492
|
-
// UI utilities
|
|
1493
|
-
this.clickedOnFilterEvent = undefined;
|
|
1494
|
-
combineLatest([this.searchValueSubject.pipe(debounceTime(500), distinctUntilChanged()), this.searchCaseSensitiveSubject])
|
|
1495
|
-
// NOTE: skip is used to ignore propagating the initial value of the subjects
|
|
1496
|
-
.pipe(skip(1), takeUntilDestroyed())
|
|
1497
|
-
.subscribe(([value, caseSensitive]) => {
|
|
1498
|
-
this.updatePrimeTableGlobalFilter(value == null ? (this.search()?.value ?? '') : value, caseSensitive == null ? (this.search()?.caseSensitive ?? undefined) : caseSensitive);
|
|
1499
|
-
});
|
|
1500
|
-
}
|
|
1501
|
-
onFilterFormApply(event) {
|
|
1502
|
-
const filterMetadata = this.metadata().find(d => d.descriptor.property === event.property);
|
|
1503
|
-
if (!filterMetadata) {
|
|
1504
|
-
return;
|
|
1505
|
-
}
|
|
1506
|
-
const filterData = {
|
|
1507
|
-
...filterSetMetadataOnDisplayChange({ caseSensitive: event.caseSensitive }, event.matchMode, event.value, filterMetadata.descriptor.filterType, filterMetadata.dateConfig),
|
|
1508
|
-
metadata: filterMetadata
|
|
1509
|
-
};
|
|
1510
|
-
this.updatePrimeTableFilter(filterData);
|
|
1511
|
-
// this keeps the UI updated properly before closing the overlay
|
|
1512
|
-
this.filterEdit.set(filterData);
|
|
1513
|
-
// Resetting the form is done in the onOverlayHide callback because resetting the
|
|
1514
|
-
// values here renders empty inputs for a split second before closing the overlay
|
|
1515
|
-
this.filterOverlay().hide();
|
|
1516
|
-
}
|
|
1517
|
-
onFilterRemove(event) {
|
|
1518
|
-
this.updatePrimeTableFilter({
|
|
1519
|
-
...this.filters()[event.filter.metadata.descriptor.property],
|
|
1520
|
-
matchMode: undefined,
|
|
1521
|
-
displayMatchMode: undefined,
|
|
1522
|
-
value: undefined,
|
|
1523
|
-
displayValue: undefined
|
|
1524
|
-
});
|
|
1525
|
-
}
|
|
1526
|
-
onFilterEdit(event) {
|
|
1527
|
-
this.onFilterAddOrEdit(event.filter, event.event);
|
|
1528
|
-
}
|
|
1529
|
-
onFilterAdd(event) {
|
|
1530
|
-
this.onFilterAddOrEdit(undefined, event);
|
|
1531
|
-
}
|
|
1532
|
-
onSearchChange(value) {
|
|
1533
|
-
const searchWordLimitMax = this.searchWordLimitMaxCmp();
|
|
1534
|
-
if (searchWordLimitMax !== null) {
|
|
1535
|
-
const wordCount = value.split(/\s+/).filter(word => word.length > 0).length;
|
|
1536
|
-
this.searchWordLimitMaxError.set(wordCount > searchWordLimitMax);
|
|
1537
|
-
}
|
|
1538
|
-
else {
|
|
1539
|
-
this.searchWordLimitMaxError.set(false);
|
|
1540
|
-
}
|
|
1541
|
-
if (!this.searchWordLimitMaxError()) {
|
|
1542
|
-
this.searchValueSubject.next(value);
|
|
1543
|
-
}
|
|
1544
|
-
}
|
|
1545
|
-
onSearchCaseSensitiveChange(value) {
|
|
1546
|
-
this.searchCaseSensitiveSubject.next(value);
|
|
1547
|
-
}
|
|
1548
|
-
onOverlayHide() {
|
|
1549
|
-
// resetting the form is done here for a smoother animation
|
|
1550
|
-
if (this.filterFormComponent !== undefined) {
|
|
1551
|
-
this.filterFormComponent()?.resetForm();
|
|
1552
|
-
}
|
|
1553
|
-
if (this.clickedOnFilterEvent) {
|
|
1554
|
-
// show the overlay again if the user clicked another filter
|
|
1555
|
-
setTimeout(() => {
|
|
1556
|
-
this.filterEdit.set(this.clickedOnFilterEvent?.filter);
|
|
1557
|
-
this.filterOverlay().show(this.clickedOnFilterEvent?.event);
|
|
1558
|
-
this.clickedOnFilterEvent = undefined;
|
|
1559
|
-
}, 0);
|
|
1560
|
-
return;
|
|
1561
|
-
}
|
|
1562
|
-
else {
|
|
1563
|
-
// clean state
|
|
1564
|
-
this.filterEdit.set(undefined);
|
|
1565
|
-
}
|
|
1566
|
-
}
|
|
1567
|
-
onFilterAddOrEdit(filter, event) {
|
|
1568
|
-
// If user clicks on the same filter or add that is already open, close the overlay
|
|
1569
|
-
if (this.filterOverlay().overlayVisible && this.filterEdit()?.metadata.descriptor.property === filter?.metadata.descriptor.property) {
|
|
1570
|
-
this.filterOverlay().hide();
|
|
1571
|
-
return;
|
|
1572
|
-
}
|
|
1573
|
-
if (this.filterOverlay().overlayVisible) {
|
|
1574
|
-
// In case the user clicks another filter, 're-showing' the overlay in
|
|
1575
|
-
// the new position is done in the onOverlayHide callback
|
|
1576
|
-
this.clickedOnFilterEvent = { event, filter };
|
|
1577
|
-
this.filterOverlay().hide();
|
|
1578
|
-
}
|
|
1579
|
-
else {
|
|
1580
|
-
this.filterEdit.set(filter);
|
|
1581
|
-
this.filterOverlay().show(event);
|
|
1582
|
-
}
|
|
1583
|
-
}
|
|
1584
|
-
getInitialFilters(filtersInit, metadata) {
|
|
1585
|
-
const filtersResult = {};
|
|
1586
|
-
if (filtersInit) {
|
|
1587
|
-
for (const property in filtersInit) {
|
|
1588
|
-
const filterInit = filtersInit[property];
|
|
1589
|
-
const filterMetadata = metadata.find(m => m.descriptor.property === property);
|
|
1590
|
-
if (!filterMetadata) {
|
|
1591
|
-
continue;
|
|
1592
|
-
}
|
|
1593
|
-
filtersResult[property] = {
|
|
1594
|
-
...filterSetMetadataOnChange(filterInit, filterInit.matchMode, filterInit.value, filterMetadata.descriptor.filterType, filterMetadata.dateConfig),
|
|
1595
|
-
metadata: filterMetadata
|
|
1596
|
-
};
|
|
1597
|
-
}
|
|
1598
|
-
}
|
|
1599
|
-
return filtersResult;
|
|
1600
|
-
}
|
|
1601
|
-
updatePrimeTableFilter(filter) {
|
|
1602
|
-
this.primeTable.filters[filter.metadata.descriptor.property] = { ...filter };
|
|
1603
|
-
this.primeTable._filter();
|
|
1604
|
-
}
|
|
1605
|
-
updatePrimeTableGlobalFilter(searchQuery, caseSensitive = false) {
|
|
1606
|
-
// match mode needs to be set for inline search
|
|
1607
|
-
this.primeTable.filters['global'] = { ...{ value: searchQuery, matchMode: 'contains', caseSensitive: caseSensitive } };
|
|
1608
|
-
this.primeTable._filter();
|
|
1609
|
-
}
|
|
1610
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableFilterOverlayWithTagComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1611
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.12", type: TableFilterOverlayWithTagComponent, isStandalone: true, selector: "mng-table-filter-overlay-with-tag", inputs: { metadata: { classPropertyName: "metadata", publicName: "metadata", isSignal: true, isRequired: true, transformFunction: null }, genericFilterDescriptor: { classPropertyName: "genericFilterDescriptor", publicName: "genericFilterDescriptor", isSignal: true, isRequired: false, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: true, transformFunction: null }, enableSearch: { classPropertyName: "enableSearch", publicName: "enableSearch", isSignal: true, isRequired: false, transformFunction: null }, search: { classPropertyName: "search", publicName: "search", isSignal: true, isRequired: false, transformFunction: null }, searchLimitWordMax: { classPropertyName: "searchLimitWordMax", publicName: "searchLimitWordMax", isSignal: true, isRequired: false, transformFunction: null }, enableCaseSensitive: { classPropertyName: "enableCaseSensitive", publicName: "enableCaseSensitive", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "templates", predicate: TemplateDirective, isSignal: true }], viewQueries: [{ propertyName: "filterOverlay", first: true, predicate: OverlayPanel, descendants: true, isSignal: true }, { propertyName: "filterFormComponent", first: true, predicate: TableFilterFormComponent, descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"flex align-items-center flex-grow-1\">\n @if (titleTemplate()) {\n <ng-container *ngTemplateOutlet=\"titleTemplate()\"></ng-container>\n }\n @if (showFilterButton()) {\n <p-button\n icon=\"pi pi-filter\"\n rounded=\"true\"\n [severity]=\"activeFilters().length > 0 ? 'primary' : 'secondary'\"\n size=\"small\"\n (click)=\"onFilterAdd($event)\"\n [styleClass]=\"'my-1 mr-2' + (titleTemplate() ? ' ml-3' : '')\">\n </p-button>\n }\n @if (enableSearch()) {\n <div class=\"col-4\" [ngClass]=\"{'ml-3': !showFilterButton() && titleTemplate()}\">\n <span class=\"p-input-icon-left w-full\">\n <i class=\"pi pi-search\"></i>\n <input\n [ngModel]=\"searchValue()\"\n (ngModelChange)=\"onSearchChange($event)\"\n name=\"globalSearch\"\n type=\"text\"\n pInputText\n class=\"search-input w-full\"\n [ngClass]=\"{'ng-invalid': searchWordLimitMaxError()}\"\n [attr.placeholder]=\"'mngFilter.search.input' | translate\"\n [placeholder]=\"'mngFilter.search.input' | translate\" />\n @if (enableCaseSensitive()) {\n <span class=\"toggle-button-input\">\n <p-toggleButton\n styleClass=\"ml-1 p-1 p-button-sm\"\n [ngModel]=\"searchCaseSensitive()\"\n (ngModelChange)=\"onSearchCaseSensitiveChange($event)\"\n onLabel=\"Aa\"\n offLabel=\"Aa\" />\n </span>\n }\n </span>\n @if (searchWordLimitMaxError()) {\n <small class=\"p-error block\">\n {{ 'mngFilter.search.maxWordsExceededMessage' | translate }}\n </small>\n }\n </div>\n }\n</div>\n@if (activeFilters().length > 0) {\n <div class=\"flex align-items-center flex-wrap mt-2\">\n @for (filter of activeFilters(); track filter.metadata.descriptor.property) {\n <mng-table-filter-active-tag [model]=\"model()\" [filter]=\"filter\" (edit)=\"onFilterEdit($event)\" (remove)=\"onFilterRemove($event)\" />\n }\n </div>\n}\n<p-overlayPanel #op [showCloseIcon]=\"true\" (onHide)=\"onOverlayHide()\" appendTo=\"body\">\n <mng-table-filter-form\n [model]=\"model()\"\n [metadata]=\"metadata()\"\n [genericDescriptor]=\"genericFilterDescriptor()\"\n [filter]=\"filterEdit()\"\n [disabledProperties]=\"activeFilterProperties()\"\n [propertySearch]=\"genericFilterDescriptor()?.propertySearch\"\n [overlay]=\"op\"\n [enableCaseSensitive]=\"enableCaseSensitive()\"\n (apply)=\"onFilterFormApply($event)\" />\n</p-overlayPanel>\n", styles: [".toggle-button-input{position:absolute;right:.35rem;top:50%;transform:translateY(-50%)}\n"], dependencies: [{ kind: "ngmodule", type: OverlayPanelModule }, { kind: "component", type: i1$2.OverlayPanel, selector: "p-overlayPanel", inputs: ["ariaLabel", "ariaLabelledBy", "dismissable", "showCloseIcon", "style", "styleClass", "appendTo", "autoZIndex", "ariaCloseLabel", "baseZIndex", "focusOnShow", "showTransitionOptions", "hideTransitionOptions"], outputs: ["onShow", "onHide"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: TagModule }, { kind: "component", type: TableFilterFormComponent, selector: "mng-table-filter-form", inputs: ["title", "metadata", "genericDescriptor", "model", "filter", "overlay", "disabledProperties", "enableCaseSensitive", "propertySearch"], outputs: ["apply"] }, { kind: "component", type: Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "style", "styleClass", "badgeClass", "ariaLabel", "autofocus"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: TableFilterActiveTagComponent, selector: "mng-table-filter-active-tag", inputs: ["model", "filter"], outputs: ["edit", "remove"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i5.InputText, selector: "[pInputText]", inputs: ["variant"] }, { kind: "ngmodule", type: PaginatorModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ToggleButtonModule }, { kind: "component", type: i9.ToggleButton, selector: "p-toggleButton", inputs: ["onLabel", "offLabel", "onIcon", "offIcon", "ariaLabel", "ariaLabelledBy", "disabled", "style", "styleClass", "inputId", "tabindex", "iconPos", "autofocus"], outputs: ["onChange"] }, { kind: "ngmodule", type: InputGroupModule }, { kind: "ngmodule", type: InputGroupAddonModule }, { kind: "ngmodule", type: CheckboxModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1612
|
-
}
|
|
1613
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableFilterOverlayWithTagComponent, decorators: [{
|
|
1614
|
-
type: Component,
|
|
1615
|
-
args: [{ standalone: true, selector: 'mng-table-filter-overlay-with-tag', imports: [
|
|
1616
|
-
OverlayPanelModule,
|
|
1617
|
-
TranslateModule,
|
|
1618
|
-
TagModule,
|
|
1619
|
-
TableFilterFormComponent,
|
|
1620
|
-
Button,
|
|
1621
|
-
TableFilterActiveTagComponent,
|
|
1622
|
-
NgTemplateOutlet,
|
|
1623
|
-
InputTextModule,
|
|
1624
|
-
PaginatorModule,
|
|
1625
|
-
NgClass,
|
|
1626
|
-
ToggleButtonModule,
|
|
1627
|
-
InputGroupModule,
|
|
1628
|
-
InputGroupAddonModule,
|
|
1629
|
-
CheckboxModule,
|
|
1630
|
-
NgStyle
|
|
1631
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"flex align-items-center flex-grow-1\">\n @if (titleTemplate()) {\n <ng-container *ngTemplateOutlet=\"titleTemplate()\"></ng-container>\n }\n @if (showFilterButton()) {\n <p-button\n icon=\"pi pi-filter\"\n rounded=\"true\"\n [severity]=\"activeFilters().length > 0 ? 'primary' : 'secondary'\"\n size=\"small\"\n (click)=\"onFilterAdd($event)\"\n [styleClass]=\"'my-1 mr-2' + (titleTemplate() ? ' ml-3' : '')\">\n </p-button>\n }\n @if (enableSearch()) {\n <div class=\"col-4\" [ngClass]=\"{'ml-3': !showFilterButton() && titleTemplate()}\">\n <span class=\"p-input-icon-left w-full\">\n <i class=\"pi pi-search\"></i>\n <input\n [ngModel]=\"searchValue()\"\n (ngModelChange)=\"onSearchChange($event)\"\n name=\"globalSearch\"\n type=\"text\"\n pInputText\n class=\"search-input w-full\"\n [ngClass]=\"{'ng-invalid': searchWordLimitMaxError()}\"\n [attr.placeholder]=\"'mngFilter.search.input' | translate\"\n [placeholder]=\"'mngFilter.search.input' | translate\" />\n @if (enableCaseSensitive()) {\n <span class=\"toggle-button-input\">\n <p-toggleButton\n styleClass=\"ml-1 p-1 p-button-sm\"\n [ngModel]=\"searchCaseSensitive()\"\n (ngModelChange)=\"onSearchCaseSensitiveChange($event)\"\n onLabel=\"Aa\"\n offLabel=\"Aa\" />\n </span>\n }\n </span>\n @if (searchWordLimitMaxError()) {\n <small class=\"p-error block\">\n {{ 'mngFilter.search.maxWordsExceededMessage' | translate }}\n </small>\n }\n </div>\n }\n</div>\n@if (activeFilters().length > 0) {\n <div class=\"flex align-items-center flex-wrap mt-2\">\n @for (filter of activeFilters(); track filter.metadata.descriptor.property) {\n <mng-table-filter-active-tag [model]=\"model()\" [filter]=\"filter\" (edit)=\"onFilterEdit($event)\" (remove)=\"onFilterRemove($event)\" />\n }\n </div>\n}\n<p-overlayPanel #op [showCloseIcon]=\"true\" (onHide)=\"onOverlayHide()\" appendTo=\"body\">\n <mng-table-filter-form\n [model]=\"model()\"\n [metadata]=\"metadata()\"\n [genericDescriptor]=\"genericFilterDescriptor()\"\n [filter]=\"filterEdit()\"\n [disabledProperties]=\"activeFilterProperties()\"\n [propertySearch]=\"genericFilterDescriptor()?.propertySearch\"\n [overlay]=\"op\"\n [enableCaseSensitive]=\"enableCaseSensitive()\"\n (apply)=\"onFilterFormApply($event)\" />\n</p-overlayPanel>\n", styles: [".toggle-button-input{position:absolute;right:.35rem;top:50%;transform:translateY(-50%)}\n"] }]
|
|
1632
|
-
}], ctorParameters: () => [] });
|
|
1633
|
-
|
|
1634
|
-
/**
|
|
1635
|
-
* Generates and displays a notification for a table-related error with localized error messages and details.
|
|
1636
|
-
*
|
|
1637
|
-
* @param {TranslateService} translate - The service used to handle localization and translations.
|
|
1638
|
-
* @param {MessageService} messageService - The service used to manage and display messages.
|
|
1639
|
-
* @param {TableDescriptorInst<any>} table - The table descriptor containing table-specific information and model data.
|
|
1640
|
-
* @param {Error} error - The error object providing details about the error that occurred.
|
|
1641
|
-
* @return {Message | null} The generated message object for the error notification or null if no notification was created.
|
|
1642
|
-
*/
|
|
1643
|
-
function tableNotificationError(translate, messageService, table, error) {
|
|
1644
|
-
const params = {
|
|
1645
|
-
errorMessage: getI18nForError(translate, error) ?? error.message,
|
|
1646
|
-
...getI18nErrorParams(error)
|
|
1647
|
-
};
|
|
1648
|
-
const tableErrorTitle = getI18nForModel(translate, table.model, 'table.error.title', { fallbackKey: 'general.error', params }) ?? undefined;
|
|
1649
|
-
const tableErrorMessage = getI18nForModel(translate, table.model, 'table.error.message', { fallbackKey: 'general.errorMessage', params }) ?? undefined;
|
|
1650
|
-
return toastMessage(tableErrorMessage ?? error.message, 'error', { messageService: messageService, title: tableErrorTitle, icon: 'pi-exclamation-triangle' });
|
|
1651
|
-
}
|
|
1652
|
-
|
|
1653
|
-
class LocaleDefaultRowClassPipe {
|
|
1654
|
-
constructor(injector) {
|
|
1655
|
-
this.injector = injector;
|
|
1656
|
-
}
|
|
1657
|
-
transform(value, descriptor, item) {
|
|
1658
|
-
if (descriptor?.isLocalized) {
|
|
1659
|
-
if (item[descriptor.localizationLocaleProperty] === this.injector.get(CommonsService).getDefaultLocale()) {
|
|
1660
|
-
return value + ' all-translations-default-value';
|
|
1661
|
-
}
|
|
1662
|
-
}
|
|
1663
|
-
return value ?? '';
|
|
1664
|
-
}
|
|
1665
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: LocaleDefaultRowClassPipe, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1666
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.12", ngImport: i0, type: LocaleDefaultRowClassPipe, isStandalone: true, name: "mngLocaleDefaultRowClass" }); }
|
|
1667
|
-
}
|
|
1668
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: LocaleDefaultRowClassPipe, decorators: [{
|
|
1669
|
-
type: Pipe,
|
|
1670
|
-
args: [{
|
|
1671
|
-
standalone: true,
|
|
1672
|
-
name: 'mngLocaleDefaultRowClass',
|
|
1673
|
-
pure: true
|
|
1674
|
-
}]
|
|
1675
|
-
}], ctorParameters: () => [{ type: i0.Injector }] });
|
|
1676
|
-
|
|
1677
|
-
class TableColumnFilterClassPipe {
|
|
1678
|
-
transform(value, filter, isEnabled) {
|
|
1679
|
-
const strValue = typeof value === 'string' ? value : '';
|
|
1680
|
-
if (isEnabled && filter?.filterType !== undefined) {
|
|
1681
|
-
return `${strValue} mng-column-filter-${FilterTypeEnum[filter.filterType].toLowerCase()}`;
|
|
1682
|
-
}
|
|
1683
|
-
else {
|
|
1684
|
-
return strValue;
|
|
1685
|
-
}
|
|
1686
|
-
}
|
|
1687
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableColumnFilterClassPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1688
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.12", ngImport: i0, type: TableColumnFilterClassPipe, isStandalone: true, name: "mngTableColumnFilterClass" }); }
|
|
1689
|
-
}
|
|
1690
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableColumnFilterClassPipe, decorators: [{
|
|
1691
|
-
type: Pipe,
|
|
1692
|
-
args: [{
|
|
1693
|
-
standalone: true,
|
|
1694
|
-
pure: true,
|
|
1695
|
-
name: 'mngTableColumnFilterClass'
|
|
1696
|
-
}]
|
|
1697
|
-
}] });
|
|
1698
|
-
|
|
1699
|
-
/**
|
|
1700
|
-
* generates table layout preferences key used when saving preferences to localstorage
|
|
1701
|
-
* @param typeName string, required
|
|
1702
|
-
* @param url string, required
|
|
1703
|
-
* @param trackProperty string, not required
|
|
1704
|
-
*/
|
|
1705
|
-
function generateTableLayoutPrefsKey(typeName, url, trackProperty) {
|
|
1706
|
-
return `commonsTableLayoutPrefs~~${typeName}~~${trackProperty ?? url.split('?')[0].split('#')[0]}`;
|
|
1707
|
-
}
|
|
1708
|
-
|
|
1709
|
-
class TablePreferencesService {
|
|
1710
|
-
constructor() {
|
|
1711
|
-
this.#router = inject(Router);
|
|
1712
|
-
this.#storageService = inject(CommonsStorageService);
|
|
1713
|
-
this.#metadata = inject(TableMetadataService);
|
|
1714
|
-
this.localstorageKey = computed(() => {
|
|
1715
|
-
const descriptor = this.#metadata.descriptor();
|
|
1716
|
-
return descriptor.model.i18nBaseKey ? generateTableLayoutPrefsKey(descriptor.model.i18nBaseKey, this.#router.url, descriptor.identifier) : null;
|
|
1717
|
-
});
|
|
1718
|
-
this.#layoutPrefsSaveCnt = signal(0);
|
|
1719
|
-
this.layoutPreferences = computed(() => {
|
|
1720
|
-
const lsKey = this.localstorageKey();
|
|
1721
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1722
|
-
const cnt = this.#layoutPrefsSaveCnt(); // needed to force updates on user changes
|
|
1723
|
-
const layoutPrefs = lsKey ? this.#storageService.getItem(TableMetadataService.cmpTypeName, lsKey) : undefined;
|
|
1724
|
-
return layoutPrefs ?? { columnWidths: {} };
|
|
1725
|
-
});
|
|
1726
|
-
// columns
|
|
1727
|
-
this.columnsWithPrefs = computed(() => this.#computeColumnsWithLayout());
|
|
1728
|
-
}
|
|
1729
|
-
#router;
|
|
1730
|
-
#storageService;
|
|
1731
|
-
#metadata;
|
|
1732
|
-
#layoutPrefsSaveCnt;
|
|
1733
|
-
/**
|
|
1734
|
-
* Method is called on column resize
|
|
1735
|
-
* @param element event's element
|
|
1736
|
-
*/
|
|
1737
|
-
onColumnResize({ element }) {
|
|
1738
|
-
const fieldId = element.id;
|
|
1739
|
-
const width = element.offsetWidth;
|
|
1740
|
-
const layoutPrefs = this.layoutPreferences();
|
|
1741
|
-
const col = this.columnsWithPrefs().find(el => el.descriptor.property === fieldId);
|
|
1742
|
-
if (col)
|
|
1743
|
-
col.width = width;
|
|
1744
|
-
if (!layoutPrefs.columnWidths)
|
|
1745
|
-
layoutPrefs.columnWidths = {};
|
|
1746
|
-
layoutPrefs.columnWidths[fieldId] = width;
|
|
1747
|
-
this.#saveLayoutPreferences(layoutPrefs);
|
|
1748
|
-
}
|
|
1749
|
-
onColumnToggle(event) {
|
|
1750
|
-
const layoutPrefs = this.layoutPreferences();
|
|
1751
|
-
const selectedColumns = event.value.map(v => v.descriptor.property);
|
|
1752
|
-
layoutPrefs.columnHidden = this.columnsWithPrefs()
|
|
1753
|
-
.filter(c => selectedColumns.indexOf(c.descriptor.property) < 0)
|
|
1754
|
-
.map(c => c.descriptor.property);
|
|
1755
|
-
this.#saveLayoutPreferences(layoutPrefs, true);
|
|
1756
|
-
}
|
|
1757
|
-
onColumnToggleAll() {
|
|
1758
|
-
const layoutPrefs = this.layoutPreferences();
|
|
1759
|
-
const columns = [...this.columnsWithPrefs()];
|
|
1760
|
-
const isVisible = !this.columnsWithPrefs().some(c => c.isVisible);
|
|
1761
|
-
for (const col of columns) {
|
|
1762
|
-
if (isVisible !== col.isVisible) {
|
|
1763
|
-
col.isVisible = isVisible;
|
|
1764
|
-
}
|
|
1765
|
-
}
|
|
1766
|
-
layoutPrefs.columnHidden = columns.filter(c => !c.isVisible).map(c => c.descriptor.property);
|
|
1767
|
-
this.#saveLayoutPreferences(layoutPrefs);
|
|
1768
|
-
}
|
|
1769
|
-
onColumnReorder(event) {
|
|
1770
|
-
if (event.dropIndex !== undefined && event.dropIndex >= 0 && event.dragIndex !== undefined && event.dragIndex >= 0 && event.dropIndex !== event.dragIndex) {
|
|
1771
|
-
const eventDropIndex = event.dropIndex;
|
|
1772
|
-
const eventDragIndex = event.dragIndex;
|
|
1773
|
-
const prevVisibleColumns = this.columnsWithPrefs().filter(c => c.isVisible);
|
|
1774
|
-
const colAtDrop = prevVisibleColumns[eventDropIndex];
|
|
1775
|
-
const colAtDrag = prevVisibleColumns[eventDragIndex];
|
|
1776
|
-
const colAtDropIndex = this.columnsWithPrefs().findIndex(el => el.id === colAtDrop.id);
|
|
1777
|
-
const colAtDragIndex = this.columnsWithPrefs().findIndex(el => el.id === colAtDrag.id);
|
|
1778
|
-
if (colAtDropIndex > -1 && colAtDragIndex > -1) {
|
|
1779
|
-
let columns = [...this.columnsWithPrefs()];
|
|
1780
|
-
columns.splice(colAtDragIndex, 1);
|
|
1781
|
-
const dropIndex = columns.findIndex(el => el.id === colAtDrop.id) + (eventDropIndex > eventDragIndex ? 1 : 0);
|
|
1782
|
-
columns = [...columns.slice(0, dropIndex), colAtDrag, ...columns.slice(dropIndex)];
|
|
1783
|
-
const layoutPrefs = this.layoutPreferences();
|
|
1784
|
-
layoutPrefs.columnOrder = columns.map(el => el.descriptor.property);
|
|
1785
|
-
this.#saveLayoutPreferences(layoutPrefs);
|
|
1786
|
-
}
|
|
1787
|
-
}
|
|
1788
|
-
}
|
|
1789
|
-
/**
|
|
1790
|
-
* Reset column order and column visibility to default settings
|
|
1791
|
-
*/
|
|
1792
|
-
clearLayoutPreferences() {
|
|
1793
|
-
const key = this.localstorageKey();
|
|
1794
|
-
if (key) {
|
|
1795
|
-
this.#storageService.removeItem(TableMetadataService.cmpTypeName, key);
|
|
1796
|
-
this.#layoutPrefsSaveCnt.update(v => v + 1);
|
|
1797
|
-
}
|
|
1798
|
-
}
|
|
1799
|
-
#saveLayoutPreferences(layoutPrefs, forceUpdate = false) {
|
|
1800
|
-
const key = this.localstorageKey();
|
|
1801
|
-
if (key) {
|
|
1802
|
-
this.#storageService.setItem(TableMetadataService.cmpTypeName, key, layoutPrefs);
|
|
1803
|
-
if (forceUpdate) {
|
|
1804
|
-
this.#layoutPrefsSaveCnt.update(v => v + 1);
|
|
1805
|
-
}
|
|
1806
|
-
}
|
|
1807
|
-
}
|
|
1808
|
-
#computeColumnsWithLayout() {
|
|
1809
|
-
const descriptor = this.#metadata.descriptor();
|
|
1810
|
-
const layoutPrefs = this.layoutPreferences();
|
|
1811
|
-
// initialize columns with additional properties
|
|
1812
|
-
const timestamp = new Date().getTime();
|
|
1813
|
-
const columns = descriptor.columns.map(col => ({
|
|
1814
|
-
id: `${col.property}-${timestamp}`,
|
|
1815
|
-
descriptor: col,
|
|
1816
|
-
filter: this.#metadata
|
|
1817
|
-
.filters()
|
|
1818
|
-
.find(f => f.descriptor.showOnColumn === col.property &&
|
|
1819
|
-
((f.descriptor.displayType == null && this.#metadata.defaultFilterDisplayType === FilterDisplayTypeEnum.Column) ||
|
|
1820
|
-
f.descriptor.displayType === FilterDisplayTypeEnum.Column)),
|
|
1821
|
-
sort: descriptor.sorts.find(f => f.showOnColumn === col.property),
|
|
1822
|
-
disabled: !col.isToggleable,
|
|
1823
|
-
isVisible: layoutPrefs.columnHidden ? !layoutPrefs.columnHidden.includes(col.property) : col.isVisible,
|
|
1824
|
-
width: layoutPrefs.columnWidths?.[col.property]
|
|
1825
|
-
}));
|
|
1826
|
-
if (layoutPrefs.columnOrder) {
|
|
1827
|
-
for (let i = 0; i < layoutPrefs.columnOrder.length; i++) {
|
|
1828
|
-
const colName = layoutPrefs.columnOrder[i];
|
|
1829
|
-
const colWithPrefs = columns.find(el => el.descriptor.property === colName);
|
|
1830
|
-
if (colWithPrefs) {
|
|
1831
|
-
colWithPrefs.orderIdx = i;
|
|
1832
|
-
}
|
|
1833
|
-
}
|
|
1834
|
-
}
|
|
1835
|
-
return columns.sort((a, b) => (a.orderIdx !== undefined && b.orderIdx !== undefined ? a.orderIdx - b.orderIdx : 0));
|
|
1836
|
-
}
|
|
1837
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TablePreferencesService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1838
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TablePreferencesService }); }
|
|
1839
|
-
}
|
|
1840
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TablePreferencesService, decorators: [{
|
|
1841
|
-
type: Injectable
|
|
1842
|
-
}] });
|
|
1843
|
-
|
|
1844
|
-
class TableComponent {
|
|
1845
|
-
// subscriptions and refs
|
|
1846
|
-
#previousDataProvider;
|
|
1847
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1848
|
-
#dataProviderEagerFirstLoad;
|
|
1849
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1850
|
-
#dataProviderReloadSubscription;
|
|
1851
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1852
|
-
#routeQueryParamsSubscription;
|
|
1853
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1854
|
-
#routerEventsSubscription;
|
|
1855
|
-
#afterNextRenderRef;
|
|
1856
|
-
constructor() {
|
|
1857
|
-
this.filterKeyPrepend = 'f_';
|
|
1858
|
-
this.logger = inject(LoggerService).create(TableMetadataService.cmpTypeName);
|
|
1859
|
-
this.router = inject(Router);
|
|
1860
|
-
this.route = inject(ActivatedRoute);
|
|
1861
|
-
this.translate = inject(TranslateService);
|
|
1862
|
-
this.messageService = inject(MessageService);
|
|
1863
|
-
this.metadata = inject(TableMetadataService);
|
|
1864
|
-
this.prefs = inject(TablePreferencesService);
|
|
1865
|
-
this.data = inject((TableDataService));
|
|
1866
|
-
// descriptor
|
|
1867
|
-
this.descriptorInput = input.required({ alias: 'descriptor' });
|
|
1868
|
-
// data source inputs
|
|
1869
|
-
this.items = input();
|
|
1870
|
-
this.result = input();
|
|
1871
|
-
this.loadingInput = input(undefined, { alias: 'loading', transform: booleanOrUndefinedAttribute });
|
|
1872
|
-
this.dataProvider = input();
|
|
1873
|
-
// extra features input
|
|
1874
|
-
this.useQueryParams = input(false, { transform: booleanAttribute });
|
|
1875
|
-
this.cellClickEnabled = input(true, { transform: booleanAttribute });
|
|
1876
|
-
this.selectionMode = input('multiple');
|
|
1877
|
-
this.selectionEnabled = input(false, { transform: booleanAttribute });
|
|
1878
|
-
this.rowReorderEnabledInput = input(true, { alias: 'rowReorderEnabled', transform: booleanAttribute });
|
|
1879
|
-
this.rowReorderEnabled = computed(() => this.rowReorderEnabledInput() && this.metadata.descriptor().rowReorderable);
|
|
1880
|
-
this.expandedRowKeys = computed(() => {
|
|
1881
|
-
const descriptor = this.metadata.descriptor();
|
|
1882
|
-
if (typeof descriptor.isRowExpanded === 'string') {
|
|
1883
|
-
return this.data.data()?.reduce((acc, item) => {
|
|
1884
|
-
acc[item[descriptor.trackProperty]] = !!item[descriptor.isRowExpanded];
|
|
1885
|
-
return acc;
|
|
1886
|
-
}, {});
|
|
1887
|
-
}
|
|
1888
|
-
else if (typeof descriptor.isRowExpanded === 'function') {
|
|
1889
|
-
return this.data.data()?.reduce((acc, item) => {
|
|
1890
|
-
acc[item[descriptor.trackProperty]] = descriptor.isRowExpanded(item);
|
|
1891
|
-
return acc;
|
|
1892
|
-
}, {});
|
|
1893
|
-
}
|
|
1894
|
-
return {};
|
|
1895
|
-
});
|
|
1896
|
-
// styling
|
|
1897
|
-
this.columnLastMinWidth = input();
|
|
1898
|
-
this.columnsColspan = computed(() => this.visibleColumns().length + (this.hasLastColumn() ? 1 : 0) + (this.selectionEnabled() ? 1 : 0) + (this.rowReorderEnabled() ? 1 : 0));
|
|
1899
|
-
this.hasTitleDisplay = computed(() => this.captionTemplate() || this.captionComponent() || this.metadata.descriptor().title);
|
|
1900
|
-
this.isCaptionVisible = computed(() => this.hasTitleDisplay() || this.overlayWithTagFilters().length > 0 || this.metadata.descriptor().search);
|
|
1901
|
-
// component inputs
|
|
1902
|
-
this.captionComponent = input();
|
|
1903
|
-
this.columnCustomLastComponent = input();
|
|
1904
|
-
this.globalFilterFieldsInput = input(undefined, { alias: 'globalFilterFields' });
|
|
1905
|
-
// cell click
|
|
1906
|
-
this.cellClickSubject = new Subject();
|
|
1907
|
-
this.isCellClickObserved = signal(this.cellClickSubject.observed);
|
|
1908
|
-
this.isCellClickEnabled = computed(() => this.cellClickEnabled() && this.isCellClickObserved());
|
|
1909
|
-
// event outputs
|
|
1910
|
-
this.tableLoad = output();
|
|
1911
|
-
this.cellClick = outputFromObservable(this.cellClickSubject);
|
|
1912
|
-
this.selectionChange = output();
|
|
1913
|
-
this.captionComponentInstance = output();
|
|
1914
|
-
this.columnCustomLastComponentInstance = output();
|
|
1915
|
-
this.rowReorder = output();
|
|
1916
|
-
// content and view queries
|
|
1917
|
-
this.templates = contentChildren(TemplateDirective);
|
|
1918
|
-
this.components = viewChildren((ComponentDirective));
|
|
1919
|
-
this.primeTable = viewChild(Table);
|
|
1920
|
-
// templates
|
|
1921
|
-
this.captionTemplate = computed(() => findTemplateByName([...this.templates()], 'caption'));
|
|
1922
|
-
this.columnCustomLastTemplate = computed(() => findTemplateByName([...this.templates()], 'columnCustomLast'));
|
|
1923
|
-
this.footerTemplate = computed(() => findTemplateByName([...this.templates()], 'footer'));
|
|
1924
|
-
this.rowExpandTemplate = computed(() => findTemplateByName([...this.templates()], 'rowExpandContent'));
|
|
1925
|
-
// data provider and items
|
|
1926
|
-
this.isLazy = computed(() => this.dataProvider()?.isLazy === true);
|
|
1927
|
-
this.isPagination = computed(() => this.data.paginationMode() === TablePaginationModeEnum.Pagination);
|
|
1928
|
-
this.useQueryParamsInitialized = signal(false);
|
|
1929
|
-
// visual
|
|
1930
|
-
this.className = computed(() => {
|
|
1931
|
-
let className = this.metadata.descriptor().className ?? '';
|
|
1932
|
-
switch (this.metadata.descriptor().size) {
|
|
1933
|
-
case TableSizeEnum.Small:
|
|
1934
|
-
className += ' p-datatable-sm';
|
|
1935
|
-
break;
|
|
1936
|
-
case TableSizeEnum.Large:
|
|
1937
|
-
className += ' p-datatable-lg';
|
|
1938
|
-
break;
|
|
1939
|
-
}
|
|
1940
|
-
if (this.metadata.descriptor().hasGridlines) {
|
|
1941
|
-
className += ' p-datatable-gridlines';
|
|
1942
|
-
}
|
|
1943
|
-
if (!this.isCaptionVisible()) {
|
|
1944
|
-
className += ' datatable-no-header';
|
|
1945
|
-
}
|
|
1946
|
-
return className;
|
|
1947
|
-
});
|
|
1948
|
-
// columns
|
|
1949
|
-
this.visibleColumns = computed(() => this.prefs.columnsWithPrefs().filter(col => col.isVisible));
|
|
1950
|
-
this.areColumnsReorderable = computed(() => this.prefs.columnsWithPrefs().some(col => col.descriptor.isReorderable));
|
|
1951
|
-
this.areColumnsToggleable = computed(() => this.prefs.columnsWithPrefs().some(col => col.descriptor.isToggleable));
|
|
1952
|
-
// filter, sort
|
|
1953
|
-
this.hasColumnFilters = computed(() => (this.metadata.defaultFilterDisplayType === FilterDisplayTypeEnum.OverlayWithTag &&
|
|
1954
|
-
this.metadata.filterDescriptors().some(d => d.displayType === FilterDisplayTypeEnum.Column)) ||
|
|
1955
|
-
(this.metadata.defaultFilterDisplayType === FilterDisplayTypeEnum.Column && this.metadata.filterDescriptors().some(d => d.displayType == null)));
|
|
1956
|
-
this.overlayWithTagFilters = computed(() => {
|
|
1957
|
-
// statically defined filters AND generic filters
|
|
1958
|
-
const filters = this.metadata
|
|
1959
|
-
.filters()
|
|
1960
|
-
.filter(d => (d.descriptor.displayType == null && this.metadata.defaultFilterDisplayType === FilterDisplayTypeEnum.OverlayWithTag) ||
|
|
1961
|
-
d.descriptor.displayType === FilterDisplayTypeEnum.OverlayWithTag);
|
|
1962
|
-
return filters.concat(this.metadata.genericFilters());
|
|
1963
|
-
});
|
|
1964
|
-
this.anyColumnVisible = computed(() => this.visibleColumns().length > 0);
|
|
1965
|
-
this.hasCustomLastColumn = computed(() => this.columnCustomLastComponent() || this.columnCustomLastTemplate());
|
|
1966
|
-
this.hasLastColumn = computed(() => this.hasCustomLastColumn() || this.areColumnsToggleable() || this.areColumnsReorderable());
|
|
1967
|
-
// other
|
|
1968
|
-
this.navigationOutOfTableInProgress = false;
|
|
1969
|
-
this.navigationInTableInProgress = false;
|
|
1970
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1971
|
-
this.#dataProviderEagerFirstLoad = effectWithDeps([this.dataProvider], ([dataProvider]) => {
|
|
1972
|
-
if (dataProvider?.isLazy === false) {
|
|
1973
|
-
this.loadTableWithDataProvider(this.metadata.defaultParams());
|
|
1974
|
-
}
|
|
1975
|
-
else if (this.#previousDataProvider && dataProvider) {
|
|
1976
|
-
this.reload();
|
|
1977
|
-
}
|
|
1978
|
-
this.#previousDataProvider = dataProvider;
|
|
1979
|
-
});
|
|
1980
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1981
|
-
this.#dataProviderReloadSubscription = toObservable(this.dataProvider)
|
|
1982
|
-
.pipe(switchMap(dp => dp?.tableReload$ ?? of({})), takeUntilDestroyed())
|
|
1983
|
-
.subscribe({
|
|
1984
|
-
next: e => {
|
|
1985
|
-
this.reload(e);
|
|
1986
|
-
}
|
|
1987
|
-
});
|
|
1988
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1989
|
-
this.#routeQueryParamsSubscription = toObservable(this.useQueryParams)
|
|
1990
|
-
.pipe(switchMap(useQp => (useQp ? this.route.queryParams : NEVER)), takeUntilDestroyed())
|
|
1991
|
-
.subscribe(qp => {
|
|
1992
|
-
this.loadTableFromRouteUpdate(qp);
|
|
1993
|
-
});
|
|
1994
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1995
|
-
this.#routerEventsSubscription = toObservable(this.useQueryParams)
|
|
1996
|
-
.pipe(switchMap(useQp => (useQp ? this.router.events : NEVER)), filter(e => (e instanceof NavigationStart && e.url.split('?')[0].split('#')[0] !== this.router.url.split('?')[0].split('#')[0]) ||
|
|
1997
|
-
e instanceof NavigationEnd ||
|
|
1998
|
-
e instanceof NavigationCancel ||
|
|
1999
|
-
e instanceof NavigationError), takeUntilDestroyed())
|
|
2000
|
-
.subscribe(e => {
|
|
2001
|
-
this.navigationOutOfTableInProgress = e instanceof NavigationStart;
|
|
2002
|
-
});
|
|
2003
|
-
this.#afterNextRenderRef = afterNextRender(() => {
|
|
2004
|
-
this.isCellClickObserved.set(this.cellClickSubject.observed);
|
|
2005
|
-
});
|
|
2006
|
-
this.metadata.setSignalSources(this.descriptorInput, this.globalFilterFieldsInput);
|
|
2007
|
-
this.data.setDataSources(this.items, this.result, this.dataProvider, this.loadingInput);
|
|
2008
|
-
}
|
|
2009
|
-
reload(emitEvent) {
|
|
2010
|
-
const params = emitEvent?.params ? emitEvent?.params : emitEvent?.resetParams ? undefined : this.lastParamsWithDefaults;
|
|
2011
|
-
const reloadParams = mergeDataListParamsWithDefaults(params ?? {}, this.metadata.defaultParams());
|
|
2012
|
-
this.loadTableWithDataProvider(reloadParams, emitEvent?.emitEvent ?? false);
|
|
2013
|
-
}
|
|
2014
|
-
onTableLazyLoad(event) {
|
|
2015
|
-
this.lastLazyLoadEvent = event;
|
|
2016
|
-
const params = fromTableLoadToDataListParams(event);
|
|
2017
|
-
if (this.useQueryParams()) {
|
|
2018
|
-
if (!this.navigationOutOfTableInProgress && !this.navigationInTableInProgress) {
|
|
2019
|
-
// this check is necessary: from some reason, primeNG commits one last lazy load event whenever any angular router navigation occurs
|
|
2020
|
-
this.navigationInTableInProgress = true;
|
|
2021
|
-
const newParams = dataListParamsToUrlQuery(params, this.metadata.defaultParams(), { prependFilterName: this.filterKeyPrepend });
|
|
2022
|
-
const newParamsWithParamsToRemove = { ...newParams };
|
|
2023
|
-
const currentQp = this.route.snapshot.queryParams;
|
|
2024
|
-
if (currentQp) {
|
|
2025
|
-
Object.keys(currentQp)
|
|
2026
|
-
.filter(k => (k.startsWith(this.filterKeyPrepend) || ['offset', 'limit', 'sort', 'q'].indexOf(k) >= 0) && newParams[k] === undefined)
|
|
2027
|
-
.forEach(k => (newParamsWithParamsToRemove[k] = null));
|
|
2028
|
-
}
|
|
2029
|
-
this.router
|
|
2030
|
-
.navigate([], {
|
|
2031
|
-
relativeTo: this.route,
|
|
2032
|
-
replaceUrl: true,
|
|
2033
|
-
queryParams: newParamsWithParamsToRemove,
|
|
2034
|
-
queryParamsHandling: 'merge'
|
|
2035
|
-
})
|
|
2036
|
-
.then(() => {
|
|
2037
|
-
this.navigationInTableInProgress = false;
|
|
2038
|
-
});
|
|
2039
|
-
}
|
|
2040
|
-
}
|
|
2041
|
-
else {
|
|
2042
|
-
const paramsWithDefaults = mergeDataListParamsWithDefaults(params, this.metadata.defaultParams());
|
|
2043
|
-
this.data.setParams(paramsWithDefaults);
|
|
2044
|
-
this.loadTableWithDataProvider(paramsWithDefaults);
|
|
2045
|
-
}
|
|
2046
|
-
}
|
|
2047
|
-
onTableFilter(event) {
|
|
2048
|
-
if (this.useQueryParams()) {
|
|
2049
|
-
return;
|
|
2050
|
-
}
|
|
2051
|
-
const params = fromTableLoadToDataListParams({ filters: event.filters });
|
|
2052
|
-
const paramsWithDefaults = mergeDataListParamsWithDefaults(params, this.metadata.defaultParams());
|
|
2053
|
-
// if table doesn't use lazy loading, filter params need to be set here
|
|
2054
|
-
// because the onTableLazyLoad event is not emitted
|
|
2055
|
-
if (!this.isLazy()) {
|
|
2056
|
-
this.data.setParams(paramsWithDefaults);
|
|
2057
|
-
}
|
|
2058
|
-
}
|
|
2059
|
-
onCellClick(event, col, item, idx) {
|
|
2060
|
-
if (!this.isCellClickEnabled()) {
|
|
2061
|
-
return;
|
|
2062
|
-
}
|
|
2063
|
-
const tableEvent = {
|
|
2064
|
-
column: col,
|
|
2065
|
-
rowItem: item,
|
|
2066
|
-
rowIndex: idx,
|
|
2067
|
-
event: event
|
|
2068
|
-
};
|
|
2069
|
-
this.cellClickSubject.next(tableEvent);
|
|
2070
|
-
}
|
|
2071
|
-
onSelectionChange(event) {
|
|
2072
|
-
this.selectionChange.emit(event);
|
|
2073
|
-
}
|
|
2074
|
-
onRowReorder(event) {
|
|
2075
|
-
this.rowReorder.emit(event);
|
|
2076
|
-
}
|
|
2077
|
-
loadTableWithDataProvider(paramsWithDefaults, emitEvent = true) {
|
|
2078
|
-
const isFetched = this.data.fetchWithDataProvider(paramsWithDefaults, error => {
|
|
2079
|
-
tableNotificationError(this.translate, this.messageService, this.metadata.descriptor(), error);
|
|
2080
|
-
const commonsError = fromSubscribeError(error, 'TableComponentError', {
|
|
2081
|
-
params: paramsWithDefaults
|
|
2082
|
-
});
|
|
2083
|
-
this.logger.log(commonsError, getErrorLogLevel(commonsError));
|
|
2084
|
-
});
|
|
2085
|
-
if (isFetched) {
|
|
2086
|
-
this.lastParamsWithDefaults = paramsWithDefaults;
|
|
2087
|
-
if (emitEvent) {
|
|
2088
|
-
const tableEvent = {
|
|
2089
|
-
originalEvent: this.lastLazyLoadEvent,
|
|
2090
|
-
params: paramsWithDefaults
|
|
2091
|
-
};
|
|
2092
|
-
this.tableLoad.emit(tableEvent);
|
|
2093
|
-
}
|
|
2094
|
-
}
|
|
2095
|
-
}
|
|
2096
|
-
loadTableFromRouteUpdate(urlParams) {
|
|
2097
|
-
const paramsWithDefaults = mergeDataListParamsWithDefaults(fromUrlQueryToDataListParams(urlParams, {
|
|
2098
|
-
prependFilterName: this.filterKeyPrepend,
|
|
2099
|
-
searchAsGlobal: true
|
|
2100
|
-
}), this.metadata.defaultParams());
|
|
2101
|
-
this.data.setParams(paramsWithDefaults, true);
|
|
2102
|
-
this.loadTableWithDataProvider(paramsWithDefaults);
|
|
2103
|
-
}
|
|
2104
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2105
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.12", type: TableComponent, isStandalone: true, selector: "mng-table", inputs: { descriptorInput: { classPropertyName: "descriptorInput", publicName: "descriptor", isSignal: true, isRequired: true, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, result: { classPropertyName: "result", publicName: "result", isSignal: true, isRequired: false, transformFunction: null }, loadingInput: { classPropertyName: "loadingInput", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, dataProvider: { classPropertyName: "dataProvider", publicName: "dataProvider", isSignal: true, isRequired: false, transformFunction: null }, useQueryParams: { classPropertyName: "useQueryParams", publicName: "useQueryParams", isSignal: true, isRequired: false, transformFunction: null }, cellClickEnabled: { classPropertyName: "cellClickEnabled", publicName: "cellClickEnabled", isSignal: true, isRequired: false, transformFunction: null }, selectionMode: { classPropertyName: "selectionMode", publicName: "selectionMode", isSignal: true, isRequired: false, transformFunction: null }, selectionEnabled: { classPropertyName: "selectionEnabled", publicName: "selectionEnabled", isSignal: true, isRequired: false, transformFunction: null }, rowReorderEnabledInput: { classPropertyName: "rowReorderEnabledInput", publicName: "rowReorderEnabled", isSignal: true, isRequired: false, transformFunction: null }, columnLastMinWidth: { classPropertyName: "columnLastMinWidth", publicName: "columnLastMinWidth", isSignal: true, isRequired: false, transformFunction: null }, captionComponent: { classPropertyName: "captionComponent", publicName: "captionComponent", isSignal: true, isRequired: false, transformFunction: null }, columnCustomLastComponent: { classPropertyName: "columnCustomLastComponent", publicName: "columnCustomLastComponent", isSignal: true, isRequired: false, transformFunction: null }, globalFilterFieldsInput: { classPropertyName: "globalFilterFieldsInput", publicName: "globalFilterFields", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { tableLoad: "tableLoad", cellClick: "cellClick", selectionChange: "selectionChange", captionComponentInstance: "captionComponentInstance", columnCustomLastComponentInstance: "columnCustomLastComponentInstance", rowReorder: "rowReorder" }, providers: [TableMetadataService, TableDataService, TablePreferencesService], queries: [{ propertyName: "templates", predicate: TemplateDirective, isSignal: true }], viewQueries: [{ propertyName: "components", predicate: (ComponentDirective), descendants: true, isSignal: true }, { propertyName: "primeTable", first: true, predicate: Table, descendants: true, isSignal: true }], ngImport: i0, template: "<div>\n <!-- MUST NOT use observable for value when using virtual scroll - does not work for some reason -->\n @if (data.isAllPaginationMetaInitialized()) {\n <p-table\n [value]=\"data.data()\"\n [dataKey]=\"metadata.descriptor().trackProperty\"\n [lazy]=\"isLazy()\"\n [loading]=\"data.loading()\"\n [paginator]=\"isPagination()\"\n [rows]=\"data.rows()\"\n [first]=\"data.offset()\"\n [totalRecords]=\"data.count()\"\n [rowsPerPageOptions]=\"metadata.rowsPerPageOptions()\"\n [showCurrentPageReport]=\"true\"\n [currentPageReportTemplate]=\"'mngTable.paginationMsg' | translate\"\n [multiSortMeta]=\"data.sortMeta()\"\n [filters]=\"data.filterMeta()\"\n [globalFilterFields]=\"metadata.searchFields()\"\n sortMode=\"multiple\"\n [selection]=\"[]\"\n (selectionChange)=\"onSelectionChange($event)\"\n [selectionMode]=\"selectionEnabled() ? selectionMode() : null\"\n [scrollable]=\"true\"\n scrollHeight=\"flex\"\n [rowHover]=\"metadata.descriptor().hasHover\"\n [styleClass]=\"className()\"\n [resizableColumns]=\"metadata.descriptor().hasResizableColumns\"\n [columnResizeMode]=\"metadata.descriptor().columnResizeMode ?? 'expand'\"\n [reorderableColumns]=\"areColumnsReorderable()\"\n paginatorDropdownAppendTo=\"body\"\n [columns]=\"visibleColumns()\"\n [expandedRowKeys]=\"expandedRowKeys()\"\n (onColResize)=\"prefs.onColumnResize($event)\"\n (onColReorder)=\"prefs.onColumnReorder($event)\"\n (onLazyLoad)=\"onTableLazyLoad($event)\"\n (onFilter)=\"onTableFilter($event)\"\n (onRowReorder)=\"onRowReorder($event)\">\n <ng-template pTemplate=\"caption\">\n @if (isCaptionVisible()) {\n <div class=\"table-header\">\n @if (overlayWithTagFilters().length > 0 || metadata.descriptor().search) {\n <mng-table-filter-overlay-with-tag\n [title]=\"metadata.descriptor().title\"\n [metadata]=\"overlayWithTagFilters()\"\n [genericFilterDescriptor]=\"metadata.genericFilterDescriptor()\"\n [model]=\"metadata.descriptor().model\"\n [enableSearch]=\"metadata.descriptor().search\"\n [search]=\"data.searchMeta()\"\n [searchLimitWordMax]=\"metadata.descriptor().searchLimitMaxWords\"\n [enableCaseSensitive]=\"isLazy()\">\n @if (hasTitleDisplay()) {\n <ng-template mngTemplate=\"title\">\n <ng-container *ngTemplateOutlet=\"captionTemplateOrComponentOrTitle\"></ng-container>\n </ng-template>\n }\n </mng-table-filter-overlay-with-tag>\n } @else {\n <ng-container *ngTemplateOutlet=\"captionTemplateOrComponentOrTitle\"></ng-container>\n }\n <ng-template #captionTemplateOrComponentOrTitle>\n @if (captionTemplate()) {\n <ng-container *ngTemplateOutlet=\"captionTemplate()\"></ng-container>\n } @else if (captionComponent()) {\n <ng-container [mngComponent]=\"captionComponent()\" (instanceCreated)=\"captionComponentInstance.emit($event)\"></ng-container>\n } @else if (metadata.descriptor().title) {\n <h5 class=\"p-0 m-0\">{{ metadata.descriptor().title! | translate }}</h5>\n }\n </ng-template>\n </div>\n }\n </ng-template>\n <ng-template pTemplate=\"header\">\n @if (!metadata.descriptor().hideHeader) {\n <tr class=\"mng-table-header\" [class]=\"metadata.descriptor().headerClassName\">\n @if (selectionEnabled()) {\n @if (selectionMode() === 'multiple') {\n <th style=\"min-width: 36px\" pFrozenColumn [frozen]=\"metadata.descriptor().selectionColumnFrozen ?? true\">\n <p-tableHeaderCheckbox></p-tableHeaderCheckbox>\n </th>\n } @else {\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n <th style=\"min-width: 36px\" pFrozenColumn [frozen]=\"metadata.descriptor().selectionColumnFrozen ?? true\"></th>\n }\n }\n @if (metadata.descriptor().rowExpandable) {\n <th scope=\"col\" pFrozenColumn [frozen]=\"true\"></th>\n }\n @if (rowReorderEnabled()) {\n <th scope=\"col\"></th>\n }\n @for (col of visibleColumns(); track col.id) {\n <ng-template #sortableColumnTHTemplate>\n <div class=\"flex justify-content-between align-items-center\">\n {{\n (col.descriptor.title && !col.descriptor.titleUseModelBase\n ? col.descriptor.title\n : (col.descriptor.title ?? col.descriptor.property | mngI18nProperty: metadata.descriptor().model)\n ) | translate\n }}\n <p-sortIcon [field]=\"col.sort?.property\"></p-sortIcon>\n </div>\n </ng-template>\n <ng-template #nonSortableColumnTHTemplate>\n {{\n (col.descriptor.title && !col.descriptor.titleUseModelBase\n ? col.descriptor.title\n : (col.descriptor.title ?? col.descriptor.property | mngI18nProperty: metadata.descriptor().model)\n ) | translate\n }}\n </ng-template>\n @if (col.descriptor.isReorderable) {\n <th\n pResizableColumn\n pReorderableColumn\n [id]=\"col.descriptor.property\"\n [pSortableColumn]=\"col.sort?.property\"\n [pSortableColumnDisabled]=\"!col.sort\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.width ? null : col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\"\n [class]=\"col.descriptor.headerClassName | mngTableColumnFilterClass: col.filter?.descriptor : hasColumnFilters() && !col.width\">\n <ng-container *ngTemplateOutlet=\"col.sort ? sortableColumnTHTemplate : nonSortableColumnTHTemplate\"></ng-container>\n </th>\n } @else {\n <th\n pResizableColumn\n [id]=\"col.descriptor.property\"\n [pSortableColumn]=\"col.sort?.property\"\n [pSortableColumnDisabled]=\"!col.sort\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.width ? null : col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\"\n [class]=\"col.descriptor.headerClassName | mngTableColumnFilterClass: col.filter?.descriptor : hasColumnFilters() && !col.width\">\n <ng-container *ngTemplateOutlet=\"col.sort ? sortableColumnTHTemplate : nonSortableColumnTHTemplate\"></ng-container>\n </th>\n }\n }\n @if (hasLastColumn()) {\n <th\n [style.min-width.px]=\"columnLastMinWidth()\"\n pFrozenColumn\n [frozen]=\"metadata.descriptor().actionColumnFrozen ?? areColumnsToggleable()\"\n alignFrozen=\"right\"\n class=\"column-custom-last text-right\">\n @if (areColumnsToggleable()) {\n <p-multiSelect\n #columnToggleMultiselect\n styleClass=\"p-button-primary mng-table-columns-multiselect\"\n appendTo=\"body\"\n dataKey=\"id\"\n tooltipPosition=\"left\"\n placeholder=\"\"\n dropdownIcon=\"pi pi-sliders-h\"\n [filter]=\"false\"\n [options]=\"prefs.columnsWithPrefs()\"\n [ngModel]=\"visibleColumns()\"\n [pTooltip]=\"'mngTable.adjustTable' | translate\"\n [displaySelectedLabel]=\"false\"\n (onChange)=\"prefs.onColumnToggle($event)\">\n <ng-template pTemplate=\"filter\">\n <div class=\"p-checkbox p-component ml-1\">\n <div class=\"p-hidden-accessible\">\n <input\n type=\"checkbox\"\n readonly=\"readonly\"\n [checked]=\"columnToggleMultiselect.allSelected\"\n (focus)=\"columnToggleMultiselect.onHeaderCheckboxFocus()\"\n (blur)=\"columnToggleMultiselect.onHeaderCheckboxBlur()\"\n (keydown.space)=\"columnToggleMultiselect.onToggleAll($event)\" />\n </div>\n <div\n class=\"p-checkbox-box\"\n role=\"checkbox\"\n [attr.aria-checked]=\"columnToggleMultiselect.allSelected\"\n [ngClass]=\"{\n 'p-highlight': anyColumnVisible()\n }\"\n (click)=\"prefs.onColumnToggleAll()\">\n <span class=\"p-checkbox-icon\" [ngClass]=\"{'pi pi-check': anyColumnVisible()}\"></span>\n </div>\n </div>\n <p-button\n icon=\"pi pi-replay\"\n styleClass=\"p-button-secondary\"\n [pTooltip]=\"'mngTable.resetLayout' | translate\"\n tooltipPosition=\"left\"\n (click)=\"prefs.clearLayoutPreferences()\"></p-button>\n </ng-template>\n <ng-template let-item pTemplate=\"item\">\n {{\n (item.descriptor.title && !item.descriptor.titleUseModelBase\n ? item.descriptor.title\n : (item.descriptor.title ?? item.descriptor.property | mngI18nProperty: metadata.descriptor().model)\n ) | translate\n }}\n </ng-template>\n </p-multiSelect>\n }\n </th>\n }\n </tr>\n }\n @if (hasColumnFilters()) {\n <tr class=\"mng-column-filter-row\">\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n @if (selectionEnabled()) {\n <th style=\"min-width: 36px\" pFrozenColumn [frozen]=\"metadata.descriptor().selectionColumnFrozen ?? true\"></th>\n }\n @if (rowReorderEnabled()) {\n <th scope=\"col\"></th>\n }\n @if (metadata.descriptor().rowExpandable) {\n <th scope=\"col\"></th>\n }\n @for (col of visibleColumns(); track col.id) {\n <th\n [class]=\"col.filter?.descriptor?.columnClassName | mngTableColumnFilterClass: col.filter?.descriptor : hasColumnFilters() && !col.width\"\n [style.width.px]=\"col.width\"\n [style.width.%]=\"col.width ? null : (col.filter?.descriptor?.columnWidth ?? col.descriptor.width ?? null)\"\n [style.min-width.px]=\"col.width ? null : (col.filter?.descriptor?.columnMinWidth ?? col.descriptor.minWidth)\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\">\n @if (col.filter) {\n <mng-table-column-filter [metadata]=\"col.filter\"></mng-table-column-filter>\n }\n </th>\n }\n @if (hasLastColumn()) {\n <th class=\"column-custom-last\" [style.min-width.px]=\"columnLastMinWidth()\"></th>\n }\n </tr>\n }\n </ng-template>\n <ng-template pTemplate=\"body\" let-item let-idx=\"rowIndex\" let-expanded=\"expanded\">\n <tr\n [pReorderableRow]=\"idx\"\n [ngClass]=\"\n metadata.descriptor().rowClassName | mngClassMap: metadata.descriptor().rowClassNameMapFn : item | mngLocaleDefaultRowClass: metadata.descriptor() : item\n \">\n @if (selectionEnabled()) {\n @if (selectionMode() === 'multiple') {\n <td style=\"min-width: 36px\" pFrozenColumn [frozen]=\"metadata.descriptor().selectionColumnFrozen ?? true\">\n <p-tableCheckbox [value]=\"item\"></p-tableCheckbox>\n </td>\n } @else {\n <td style=\"min-width: 36px\" pFrozenColumn [frozen]=\"metadata.descriptor().selectionColumnFrozen ?? true\">\n <p-tableRadioButton [value]=\"item\"></p-tableRadioButton>\n </td>\n }\n }\n @if (metadata.descriptor().rowExpandable) {\n <td>\n @if (!metadata.descriptor().rowExpandableProperty || item[metadata.descriptor().rowExpandableProperty!]) {\n <button\n pButton\n type=\"button\"\n [pRowToggler]=\"item\"\n class=\"p-button-text p-button-rounded p-button-plain mng-table-row-expand-button\"\n [icon]=\"expanded ? 'pi pi-chevron-down' : 'pi pi-chevron-right'\"></button>\n }\n </td>\n }\n @if (rowReorderEnabled()) {\n <td>\n <span class=\"pi pi-bars\" pReorderableRowHandle></span>\n </td>\n }\n @for (col of visibleColumns(); track col.id) {\n <td\n (click)=\"onCellClick($event, col.descriptor, item, idx)\"\n [class]=\"\n col.descriptor.className\n | mngClassMap: col.descriptor.classNameMapFn : item\n | mngTableColumnFilterClass: col.filter?.descriptor : hasColumnFilters() && !col.width\n \"\n [class.clickable]=\"isCellClickEnabled()\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.width ? null : col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\">\n <span class=\"p-column-title\">\n {{\n (col.descriptor.title && !col.descriptor.titleUseModelBase\n ? col.descriptor.title\n : (col.descriptor.title ?? col.descriptor.property | mngI18nProperty: metadata.descriptor().model)\n ) | translate\n }}\n </span>\n <mng-table-column-value [descriptor]=\"col.descriptor\" [item]=\"item\"></mng-table-column-value>\n </td>\n }\n @if (hasLastColumn()) {\n <td\n class=\"column-custom-last justify-content-end text-right\"\n [style.min-width.px]=\"columnLastMinWidth()\"\n pFrozenColumn\n [frozen]=\"metadata.descriptor().actionColumnFrozen ?? true\"\n alignFrozen=\"right\">\n @if (columnCustomLastTemplate()) {\n <ng-container *ngTemplateOutlet=\"columnCustomLastTemplate(); context: {rowItem: item, rowIndex: idx}\"></ng-container>\n } @else if (columnCustomLastComponent()) {\n <div [mngComponent]=\"columnCustomLastComponent()\" (instanceCreated)=\"columnCustomLastComponentInstance.emit($event)\"></div>\n }\n </td>\n }\n </tr>\n </ng-template>\n <ng-template pTemplate=\"rowexpansion\" let-item>\n @if (metadata.descriptor().rowExpandable) {\n <tr>\n <td></td>\n <td [colSpan]=\"metadata.descriptor().rowExpandableColSpan\">\n @if (metadata.descriptor().rowExpandableComponentType !== undefined) {\n <ng-container [mngComponent]=\"metadata.descriptor().rowExpandableComponentType\" [inputs]=\"{item}\"> </ng-container>\n } @else {\n <ng-container *ngTemplateOutlet=\"rowExpandTemplate(); context: {rowItem: item}\"></ng-container>\n }\n </td>\n </tr>\n }\n </ng-template>\n <ng-template pTemplate=\"loadingicon\">\n <div class=\"flex flex-column align-items-center\">\n @if (metadata.descriptor().loadingIcon) {\n <i [class]=\"'text-white text-4xl pi-spin ' + metadata.descriptor().loadingIcon\"></i>\n }\n @if (metadata.descriptor().loadingText) {\n <div class=\"text text-white text-lg font-semibold\" [ngClass]=\"{'mt-3': metadata.descriptor().loadingIcon}\">\n {{ metadata.descriptor().loadingText ?? '' | translate }}\n </div>\n }\n </div>\n </ng-template>\n <ng-template pTemplate=\"loadingbody\">\n <tr>\n <td [attr.colspan]=\"columnsColspan()\">\n <div class=\"loading-text\"></div>\n <p-skeleton [ngStyle]=\"{width: '100%'}\"></p-skeleton>\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"emptymessage\">\n <tr>\n <td [attr.colspan]=\"columnsColspan()\">\n {{ 'mngTable.noItems' | translate }}\n </td>\n </tr>\n </ng-template>\n @if (footerTemplate()) {\n <ng-template pTemplate=\"summary\">\n <ng-container *ngTemplateOutlet=\"footerTemplate(); context: {data: data.data(), totalCount: data.count()}\"></ng-container>\n </ng-template>\n }\n </p-table>\n }\n</div>\n", dependencies: [{ kind: "directive", type: ComponentDirective, selector: "[mngComponent]", inputs: ["mngComponent", "injectionToken", "inputs", "attachToHost", "parentInjector"], outputs: ["instanceCreated"] }, { kind: "pipe", type: I18nPropertyPipe, name: "mngI18nProperty" }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: TableColumnValueComponent, selector: "mng-table-column-value", inputs: ["descriptor", "item"] }, { kind: "pipe", type: ClassMapPipe, name: "mngClassMap" }, { kind: "pipe", type: LocaleDefaultRowClassPipe, name: "mngLocaleDefaultRowClass" }, { kind: "component", type: TableColumnFilterComponent, selector: "mng-table-column-filter", inputs: ["metadata"] }, { kind: "pipe", type: TableColumnFilterClassPipe, name: "mngTableColumnFilterClass" }, { kind: "ngmodule", type: TableModule }, { kind: "component", type: i1$3.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorStyleClass", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "groupRowsByOrder", "responsiveLayout", "breakpoint", "paginatorLocale", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "selectAll", "virtualRowHeight"], outputs: ["contextMenuSelectionChange", "selectAllChange", "selectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "directive", type: i2$3.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "directive", type: i1$3.SortableColumn, selector: "[pSortableColumn]", inputs: ["pSortableColumn", "pSortableColumnDisabled"] }, { kind: "directive", type: i1$3.FrozenColumn, selector: "[pFrozenColumn]", inputs: ["frozen", "alignFrozen"] }, { kind: "directive", type: i1$3.RowToggler, selector: "[pRowToggler]", inputs: ["pRowToggler", "pRowTogglerDisabled"] }, { kind: "directive", type: i1$3.ResizableColumn, selector: "[pResizableColumn]", inputs: ["pResizableColumnDisabled"] }, { kind: "directive", type: i1$3.ReorderableColumn, selector: "[pReorderableColumn]", inputs: ["pReorderableColumnDisabled"] }, { kind: "component", type: i1$3.SortIcon, selector: "p-sortIcon", inputs: ["field"] }, { kind: "component", type: i1$3.TableRadioButton, selector: "p-tableRadioButton", inputs: ["disabled", "value", "index", "inputId", "name", "ariaLabel"] }, { kind: "component", type: i1$3.TableCheckbox, selector: "p-tableCheckbox", inputs: ["disabled", "value", "index", "inputId", "name", "required", "ariaLabel"] }, { kind: "component", type: i1$3.TableHeaderCheckbox, selector: "p-tableHeaderCheckbox", inputs: ["disabled", "inputId", "name", "ariaLabel"] }, { kind: "directive", type: i1$3.ReorderableRowHandle, selector: "[pReorderableRowHandle]" }, { kind: "directive", type: i1$3.ReorderableRow, selector: "[pReorderableRow]", inputs: ["pReorderableRow", "pReorderableRowDisabled"] }, { kind: "ngmodule", type: MultiSelectModule }, { kind: "component", type: i3.MultiSelect, selector: "p-multiSelect", inputs: ["id", "ariaLabel", "style", "styleClass", "panelStyle", "panelStyleClass", "inputId", "disabled", "readonly", "group", "filter", "filterPlaceHolder", "filterLocale", "overlayVisible", "tabindex", "variant", "appendTo", "dataKey", "name", "ariaLabelledBy", "displaySelectedLabel", "maxSelectedLabels", "selectionLimit", "selectedItemsLabel", "showToggleAll", "emptyFilterMessage", "emptyMessage", "resetFilterOnHide", "dropdownIcon", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "showHeader", "filterBy", "scrollHeight", "lazy", "virtualScroll", "loading", "virtualScrollItemSize", "loadingIcon", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "autofocusFilter", "display", "autocomplete", "showClear", "autofocus", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "defaultLabel", "placeholder", "options", "filterValue", "itemSize", "selectAll", "focusOnHover", "filterFields", "selectOnFocus", "autoOptionFocus"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onClear", "onPanelShow", "onPanelHide", "onLazyLoad", "onRemove", "onSelectAllChange"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i4$1.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain"] }, { kind: "component", type: i4$1.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "style", "styleClass", "badgeClass", "ariaLabel", "autofocus"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i1$1.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "component", type: TableFilterOverlayWithTagComponent, selector: "mng-table-filter-overlay-with-tag", inputs: ["metadata", "genericFilterDescriptor", "model", "enableSearch", "search", "searchLimitWordMax", "enableCaseSensitive"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: TemplateDirective, selector: "[mngTemplate]", inputs: ["type", "mngTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2106
|
-
}
|
|
2107
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TableComponent, decorators: [{
|
|
2108
|
-
type: Component,
|
|
2109
|
-
args: [{ standalone: true, selector: 'mng-table', imports: [
|
|
2110
|
-
ComponentDirective,
|
|
2111
|
-
I18nPropertyPipe,
|
|
2112
|
-
NgClass,
|
|
2113
|
-
NgStyle,
|
|
2114
|
-
NgTemplateOutlet,
|
|
2115
|
-
TableColumnValueComponent,
|
|
2116
|
-
ClassMapPipe,
|
|
2117
|
-
LocaleDefaultRowClassPipe,
|
|
2118
|
-
TableColumnFilterComponent,
|
|
2119
|
-
TableColumnFilterClassPipe,
|
|
2120
|
-
TableModule,
|
|
2121
|
-
MultiSelectModule,
|
|
2122
|
-
ButtonModule,
|
|
2123
|
-
TooltipModule,
|
|
2124
|
-
TranslateModule,
|
|
2125
|
-
TableFilterOverlayWithTagComponent,
|
|
2126
|
-
FormsModule,
|
|
2127
|
-
TemplateDirective
|
|
2128
|
-
], providers: [TableMetadataService, TableDataService, TablePreferencesService], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div>\n <!-- MUST NOT use observable for value when using virtual scroll - does not work for some reason -->\n @if (data.isAllPaginationMetaInitialized()) {\n <p-table\n [value]=\"data.data()\"\n [dataKey]=\"metadata.descriptor().trackProperty\"\n [lazy]=\"isLazy()\"\n [loading]=\"data.loading()\"\n [paginator]=\"isPagination()\"\n [rows]=\"data.rows()\"\n [first]=\"data.offset()\"\n [totalRecords]=\"data.count()\"\n [rowsPerPageOptions]=\"metadata.rowsPerPageOptions()\"\n [showCurrentPageReport]=\"true\"\n [currentPageReportTemplate]=\"'mngTable.paginationMsg' | translate\"\n [multiSortMeta]=\"data.sortMeta()\"\n [filters]=\"data.filterMeta()\"\n [globalFilterFields]=\"metadata.searchFields()\"\n sortMode=\"multiple\"\n [selection]=\"[]\"\n (selectionChange)=\"onSelectionChange($event)\"\n [selectionMode]=\"selectionEnabled() ? selectionMode() : null\"\n [scrollable]=\"true\"\n scrollHeight=\"flex\"\n [rowHover]=\"metadata.descriptor().hasHover\"\n [styleClass]=\"className()\"\n [resizableColumns]=\"metadata.descriptor().hasResizableColumns\"\n [columnResizeMode]=\"metadata.descriptor().columnResizeMode ?? 'expand'\"\n [reorderableColumns]=\"areColumnsReorderable()\"\n paginatorDropdownAppendTo=\"body\"\n [columns]=\"visibleColumns()\"\n [expandedRowKeys]=\"expandedRowKeys()\"\n (onColResize)=\"prefs.onColumnResize($event)\"\n (onColReorder)=\"prefs.onColumnReorder($event)\"\n (onLazyLoad)=\"onTableLazyLoad($event)\"\n (onFilter)=\"onTableFilter($event)\"\n (onRowReorder)=\"onRowReorder($event)\">\n <ng-template pTemplate=\"caption\">\n @if (isCaptionVisible()) {\n <div class=\"table-header\">\n @if (overlayWithTagFilters().length > 0 || metadata.descriptor().search) {\n <mng-table-filter-overlay-with-tag\n [title]=\"metadata.descriptor().title\"\n [metadata]=\"overlayWithTagFilters()\"\n [genericFilterDescriptor]=\"metadata.genericFilterDescriptor()\"\n [model]=\"metadata.descriptor().model\"\n [enableSearch]=\"metadata.descriptor().search\"\n [search]=\"data.searchMeta()\"\n [searchLimitWordMax]=\"metadata.descriptor().searchLimitMaxWords\"\n [enableCaseSensitive]=\"isLazy()\">\n @if (hasTitleDisplay()) {\n <ng-template mngTemplate=\"title\">\n <ng-container *ngTemplateOutlet=\"captionTemplateOrComponentOrTitle\"></ng-container>\n </ng-template>\n }\n </mng-table-filter-overlay-with-tag>\n } @else {\n <ng-container *ngTemplateOutlet=\"captionTemplateOrComponentOrTitle\"></ng-container>\n }\n <ng-template #captionTemplateOrComponentOrTitle>\n @if (captionTemplate()) {\n <ng-container *ngTemplateOutlet=\"captionTemplate()\"></ng-container>\n } @else if (captionComponent()) {\n <ng-container [mngComponent]=\"captionComponent()\" (instanceCreated)=\"captionComponentInstance.emit($event)\"></ng-container>\n } @else if (metadata.descriptor().title) {\n <h5 class=\"p-0 m-0\">{{ metadata.descriptor().title! | translate }}</h5>\n }\n </ng-template>\n </div>\n }\n </ng-template>\n <ng-template pTemplate=\"header\">\n @if (!metadata.descriptor().hideHeader) {\n <tr class=\"mng-table-header\" [class]=\"metadata.descriptor().headerClassName\">\n @if (selectionEnabled()) {\n @if (selectionMode() === 'multiple') {\n <th style=\"min-width: 36px\" pFrozenColumn [frozen]=\"metadata.descriptor().selectionColumnFrozen ?? true\">\n <p-tableHeaderCheckbox></p-tableHeaderCheckbox>\n </th>\n } @else {\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n <th style=\"min-width: 36px\" pFrozenColumn [frozen]=\"metadata.descriptor().selectionColumnFrozen ?? true\"></th>\n }\n }\n @if (metadata.descriptor().rowExpandable) {\n <th scope=\"col\" pFrozenColumn [frozen]=\"true\"></th>\n }\n @if (rowReorderEnabled()) {\n <th scope=\"col\"></th>\n }\n @for (col of visibleColumns(); track col.id) {\n <ng-template #sortableColumnTHTemplate>\n <div class=\"flex justify-content-between align-items-center\">\n {{\n (col.descriptor.title && !col.descriptor.titleUseModelBase\n ? col.descriptor.title\n : (col.descriptor.title ?? col.descriptor.property | mngI18nProperty: metadata.descriptor().model)\n ) | translate\n }}\n <p-sortIcon [field]=\"col.sort?.property\"></p-sortIcon>\n </div>\n </ng-template>\n <ng-template #nonSortableColumnTHTemplate>\n {{\n (col.descriptor.title && !col.descriptor.titleUseModelBase\n ? col.descriptor.title\n : (col.descriptor.title ?? col.descriptor.property | mngI18nProperty: metadata.descriptor().model)\n ) | translate\n }}\n </ng-template>\n @if (col.descriptor.isReorderable) {\n <th\n pResizableColumn\n pReorderableColumn\n [id]=\"col.descriptor.property\"\n [pSortableColumn]=\"col.sort?.property\"\n [pSortableColumnDisabled]=\"!col.sort\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.width ? null : col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\"\n [class]=\"col.descriptor.headerClassName | mngTableColumnFilterClass: col.filter?.descriptor : hasColumnFilters() && !col.width\">\n <ng-container *ngTemplateOutlet=\"col.sort ? sortableColumnTHTemplate : nonSortableColumnTHTemplate\"></ng-container>\n </th>\n } @else {\n <th\n pResizableColumn\n [id]=\"col.descriptor.property\"\n [pSortableColumn]=\"col.sort?.property\"\n [pSortableColumnDisabled]=\"!col.sort\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.width ? null : col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\"\n [class]=\"col.descriptor.headerClassName | mngTableColumnFilterClass: col.filter?.descriptor : hasColumnFilters() && !col.width\">\n <ng-container *ngTemplateOutlet=\"col.sort ? sortableColumnTHTemplate : nonSortableColumnTHTemplate\"></ng-container>\n </th>\n }\n }\n @if (hasLastColumn()) {\n <th\n [style.min-width.px]=\"columnLastMinWidth()\"\n pFrozenColumn\n [frozen]=\"metadata.descriptor().actionColumnFrozen ?? areColumnsToggleable()\"\n alignFrozen=\"right\"\n class=\"column-custom-last text-right\">\n @if (areColumnsToggleable()) {\n <p-multiSelect\n #columnToggleMultiselect\n styleClass=\"p-button-primary mng-table-columns-multiselect\"\n appendTo=\"body\"\n dataKey=\"id\"\n tooltipPosition=\"left\"\n placeholder=\"\"\n dropdownIcon=\"pi pi-sliders-h\"\n [filter]=\"false\"\n [options]=\"prefs.columnsWithPrefs()\"\n [ngModel]=\"visibleColumns()\"\n [pTooltip]=\"'mngTable.adjustTable' | translate\"\n [displaySelectedLabel]=\"false\"\n (onChange)=\"prefs.onColumnToggle($event)\">\n <ng-template pTemplate=\"filter\">\n <div class=\"p-checkbox p-component ml-1\">\n <div class=\"p-hidden-accessible\">\n <input\n type=\"checkbox\"\n readonly=\"readonly\"\n [checked]=\"columnToggleMultiselect.allSelected\"\n (focus)=\"columnToggleMultiselect.onHeaderCheckboxFocus()\"\n (blur)=\"columnToggleMultiselect.onHeaderCheckboxBlur()\"\n (keydown.space)=\"columnToggleMultiselect.onToggleAll($event)\" />\n </div>\n <div\n class=\"p-checkbox-box\"\n role=\"checkbox\"\n [attr.aria-checked]=\"columnToggleMultiselect.allSelected\"\n [ngClass]=\"{\n 'p-highlight': anyColumnVisible()\n }\"\n (click)=\"prefs.onColumnToggleAll()\">\n <span class=\"p-checkbox-icon\" [ngClass]=\"{'pi pi-check': anyColumnVisible()}\"></span>\n </div>\n </div>\n <p-button\n icon=\"pi pi-replay\"\n styleClass=\"p-button-secondary\"\n [pTooltip]=\"'mngTable.resetLayout' | translate\"\n tooltipPosition=\"left\"\n (click)=\"prefs.clearLayoutPreferences()\"></p-button>\n </ng-template>\n <ng-template let-item pTemplate=\"item\">\n {{\n (item.descriptor.title && !item.descriptor.titleUseModelBase\n ? item.descriptor.title\n : (item.descriptor.title ?? item.descriptor.property | mngI18nProperty: metadata.descriptor().model)\n ) | translate\n }}\n </ng-template>\n </p-multiSelect>\n }\n </th>\n }\n </tr>\n }\n @if (hasColumnFilters()) {\n <tr class=\"mng-column-filter-row\">\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n @if (selectionEnabled()) {\n <th style=\"min-width: 36px\" pFrozenColumn [frozen]=\"metadata.descriptor().selectionColumnFrozen ?? true\"></th>\n }\n @if (rowReorderEnabled()) {\n <th scope=\"col\"></th>\n }\n @if (metadata.descriptor().rowExpandable) {\n <th scope=\"col\"></th>\n }\n @for (col of visibleColumns(); track col.id) {\n <th\n [class]=\"col.filter?.descriptor?.columnClassName | mngTableColumnFilterClass: col.filter?.descriptor : hasColumnFilters() && !col.width\"\n [style.width.px]=\"col.width\"\n [style.width.%]=\"col.width ? null : (col.filter?.descriptor?.columnWidth ?? col.descriptor.width ?? null)\"\n [style.min-width.px]=\"col.width ? null : (col.filter?.descriptor?.columnMinWidth ?? col.descriptor.minWidth)\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\">\n @if (col.filter) {\n <mng-table-column-filter [metadata]=\"col.filter\"></mng-table-column-filter>\n }\n </th>\n }\n @if (hasLastColumn()) {\n <th class=\"column-custom-last\" [style.min-width.px]=\"columnLastMinWidth()\"></th>\n }\n </tr>\n }\n </ng-template>\n <ng-template pTemplate=\"body\" let-item let-idx=\"rowIndex\" let-expanded=\"expanded\">\n <tr\n [pReorderableRow]=\"idx\"\n [ngClass]=\"\n metadata.descriptor().rowClassName | mngClassMap: metadata.descriptor().rowClassNameMapFn : item | mngLocaleDefaultRowClass: metadata.descriptor() : item\n \">\n @if (selectionEnabled()) {\n @if (selectionMode() === 'multiple') {\n <td style=\"min-width: 36px\" pFrozenColumn [frozen]=\"metadata.descriptor().selectionColumnFrozen ?? true\">\n <p-tableCheckbox [value]=\"item\"></p-tableCheckbox>\n </td>\n } @else {\n <td style=\"min-width: 36px\" pFrozenColumn [frozen]=\"metadata.descriptor().selectionColumnFrozen ?? true\">\n <p-tableRadioButton [value]=\"item\"></p-tableRadioButton>\n </td>\n }\n }\n @if (metadata.descriptor().rowExpandable) {\n <td>\n @if (!metadata.descriptor().rowExpandableProperty || item[metadata.descriptor().rowExpandableProperty!]) {\n <button\n pButton\n type=\"button\"\n [pRowToggler]=\"item\"\n class=\"p-button-text p-button-rounded p-button-plain mng-table-row-expand-button\"\n [icon]=\"expanded ? 'pi pi-chevron-down' : 'pi pi-chevron-right'\"></button>\n }\n </td>\n }\n @if (rowReorderEnabled()) {\n <td>\n <span class=\"pi pi-bars\" pReorderableRowHandle></span>\n </td>\n }\n @for (col of visibleColumns(); track col.id) {\n <td\n (click)=\"onCellClick($event, col.descriptor, item, idx)\"\n [class]=\"\n col.descriptor.className\n | mngClassMap: col.descriptor.classNameMapFn : item\n | mngTableColumnFilterClass: col.filter?.descriptor : hasColumnFilters() && !col.width\n \"\n [class.clickable]=\"isCellClickEnabled()\"\n [style.width]=\"col.width ? col.width + 'px' : col.descriptor.width + '%'\"\n [style.min-width.px]=\"col.width ? null : col.descriptor.minWidth\"\n [style.max-width.px]=\"col.width ?? col.descriptor.maxWidth\">\n <span class=\"p-column-title\">\n {{\n (col.descriptor.title && !col.descriptor.titleUseModelBase\n ? col.descriptor.title\n : (col.descriptor.title ?? col.descriptor.property | mngI18nProperty: metadata.descriptor().model)\n ) | translate\n }}\n </span>\n <mng-table-column-value [descriptor]=\"col.descriptor\" [item]=\"item\"></mng-table-column-value>\n </td>\n }\n @if (hasLastColumn()) {\n <td\n class=\"column-custom-last justify-content-end text-right\"\n [style.min-width.px]=\"columnLastMinWidth()\"\n pFrozenColumn\n [frozen]=\"metadata.descriptor().actionColumnFrozen ?? true\"\n alignFrozen=\"right\">\n @if (columnCustomLastTemplate()) {\n <ng-container *ngTemplateOutlet=\"columnCustomLastTemplate(); context: {rowItem: item, rowIndex: idx}\"></ng-container>\n } @else if (columnCustomLastComponent()) {\n <div [mngComponent]=\"columnCustomLastComponent()\" (instanceCreated)=\"columnCustomLastComponentInstance.emit($event)\"></div>\n }\n </td>\n }\n </tr>\n </ng-template>\n <ng-template pTemplate=\"rowexpansion\" let-item>\n @if (metadata.descriptor().rowExpandable) {\n <tr>\n <td></td>\n <td [colSpan]=\"metadata.descriptor().rowExpandableColSpan\">\n @if (metadata.descriptor().rowExpandableComponentType !== undefined) {\n <ng-container [mngComponent]=\"metadata.descriptor().rowExpandableComponentType\" [inputs]=\"{item}\"> </ng-container>\n } @else {\n <ng-container *ngTemplateOutlet=\"rowExpandTemplate(); context: {rowItem: item}\"></ng-container>\n }\n </td>\n </tr>\n }\n </ng-template>\n <ng-template pTemplate=\"loadingicon\">\n <div class=\"flex flex-column align-items-center\">\n @if (metadata.descriptor().loadingIcon) {\n <i [class]=\"'text-white text-4xl pi-spin ' + metadata.descriptor().loadingIcon\"></i>\n }\n @if (metadata.descriptor().loadingText) {\n <div class=\"text text-white text-lg font-semibold\" [ngClass]=\"{'mt-3': metadata.descriptor().loadingIcon}\">\n {{ metadata.descriptor().loadingText ?? '' | translate }}\n </div>\n }\n </div>\n </ng-template>\n <ng-template pTemplate=\"loadingbody\">\n <tr>\n <td [attr.colspan]=\"columnsColspan()\">\n <div class=\"loading-text\"></div>\n <p-skeleton [ngStyle]=\"{width: '100%'}\"></p-skeleton>\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"emptymessage\">\n <tr>\n <td [attr.colspan]=\"columnsColspan()\">\n {{ 'mngTable.noItems' | translate }}\n </td>\n </tr>\n </ng-template>\n @if (footerTemplate()) {\n <ng-template pTemplate=\"summary\">\n <ng-container *ngTemplateOutlet=\"footerTemplate(); context: {data: data.data(), totalCount: data.count()}\"></ng-container>\n </ng-template>\n }\n </p-table>\n }\n</div>\n" }]
|
|
2129
|
-
}], ctorParameters: () => [] });
|
|
2130
|
-
|
|
2131
|
-
/**
|
|
2132
|
-
* Prepares providers for usage of the tableview functionalities.
|
|
2133
|
-
*
|
|
2134
|
-
* @returns {CommonsFeature} The `CommonsFeature` object with the layout configuration.
|
|
2135
|
-
*/
|
|
2136
|
-
function withTable(config) {
|
|
2137
|
-
return {
|
|
2138
|
-
type: CommonsFeatureTypeEnum.Table,
|
|
2139
|
-
providers: [
|
|
2140
|
-
{
|
|
2141
|
-
provide: COMMONS_TABLE_FEATURE_CONFIG_IT,
|
|
2142
|
-
useValue: config
|
|
2143
|
-
}
|
|
2144
|
-
]
|
|
2145
|
-
};
|
|
2146
|
-
}
|
|
2147
|
-
|
|
2148
|
-
// components
|
|
2149
|
-
|
|
2150
|
-
/**
|
|
2151
|
-
* Generated bundle index. Do not edit.
|
|
2152
|
-
*/
|
|
2153
|
-
|
|
2154
|
-
export { COMMONS_TABLE_FEATURE_CONFIG_IT, FilterValuePipe, LocaleDefaultRowClassPipe, TableColumnFilterClassPipe, TableColumnFilterComponent, TableColumnValueComponent, TableComponent, TableDataService, TableFilterActiveTagComponent, TableFilterFormComponent, TableFilterOverlayWithTagComponent, createFilterDescriptorsFromGeneric, filterAdjustDisplayValueOnMatchModeChange, filterApplySerializationConfigToCmp, filterAreDatesEqual, filterGenerateMatchModeOptions, filterGetDateConfig, filterGetDefaultMatchMode, filterGetNumberConfig, filterSetMetadataOnChange, filterSetMetadataOnDisplayChange, generateTableLayoutPrefsKey, tableNotificationError, withTable };
|
|
1
|
+
export { C as COMMONS_TABLE_FEATURE_CONFIG_IT, F as FilterValuePipe, L as LocaleDefaultRowClassPipe, s as TableColumnFilterClassPipe, b as TableColumnFilterComponent, c as TableColumnValueComponent, g as TableComponent, u as TableDataService, d as TableFilterActiveTagComponent, e as TableFilterFormComponent, f as TableFilterOverlayWithTagComponent, q as createFilterDescriptorsFromGeneric, n as filterAdjustDisplayValueOnMatchModeChange, m as filterApplySerializationConfigToCmp, l as filterAreDatesEqual, h as filterGenerateMatchModeOptions, o as filterGetDateConfig, i as filterGetDefaultMatchMode, p as filterGetNumberConfig, j as filterSetMetadataOnChange, k as filterSetMetadataOnDisplayChange, r as generateTableLayoutPrefsKey, t as tableNotificationError, w as withTable } from './mediusinc-mng-commons-table-mediusinc-mng-commons-table-JZpyiDIL.mjs';
|
|
2155
2
|
//# sourceMappingURL=mediusinc-mng-commons-table.mjs.map
|