@verisoft/ui-core 18.6.0 → 18.7.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/.eslintrc.json +48 -0
- package/README.md +52 -3
- package/jest.config.ts +21 -0
- package/ng-package.json +7 -0
- package/package.json +19 -35
- package/project.json +36 -0
- package/{index.d.ts → src/index.ts} +6 -6
- package/src/lib/common/angular-helper.ts +44 -0
- package/src/lib/common/constants.ts +5 -0
- package/src/lib/common/control.models.ts +71 -0
- package/src/lib/common/datasource-component.model.spec.ts +42 -0
- package/src/lib/common/datasource-component.model.ts +43 -0
- package/{lib/common/deactivate-guard.model.d.ts → src/lib/common/deactivate-guard.model.ts} +5 -4
- package/src/lib/common/download-file.ts +20 -0
- package/src/lib/common/filter.ts +7 -0
- package/{lib/common/icons.d.ts → src/lib/common/icons.ts} +34 -34
- package/{lib/common/index.d.ts → src/lib/common/index.ts} +10 -10
- package/{lib/common/notificable-property.model.d.ts → src/lib/common/notificable-property.model.ts} +5 -4
- package/src/lib/common/rxjs.spec.ts +58 -0
- package/src/lib/common/rxjs.ts +21 -0
- package/src/lib/components/action-button-group/action-button-group.model.ts +15 -0
- package/src/lib/components/action-button-group/action-button.model.ts +15 -0
- package/{lib/components/action-button-group/index.d.ts → src/lib/components/action-button-group/index.ts} +2 -2
- package/src/lib/components/base-form/base-form-input.component.ts +121 -0
- package/src/lib/components/base-form/base-form.component.ts +236 -0
- package/src/lib/components/base-form/directives/detail-store.directive.ts +219 -0
- package/{lib/components/base-form/index.d.ts → src/lib/components/base-form/index.ts} +4 -4
- package/src/lib/components/base-form/models/base-form-input.models.ts +11 -0
- package/src/lib/components/base-form/models/base-form.models.ts +31 -0
- package/{lib/components/base-form/models/index.d.ts → src/lib/components/base-form/models/index.ts} +2 -2
- package/{lib/components/breadcrumb/breadcrumb.model.d.ts → src/lib/components/breadcrumb/breadcrumb.model.ts} +21 -16
- package/src/lib/components/breadcrumb/breadcrumb.service.ts +9 -0
- package/src/lib/components/breadcrumb/breadcrumbcore.component.ts +115 -0
- package/src/lib/components/breadcrumb/index.ts +3 -0
- package/{lib/components/button/button.model.d.ts → src/lib/components/button/button.model.ts} +21 -17
- package/src/lib/components/button/index.ts +1 -0
- package/{lib/components/calendar/calendar.model.d.ts → src/lib/components/calendar/calendar.model.ts} +16 -12
- package/src/lib/components/calendar/index.ts +1 -0
- package/src/lib/components/checkbox/checkbox.model.ts +8 -0
- package/src/lib/components/checkbox/index.ts +1 -0
- package/src/lib/components/confirm-dialog/confirm-dialog.model.ts +31 -0
- package/src/lib/components/confirm-dialog/index.ts +1 -0
- package/{lib/components/dropdown/dropdown.model.d.ts → src/lib/components/dropdown/dropdown.model.ts} +16 -12
- package/src/lib/components/dropdown/index.ts +1 -0
- package/src/lib/components/dynamic-component/dynamic-component.model.ts +2 -0
- package/src/lib/components/dynamic-component/index.ts +1 -0
- package/src/lib/components/filter/filter.model.ts +17 -0
- package/{lib/components/filter/index.d.ts → src/lib/components/filter/index.ts} +1 -1
- package/{lib/components/form-field/form-field.model.d.ts → src/lib/components/form-field/form-field.model.ts} +15 -11
- package/src/lib/components/form-field/index.ts +1 -0
- package/{lib/components/generic-field/generic-field.model.d.ts → src/lib/components/generic-field/generic-field.model.ts} +10 -6
- package/src/lib/components/generic-field/index.ts +1 -0
- package/src/lib/components/generic-form/generic-form.component.ts +33 -0
- package/{lib/components/generic-form/index.d.ts → src/lib/components/generic-form/index.ts} +1 -1
- package/{lib/components/header/header.model.d.ts → src/lib/components/header/header.model.ts} +18 -11
- package/src/lib/components/header/index.ts +1 -0
- package/src/lib/components/icons/icons.component.ts +17 -0
- package/src/lib/components/icons/icons.model.ts +10 -0
- package/src/lib/components/icons/index.ts +2 -0
- package/{lib/components/index.d.ts → src/lib/components/index.ts} +35 -35
- package/src/lib/components/input-group/index.ts +1 -0
- package/{lib/components/input-group/input-group.model.d.ts → src/lib/components/input-group/input-group.model.ts} +17 -12
- package/src/lib/components/loader/index.ts +1 -0
- package/src/lib/components/loader/loader.model.ts +7 -0
- package/src/lib/components/multiselect/index.ts +1 -0
- package/{lib/components/multiselect/mutiselect.model.d.ts → src/lib/components/multiselect/mutiselect.model.ts} +13 -9
- package/src/lib/components/number-input/index.ts +1 -0
- package/{lib/components/number-input/number-input.model.d.ts → src/lib/components/number-input/number-input.model.ts} +14 -10
- package/{lib/components/page-header/index.d.ts → src/lib/components/page-header/index.ts} +3 -3
- package/{lib/components/page-header/page-header.model.d.ts → src/lib/components/page-header/page-header.model.ts} +11 -7
- package/src/lib/components/page-header/page-header.service.ts +9 -0
- package/src/lib/components/page-header/page-headercore.component.ts +40 -0
- package/src/lib/components/password/index.ts +1 -0
- package/{lib/components/password/password.model.d.ts → src/lib/components/password/password.model.ts} +25 -19
- package/src/lib/components/radiobutton/index.ts +1 -0
- package/{lib/components/radiobutton/radiobutton.model.d.ts → src/lib/components/radiobutton/radiobutton.model.ts} +16 -11
- package/src/lib/components/section/index.ts +1 -0
- package/{lib/components/section/section.model.d.ts → src/lib/components/section/section.model.ts} +11 -7
- package/src/lib/components/side-menu/directives/side-menu-service.directive.ts +31 -0
- package/{lib/components/side-menu/index.d.ts → src/lib/components/side-menu/index.ts} +4 -4
- package/src/lib/components/side-menu/services/side-menu-provider.service.ts +13 -0
- package/src/lib/components/side-menu/services/side-menu.service.ts +62 -0
- package/src/lib/components/side-menu/side-menu.model.ts +67 -0
- package/src/lib/components/slider/index.ts +1 -0
- package/{lib/components/slider/slider.model.d.ts → src/lib/components/slider/slider.model.ts} +13 -9
- package/src/lib/components/snackbar/index.ts +1 -0
- package/src/lib/components/snackbar/snackbar.model.ts +7 -0
- package/src/lib/components/stepper/index.ts +1 -0
- package/{lib/components/stepper/stepper.model.d.ts → src/lib/components/stepper/stepper.model.ts} +24 -19
- package/src/lib/components/switch/index.ts +1 -0
- package/src/lib/components/switch/switch.model.ts +8 -0
- package/src/lib/components/tab-view/index.ts +1 -0
- package/{lib/components/tab-view/tab-view.model.d.ts → src/lib/components/tab-view/tab-view.model.ts} +22 -17
- package/src/lib/components/table/column-configuration.ts +38 -0
- package/{lib/components/table/index.d.ts → src/lib/components/table/index.ts} +4 -4
- package/src/lib/components/table/table-builder.ts +93 -0
- package/src/lib/components/table/table-column.directive.ts +62 -0
- package/src/lib/components/table/table.models.ts +261 -0
- package/src/lib/components/table-filter/index.ts +1 -0
- package/{lib/components/table-filter/table-filter.model.d.ts → src/lib/components/table-filter/table-filter.model.ts} +22 -17
- package/src/lib/components/textarea/index.ts +1 -0
- package/{lib/components/textarea/textarea.model.d.ts → src/lib/components/textarea/textarea.model.ts} +13 -9
- package/src/lib/components/textfield/index.ts +1 -0
- package/{lib/components/textfield/textfield.model.d.ts → src/lib/components/textfield/textfield.model.ts} +13 -9
- package/src/lib/components/tristatecheckbox/index.ts +1 -0
- package/src/lib/components/tristatecheckbox/tristatecheckbox.model.ts +8 -0
- package/src/lib/components/unsubscribe.component.ts +12 -0
- package/src/lib/directives/datasource.directive.ts +275 -0
- package/{lib/directives/index.d.ts → src/lib/directives/index.ts} +4 -4
- package/src/lib/directives/shortcut.directive.ts +37 -0
- package/src/lib/directives/table-datasource.directive.ts +184 -0
- package/src/lib/directives/table-filter.directive.ts +69 -0
- package/src/lib/format/format.ts +74 -0
- package/src/lib/pipes/error/error.codes.ts +11 -0
- package/src/lib/pipes/error/error.models.ts +27 -0
- package/src/lib/pipes/error/error.pipe.ts +27 -0
- package/src/lib/pipes/error/warning.codes.ts +5 -0
- package/src/lib/pipes/error/warning.pipe.ts +27 -0
- package/src/lib/pipes/helper/enumToList.pipe.ts +16 -0
- package/{lib/pipes/index.d.ts → src/lib/pipes/index.ts} +7 -7
- package/src/lib/pipes/keyOrFn/keyOrFn.pipe.ts +23 -0
- package/src/lib/services/confirm-dialog.service.ts +44 -0
- package/{lib/services/index.d.ts → src/lib/services/index.ts} +4 -4
- package/src/lib/services/leave-form.service.ts +53 -0
- package/src/lib/services/screen-size.service.ts +25 -0
- package/src/lib/services/table.service.ts +22 -0
- package/src/test-setup.ts +8 -0
- package/tsconfig.json +28 -0
- package/tsconfig.lib.json +17 -0
- package/tsconfig.lib.prod.json +9 -0
- package/tsconfig.spec.json +16 -0
- package/esm2022/index.mjs +0 -7
- package/esm2022/lib/common/angular-helper.mjs +0 -23
- package/esm2022/lib/common/constants.mjs +0 -4
- package/esm2022/lib/common/control.models.mjs +0 -63
- package/esm2022/lib/common/datasource-component.model.mjs +0 -14
- package/esm2022/lib/common/deactivate-guard.model.mjs +0 -2
- package/esm2022/lib/common/download-file.mjs +0 -13
- package/esm2022/lib/common/filter.mjs +0 -7
- package/esm2022/lib/common/icons.mjs +0 -2
- package/esm2022/lib/common/index.mjs +0 -11
- package/esm2022/lib/common/notificable-property.model.mjs +0 -2
- package/esm2022/lib/common/rxjs.mjs +0 -11
- package/esm2022/lib/components/action-button-group/action-button-group.model.mjs +0 -3
- package/esm2022/lib/components/action-button-group/action-button.model.mjs +0 -2
- package/esm2022/lib/components/action-button-group/index.mjs +0 -3
- package/esm2022/lib/components/base-form/base-form-input.component.mjs +0 -100
- package/esm2022/lib/components/base-form/base-form.component.mjs +0 -187
- package/esm2022/lib/components/base-form/directives/detail-store.directive.mjs +0 -163
- package/esm2022/lib/components/base-form/index.mjs +0 -5
- package/esm2022/lib/components/base-form/models/base-form-input.models.mjs +0 -7
- package/esm2022/lib/components/base-form/models/base-form.models.mjs +0 -10
- package/esm2022/lib/components/base-form/models/index.mjs +0 -3
- package/esm2022/lib/components/breadcrumb/breadcrumb.model.mjs +0 -3
- package/esm2022/lib/components/breadcrumb/breadcrumb.service.mjs +0 -16
- package/esm2022/lib/components/breadcrumb/breadcrumbcore.component.mjs +0 -88
- package/esm2022/lib/components/breadcrumb/index.mjs +0 -4
- package/esm2022/lib/components/button/button.model.mjs +0 -3
- package/esm2022/lib/components/button/index.mjs +0 -2
- package/esm2022/lib/components/calendar/calendar.model.mjs +0 -3
- package/esm2022/lib/components/calendar/index.mjs +0 -2
- package/esm2022/lib/components/checkbox/checkbox.model.mjs +0 -3
- package/esm2022/lib/components/checkbox/index.mjs +0 -2
- package/esm2022/lib/components/confirm-dialog/confirm-dialog.model.mjs +0 -3
- package/esm2022/lib/components/confirm-dialog/index.mjs +0 -2
- package/esm2022/lib/components/dropdown/dropdown.model.mjs +0 -3
- package/esm2022/lib/components/dropdown/index.mjs +0 -2
- package/esm2022/lib/components/dynamic-component/dynamic-component.model.mjs +0 -2
- package/esm2022/lib/components/dynamic-component/index.mjs +0 -2
- package/esm2022/lib/components/filter/filter.model.mjs +0 -3
- package/esm2022/lib/components/filter/index.mjs +0 -2
- package/esm2022/lib/components/form-field/form-field.model.mjs +0 -3
- package/esm2022/lib/components/form-field/index.mjs +0 -2
- package/esm2022/lib/components/generic-field/generic-field.model.mjs +0 -3
- package/esm2022/lib/components/generic-field/index.mjs +0 -2
- package/esm2022/lib/components/generic-form/generic-form.component.mjs +0 -10
- package/esm2022/lib/components/generic-form/index.mjs +0 -2
- package/esm2022/lib/components/header/header.model.mjs +0 -4
- package/esm2022/lib/components/header/index.mjs +0 -2
- package/esm2022/lib/components/icons/icons.component.mjs +0 -29
- package/esm2022/lib/components/icons/icons.model.mjs +0 -3
- package/esm2022/lib/components/icons/index.mjs +0 -3
- package/esm2022/lib/components/index.mjs +0 -36
- package/esm2022/lib/components/input-group/index.mjs +0 -2
- package/esm2022/lib/components/input-group/input-group.model.mjs +0 -3
- package/esm2022/lib/components/loader/index.mjs +0 -2
- package/esm2022/lib/components/loader/loader.model.mjs +0 -3
- package/esm2022/lib/components/multiselect/index.mjs +0 -2
- package/esm2022/lib/components/multiselect/mutiselect.model.mjs +0 -3
- package/esm2022/lib/components/number-input/index.mjs +0 -2
- package/esm2022/lib/components/number-input/number-input.model.mjs +0 -3
- package/esm2022/lib/components/page-header/index.mjs +0 -4
- package/esm2022/lib/components/page-header/page-header.model.mjs +0 -3
- package/esm2022/lib/components/page-header/page-header.service.mjs +0 -16
- package/esm2022/lib/components/page-header/page-headercore.component.mjs +0 -52
- package/esm2022/lib/components/password/index.mjs +0 -2
- package/esm2022/lib/components/password/password.model.mjs +0 -11
- package/esm2022/lib/components/radiobutton/index.mjs +0 -2
- package/esm2022/lib/components/radiobutton/radiobutton.model.mjs +0 -3
- package/esm2022/lib/components/section/index.mjs +0 -2
- package/esm2022/lib/components/section/section.model.mjs +0 -3
- package/esm2022/lib/components/side-menu/directives/side-menu-service.directive.mjs +0 -31
- package/esm2022/lib/components/side-menu/index.mjs +0 -5
- package/esm2022/lib/components/side-menu/services/side-menu-provider.service.mjs +0 -25
- package/esm2022/lib/components/side-menu/services/side-menu.service.mjs +0 -50
- package/esm2022/lib/components/side-menu/side-menu.model.mjs +0 -6
- package/esm2022/lib/components/slider/index.mjs +0 -2
- package/esm2022/lib/components/slider/slider.model.mjs +0 -3
- package/esm2022/lib/components/snackbar/index.mjs +0 -2
- package/esm2022/lib/components/snackbar/snackbar.model.mjs +0 -3
- package/esm2022/lib/components/stepper/index.mjs +0 -2
- package/esm2022/lib/components/stepper/stepper.model.mjs +0 -3
- package/esm2022/lib/components/switch/index.mjs +0 -2
- package/esm2022/lib/components/switch/switch.model.mjs +0 -3
- package/esm2022/lib/components/tab-view/index.mjs +0 -2
- package/esm2022/lib/components/tab-view/tab-view.model.mjs +0 -3
- package/esm2022/lib/components/table/column-configuration.mjs +0 -32
- package/esm2022/lib/components/table/index.mjs +0 -5
- package/esm2022/lib/components/table/table-builder.mjs +0 -68
- package/esm2022/lib/components/table/table-column.directive.mjs +0 -86
- package/esm2022/lib/components/table/table.models.mjs +0 -150
- package/esm2022/lib/components/table-filter/index.mjs +0 -2
- package/esm2022/lib/components/table-filter/table-filter.model.mjs +0 -3
- package/esm2022/lib/components/textarea/index.mjs +0 -2
- package/esm2022/lib/components/textarea/textarea.model.mjs +0 -3
- package/esm2022/lib/components/textfield/index.mjs +0 -2
- package/esm2022/lib/components/textfield/textfield.model.mjs +0 -3
- package/esm2022/lib/components/tristatecheckbox/index.mjs +0 -2
- package/esm2022/lib/components/tristatecheckbox/tristatecheckbox.model.mjs +0 -3
- package/esm2022/lib/components/unsubscribe.component.mjs +0 -16
- package/esm2022/lib/directives/datasource.directive.mjs +0 -175
- package/esm2022/lib/directives/index.mjs +0 -5
- package/esm2022/lib/directives/shortcut.directive.mjs +0 -46
- package/esm2022/lib/directives/table-datasource.directive.mjs +0 -124
- package/esm2022/lib/directives/table-filter.directive.mjs +0 -56
- package/esm2022/lib/format/format.mjs +0 -63
- package/esm2022/lib/pipes/error/error.codes.mjs +0 -10
- package/esm2022/lib/pipes/error/error.models.mjs +0 -21
- package/esm2022/lib/pipes/error/error.pipe.mjs +0 -31
- package/esm2022/lib/pipes/error/warning.codes.mjs +0 -4
- package/esm2022/lib/pipes/error/warning.pipe.mjs +0 -31
- package/esm2022/lib/pipes/helper/enumToList.pipe.mjs +0 -22
- package/esm2022/lib/pipes/index.mjs +0 -8
- package/esm2022/lib/pipes/keyOrFn/keyOrFn.pipe.mjs +0 -31
- package/esm2022/lib/services/confirm-dialog.service.mjs +0 -45
- package/esm2022/lib/services/index.mjs +0 -5
- package/esm2022/lib/services/leave-form.service.mjs +0 -52
- package/esm2022/lib/services/screen-size.service.mjs +0 -29
- package/esm2022/lib/services/table.service.mjs +0 -27
- package/esm2022/verisoft-ui-core.mjs +0 -5
- package/fesm2022/verisoft-ui-core.mjs +0 -2014
- package/fesm2022/verisoft-ui-core.mjs.map +0 -1
- package/lib/common/angular-helper.d.ts +0 -1
- package/lib/common/constants.d.ts +0 -3
- package/lib/common/control.models.d.ts +0 -62
- package/lib/common/datasource-component.model.d.ts +0 -19
- package/lib/common/download-file.d.ts +0 -2
- package/lib/common/filter.d.ts +0 -1
- package/lib/common/rxjs.d.ts +0 -2
- package/lib/components/action-button-group/action-button-group.model.d.ts +0 -12
- package/lib/components/action-button-group/action-button.model.d.ts +0 -14
- package/lib/components/base-form/base-form-input.component.d.ts +0 -30
- package/lib/components/base-form/base-form.component.d.ts +0 -50
- package/lib/components/base-form/directives/detail-store.directive.d.ts +0 -35
- package/lib/components/base-form/models/base-form-input.models.d.ts +0 -7
- package/lib/components/base-form/models/base-form.models.d.ts +0 -18
- package/lib/components/breadcrumb/breadcrumb.service.d.ts +0 -8
- package/lib/components/breadcrumb/breadcrumbcore.component.d.ts +0 -30
- package/lib/components/breadcrumb/index.d.ts +0 -3
- package/lib/components/button/index.d.ts +0 -1
- package/lib/components/calendar/index.d.ts +0 -1
- package/lib/components/checkbox/checkbox.model.d.ts +0 -4
- package/lib/components/checkbox/index.d.ts +0 -1
- package/lib/components/confirm-dialog/confirm-dialog.model.d.ts +0 -25
- package/lib/components/confirm-dialog/index.d.ts +0 -1
- package/lib/components/dropdown/index.d.ts +0 -1
- package/lib/components/dynamic-component/dynamic-component.model.d.ts +0 -3
- package/lib/components/dynamic-component/index.d.ts +0 -1
- package/lib/components/filter/filter.model.d.ts +0 -13
- package/lib/components/form-field/index.d.ts +0 -1
- package/lib/components/generic-field/index.d.ts +0 -1
- package/lib/components/generic-form/generic-form.component.d.ts +0 -30
- package/lib/components/header/index.d.ts +0 -1
- package/lib/components/icons/icons.component.d.ts +0 -6
- package/lib/components/icons/icons.model.d.ts +0 -6
- package/lib/components/icons/index.d.ts +0 -2
- package/lib/components/input-group/index.d.ts +0 -1
- package/lib/components/loader/index.d.ts +0 -1
- package/lib/components/loader/loader.model.d.ts +0 -3
- package/lib/components/multiselect/index.d.ts +0 -1
- package/lib/components/number-input/index.d.ts +0 -1
- package/lib/components/page-header/page-header.service.d.ts +0 -8
- package/lib/components/page-header/page-headercore.component.d.ts +0 -20
- package/lib/components/password/index.d.ts +0 -1
- package/lib/components/radiobutton/index.d.ts +0 -1
- package/lib/components/section/index.d.ts +0 -1
- package/lib/components/side-menu/directives/side-menu-service.directive.d.ts +0 -11
- package/lib/components/side-menu/services/side-menu-provider.service.d.ts +0 -10
- package/lib/components/side-menu/services/side-menu.service.d.ts +0 -15
- package/lib/components/side-menu/side-menu.model.d.ts +0 -42
- package/lib/components/slider/index.d.ts +0 -1
- package/lib/components/snackbar/index.d.ts +0 -1
- package/lib/components/snackbar/snackbar.model.d.ts +0 -3
- package/lib/components/stepper/index.d.ts +0 -1
- package/lib/components/switch/index.d.ts +0 -1
- package/lib/components/switch/switch.model.d.ts +0 -4
- package/lib/components/tab-view/index.d.ts +0 -1
- package/lib/components/table/column-configuration.d.ts +0 -12
- package/lib/components/table/table-builder.d.ts +0 -15
- package/lib/components/table/table-column.directive.d.ts +0 -25
- package/lib/components/table/table.models.d.ts +0 -132
- package/lib/components/table-filter/index.d.ts +0 -1
- package/lib/components/textarea/index.d.ts +0 -1
- package/lib/components/textfield/index.d.ts +0 -1
- package/lib/components/tristatecheckbox/index.d.ts +0 -1
- package/lib/components/tristatecheckbox/tristatecheckbox.model.d.ts +0 -4
- package/lib/components/unsubscribe.component.d.ts +0 -9
- package/lib/directives/datasource.directive.d.ts +0 -32
- package/lib/directives/shortcut.directive.d.ts +0 -11
- package/lib/directives/table-datasource.directive.d.ts +0 -29
- package/lib/directives/table-filter.directive.d.ts +0 -17
- package/lib/format/format.d.ts +0 -9
- package/lib/pipes/error/error.codes.d.ts +0 -5
- package/lib/pipes/error/error.models.d.ts +0 -8
- package/lib/pipes/error/error.pipe.d.ts +0 -8
- package/lib/pipes/error/warning.codes.d.ts +0 -5
- package/lib/pipes/error/warning.pipe.d.ts +0 -8
- package/lib/pipes/helper/enumToList.pipe.d.ts +0 -7
- package/lib/pipes/keyOrFn/keyOrFn.pipe.d.ts +0 -7
- package/lib/services/confirm-dialog.service.d.ts +0 -12
- package/lib/services/leave-form.service.d.ts +0 -13
- package/lib/services/screen-size.service.d.ts +0 -10
- package/lib/services/table.service.d.ts +0 -13
package/.eslintrc.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": ["../../../.eslintrc.base.json"],
|
|
3
|
+
"ignorePatterns": ["!**/*"],
|
|
4
|
+
"overrides": [
|
|
5
|
+
{
|
|
6
|
+
"files": ["*.ts"],
|
|
7
|
+
"extends": [
|
|
8
|
+
"plugin:@nx/angular",
|
|
9
|
+
"plugin:@angular-eslint/template/process-inline-templates"
|
|
10
|
+
],
|
|
11
|
+
"rules": {
|
|
12
|
+
"@angular-eslint/directive-selector": [
|
|
13
|
+
"error",
|
|
14
|
+
{
|
|
15
|
+
"type": "attribute",
|
|
16
|
+
"prefix": "v",
|
|
17
|
+
"style": "camelCase"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"@angular-eslint/component-selector": [
|
|
21
|
+
"error",
|
|
22
|
+
{
|
|
23
|
+
"type": "element",
|
|
24
|
+
"prefix": "v",
|
|
25
|
+
"style": "kebab-case"
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"files": ["*.html"],
|
|
32
|
+
"extends": ["plugin:@nx/angular-template"],
|
|
33
|
+
"rules": {}
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"files": ["*.json"],
|
|
37
|
+
"parser": "jsonc-eslint-parser",
|
|
38
|
+
"rules": {
|
|
39
|
+
"@nx/dependency-checks": [
|
|
40
|
+
"error",
|
|
41
|
+
{
|
|
42
|
+
"ignoredFiles": ["{projectRoot}/eslint.config.{js,cjs,mjs}"]
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
}
|
package/README.md
CHANGED
|
@@ -1,7 +1,56 @@
|
|
|
1
1
|
# ui-core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The `ui-core` library provides shared UI components, utilities, and base styles for the Verisoft Frontend workspace.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Features
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- Reusable Angular UI components
|
|
8
|
+
- Shared UI utilities and helpers
|
|
9
|
+
- Base styles and theming support
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
This package is intended for internal use within the monorepo. To use it in another library or app, add it as a dependency in your `project.json`:
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"ui-core": "*"
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
Import the required modules or components from `ui-core`:
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { UiButtonComponent } from '@verisoft/ui-core';
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Development
|
|
30
|
+
|
|
31
|
+
### Building
|
|
32
|
+
|
|
33
|
+
Run the following command to build the library:
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
nx build ui-core
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Running Unit Tests
|
|
40
|
+
|
|
41
|
+
To execute the unit tests for this library:
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
nx test ui-core
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Contributing
|
|
48
|
+
|
|
49
|
+
1. Fork the repository and create your branch from `master`.
|
|
50
|
+
2. Make your changes and add tests if needed.
|
|
51
|
+
3. Run `nx test ui-core` to ensure all tests pass.
|
|
52
|
+
4. Submit a pull request.
|
|
53
|
+
|
|
54
|
+
## License
|
|
55
|
+
|
|
56
|
+
This project is licensed under the MIT License.
|
package/jest.config.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
displayName: 'ui-core',
|
|
3
|
+
preset: '../../../jest.preset.js',
|
|
4
|
+
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
|
|
5
|
+
coverageDirectory: '../../../coverage/src/libs/ui-core',
|
|
6
|
+
transform: {
|
|
7
|
+
'^.+\\.(ts|mjs|js|html)$': [
|
|
8
|
+
'jest-preset-angular',
|
|
9
|
+
{
|
|
10
|
+
tsconfig: '<rootDir>/tsconfig.spec.json',
|
|
11
|
+
stringifyContentPathRegex: '\\.(html|svg)$',
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
},
|
|
15
|
+
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
|
|
16
|
+
snapshotSerializers: [
|
|
17
|
+
'jest-preset-angular/build/serializers/no-ng-attributes',
|
|
18
|
+
'jest-preset-angular/build/serializers/ng-snapshot',
|
|
19
|
+
'jest-preset-angular/build/serializers/html-comment',
|
|
20
|
+
],
|
|
21
|
+
};
|
package/ng-package.json
ADDED
package/package.json
CHANGED
|
@@ -1,35 +1,19 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@verisoft/ui-core",
|
|
3
|
-
"version": "18.
|
|
4
|
-
"peerDependencies": {
|
|
5
|
-
"@angular/core": "^18.2.8",
|
|
6
|
-
"@angular/router": "18.2.8",
|
|
7
|
-
"@verisoft/core": "18.
|
|
8
|
-
"@angular/forms": "18.2.8",
|
|
9
|
-
"rxjs": "~7.8.0",
|
|
10
|
-
"@angular/common": "^18.2.8",
|
|
11
|
-
"lodash-es": "^4.17.21",
|
|
12
|
-
"@verisoft/store": "18.
|
|
13
|
-
"@ngrx/store": "18.0.2",
|
|
14
|
-
"@angular/platform-browser": "18.2.8",
|
|
15
|
-
"uuid": "^10.0.0",
|
|
16
|
-
"@ngx-translate/core": "^15.0.0"
|
|
17
|
-
},
|
|
18
|
-
"sideEffects": false
|
|
19
|
-
|
|
20
|
-
"typings": "index.d.ts",
|
|
21
|
-
"exports": {
|
|
22
|
-
"./package.json": {
|
|
23
|
-
"default": "./package.json"
|
|
24
|
-
},
|
|
25
|
-
".": {
|
|
26
|
-
"types": "./index.d.ts",
|
|
27
|
-
"esm2022": "./esm2022/verisoft-ui-core.mjs",
|
|
28
|
-
"esm": "./esm2022/verisoft-ui-core.mjs",
|
|
29
|
-
"default": "./fesm2022/verisoft-ui-core.mjs"
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
"dependencies": {
|
|
33
|
-
"tslib": "^2.3.0"
|
|
34
|
-
}
|
|
35
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@verisoft/ui-core",
|
|
3
|
+
"version": "18.7.0",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/core": "^18.2.8",
|
|
6
|
+
"@angular/router": "18.2.8",
|
|
7
|
+
"@verisoft/core": "18.7.0",
|
|
8
|
+
"@angular/forms": "18.2.8",
|
|
9
|
+
"rxjs": "~7.8.0",
|
|
10
|
+
"@angular/common": "^18.2.8",
|
|
11
|
+
"lodash-es": "^4.17.21",
|
|
12
|
+
"@verisoft/store": "18.7.0",
|
|
13
|
+
"@ngrx/store": "18.0.2",
|
|
14
|
+
"@angular/platform-browser": "18.2.8",
|
|
15
|
+
"uuid": "^10.0.0",
|
|
16
|
+
"@ngx-translate/core": "^15.0.0"
|
|
17
|
+
},
|
|
18
|
+
"sideEffects": false
|
|
19
|
+
}
|
package/project.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ui-core",
|
|
3
|
+
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
+
"sourceRoot": "src/libs/ui-core/src",
|
|
5
|
+
"prefix": "lib",
|
|
6
|
+
"projectType": "library",
|
|
7
|
+
"tags": [],
|
|
8
|
+
"targets": {
|
|
9
|
+
"build": {
|
|
10
|
+
"executor": "@nx/angular:package",
|
|
11
|
+
"outputs": ["{workspaceRoot}/dist/{projectRoot}"],
|
|
12
|
+
"options": {
|
|
13
|
+
"project": "src/libs/ui-core/ng-package.json"
|
|
14
|
+
},
|
|
15
|
+
"configurations": {
|
|
16
|
+
"production": {
|
|
17
|
+
"tsConfig": "src/libs/ui-core/tsconfig.lib.prod.json"
|
|
18
|
+
},
|
|
19
|
+
"development": {
|
|
20
|
+
"tsConfig": "src/libs/ui-core/tsconfig.lib.json"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"defaultConfiguration": "production"
|
|
24
|
+
},
|
|
25
|
+
"test": {
|
|
26
|
+
"executor": "@nx/jest:jest",
|
|
27
|
+
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
|
|
28
|
+
"options": {
|
|
29
|
+
"jestConfig": "src/libs/ui-core/jest.config.ts"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"lint": {
|
|
33
|
+
"executor": "@nx/eslint:lint"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './lib/common';
|
|
2
|
-
export * from './lib/components';
|
|
3
|
-
export * from './lib/directives';
|
|
4
|
-
export * from './lib/pipes';
|
|
5
|
-
export * from './lib/services';
|
|
6
|
-
export * from './lib/format/format';
|
|
1
|
+
export * from './lib/common';
|
|
2
|
+
export * from './lib/components';
|
|
3
|
+
export * from './lib/directives';
|
|
4
|
+
export * from './lib/pipes';
|
|
5
|
+
export * from './lib/services';
|
|
6
|
+
export * from './lib/format/format';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { OnChanges, SimpleChange, SimpleChanges } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
export function setComponentProperties<TComponent>(
|
|
4
|
+
component: TComponent,
|
|
5
|
+
value: Partial<TComponent>,
|
|
6
|
+
firstChange = false
|
|
7
|
+
) {
|
|
8
|
+
if (!value || !component) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const simpleChanges = Object.keys(value).reduce(
|
|
13
|
+
(changes: SimpleChanges, property: string) => {
|
|
14
|
+
const indexedComponent = component as unknown as {
|
|
15
|
+
[key: string]: TComponent[keyof TComponent];
|
|
16
|
+
};
|
|
17
|
+
const indexedValue = value as unknown as {
|
|
18
|
+
[key: string]: TComponent[keyof TComponent];
|
|
19
|
+
};
|
|
20
|
+
const previousValue = indexedComponent[property];
|
|
21
|
+
const currentValue = indexedValue[
|
|
22
|
+
property
|
|
23
|
+
] as TComponent[keyof TComponent];
|
|
24
|
+
if (currentValue !== previousValue) {
|
|
25
|
+
indexedComponent[property] = currentValue;
|
|
26
|
+
const change = new SimpleChange(
|
|
27
|
+
previousValue,
|
|
28
|
+
currentValue,
|
|
29
|
+
firstChange
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
return { ...changes, [property]: change };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return changes;
|
|
36
|
+
},
|
|
37
|
+
{}
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
const changeableComponent = component as unknown as OnChanges;
|
|
41
|
+
if (changeableComponent['ngOnChanges']) {
|
|
42
|
+
changeableComponent.ngOnChanges(simpleChanges);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export enum ControlSeverity {
|
|
2
|
+
success = 'success',
|
|
3
|
+
info = 'info',
|
|
4
|
+
warning = 'warning',
|
|
5
|
+
danger = 'danger',
|
|
6
|
+
help = 'help',
|
|
7
|
+
primary = 'primary',
|
|
8
|
+
secondary = 'secondary',
|
|
9
|
+
contrast = 'contrast',
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export enum GovControlSeverity {
|
|
13
|
+
primary = 'primary',
|
|
14
|
+
secondary = 'secondary',
|
|
15
|
+
neutral = 'neutral',
|
|
16
|
+
error = 'error',
|
|
17
|
+
success = 'success',
|
|
18
|
+
warning = 'warning',
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export enum GovButtonType {
|
|
22
|
+
solid = 'solid',
|
|
23
|
+
outlined = "outlined",
|
|
24
|
+
base = "base",
|
|
25
|
+
link = "link"
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export enum IconPosition {
|
|
29
|
+
left = 'left',
|
|
30
|
+
right = 'right',
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export enum SlotPosition {
|
|
34
|
+
top = 'top',
|
|
35
|
+
bottom = 'bottom',
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export enum FieldSize {
|
|
39
|
+
small = 'small',
|
|
40
|
+
medium = 'medium',
|
|
41
|
+
large = 'large',
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export enum FieldAlign {
|
|
45
|
+
left = 'left',
|
|
46
|
+
center = 'center',
|
|
47
|
+
right = 'right',
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export enum FieldType {
|
|
51
|
+
text = 'text',
|
|
52
|
+
number = 'number',
|
|
53
|
+
password = 'password',
|
|
54
|
+
search = 'search',
|
|
55
|
+
date = 'date',
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export enum LayoutType {
|
|
59
|
+
horizontal = 'horizontal',
|
|
60
|
+
vertical = 'vertical',
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export type ControlSeverityType = keyof typeof ControlSeverity;
|
|
64
|
+
export type GovControlSeverityType = keyof typeof GovControlSeverity;
|
|
65
|
+
export type GovButtonTypeType = keyof typeof GovButtonType;
|
|
66
|
+
export type IconPositionType = keyof typeof IconPosition;
|
|
67
|
+
export type SlotPositionType = keyof typeof SlotPosition;
|
|
68
|
+
export type FieldSizeType = keyof typeof FieldSize;
|
|
69
|
+
export type FieldAlignType = keyof typeof FieldAlign;
|
|
70
|
+
export type FieldTypeType = keyof typeof FieldType;
|
|
71
|
+
export type LayoutTypeType = keyof typeof LayoutType;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { setDataToArray } from './datasource-component.model';
|
|
2
|
+
|
|
3
|
+
describe('setDataToArray', () => {
|
|
4
|
+
test('Should return data when target array is null and data is passed.', () => {
|
|
5
|
+
const data = ['item 1', 'item 2'];
|
|
6
|
+
const targetData = undefined;
|
|
7
|
+
|
|
8
|
+
const actual = setDataToArray(targetData, data);
|
|
9
|
+
|
|
10
|
+
expect(actual).toEqual(data);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
test('Should return data when target array is null and data is passed.', () => {
|
|
14
|
+
const data = ['item 1', 'item 2'];
|
|
15
|
+
const targetData: string[] = [];
|
|
16
|
+
|
|
17
|
+
const actual = setDataToArray(targetData, data);
|
|
18
|
+
|
|
19
|
+
expect(actual).toEqual(data);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test('Should return extended target array when target array is empty and data is passed and offset is specified.', () => {
|
|
23
|
+
const data = ['item 1', 'item 2'];
|
|
24
|
+
const targetData: string[] = [];
|
|
25
|
+
const offset = 1;
|
|
26
|
+
|
|
27
|
+
const actual = setDataToArray(targetData, data, offset);
|
|
28
|
+
|
|
29
|
+
expect(actual).toEqual([undefined, ...data]);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test('Should return target array extended to total items when data is passed and total is specified.', () => {
|
|
33
|
+
const data = ['item 1', 'item 2'];
|
|
34
|
+
const targetData: string[] = [];
|
|
35
|
+
const total = 5;
|
|
36
|
+
const offset = 0;
|
|
37
|
+
|
|
38
|
+
const actual = setDataToArray(targetData, data, offset, total);
|
|
39
|
+
|
|
40
|
+
expect(actual.length).toEqual(total);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { EventEmitter, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { FilterEvent, LazyLoadEvent, RequestParams } from '@verisoft/core';
|
|
3
|
+
|
|
4
|
+
export interface DataSourceComponentModel<TEntity> {
|
|
5
|
+
ngOnChanges?: (changes: SimpleChanges) => void;
|
|
6
|
+
lazy: boolean;
|
|
7
|
+
loading: boolean;
|
|
8
|
+
filter: boolean;
|
|
9
|
+
options: TEntity[] | undefined;
|
|
10
|
+
optionValue: string | undefined;
|
|
11
|
+
optionLabel: string | undefined;
|
|
12
|
+
showed: EventEmitter<any>;
|
|
13
|
+
cleared: EventEmitter<any>;
|
|
14
|
+
filtered: EventEmitter<FilterEvent>;
|
|
15
|
+
lazyLoad: EventEmitter<LazyLoadEvent>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function setDataToArray<T>(
|
|
19
|
+
targetArray: (T | undefined)[] | undefined,
|
|
20
|
+
data: T[],
|
|
21
|
+
offset = 0,
|
|
22
|
+
total: number | undefined = undefined,
|
|
23
|
+
defaultItem: T | undefined = undefined
|
|
24
|
+
): (T | undefined)[] {
|
|
25
|
+
const totalItems = total ?? data.length + offset;
|
|
26
|
+
if (!targetArray) {
|
|
27
|
+
targetArray = Array(totalItems).fill(defaultItem);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (targetArray.length < totalItems) {
|
|
31
|
+
targetArray = targetArray.concat(
|
|
32
|
+
new Array(totalItems - targetArray.length).fill(defaultItem)
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
for (let i = 0; i < data.length; i++) {
|
|
37
|
+
targetArray[i + offset] = data[i] ?? defaultItem;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return targetArray;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type ExtendedRequestType<T> = RequestParams<T> & { useNewData: boolean}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Observable } from "rxjs";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
|
|
3
|
+
export interface PreventUnsavedChangesCore {
|
|
4
|
+
canDeactivate: () => Observable<boolean> | Promise<boolean> | boolean;
|
|
5
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export function downloadText(
|
|
2
|
+
filename: string,
|
|
3
|
+
text: string,
|
|
4
|
+
mimeType: string | undefined = 'text/plain'
|
|
5
|
+
): void {
|
|
6
|
+
const blob = new Blob([text], { type: mimeType });
|
|
7
|
+
downloadFile(filename, blob);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function downloadFile(
|
|
11
|
+
filename: string,
|
|
12
|
+
blob: Blob
|
|
13
|
+
): void {
|
|
14
|
+
const url = window.URL.createObjectURL(blob);
|
|
15
|
+
const a = document.createElement('a');
|
|
16
|
+
a.href = url;
|
|
17
|
+
a.download = filename;
|
|
18
|
+
a.click();
|
|
19
|
+
window.URL.revokeObjectURL(url);
|
|
20
|
+
}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
export interface CommonIcons {
|
|
2
|
-
add: string;
|
|
3
|
-
minus: string;
|
|
4
|
-
delete: string;
|
|
5
|
-
filter: string;
|
|
6
|
-
download: string;
|
|
7
|
-
save: string;
|
|
8
|
-
print: string;
|
|
9
|
-
edit: string;
|
|
10
|
-
settings: string;
|
|
11
|
-
house: string;
|
|
12
|
-
calendar: string;
|
|
13
|
-
chevronRight: string;
|
|
14
|
-
chevronLeft: string;
|
|
15
|
-
chevronDown: string;
|
|
16
|
-
chevronUp: string;
|
|
17
|
-
checkbox: string;
|
|
18
|
-
warning: string;
|
|
19
|
-
search: string;
|
|
20
|
-
action: string;
|
|
21
|
-
user: string;
|
|
22
|
-
logout: string;
|
|
23
|
-
crossCircle: string;
|
|
24
|
-
infoCircle: string;
|
|
25
|
-
cross: string;
|
|
26
|
-
arrowLeft: string;
|
|
27
|
-
arrowRight: string;
|
|
28
|
-
questionCircle: string;
|
|
29
|
-
checkCircle: string;
|
|
30
|
-
sitemap: string;
|
|
31
|
-
check: string;
|
|
32
|
-
envelope: string;
|
|
33
|
-
loader: string;
|
|
34
|
-
}
|
|
1
|
+
export interface CommonIcons {
|
|
2
|
+
add: string;
|
|
3
|
+
minus: string;
|
|
4
|
+
delete: string;
|
|
5
|
+
filter: string;
|
|
6
|
+
download: string;
|
|
7
|
+
save: string;
|
|
8
|
+
print: string;
|
|
9
|
+
edit: string;
|
|
10
|
+
settings: string;
|
|
11
|
+
house: string;
|
|
12
|
+
calendar: string;
|
|
13
|
+
chevronRight: string;
|
|
14
|
+
chevronLeft: string;
|
|
15
|
+
chevronDown: string;
|
|
16
|
+
chevronUp: string;
|
|
17
|
+
checkbox: string;
|
|
18
|
+
warning: string;
|
|
19
|
+
search: string;
|
|
20
|
+
action: string;
|
|
21
|
+
user: string;
|
|
22
|
+
logout: string;
|
|
23
|
+
crossCircle: string;
|
|
24
|
+
infoCircle: string;
|
|
25
|
+
cross: string;
|
|
26
|
+
arrowLeft: string;
|
|
27
|
+
arrowRight: string;
|
|
28
|
+
questionCircle: string;
|
|
29
|
+
checkCircle: string;
|
|
30
|
+
sitemap: string;
|
|
31
|
+
check: string;
|
|
32
|
+
envelope: string;
|
|
33
|
+
loader: string;
|
|
34
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export * from './angular-helper';
|
|
2
|
-
export * from './control.models';
|
|
3
|
-
export * from './constants';
|
|
4
|
-
export * from './datasource-component.model';
|
|
5
|
-
export * from './filter';
|
|
6
|
-
export * from './notificable-property.model';
|
|
7
|
-
export * from './rxjs';
|
|
8
|
-
export * from './icons';
|
|
9
|
-
export * from './download-file';
|
|
10
|
-
export * from './deactivate-guard.model'
|
|
1
|
+
export * from './angular-helper';
|
|
2
|
+
export * from './control.models';
|
|
3
|
+
export * from './constants';
|
|
4
|
+
export * from './datasource-component.model';
|
|
5
|
+
export * from './filter';
|
|
6
|
+
export * from './notificable-property.model';
|
|
7
|
+
export * from './rxjs';
|
|
8
|
+
export * from './icons';
|
|
9
|
+
export * from './download-file';
|
|
10
|
+
export * from './deactivate-guard.model'
|
package/{lib/common/notificable-property.model.d.ts → src/lib/common/notificable-property.model.ts}
RENAMED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Observable } from "rxjs";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
|
|
3
|
+
export interface NotificableProperty {
|
|
4
|
+
propertyChanged: Observable<unknown>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { QueryList } from '@angular/core';
|
|
2
|
+
import { skip, Subject } from 'rxjs';
|
|
3
|
+
import { NotificableProperty } from './notificable-property.model';
|
|
4
|
+
import { queryListChanged } from './rxjs';
|
|
5
|
+
|
|
6
|
+
describe('queryListChanged', () => {
|
|
7
|
+
let queryList: QueryList<NotificableProperty>;
|
|
8
|
+
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
queryList = new QueryList<NotificableProperty>();
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('should emit initial value', (done) => {
|
|
14
|
+
queryListChanged(queryList).subscribe((result) => {
|
|
15
|
+
expect(result).toEqual([]);
|
|
16
|
+
done();
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should emit when propertyChanged emits', (done) => {
|
|
21
|
+
const propertyChanged = new Subject<void>();
|
|
22
|
+
const item = { propertyChanged } as NotificableProperty;
|
|
23
|
+
queryList.reset([item]);
|
|
24
|
+
queryList.notifyOnChanges();
|
|
25
|
+
|
|
26
|
+
queryListChanged(queryList)
|
|
27
|
+
.pipe(skip(1))
|
|
28
|
+
.subscribe((result) => {
|
|
29
|
+
expect(result).toEqual([item]);
|
|
30
|
+
done();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
setTimeout(() => {
|
|
34
|
+
propertyChanged.next();
|
|
35
|
+
}, 60);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('should debounce emissions', (done) => {
|
|
39
|
+
const propertyChanged = new Subject<void>();
|
|
40
|
+
const item = { propertyChanged } as NotificableProperty;
|
|
41
|
+
queryList.reset([item]);
|
|
42
|
+
queryList.notifyOnChanges();
|
|
43
|
+
|
|
44
|
+
const emittedValues: NotificableProperty[][] = [];
|
|
45
|
+
queryListChanged(queryList).subscribe((result) => {
|
|
46
|
+
emittedValues.push(result);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
propertyChanged.next();
|
|
50
|
+
propertyChanged.next();
|
|
51
|
+
|
|
52
|
+
setTimeout(() => {
|
|
53
|
+
expect(emittedValues.length).toBe(1);
|
|
54
|
+
expect(emittedValues[0]).toEqual([item]);
|
|
55
|
+
done();
|
|
56
|
+
}, 100);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { QueryList } from '@angular/core';
|
|
2
|
+
import { debounceTime, map, merge, startWith, switchMap } from 'rxjs';
|
|
3
|
+
import { NotificableProperty } from './notificable-property.model';
|
|
4
|
+
|
|
5
|
+
export function queryListChanged<TEntity>(list: QueryList<TEntity>) {
|
|
6
|
+
return list.changes.pipe(
|
|
7
|
+
startWith({}),
|
|
8
|
+
switchMap(() => {
|
|
9
|
+
const actionPropertyChanges$ = list
|
|
10
|
+
.toArray()
|
|
11
|
+
.filter((action) => (<NotificableProperty>action).propertyChanged)
|
|
12
|
+
.map((action) => (<NotificableProperty>action).propertyChanged);
|
|
13
|
+
|
|
14
|
+
return merge(...actionPropertyChanges$).pipe(
|
|
15
|
+
startWith({}),
|
|
16
|
+
map(() => list.toArray())
|
|
17
|
+
);
|
|
18
|
+
}),
|
|
19
|
+
debounceTime(50)
|
|
20
|
+
);
|
|
21
|
+
}
|