@verisoft/ui-core 18.7.0 → 18.8.0
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/README.md +7 -56
- package/esm2022/index.mjs +7 -0
- package/esm2022/lib/common/angular-helper.mjs +23 -0
- package/esm2022/lib/common/constants.mjs +4 -0
- package/esm2022/lib/common/control.models.mjs +63 -0
- package/esm2022/lib/common/datasource-component.model.mjs +14 -0
- package/esm2022/lib/common/deactivate-guard.model.mjs +2 -0
- package/esm2022/lib/common/download-file.mjs +13 -0
- package/esm2022/lib/common/filter.mjs +7 -0
- package/esm2022/lib/common/icons.mjs +2 -0
- package/esm2022/lib/common/index.mjs +11 -0
- package/esm2022/lib/common/notificable-property.model.mjs +2 -0
- package/esm2022/lib/common/rxjs.mjs +11 -0
- package/esm2022/lib/components/action-button-group/action-button-group.model.mjs +3 -0
- package/esm2022/lib/components/action-button-group/action-button.model.mjs +2 -0
- package/esm2022/lib/components/action-button-group/index.mjs +3 -0
- package/esm2022/lib/components/base-form/base-form-input.component.mjs +100 -0
- package/esm2022/lib/components/base-form/base-form.component.mjs +187 -0
- package/esm2022/lib/components/base-form/directives/detail-store.directive.mjs +163 -0
- package/esm2022/lib/components/base-form/index.mjs +5 -0
- package/esm2022/lib/components/base-form/models/base-form-input.models.mjs +7 -0
- package/esm2022/lib/components/base-form/models/base-form.models.mjs +10 -0
- package/esm2022/lib/components/base-form/models/index.mjs +3 -0
- package/esm2022/lib/components/breadcrumb/breadcrumb.model.mjs +3 -0
- package/esm2022/lib/components/breadcrumb/breadcrumb.service.mjs +16 -0
- package/esm2022/lib/components/breadcrumb/breadcrumbcore.component.mjs +88 -0
- package/esm2022/lib/components/breadcrumb/index.mjs +4 -0
- package/esm2022/lib/components/button/button.model.mjs +3 -0
- package/esm2022/lib/components/button/index.mjs +2 -0
- package/esm2022/lib/components/calendar/calendar.model.mjs +3 -0
- package/esm2022/lib/components/calendar/index.mjs +2 -0
- package/esm2022/lib/components/checkbox/checkbox.model.mjs +3 -0
- package/esm2022/lib/components/checkbox/index.mjs +2 -0
- package/esm2022/lib/components/confirm-dialog/confirm-dialog.model.mjs +3 -0
- package/esm2022/lib/components/confirm-dialog/index.mjs +2 -0
- package/esm2022/lib/components/dropdown/dropdown.model.mjs +3 -0
- package/esm2022/lib/components/dropdown/index.mjs +2 -0
- package/esm2022/lib/components/dynamic-component/dynamic-component.model.mjs +2 -0
- package/esm2022/lib/components/dynamic-component/index.mjs +2 -0
- package/esm2022/lib/components/filter/filter.model.mjs +3 -0
- package/esm2022/lib/components/filter/index.mjs +2 -0
- package/esm2022/lib/components/form-field/form-field.model.mjs +3 -0
- package/esm2022/lib/components/form-field/index.mjs +2 -0
- package/esm2022/lib/components/generic-field/generic-field.model.mjs +3 -0
- package/esm2022/lib/components/generic-field/index.mjs +2 -0
- package/esm2022/lib/components/generic-form/generic-form.component.mjs +10 -0
- package/esm2022/lib/components/generic-form/index.mjs +2 -0
- package/esm2022/lib/components/header/header.model.mjs +4 -0
- package/esm2022/lib/components/header/index.mjs +2 -0
- package/esm2022/lib/components/icons/icons.component.mjs +29 -0
- package/esm2022/lib/components/icons/icons.model.mjs +3 -0
- package/esm2022/lib/components/icons/index.mjs +3 -0
- package/esm2022/lib/components/index.mjs +36 -0
- package/esm2022/lib/components/input-group/index.mjs +2 -0
- package/esm2022/lib/components/input-group/input-group.model.mjs +3 -0
- package/esm2022/lib/components/loader/index.mjs +2 -0
- package/esm2022/lib/components/loader/loader.model.mjs +3 -0
- package/esm2022/lib/components/multiselect/index.mjs +2 -0
- package/esm2022/lib/components/multiselect/mutiselect.model.mjs +3 -0
- package/esm2022/lib/components/number-input/index.mjs +2 -0
- package/esm2022/lib/components/number-input/number-input.model.mjs +3 -0
- package/esm2022/lib/components/page-header/index.mjs +4 -0
- package/esm2022/lib/components/page-header/page-header.model.mjs +3 -0
- package/esm2022/lib/components/page-header/page-header.service.mjs +16 -0
- package/esm2022/lib/components/page-header/page-headercore.component.mjs +52 -0
- package/esm2022/lib/components/password/index.mjs +2 -0
- package/esm2022/lib/components/password/password.model.mjs +11 -0
- package/esm2022/lib/components/radiobutton/index.mjs +2 -0
- package/esm2022/lib/components/radiobutton/radiobutton.model.mjs +3 -0
- package/esm2022/lib/components/section/index.mjs +2 -0
- package/esm2022/lib/components/section/section.model.mjs +3 -0
- package/esm2022/lib/components/side-menu/directives/side-menu-service.directive.mjs +31 -0
- package/esm2022/lib/components/side-menu/index.mjs +5 -0
- package/esm2022/lib/components/side-menu/services/side-menu-provider.service.mjs +25 -0
- package/esm2022/lib/components/side-menu/services/side-menu.service.mjs +50 -0
- package/esm2022/lib/components/side-menu/side-menu.model.mjs +6 -0
- package/esm2022/lib/components/slider/index.mjs +2 -0
- package/esm2022/lib/components/slider/slider.model.mjs +3 -0
- package/esm2022/lib/components/snackbar/index.mjs +2 -0
- package/esm2022/lib/components/snackbar/snackbar.model.mjs +3 -0
- package/esm2022/lib/components/stepper/index.mjs +2 -0
- package/esm2022/lib/components/stepper/stepper.model.mjs +3 -0
- package/esm2022/lib/components/switch/index.mjs +2 -0
- package/esm2022/lib/components/switch/switch.model.mjs +3 -0
- package/esm2022/lib/components/tab-view/index.mjs +2 -0
- package/esm2022/lib/components/tab-view/tab-view.model.mjs +3 -0
- package/esm2022/lib/components/table/column-configuration.mjs +32 -0
- package/esm2022/lib/components/table/index.mjs +5 -0
- package/esm2022/lib/components/table/table-builder.mjs +68 -0
- package/esm2022/lib/components/table/table-column.directive.mjs +86 -0
- package/esm2022/lib/components/table/table.models.mjs +150 -0
- package/esm2022/lib/components/table-filter/index.mjs +2 -0
- package/esm2022/lib/components/table-filter/table-filter.model.mjs +3 -0
- package/esm2022/lib/components/textarea/index.mjs +2 -0
- package/esm2022/lib/components/textarea/textarea.model.mjs +3 -0
- package/esm2022/lib/components/textfield/index.mjs +2 -0
- package/esm2022/lib/components/textfield/textfield.model.mjs +3 -0
- package/esm2022/lib/components/tristatecheckbox/index.mjs +2 -0
- package/esm2022/lib/components/tristatecheckbox/tristatecheckbox.model.mjs +3 -0
- package/esm2022/lib/components/unsubscribe.component.mjs +16 -0
- package/esm2022/lib/directives/datasource.directive.mjs +175 -0
- package/esm2022/lib/directives/index.mjs +5 -0
- package/esm2022/lib/directives/shortcut.directive.mjs +46 -0
- package/esm2022/lib/directives/table-datasource.directive.mjs +124 -0
- package/esm2022/lib/directives/table-filter.directive.mjs +56 -0
- package/esm2022/lib/format/format.mjs +63 -0
- package/esm2022/lib/pipes/error/error.codes.mjs +10 -0
- package/esm2022/lib/pipes/error/error.models.mjs +21 -0
- package/esm2022/lib/pipes/error/error.pipe.mjs +31 -0
- package/esm2022/lib/pipes/error/warning.codes.mjs +4 -0
- package/esm2022/lib/pipes/error/warning.pipe.mjs +31 -0
- package/esm2022/lib/pipes/helper/enumToList.pipe.mjs +22 -0
- package/esm2022/lib/pipes/index.mjs +8 -0
- package/esm2022/lib/pipes/keyOrFn/keyOrFn.pipe.mjs +31 -0
- package/esm2022/lib/services/confirm-dialog.service.mjs +45 -0
- package/esm2022/lib/services/index.mjs +5 -0
- package/esm2022/lib/services/leave-form.service.mjs +52 -0
- package/esm2022/lib/services/screen-size.service.mjs +29 -0
- package/esm2022/lib/services/table.service.mjs +27 -0
- package/esm2022/verisoft-ui-core.mjs +5 -0
- package/fesm2022/verisoft-ui-core.mjs +2014 -0
- package/fesm2022/verisoft-ui-core.mjs.map +1 -0
- package/{src/index.ts → index.d.ts} +6 -6
- package/lib/common/angular-helper.d.ts +1 -0
- package/lib/common/constants.d.ts +3 -0
- package/lib/common/control.models.d.ts +62 -0
- package/lib/common/datasource-component.model.d.ts +19 -0
- package/{src/lib/common/deactivate-guard.model.ts → lib/common/deactivate-guard.model.d.ts} +4 -5
- package/lib/common/download-file.d.ts +2 -0
- package/lib/common/filter.d.ts +1 -0
- package/{src/lib/common/icons.ts → lib/common/icons.d.ts} +34 -34
- package/{src/lib/common/index.ts → lib/common/index.d.ts} +10 -10
- package/{src/lib/common/notificable-property.model.ts → lib/common/notificable-property.model.d.ts} +4 -5
- package/lib/common/rxjs.d.ts +2 -0
- package/lib/components/action-button-group/action-button-group.model.d.ts +12 -0
- package/lib/components/action-button-group/action-button.model.d.ts +14 -0
- package/{src/lib/components/action-button-group/index.ts → lib/components/action-button-group/index.d.ts} +2 -2
- package/lib/components/base-form/base-form-input.component.d.ts +30 -0
- package/lib/components/base-form/base-form.component.d.ts +50 -0
- package/lib/components/base-form/directives/detail-store.directive.d.ts +35 -0
- package/{src/lib/components/base-form/index.ts → lib/components/base-form/index.d.ts} +4 -4
- package/lib/components/base-form/models/base-form-input.models.d.ts +7 -0
- package/lib/components/base-form/models/base-form.models.d.ts +18 -0
- package/{src/lib/components/base-form/models/index.ts → lib/components/base-form/models/index.d.ts} +2 -2
- package/{src/lib/components/breadcrumb/breadcrumb.model.ts → lib/components/breadcrumb/breadcrumb.model.d.ts} +16 -21
- package/lib/components/breadcrumb/breadcrumb.service.d.ts +8 -0
- package/lib/components/breadcrumb/breadcrumbcore.component.d.ts +30 -0
- package/lib/components/breadcrumb/index.d.ts +3 -0
- package/{src/lib/components/button/button.model.ts → lib/components/button/button.model.d.ts} +17 -21
- package/lib/components/button/index.d.ts +1 -0
- package/{src/lib/components/calendar/calendar.model.ts → lib/components/calendar/calendar.model.d.ts} +12 -16
- package/lib/components/calendar/index.d.ts +1 -0
- package/lib/components/checkbox/checkbox.model.d.ts +4 -0
- package/lib/components/checkbox/index.d.ts +1 -0
- package/lib/components/confirm-dialog/confirm-dialog.model.d.ts +25 -0
- package/lib/components/confirm-dialog/index.d.ts +1 -0
- package/{src/lib/components/dropdown/dropdown.model.ts → lib/components/dropdown/dropdown.model.d.ts} +12 -16
- package/lib/components/dropdown/index.d.ts +1 -0
- package/lib/components/dynamic-component/dynamic-component.model.d.ts +3 -0
- package/lib/components/dynamic-component/index.d.ts +1 -0
- package/lib/components/filter/filter.model.d.ts +13 -0
- package/{src/lib/components/filter/index.ts → lib/components/filter/index.d.ts} +1 -1
- package/{src/lib/components/form-field/form-field.model.ts → lib/components/form-field/form-field.model.d.ts} +11 -15
- package/lib/components/form-field/index.d.ts +1 -0
- package/{src/lib/components/generic-field/generic-field.model.ts → lib/components/generic-field/generic-field.model.d.ts} +6 -10
- package/lib/components/generic-field/index.d.ts +1 -0
- package/lib/components/generic-form/generic-form.component.d.ts +30 -0
- package/{src/lib/components/generic-form/index.ts → lib/components/generic-form/index.d.ts} +1 -1
- package/{src/lib/components/header/header.model.ts → lib/components/header/header.model.d.ts} +11 -18
- package/lib/components/header/index.d.ts +1 -0
- package/lib/components/icons/icons.component.d.ts +6 -0
- package/lib/components/icons/icons.model.d.ts +6 -0
- package/lib/components/icons/index.d.ts +2 -0
- package/{src/lib/components/index.ts → lib/components/index.d.ts} +35 -35
- package/lib/components/input-group/index.d.ts +1 -0
- package/{src/lib/components/input-group/input-group.model.ts → lib/components/input-group/input-group.model.d.ts} +12 -17
- package/lib/components/loader/index.d.ts +1 -0
- package/lib/components/loader/loader.model.d.ts +3 -0
- package/lib/components/multiselect/index.d.ts +1 -0
- package/{src/lib/components/multiselect/mutiselect.model.ts → lib/components/multiselect/mutiselect.model.d.ts} +9 -13
- package/lib/components/number-input/index.d.ts +1 -0
- package/{src/lib/components/number-input/number-input.model.ts → lib/components/number-input/number-input.model.d.ts} +10 -14
- package/{src/lib/components/page-header/index.ts → lib/components/page-header/index.d.ts} +3 -3
- package/{src/lib/components/page-header/page-header.model.ts → lib/components/page-header/page-header.model.d.ts} +7 -11
- package/lib/components/page-header/page-header.service.d.ts +8 -0
- package/lib/components/page-header/page-headercore.component.d.ts +20 -0
- package/lib/components/password/index.d.ts +1 -0
- package/{src/lib/components/password/password.model.ts → lib/components/password/password.model.d.ts} +19 -25
- package/lib/components/radiobutton/index.d.ts +1 -0
- package/{src/lib/components/radiobutton/radiobutton.model.ts → lib/components/radiobutton/radiobutton.model.d.ts} +11 -16
- package/lib/components/section/index.d.ts +1 -0
- package/{src/lib/components/section/section.model.ts → lib/components/section/section.model.d.ts} +7 -11
- package/lib/components/side-menu/directives/side-menu-service.directive.d.ts +11 -0
- package/{src/lib/components/side-menu/index.ts → lib/components/side-menu/index.d.ts} +4 -4
- package/lib/components/side-menu/services/side-menu-provider.service.d.ts +10 -0
- package/lib/components/side-menu/services/side-menu.service.d.ts +15 -0
- package/lib/components/side-menu/side-menu.model.d.ts +42 -0
- package/lib/components/slider/index.d.ts +1 -0
- package/{src/lib/components/slider/slider.model.ts → lib/components/slider/slider.model.d.ts} +9 -13
- package/lib/components/snackbar/index.d.ts +1 -0
- package/lib/components/snackbar/snackbar.model.d.ts +3 -0
- package/lib/components/stepper/index.d.ts +1 -0
- package/{src/lib/components/stepper/stepper.model.ts → lib/components/stepper/stepper.model.d.ts} +19 -24
- package/lib/components/switch/index.d.ts +1 -0
- package/lib/components/switch/switch.model.d.ts +4 -0
- package/lib/components/tab-view/index.d.ts +1 -0
- package/{src/lib/components/tab-view/tab-view.model.ts → lib/components/tab-view/tab-view.model.d.ts} +17 -22
- package/lib/components/table/column-configuration.d.ts +12 -0
- package/{src/lib/components/table/index.ts → lib/components/table/index.d.ts} +4 -4
- package/lib/components/table/table-builder.d.ts +15 -0
- package/lib/components/table/table-column.directive.d.ts +25 -0
- package/lib/components/table/table.models.d.ts +132 -0
- package/lib/components/table-filter/index.d.ts +1 -0
- package/{src/lib/components/table-filter/table-filter.model.ts → lib/components/table-filter/table-filter.model.d.ts} +17 -22
- package/lib/components/textarea/index.d.ts +1 -0
- package/{src/lib/components/textarea/textarea.model.ts → lib/components/textarea/textarea.model.d.ts} +9 -13
- package/lib/components/textfield/index.d.ts +1 -0
- package/{src/lib/components/textfield/textfield.model.ts → lib/components/textfield/textfield.model.d.ts} +9 -13
- package/lib/components/tristatecheckbox/index.d.ts +1 -0
- package/lib/components/tristatecheckbox/tristatecheckbox.model.d.ts +4 -0
- package/lib/components/unsubscribe.component.d.ts +9 -0
- package/lib/directives/datasource.directive.d.ts +32 -0
- package/{src/lib/directives/index.ts → lib/directives/index.d.ts} +4 -4
- package/lib/directives/shortcut.directive.d.ts +11 -0
- package/lib/directives/table-datasource.directive.d.ts +29 -0
- package/lib/directives/table-filter.directive.d.ts +17 -0
- package/lib/format/format.d.ts +9 -0
- package/lib/pipes/error/error.codes.d.ts +5 -0
- package/lib/pipes/error/error.models.d.ts +8 -0
- package/lib/pipes/error/error.pipe.d.ts +8 -0
- package/lib/pipes/error/warning.codes.d.ts +5 -0
- package/lib/pipes/error/warning.pipe.d.ts +8 -0
- package/lib/pipes/helper/enumToList.pipe.d.ts +7 -0
- package/{src/lib/pipes/index.ts → lib/pipes/index.d.ts} +7 -7
- package/lib/pipes/keyOrFn/keyOrFn.pipe.d.ts +7 -0
- package/lib/services/confirm-dialog.service.d.ts +12 -0
- package/{src/lib/services/index.ts → lib/services/index.d.ts} +4 -4
- package/lib/services/leave-form.service.d.ts +13 -0
- package/lib/services/screen-size.service.d.ts +10 -0
- package/lib/services/table.service.d.ts +13 -0
- package/package.json +35 -19
- package/.eslintrc.json +0 -48
- package/jest.config.ts +0 -21
- package/ng-package.json +0 -7
- package/project.json +0 -36
- package/src/lib/common/angular-helper.ts +0 -44
- package/src/lib/common/constants.ts +0 -5
- package/src/lib/common/control.models.ts +0 -71
- package/src/lib/common/datasource-component.model.spec.ts +0 -42
- package/src/lib/common/datasource-component.model.ts +0 -43
- package/src/lib/common/download-file.ts +0 -20
- package/src/lib/common/filter.ts +0 -7
- package/src/lib/common/rxjs.spec.ts +0 -58
- package/src/lib/common/rxjs.ts +0 -21
- package/src/lib/components/action-button-group/action-button-group.model.ts +0 -15
- package/src/lib/components/action-button-group/action-button.model.ts +0 -15
- package/src/lib/components/base-form/base-form-input.component.ts +0 -121
- package/src/lib/components/base-form/base-form.component.ts +0 -236
- package/src/lib/components/base-form/directives/detail-store.directive.ts +0 -219
- package/src/lib/components/base-form/models/base-form-input.models.ts +0 -11
- package/src/lib/components/base-form/models/base-form.models.ts +0 -31
- package/src/lib/components/breadcrumb/breadcrumb.service.ts +0 -9
- package/src/lib/components/breadcrumb/breadcrumbcore.component.ts +0 -115
- package/src/lib/components/breadcrumb/index.ts +0 -3
- package/src/lib/components/button/index.ts +0 -1
- package/src/lib/components/calendar/index.ts +0 -1
- package/src/lib/components/checkbox/checkbox.model.ts +0 -8
- package/src/lib/components/checkbox/index.ts +0 -1
- package/src/lib/components/confirm-dialog/confirm-dialog.model.ts +0 -31
- package/src/lib/components/confirm-dialog/index.ts +0 -1
- package/src/lib/components/dropdown/index.ts +0 -1
- package/src/lib/components/dynamic-component/dynamic-component.model.ts +0 -2
- package/src/lib/components/dynamic-component/index.ts +0 -1
- package/src/lib/components/filter/filter.model.ts +0 -17
- package/src/lib/components/form-field/index.ts +0 -1
- package/src/lib/components/generic-field/index.ts +0 -1
- package/src/lib/components/generic-form/generic-form.component.ts +0 -33
- package/src/lib/components/header/index.ts +0 -1
- package/src/lib/components/icons/icons.component.ts +0 -17
- package/src/lib/components/icons/icons.model.ts +0 -10
- package/src/lib/components/icons/index.ts +0 -2
- package/src/lib/components/input-group/index.ts +0 -1
- package/src/lib/components/loader/index.ts +0 -1
- package/src/lib/components/loader/loader.model.ts +0 -7
- package/src/lib/components/multiselect/index.ts +0 -1
- package/src/lib/components/number-input/index.ts +0 -1
- package/src/lib/components/page-header/page-header.service.ts +0 -9
- package/src/lib/components/page-header/page-headercore.component.ts +0 -40
- package/src/lib/components/password/index.ts +0 -1
- package/src/lib/components/radiobutton/index.ts +0 -1
- package/src/lib/components/section/index.ts +0 -1
- package/src/lib/components/side-menu/directives/side-menu-service.directive.ts +0 -31
- package/src/lib/components/side-menu/services/side-menu-provider.service.ts +0 -13
- package/src/lib/components/side-menu/services/side-menu.service.ts +0 -62
- package/src/lib/components/side-menu/side-menu.model.ts +0 -67
- package/src/lib/components/slider/index.ts +0 -1
- package/src/lib/components/snackbar/index.ts +0 -1
- package/src/lib/components/snackbar/snackbar.model.ts +0 -7
- package/src/lib/components/stepper/index.ts +0 -1
- package/src/lib/components/switch/index.ts +0 -1
- package/src/lib/components/switch/switch.model.ts +0 -8
- package/src/lib/components/tab-view/index.ts +0 -1
- package/src/lib/components/table/column-configuration.ts +0 -38
- package/src/lib/components/table/table-builder.ts +0 -93
- package/src/lib/components/table/table-column.directive.ts +0 -62
- package/src/lib/components/table/table.models.ts +0 -261
- package/src/lib/components/table-filter/index.ts +0 -1
- package/src/lib/components/textarea/index.ts +0 -1
- package/src/lib/components/textfield/index.ts +0 -1
- package/src/lib/components/tristatecheckbox/index.ts +0 -1
- package/src/lib/components/tristatecheckbox/tristatecheckbox.model.ts +0 -8
- package/src/lib/components/unsubscribe.component.ts +0 -12
- package/src/lib/directives/datasource.directive.ts +0 -275
- package/src/lib/directives/shortcut.directive.ts +0 -37
- package/src/lib/directives/table-datasource.directive.ts +0 -184
- package/src/lib/directives/table-filter.directive.ts +0 -69
- package/src/lib/format/format.ts +0 -74
- package/src/lib/pipes/error/error.codes.ts +0 -11
- package/src/lib/pipes/error/error.models.ts +0 -27
- package/src/lib/pipes/error/error.pipe.ts +0 -27
- package/src/lib/pipes/error/warning.codes.ts +0 -5
- package/src/lib/pipes/error/warning.pipe.ts +0 -27
- package/src/lib/pipes/helper/enumToList.pipe.ts +0 -16
- package/src/lib/pipes/keyOrFn/keyOrFn.pipe.ts +0 -23
- package/src/lib/services/confirm-dialog.service.ts +0 -44
- package/src/lib/services/leave-form.service.ts +0 -53
- package/src/lib/services/screen-size.service.ts +0 -25
- package/src/lib/services/table.service.ts +0 -22
- package/src/test-setup.ts +0 -8
- package/tsconfig.json +0 -28
- package/tsconfig.lib.json +0 -17
- package/tsconfig.lib.prod.json +0 -9
- package/tsconfig.spec.json +0 -16
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import { HttpClient } from '@angular/common/http';
|
|
2
|
-
import {
|
|
3
|
-
ChangeDetectorRef,
|
|
4
|
-
Directive,
|
|
5
|
-
inject,
|
|
6
|
-
Input,
|
|
7
|
-
OnChanges,
|
|
8
|
-
OnInit,
|
|
9
|
-
SimpleChanges,
|
|
10
|
-
} from '@angular/core';
|
|
11
|
-
import { Store } from '@ngrx/store';
|
|
12
|
-
import {
|
|
13
|
-
BASE_URL_PATH,
|
|
14
|
-
BaseHttpService,
|
|
15
|
-
convertDatasource,
|
|
16
|
-
DataSourceFunctionType,
|
|
17
|
-
DatasourceType,
|
|
18
|
-
LazyLoadEvent,
|
|
19
|
-
normalizeRequest,
|
|
20
|
-
Page,
|
|
21
|
-
RequestParams,
|
|
22
|
-
} from '@verisoft/core';
|
|
23
|
-
import {
|
|
24
|
-
BehaviorSubject,
|
|
25
|
-
catchError,
|
|
26
|
-
debounceTime,
|
|
27
|
-
map,
|
|
28
|
-
of,
|
|
29
|
-
switchMap,
|
|
30
|
-
takeUntil,
|
|
31
|
-
tap,
|
|
32
|
-
} from 'rxjs';
|
|
33
|
-
import {
|
|
34
|
-
DEFAULT_DEBOUNCE_TIME,
|
|
35
|
-
ExtendedRequestType,
|
|
36
|
-
isFilterEmpty,
|
|
37
|
-
setComponentProperties,
|
|
38
|
-
} from '../common';
|
|
39
|
-
import {
|
|
40
|
-
TABLE_COMPONENT_TOKEN,
|
|
41
|
-
TableCore,
|
|
42
|
-
UnsubscribeComponent,
|
|
43
|
-
} from '../components';
|
|
44
|
-
|
|
45
|
-
@Directive({
|
|
46
|
-
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
47
|
-
selector: 'v-table[useDatasource]',
|
|
48
|
-
exportAs: 'useDatasource',
|
|
49
|
-
standalone: true,
|
|
50
|
-
})
|
|
51
|
-
export class TableDatasourceDirective<T>
|
|
52
|
-
extends UnsubscribeComponent
|
|
53
|
-
implements OnInit, OnChanges
|
|
54
|
-
{
|
|
55
|
-
protected readonly store = inject(Store);
|
|
56
|
-
|
|
57
|
-
@Input() autoBind = true;
|
|
58
|
-
|
|
59
|
-
@Input({ required: true }) tableName!: string;
|
|
60
|
-
|
|
61
|
-
@Input() debounceTime = DEFAULT_DEBOUNCE_TIME;
|
|
62
|
-
|
|
63
|
-
@Input() datasource!: DatasourceType<T>;
|
|
64
|
-
|
|
65
|
-
@Input() extraFilter!: any;
|
|
66
|
-
|
|
67
|
-
@Input() transformFn?: (data: T) => unknown;
|
|
68
|
-
|
|
69
|
-
private tableComponent = inject<TableCore<T>>(TABLE_COMPONENT_TOKEN, {
|
|
70
|
-
self: true,
|
|
71
|
-
});
|
|
72
|
-
private changeDetectorRef = inject(ChangeDetectorRef);
|
|
73
|
-
private httpClient = inject(HttpClient);
|
|
74
|
-
private baseUrl: string = inject(BASE_URL_PATH);
|
|
75
|
-
|
|
76
|
-
private dataSourceService?: DataSourceFunctionType<T>;
|
|
77
|
-
private parameters$ = new BehaviorSubject<Partial<ExtendedRequestType<T>>>({});
|
|
78
|
-
|
|
79
|
-
params$ = this.parameters$.asObservable();
|
|
80
|
-
|
|
81
|
-
ngOnInit(): void {
|
|
82
|
-
if (!this.tableName) {
|
|
83
|
-
throw new Error('Property tableName must be defined.');
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
this.tableComponent.lazyLoad.pipe(takeUntil(this.destroyed$)).subscribe((value: LazyLoadEvent) => {
|
|
87
|
-
this.parameters$.next({
|
|
88
|
-
offset: value?.offset,
|
|
89
|
-
limit: value?.limit,
|
|
90
|
-
filter: { ...value?.filter, ...this.extraFilter },
|
|
91
|
-
sort: value?.sort,
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
this.parameters$
|
|
96
|
-
.pipe(
|
|
97
|
-
takeUntil(this.destroyed$),
|
|
98
|
-
map((request) =>
|
|
99
|
-
normalizeRequest({
|
|
100
|
-
...request,
|
|
101
|
-
filter: { ...request.filter, ...this.extraFilter },
|
|
102
|
-
})
|
|
103
|
-
),
|
|
104
|
-
debounceTime(this.debounceTime),
|
|
105
|
-
tap(() => {
|
|
106
|
-
this.changeComponent(this.tableComponent, {
|
|
107
|
-
lazy: true,
|
|
108
|
-
loading: true,
|
|
109
|
-
});
|
|
110
|
-
}),
|
|
111
|
-
switchMap((request) =>
|
|
112
|
-
this.dataSourceService
|
|
113
|
-
? this.dataSourceService(request).pipe(
|
|
114
|
-
map((response) => ({ request, response }))
|
|
115
|
-
)
|
|
116
|
-
: of({
|
|
117
|
-
request,
|
|
118
|
-
response: {
|
|
119
|
-
data: [] as T[],
|
|
120
|
-
total: 0,
|
|
121
|
-
limit: request.limit,
|
|
122
|
-
offset: request.offset,
|
|
123
|
-
} as Page<T>,
|
|
124
|
-
})
|
|
125
|
-
),
|
|
126
|
-
catchError((request) => {
|
|
127
|
-
this.changeComponent(this.tableComponent, {
|
|
128
|
-
loading: false,
|
|
129
|
-
});
|
|
130
|
-
return of({
|
|
131
|
-
request: request as ExtendedRequestType<T>,
|
|
132
|
-
response: {
|
|
133
|
-
data: [] as T[],
|
|
134
|
-
total: 0,
|
|
135
|
-
limit: request.limit,
|
|
136
|
-
offset: request.offset,
|
|
137
|
-
} as Page<T>,
|
|
138
|
-
});
|
|
139
|
-
})
|
|
140
|
-
)
|
|
141
|
-
.subscribe(({ request, response }) =>
|
|
142
|
-
this.setDataToControl(request, response)
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
ngOnChanges(changes: SimpleChanges): void {
|
|
147
|
-
if (changes['datasource']) {
|
|
148
|
-
this.dataSourceService = convertDatasource(
|
|
149
|
-
this.datasource,
|
|
150
|
-
this.baseUrl,
|
|
151
|
-
this.httpClient
|
|
152
|
-
);
|
|
153
|
-
|
|
154
|
-
if (this.autoBind) {
|
|
155
|
-
this.parameters$.next({ offset: 0 });
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
reload() {
|
|
161
|
-
this.parameters$.next({ ...this.parameters$.value });
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
private changeComponent(
|
|
165
|
-
component: TableCore<T>,
|
|
166
|
-
value: Partial<TableCore<T>>
|
|
167
|
-
) {
|
|
168
|
-
setComponentProperties(component, value);
|
|
169
|
-
this.changeDetectorRef.detectChanges();
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
private setDataToControl(request: RequestParams<T>, result: Page<T>): void {
|
|
173
|
-
const data = result.data;
|
|
174
|
-
const total = result.total;
|
|
175
|
-
const transferedData = this.transformFn ? data.map((x) => this.transformFn?.(x)) : data;
|
|
176
|
-
|
|
177
|
-
this.changeComponent(this.tableComponent, {
|
|
178
|
-
lazy: !isFilterEmpty(request.filter) || data?.length < total || this.datasource instanceof BaseHttpService,
|
|
179
|
-
data: transferedData as T[],
|
|
180
|
-
loading: false,
|
|
181
|
-
total,
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChangeDetectorRef,
|
|
3
|
-
Directive,
|
|
4
|
-
inject,
|
|
5
|
-
Input,
|
|
6
|
-
OnChanges,
|
|
7
|
-
OnDestroy,
|
|
8
|
-
SimpleChanges,
|
|
9
|
-
} from '@angular/core';
|
|
10
|
-
import { debounceTime, Subject, Subscription } from 'rxjs';
|
|
11
|
-
import { DEFAULT_DEBOUNCE_TIME, setComponentProperties } from '../common';
|
|
12
|
-
import { FilterCore, TABLE_COMPONENT_TOKEN, TableCore } from '../components';
|
|
13
|
-
|
|
14
|
-
@Directive({
|
|
15
|
-
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
16
|
-
selector: 'v-table[useFilter]',
|
|
17
|
-
standalone: true,
|
|
18
|
-
exportAs: 'tableFilterDirective',
|
|
19
|
-
})
|
|
20
|
-
export class TableFilterDirective<T> implements OnChanges, OnDestroy {
|
|
21
|
-
@Input({ required: true }) filterComponent!: FilterCore;
|
|
22
|
-
|
|
23
|
-
private filterChange$ = new Subject<T>();
|
|
24
|
-
private subscription: Subscription | undefined = undefined;
|
|
25
|
-
|
|
26
|
-
private tableComponent = inject<TableCore<T>>(TABLE_COMPONENT_TOKEN);
|
|
27
|
-
|
|
28
|
-
private changeDetectorRef = inject(ChangeDetectorRef);
|
|
29
|
-
|
|
30
|
-
ngOnChanges(changes: SimpleChanges): void {
|
|
31
|
-
if (changes['filterComponent']) {
|
|
32
|
-
this.unRegister();
|
|
33
|
-
this.register();
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
private onFilterChange(value: T): void {
|
|
38
|
-
if (this.tableComponent?.filter !== value) {
|
|
39
|
-
setComponentProperties(this.tableComponent, {
|
|
40
|
-
filter: value,
|
|
41
|
-
currentPage: 1,
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
this.changeDetectorRef.detectChanges();
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
ngOnDestroy(): void {
|
|
49
|
-
this.unRegister();
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
private unRegister() {
|
|
53
|
-
this.subscription?.unsubscribe();
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
private register() {
|
|
57
|
-
this.filterComponent.registerOnChange((value: T) => {
|
|
58
|
-
this.filterChange$.next(value);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
this.subscription = this.filterChange$
|
|
62
|
-
.pipe(
|
|
63
|
-
debounceTime(
|
|
64
|
-
this.filterComponent.debounceTime ? 0 : DEFAULT_DEBOUNCE_TIME
|
|
65
|
-
)
|
|
66
|
-
)
|
|
67
|
-
.subscribe((value) => this.onFilterChange(value));
|
|
68
|
-
}
|
|
69
|
-
}
|
package/src/lib/format/format.ts
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { toCzechDateTimeString } from "@verisoft/core";
|
|
2
|
-
|
|
3
|
-
/* eslint-disable @typescript-eslint/ban-types */
|
|
4
|
-
export class Format {
|
|
5
|
-
static concatArray(value: any[], itemFormatter?: Function, delimeter = ';') {
|
|
6
|
-
if (!value) {
|
|
7
|
-
return '';
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
return value
|
|
11
|
-
.map(item => itemFormatter ? itemFormatter(item) : item)
|
|
12
|
-
.filter(item => item !== undefined && item !== null)
|
|
13
|
-
.join(`${delimeter} `);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
static czechDate(value: Date | string) {
|
|
17
|
-
return toCzechDateTimeString(value);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
static date(value: Date | string) {
|
|
21
|
-
if (!value) {
|
|
22
|
-
return '';
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (typeof value === 'string') {
|
|
26
|
-
value = new Date(value);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return value.getDate() + '. ' + (value.getMonth() + 1) + '. ' + value.getFullYear();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
static dateAndTime(value: Date | string) {
|
|
33
|
-
if (!value) {
|
|
34
|
-
return '';
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (typeof value === 'string') {
|
|
38
|
-
value = new Date(value);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return ('0' + value.getDate()).slice(-2)
|
|
42
|
-
+ '.' + ('0' + (value.getMonth() + 1)).slice(-2)
|
|
43
|
-
+ '.' + value.getFullYear() + ' ' + ('0' + value.getHours()).slice(-2)
|
|
44
|
-
+ ':' + ('0' + value.getMinutes()).slice(-2) + ':' + ('0' + value.getSeconds()).slice(-2);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
static convertToUserLocaleDate(value?: Date | string) {
|
|
48
|
-
if (!value) {
|
|
49
|
-
return '';
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (typeof value === 'string') {
|
|
53
|
-
value = new Date(value);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return value.toLocaleDateString(navigator.language, { timeZone: 'UTC' });
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
static bool(value: boolean) {
|
|
60
|
-
if (value) {
|
|
61
|
-
return 'Yes';
|
|
62
|
-
} else {
|
|
63
|
-
return 'No';
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
static boolWithIcon(value: boolean) {
|
|
68
|
-
if (value) {
|
|
69
|
-
return `<span>✓</span>`;
|
|
70
|
-
} else {
|
|
71
|
-
return `<span>⨯</span>`;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
type ErrorCodesFn = (value?: any) => string;
|
|
2
|
-
|
|
3
|
-
export const ErrorCodesFns: { [key: string]: ErrorCodesFn } = {
|
|
4
|
-
required: () => `This field is required!`,
|
|
5
|
-
email: () => `Email is in wrong format!`,
|
|
6
|
-
iban: () => `IBAN is in wrong format!`,
|
|
7
|
-
lowStrength: () => `Password too weak!`,
|
|
8
|
-
customPasswordRequirements: () => `Password does not meet minimal requirements.`,
|
|
9
|
-
fieldsNotMatching: () => `Passwords are not the same!`,
|
|
10
|
-
validationError: (value: any) => `${value}`,
|
|
11
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { AbstractControl, ValidationErrors } from '@angular/forms';
|
|
2
|
-
|
|
3
|
-
type ErrorValue = { key: string; value: string } | null;
|
|
4
|
-
|
|
5
|
-
export function getFirstErrorFromControl<T extends AbstractControl>(
|
|
6
|
-
control: T
|
|
7
|
-
): ErrorValue {
|
|
8
|
-
if (!control || !control.errors) {
|
|
9
|
-
return null;
|
|
10
|
-
}
|
|
11
|
-
const errors = control.errors ?? false;
|
|
12
|
-
if (errors) {
|
|
13
|
-
const key = Object.keys(control.errors)[0];
|
|
14
|
-
const value = control.errors[key];
|
|
15
|
-
return { key, value };
|
|
16
|
-
}
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function getFirstError(errors: ValidationErrors): ErrorValue {
|
|
21
|
-
if (errors) {
|
|
22
|
-
const key = Object.keys(errors)[0];
|
|
23
|
-
const value = errors[key];
|
|
24
|
-
return { key, value };
|
|
25
|
-
}
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Pipe, PipeTransform } from '@angular/core';
|
|
2
|
-
import { ValidationErrors } from '@angular/forms';
|
|
3
|
-
import { ErrorCodesFns } from './error.codes';
|
|
4
|
-
import { getFirstError } from './error.models';
|
|
5
|
-
|
|
6
|
-
const EMPTY = '';
|
|
7
|
-
|
|
8
|
-
@Pipe({
|
|
9
|
-
name: 'error',
|
|
10
|
-
standalone: true,
|
|
11
|
-
})
|
|
12
|
-
export class ErrorPipe implements PipeTransform {
|
|
13
|
-
transform(errors: ValidationErrors | undefined | null): string {
|
|
14
|
-
if (!errors) {
|
|
15
|
-
return EMPTY;
|
|
16
|
-
}
|
|
17
|
-
const error = getFirstError(errors);
|
|
18
|
-
if (error) {
|
|
19
|
-
const errorFn = ErrorCodesFns[error.key];
|
|
20
|
-
if (!errorFn) {
|
|
21
|
-
return EMPTY;
|
|
22
|
-
}
|
|
23
|
-
return ErrorCodesFns[error.key](error.value);
|
|
24
|
-
}
|
|
25
|
-
return EMPTY;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Pipe, PipeTransform } from '@angular/core';
|
|
2
|
-
import { ValidationErrors } from '@angular/forms';
|
|
3
|
-
import { getFirstError } from './error.models';
|
|
4
|
-
import { WarningCodesFns } from './warning.codes';
|
|
5
|
-
|
|
6
|
-
const EMPTY = '';
|
|
7
|
-
|
|
8
|
-
@Pipe({
|
|
9
|
-
name: 'warning',
|
|
10
|
-
standalone: true,
|
|
11
|
-
})
|
|
12
|
-
export class WarningPipe implements PipeTransform {
|
|
13
|
-
transform(warnings: ValidationErrors | undefined | null): string {
|
|
14
|
-
if (!warnings) {
|
|
15
|
-
return EMPTY;
|
|
16
|
-
}
|
|
17
|
-
const error = getFirstError(warnings);
|
|
18
|
-
if (error) {
|
|
19
|
-
const errorFn = WarningCodesFns[error.key];
|
|
20
|
-
if (!errorFn) {
|
|
21
|
-
return EMPTY;
|
|
22
|
-
}
|
|
23
|
-
return WarningCodesFns[error.key](error.value);
|
|
24
|
-
}
|
|
25
|
-
return EMPTY;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Pipe, PipeTransform } from "@angular/core";
|
|
2
|
-
|
|
3
|
-
@Pipe({
|
|
4
|
-
name: 'enumToList',
|
|
5
|
-
standalone: true,
|
|
6
|
-
})
|
|
7
|
-
export class EnumToListPipe implements PipeTransform {
|
|
8
|
-
transform(data: any): any[] {
|
|
9
|
-
return Object.keys(data)
|
|
10
|
-
.filter(key => isNaN(Number(key)))
|
|
11
|
-
.map(key => ({
|
|
12
|
-
label: key,
|
|
13
|
-
value: data[key as keyof typeof data],
|
|
14
|
-
}));
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { Pipe, PipeTransform } from '@angular/core';
|
|
3
|
-
|
|
4
|
-
@Pipe({
|
|
5
|
-
name: 'keyOrFn',
|
|
6
|
-
pure: false,
|
|
7
|
-
standalone: true,
|
|
8
|
-
})
|
|
9
|
-
export class KeyOrFunctionPipe implements PipeTransform {
|
|
10
|
-
transform(keyOrFn: any, row: any): any {
|
|
11
|
-
if (keyOrFn instanceof Function) {
|
|
12
|
-
return keyOrFn(row);
|
|
13
|
-
} else if (typeof keyOrFn === 'string') {
|
|
14
|
-
const value = row[keyOrFn];
|
|
15
|
-
if (value) {
|
|
16
|
-
return value;
|
|
17
|
-
}
|
|
18
|
-
} else if (typeof keyOrFn === 'boolean') {
|
|
19
|
-
return keyOrFn;
|
|
20
|
-
}
|
|
21
|
-
return '';
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { EventEmitter, Injectable, Output } from '@angular/core';
|
|
2
|
-
import { ExtendedDialogData } from '../components';
|
|
3
|
-
|
|
4
|
-
@Injectable({
|
|
5
|
-
providedIn: 'root',
|
|
6
|
-
})
|
|
7
|
-
export class DialogService {
|
|
8
|
-
@Output() showEvent: EventEmitter<ExtendedDialogData> =
|
|
9
|
-
new EventEmitter<ExtendedDialogData>();
|
|
10
|
-
|
|
11
|
-
@Output() closeEvent: EventEmitter<null> = new EventEmitter();
|
|
12
|
-
|
|
13
|
-
showDialog<TInputs, TOutputs>(data: ExtendedDialogData<TInputs, TOutputs>): void {
|
|
14
|
-
const mappedData = this.mapInputAndOutpus(data);
|
|
15
|
-
|
|
16
|
-
this.showEvent.emit({
|
|
17
|
-
...data,
|
|
18
|
-
data: mappedData,
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
private mapInputAndOutpus<TInputs, TOutputs>(
|
|
23
|
-
data: ExtendedDialogData<TInputs, TOutputs>
|
|
24
|
-
): ExtendedDialogData<TInputs, TOutputs> {
|
|
25
|
-
const inputsAndOutputs = data.data as TInputs & TOutputs;
|
|
26
|
-
return {
|
|
27
|
-
...data.data,
|
|
28
|
-
...(Object.keys(inputsAndOutputs ?? {})
|
|
29
|
-
.filter((key) => typeof inputsAndOutputs[key as keyof TOutputs] === 'function')
|
|
30
|
-
.reduce((acc, key) => {
|
|
31
|
-
acc[key] = (value: any) => {
|
|
32
|
-
if (typeof inputsAndOutputs[key as keyof TOutputs] === 'function') {
|
|
33
|
-
(inputsAndOutputs[key as keyof TOutputs] as (value: any) => void)(value);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
return acc;
|
|
37
|
-
}, {} as Record<string, any>)),
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
closeModal(): void {
|
|
42
|
-
this.closeEvent.emit();
|
|
43
|
-
}
|
|
44
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { Injectable, inject } from '@angular/core';
|
|
2
|
-
import { CanDeactivate } from '@angular/router';
|
|
3
|
-
import { TranslateService } from '@ngx-translate/core';
|
|
4
|
-
import { Observable, Subject } from 'rxjs';
|
|
5
|
-
import { PreventUnsavedChangesCore, CommonIcons } from '../common';
|
|
6
|
-
import { DialogService } from './confirm-dialog.service';
|
|
7
|
-
|
|
8
|
-
@Injectable({
|
|
9
|
-
providedIn: 'root',
|
|
10
|
-
})
|
|
11
|
-
export class PreventUnsavedChangesDirective implements CanDeactivate<PreventUnsavedChangesCore> {
|
|
12
|
-
private dialogService = inject(DialogService);
|
|
13
|
-
private translateService = inject(TranslateService);
|
|
14
|
-
private readonly Icons!: CommonIcons;
|
|
15
|
-
|
|
16
|
-
canDeactivate(component: PreventUnsavedChangesCore): Observable<boolean> | Promise<boolean> | boolean {
|
|
17
|
-
if (!component || !component.canDeactivate) {
|
|
18
|
-
return true;
|
|
19
|
-
}
|
|
20
|
-
const result = component.canDeactivate();
|
|
21
|
-
return result;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
showConfirmationDialog(): Observable<boolean> {
|
|
25
|
-
const resultSubject = new Subject<boolean>();
|
|
26
|
-
|
|
27
|
-
const title = this.translateService.instant('VALIDATIONS.UNSAVED_CHANGES');
|
|
28
|
-
const message = this.translateService.instant('VALIDATIONS.LEAVING_UNSAVED_FORM');
|
|
29
|
-
const leaveButton = this.translateService.instant('BUTTONS.LEAVE');
|
|
30
|
-
const stayButton = this.translateService.instant('BUTTONS.STAY');
|
|
31
|
-
|
|
32
|
-
this.dialogService.showDialog({
|
|
33
|
-
title: title,
|
|
34
|
-
headerIcon: this.Icons.infoCircle,
|
|
35
|
-
innerHTML: `<p>${message}</p>`,
|
|
36
|
-
showCancelButton: true,
|
|
37
|
-
confirmButtonText: stayButton,
|
|
38
|
-
cancelButtonText: leaveButton,
|
|
39
|
-
confirmButtonFn: () => {
|
|
40
|
-
resultSubject.next(false);
|
|
41
|
-
resultSubject.complete();
|
|
42
|
-
this.dialogService.closeModal();
|
|
43
|
-
},
|
|
44
|
-
cancelButtonFn: () => {
|
|
45
|
-
resultSubject.next(true);
|
|
46
|
-
resultSubject.complete();
|
|
47
|
-
this.dialogService.closeModal();
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
return resultSubject.asObservable();
|
|
52
|
-
}
|
|
53
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import { BehaviorSubject } from 'rxjs';
|
|
3
|
-
|
|
4
|
-
@Injectable({
|
|
5
|
-
providedIn: 'root',
|
|
6
|
-
})
|
|
7
|
-
export class ScreenSizeService {
|
|
8
|
-
isMobileBlock = new BehaviorSubject<boolean>(false);
|
|
9
|
-
prevState = false;
|
|
10
|
-
|
|
11
|
-
constructor() {
|
|
12
|
-
this.checkScreenSize();
|
|
13
|
-
window.addEventListener('resize', async () => {
|
|
14
|
-
await this.checkScreenSize();
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
async checkScreenSize() {
|
|
19
|
-
const isMobile = window.matchMedia('(max-width: 768px)').matches;
|
|
20
|
-
if (isMobile !== this.prevState) {
|
|
21
|
-
this.prevState = isMobile;
|
|
22
|
-
this.isMobileBlock.next(isMobile);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Injectable, signal } from "@angular/core";
|
|
2
|
-
import { TableSignal } from "../components";
|
|
3
|
-
|
|
4
|
-
@Injectable({
|
|
5
|
-
providedIn: 'root'
|
|
6
|
-
})
|
|
7
|
-
export class TableService {
|
|
8
|
-
readonly reload = signal<TableSignal | symbol>(Symbol())
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* If name is set, reload a specific table with the set`[tableName]`
|
|
12
|
-
*
|
|
13
|
-
* If name is NOT set, reload all tables in the current DOM
|
|
14
|
-
* */
|
|
15
|
-
forceReload(name?: string): void {
|
|
16
|
-
if (name) {
|
|
17
|
-
this.reload.set({ name: name, symbol: Symbol() });
|
|
18
|
-
} else {
|
|
19
|
-
this.reload.set(Symbol());
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
package/src/test-setup.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment
|
|
2
|
-
globalThis.ngJest = {
|
|
3
|
-
testEnvironmentOptions: {
|
|
4
|
-
errorOnUnknownElements: true,
|
|
5
|
-
errorOnUnknownProperties: true,
|
|
6
|
-
},
|
|
7
|
-
};
|
|
8
|
-
import 'jest-preset-angular/setup-jest';
|
package/tsconfig.json
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es2022",
|
|
4
|
-
"forceConsistentCasingInFileNames": true,
|
|
5
|
-
"strict": true,
|
|
6
|
-
"noImplicitOverride": true,
|
|
7
|
-
"noPropertyAccessFromIndexSignature": true,
|
|
8
|
-
"noImplicitReturns": true,
|
|
9
|
-
"noFallthroughCasesInSwitch": true
|
|
10
|
-
},
|
|
11
|
-
"files": [],
|
|
12
|
-
"include": [],
|
|
13
|
-
"references": [
|
|
14
|
-
{
|
|
15
|
-
"path": "./tsconfig.lib.json"
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"path": "./tsconfig.spec.json"
|
|
19
|
-
}
|
|
20
|
-
],
|
|
21
|
-
"extends": "../../../tsconfig.base.json",
|
|
22
|
-
"angularCompilerOptions": {
|
|
23
|
-
"enableI18nLegacyMessageIdFormat": false,
|
|
24
|
-
"strictInjectionParameters": true,
|
|
25
|
-
"strictInputAccessModifiers": true,
|
|
26
|
-
"strictTemplates": true
|
|
27
|
-
}
|
|
28
|
-
}
|
package/tsconfig.lib.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "../../../dist/out-tsc",
|
|
5
|
-
"declaration": true,
|
|
6
|
-
"declarationMap": true,
|
|
7
|
-
"inlineSources": true,
|
|
8
|
-
"types": []
|
|
9
|
-
},
|
|
10
|
-
"exclude": [
|
|
11
|
-
"src/**/*.spec.ts",
|
|
12
|
-
"src/test-setup.ts",
|
|
13
|
-
"jest.config.ts",
|
|
14
|
-
"src/**/*.test.ts"
|
|
15
|
-
],
|
|
16
|
-
"include": ["src/**/*.ts"]
|
|
17
|
-
}
|