ngx-register-base 1.2.3 → 1.3.1
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/ng-package.json +15 -0
- package/package.json +12 -15
- package/schematics/ng-update/replace-menu-state-token/index.ts +33 -0
- package/schematics/ng-update/update-prefix/index.ts +38 -0
- package/schematics/utils/{utils.d.ts → utils.ts} +9 -2
- package/src/lib/components/checkbox-selector/checkbox-selector.component.html +91 -0
- package/src/lib/components/checkbox-selector/checkbox-selector.component.less +67 -0
- package/src/lib/components/checkbox-selector/checkbox-selector.component.ts +176 -0
- package/src/lib/components/checkbox-selector/checkbox-selector.types.ts +8 -0
- package/src/lib/components/column-settings/column-settings.component.html +160 -0
- package/src/lib/components/column-settings/column-settings.component.less +131 -0
- package/src/lib/components/column-settings/column-settings.component.ts +352 -0
- package/src/lib/components/column-settings/components/column-settings-template/column-settings-template.component.html +65 -0
- package/src/lib/components/column-settings/components/column-settings-template/column-settings-template.component.less +79 -0
- package/src/lib/components/column-settings/components/column-settings-template/column-settings-template.component.ts +114 -0
- package/src/lib/components/column-settings/consts/column-settings.consts.ts +9 -0
- package/src/lib/components/column-settings/types/column-settings.types.ts +26 -0
- package/src/lib/components/divider/divider.component.html +4 -0
- package/src/lib/components/divider/divider.component.less +10 -0
- package/src/lib/components/divider/divider.component.ts +12 -0
- package/src/lib/components/filter-button/filter-button.component.html +20 -0
- package/src/lib/components/filter-button/filter-button.component.less +41 -0
- package/src/lib/components/filter-button/filter-button.component.ts +18 -0
- package/src/lib/components/filters/components/filter-list/filter-edit/filter-edit.component.html +22 -0
- package/src/lib/components/filters/components/filter-list/filter-edit/filter-edit.component.less +23 -0
- package/src/lib/components/filters/components/filter-list/filter-edit/filter-edit.component.ts +31 -0
- package/src/lib/components/filters/components/filter-list/filter-list-footer/filter-list-footer.component.html +49 -0
- package/src/lib/components/filters/components/filter-list/filter-list-footer/filter-list-footer.component.less +37 -0
- package/src/lib/components/filters/components/filter-list/filter-list-footer/filter-list-footer.component.ts +66 -0
- package/src/lib/components/filters/components/filter-list/filter-list-header/filter-list-header.component.html +147 -0
- package/src/lib/components/filters/components/filter-list/filter-list-header/filter-list-header.component.less +45 -0
- package/src/lib/components/filters/components/filter-list/filter-list-header/filter-list-header.component.ts +114 -0
- package/src/lib/components/filters/components/filter-list/filter-list-saved/filter-list-saved.component.html +44 -0
- package/src/lib/components/filters/components/filter-list/filter-list-saved/filter-list-saved.component.less +49 -0
- package/src/lib/components/filters/components/filter-list/filter-list-saved/filter-list-saved.component.ts +167 -0
- package/src/lib/components/filters/components/filter-list/filter-list.service.ts +97 -0
- package/src/lib/components/filters/components/filter-list/filters-section/filters-section.component.html +18 -0
- package/src/lib/components/filters/components/filter-list/filters-section/filters-section.component.less +55 -0
- package/src/lib/components/filters/components/filter-list/filters-section/filters-section.component.ts +69 -0
- package/src/lib/components/filters/components/filter-list.module.ts +29 -0
- package/src/lib/components/filters/register-table-filter.component.html +53 -0
- package/src/lib/components/filters/register-table-filter.component.less +17 -0
- package/src/lib/components/filters/register-table-filter.component.ts +167 -0
- package/src/lib/components/filters/register-table-filter.module.ts +22 -0
- package/src/lib/components/inputs/inputs.module.ts +104 -0
- package/src/lib/components/inputs/param-calendar-year/param-calendar-year.component.html +49 -0
- package/src/lib/components/inputs/param-calendar-year/param-calendar-year.component.less +70 -0
- package/src/lib/components/inputs/param-calendar-year/param-calendar-year.component.ts +52 -0
- package/src/lib/components/inputs/param-custom/param-custom.component.html +1 -0
- package/src/lib/components/inputs/param-custom/param-custom.component.ts +9 -0
- package/src/lib/components/inputs/param-date/param-date.component.html +55 -0
- package/src/lib/components/inputs/param-date/param-date.component.less +67 -0
- package/src/lib/components/inputs/param-date/param-date.component.ts +77 -0
- package/src/lib/components/inputs/param-date-range/param-date-range.component.html +45 -0
- package/src/lib/components/inputs/param-date-range/param-date-range.component.less +75 -0
- package/src/lib/components/inputs/param-date-range/param-date-range.component.ts +67 -0
- package/src/lib/components/inputs/param-date-time/param-date-time.component.html +70 -0
- package/src/lib/components/inputs/param-date-time/param-date-time.component.less +72 -0
- package/src/lib/components/inputs/param-date-time/param-date-time.component.ts +101 -0
- package/src/lib/components/inputs/param-date-time-range/param-date-time-range.component.html +67 -0
- package/src/lib/components/inputs/param-date-time-range/param-date-time-range.component.less +103 -0
- package/src/lib/components/inputs/param-date-time-range/param-date-time-range.component.ts +128 -0
- package/src/lib/components/inputs/param-month/param-month.component.html +46 -0
- package/src/lib/components/inputs/param-month/param-month.component.less +72 -0
- package/src/lib/components/inputs/param-month/param-month.component.ts +55 -0
- package/src/lib/components/inputs/param-month-range/param-month-range.component.html +39 -0
- package/src/lib/components/inputs/param-month-range/param-month-range.component.less +71 -0
- package/src/lib/components/inputs/param-month-range/param-month-range.component.ts +76 -0
- package/src/lib/components/inputs/param-multi-select/param-multi-select.component.html +84 -0
- package/src/lib/components/inputs/param-multi-select/param-multi-select.component.less +108 -0
- package/src/lib/components/inputs/param-multi-select/param-multi-select.component.ts +448 -0
- package/src/lib/components/inputs/param-select/param-select.component.html +106 -0
- package/src/lib/components/inputs/param-select/param-select.component.less +26 -0
- package/src/lib/components/inputs/param-select/param-select.component.ts +318 -0
- package/src/lib/components/inputs/param-switcher/param-switcher.component.html +8 -0
- package/src/lib/components/inputs/param-switcher/param-switcher.component.less +53 -0
- package/src/lib/components/inputs/param-switcher/param-switcher.component.ts +13 -0
- package/src/lib/components/inputs/param-switcher-date-time-range/consts/param-switcher-date-time-range.consts.ts +29 -0
- package/src/lib/components/inputs/param-switcher-date-time-range/param-switcher-date-time-range.component.html +19 -0
- package/src/lib/components/inputs/param-switcher-date-time-range/param-switcher-date-time-range.component.less +76 -0
- package/src/lib/components/inputs/param-switcher-date-time-range/param-switcher-date-time-range.component.ts +134 -0
- package/src/lib/components/inputs/param-switcher-date-time-range/types/param-switcher-date-time-range.types.ts +8 -0
- package/src/lib/components/inputs/param-text/param-text.component.html +59 -0
- package/src/lib/components/inputs/param-text/param-text.component.less +33 -0
- package/src/lib/components/inputs/param-text/param-text.component.ts +36 -0
- package/src/lib/components/inputs/param-textarea/param-textarea.component.html +61 -0
- package/src/lib/components/inputs/param-textarea/param-textarea.component.less +21 -0
- package/src/lib/components/inputs/param-textarea/param-textarea.component.ts +33 -0
- package/src/lib/components/inputs/param-toggle/param-toggle.component.html +40 -0
- package/src/lib/components/inputs/param-toggle/param-toggle.component.less +69 -0
- package/src/lib/components/inputs/param-toggle/param-toggle.component.ts +14 -0
- package/src/lib/components/inputs/param-tree/consts/param-tree.consts.ts +59 -0
- package/src/lib/components/inputs/param-tree/param-tree.component.html +51 -0
- package/src/lib/components/inputs/param-tree/param-tree.component.less +3 -0
- package/src/lib/components/inputs/param-tree/param-tree.component.ts +282 -0
- package/src/lib/components/inputs/param-tree/services/param-tree.service.ts +176 -0
- package/src/lib/components/inputs/param-tree/services/sync-tree-loader.service.ts +18 -0
- package/{lib/components/inputs/param-tree/tokens/param-tree.tokens.d.ts → src/lib/components/inputs/param-tree/tokens/param-tree.tokens.ts} +2 -1
- package/src/lib/components/inputs/param-tree/types/param-tree.types.ts +39 -0
- package/src/lib/components/inputs/param-tree/utils/param-tree.utils.ts +18 -0
- package/src/lib/components/inputs/param-tree-multi-select/param-tree-multi-select.component.html +78 -0
- package/src/lib/components/inputs/param-tree-multi-select/param-tree-multi-select.component.less +109 -0
- package/src/lib/components/inputs/param-tree-multi-select/param-tree-multi-select.component.ts +89 -0
- package/src/lib/components/inputs/param-tree-select/param-tree-select.component.html +54 -0
- package/src/lib/components/inputs/param-tree-select/param-tree-select.component.less +56 -0
- package/src/lib/components/inputs/param-tree-select/param-tree-select.component.ts +91 -0
- package/src/lib/components/inputs/sub-components/param-delete-content-icon/param-delete-content-btn.component.html +5 -0
- package/src/lib/components/inputs/sub-components/param-delete-content-icon/param-delete-content-btn.component.ts +13 -0
- package/src/lib/components/inputs/sub-components/param-invalid-icon/param-invalid-icon.component.html +4 -0
- package/src/lib/components/inputs/sub-components/param-invalid-icon/param-invalid-icon.component.ts +11 -0
- package/src/lib/components/menu-constructor/sproc-menu-constructor.component.html +95 -0
- package/src/lib/components/menu-constructor/sproc-menu-constructor.component.less +183 -0
- package/src/lib/components/menu-constructor/sproc-menu-constructor.component.ts +687 -0
- package/src/lib/components/menu-constructor/store/sproc-abstract-menu-constructor.store.ts +32 -0
- package/src/lib/components/menu-constructor/store/sproc-menu-constructor.consts.ts +46 -0
- package/{lib/components/menu-constructor/store/sproc-menu.tokens.d.ts → src/lib/components/menu-constructor/store/sproc-menu.tokens.ts} +4 -1
- package/src/lib/components/page-menu/README.md +60 -0
- package/src/lib/components/page-menu/schema/sproc-page-menu.consts.ts +8 -0
- package/src/lib/components/page-menu/schema/sproc-page-menu.schema.ts +35 -0
- package/src/lib/components/page-menu/schema/sproc-page-menu.tokens.ts +5 -0
- package/src/lib/components/page-menu/schema/sproc-page-menu.types.ts +42 -0
- package/src/lib/components/page-menu/sproc-page-menu.component.html +166 -0
- package/src/lib/components/page-menu/sproc-page-menu.component.less +228 -0
- package/src/lib/components/page-menu/sproc-page-menu.component.ts +337 -0
- package/src/lib/components/paginator/paginator.component.html +97 -0
- package/src/lib/components/paginator/paginator.component.less +101 -0
- package/src/lib/components/paginator/paginator.component.ts +192 -0
- package/src/lib/components/paginator/types/paginator.types.ts +16 -0
- package/src/lib/components/register-table/consts/register-table.consts.ts +3 -0
- package/src/lib/components/register-table/directives/cell-template.directive.ts +11 -0
- package/src/lib/components/register-table/directives/header-template.directive.ts +11 -0
- package/src/lib/components/register-table/model/schema.ts +62 -0
- package/src/lib/components/register-table/pipes/class-by-type.pipe.ts +28 -0
- package/src/lib/components/register-table/pipes/sticky-column.pipe.ts +11 -0
- package/src/lib/components/register-table/register-table.component.html +257 -0
- package/src/lib/components/register-table/register-table.component.less +151 -0
- package/src/lib/components/register-table/register-table.component.ts +743 -0
- package/src/lib/components/reset-settings-form/reset-settings-form.component.html +14 -0
- package/src/lib/components/reset-settings-form/reset-settings-form.component.less +26 -0
- package/src/lib/components/reset-settings-form/reset-settings-form.component.ts +15 -0
- package/src/lib/components/search-input/search-input.component.html +6 -0
- package/src/lib/components/search-input/search-input.component.less +17 -0
- package/src/lib/components/search-input/search-input.component.ts +31 -0
- package/src/lib/components/sliding-panel/sliding-panel.component.html +13 -0
- package/src/lib/components/sliding-panel/sliding-panel.component.less +112 -0
- package/src/lib/components/sliding-panel/sliding-panel.component.ts +36 -0
- package/src/lib/components/sliding-panel/sliding-panel.module.ts +11 -0
- package/src/lib/consts/date-time.consts.ts +1 -0
- package/src/lib/consts/index.ts +8 -0
- package/src/lib/consts/inputs.consts.ts +9 -0
- package/src/lib/consts/month.consts.ts +82 -0
- package/src/lib/consts/params.consts.ts +1 -0
- package/src/lib/consts/register-base.consts.ts +40 -0
- package/src/lib/core/form-group-wrapper/errors-consts.ts +6 -0
- package/src/lib/core/form-group-wrapper/form-group-wrapper.ts +109 -0
- package/src/lib/core/input-control/input-control.ts +30 -0
- package/src/lib/core/param/param-base.ts +262 -0
- package/src/lib/core/param/param-date-base.ts +30 -0
- package/src/lib/core/param/param-select-base.ts +118 -0
- package/src/lib/core/param/param-text-base.ts +23 -0
- package/{lib/core/param/param.tokens.d.ts → src/lib/core/param/param.tokens.ts} +2 -1
- package/src/lib/core/register-base/register-base.store.ts +84 -0
- package/src/lib/core/register-base/register-base.ts +854 -0
- package/src/lib/directives/date/date-time.types.ts +36 -0
- package/src/lib/directives/date/format-date.pipe.ts +28 -0
- package/src/lib/directives/number/number-only.directive.ts +36 -0
- package/src/lib/directives/sticky/sticky-relative.directive.ts +30 -0
- package/src/lib/directives/sticky/sticky-relative.service.ts +34 -0
- package/src/lib/directives/sticky/sticky.directive.ts +189 -0
- package/src/lib/services/date-time.service.ts +399 -0
- package/src/lib/services/dialog/dialog.service.ts +62 -0
- package/{lib/services/dialog/dialog.types.d.ts → src/lib/services/dialog/dialog.types.ts} +8 -4
- package/src/lib/services/dom-intersection.service.ts +23 -0
- package/src/lib/services/filter/filters-state.service.ts +83 -0
- package/src/lib/services/filter/filters-transmit.service.ts +105 -0
- package/src/lib/services/filter/filters.service.ts +21 -0
- package/src/lib/services/inputs-state.service.ts +157 -0
- package/src/lib/services/inputs.service.ts +114 -0
- package/src/lib/services/key-pressed.service.ts +40 -0
- package/src/lib/services/resize-window-observer.service.ts +37 -0
- package/src/lib/services/selected-objects-state.service.ts +159 -0
- package/src/lib/store/fast-query-store.service.ts +132 -0
- package/{lib/types/event.types.d.ts → src/lib/types/event.types.ts} +1 -1
- package/src/lib/types/hasura.types.ts +41 -0
- package/src/lib/types/inputs.types.ts +63 -0
- package/src/lib/types/params.types.ts +42 -0
- package/src/lib/types/register-base.types.ts +161 -0
- package/src/lib/types/sub-types.ts +15 -0
- package/src/lib/types/user-profile.types.ts +18 -0
- package/src/lib/utils/functions.ts +11 -0
- package/src/lib/utils/get-url-segment.ts +46 -0
- package/src/lib/utils/prizm.shared.module.ts +176 -0
- package/src/lib/utils/rxjs.ts +33 -0
- package/src/lib/utils/select-all-utils.ts +16 -0
- package/tsconfig.lib.json +16 -0
- package/tsconfig.lib.prod.json +11 -0
- package/tsconfig.schematics.json +26 -0
- package/tsconfig.spec.json +15 -0
- package/esm2022/lib/components/checkbox-selector/checkbox-selector.component.mjs +0 -129
- package/esm2022/lib/components/checkbox-selector/checkbox-selector.types.mjs +0 -8
- package/esm2022/lib/components/column-settings/column-settings.component.mjs +0 -249
- package/esm2022/lib/components/column-settings/components/column-settings-template/column-settings-template.component.mjs +0 -80
- package/esm2022/lib/components/column-settings/consts/column-settings.consts.mjs +0 -10
- package/esm2022/lib/components/column-settings/index.mjs +0 -3
- package/esm2022/lib/components/column-settings/types/column-settings.types.mjs +0 -7
- package/esm2022/lib/components/divider/divider.component.mjs +0 -16
- package/esm2022/lib/components/filter-button/filter-button.component.mjs +0 -19
- package/esm2022/lib/components/filters/components/filter-list/filter-edit/filter-edit.component.mjs +0 -31
- package/esm2022/lib/components/filters/components/filter-list/filter-list-footer/filter-list-footer.component.mjs +0 -57
- package/esm2022/lib/components/filters/components/filter-list/filter-list-header/filter-list-header.component.mjs +0 -110
- package/esm2022/lib/components/filters/components/filter-list/filter-list-saved/filter-list-saved.component.mjs +0 -130
- package/esm2022/lib/components/filters/components/filter-list/filter-list.service.mjs +0 -89
- package/esm2022/lib/components/filters/components/filter-list/filters-section/filters-section.component.mjs +0 -41
- package/esm2022/lib/components/filters/components/filter-list.module.mjs +0 -45
- package/esm2022/lib/components/filters/index.mjs +0 -3
- package/esm2022/lib/components/filters/register-table-filter.component.mjs +0 -155
- package/esm2022/lib/components/filters/register-table-filter.module.mjs +0 -39
- package/esm2022/lib/components/index.mjs +0 -11
- package/esm2022/lib/components/inputs/index.mjs +0 -20
- package/esm2022/lib/components/inputs/inputs.module.mjs +0 -166
- package/esm2022/lib/components/inputs/param-calendar-year/param-calendar-year.component.mjs +0 -45
- package/esm2022/lib/components/inputs/param-custom/param-custom.component.mjs +0 -12
- package/esm2022/lib/components/inputs/param-date/param-date.component.mjs +0 -76
- package/esm2022/lib/components/inputs/param-date-range/param-date-range.component.mjs +0 -61
- package/esm2022/lib/components/inputs/param-date-time/param-date-time.component.mjs +0 -86
- package/esm2022/lib/components/inputs/param-date-time-range/param-date-time-range.component.mjs +0 -96
- package/esm2022/lib/components/inputs/param-month/param-month.component.mjs +0 -50
- package/esm2022/lib/components/inputs/param-month-range/param-month-range.component.mjs +0 -62
- package/esm2022/lib/components/inputs/param-multi-select/param-multi-select.component.mjs +0 -309
- package/esm2022/lib/components/inputs/param-select/param-select.component.mjs +0 -209
- package/esm2022/lib/components/inputs/param-switcher/param-switcher.component.mjs +0 -21
- package/esm2022/lib/components/inputs/param-switcher-date-time-range/consts/param-switcher-date-time-range.consts.mjs +0 -28
- package/esm2022/lib/components/inputs/param-switcher-date-time-range/index.mjs +0 -3
- package/esm2022/lib/components/inputs/param-switcher-date-time-range/param-switcher-date-time-range.component.mjs +0 -105
- package/esm2022/lib/components/inputs/param-switcher-date-time-range/types/param-switcher-date-time-range.types.mjs +0 -10
- package/esm2022/lib/components/inputs/param-text/param-text.component.mjs +0 -40
- package/esm2022/lib/components/inputs/param-textarea/param-textarea.component.mjs +0 -38
- package/esm2022/lib/components/inputs/param-toggle/param-toggle.component.mjs +0 -20
- package/esm2022/lib/components/inputs/param-tree/consts/param-tree.consts.mjs +0 -37
- package/esm2022/lib/components/inputs/param-tree/index.mjs +0 -8
- package/esm2022/lib/components/inputs/param-tree/param-tree.component.mjs +0 -207
- package/esm2022/lib/components/inputs/param-tree/services/param-tree.service.mjs +0 -116
- package/esm2022/lib/components/inputs/param-tree/services/sync-tree-loader.service.mjs +0 -20
- package/esm2022/lib/components/inputs/param-tree/tokens/param-tree.tokens.mjs +0 -3
- package/esm2022/lib/components/inputs/param-tree/types/param-tree.types.mjs +0 -2
- package/esm2022/lib/components/inputs/param-tree/utils/param-tree.utils.mjs +0 -9
- package/esm2022/lib/components/inputs/param-tree-multi-select/param-tree-multi-select.component.mjs +0 -80
- package/esm2022/lib/components/inputs/param-tree-select/param-tree-select.component.mjs +0 -85
- package/esm2022/lib/components/inputs/sub-components/param-delete-content-icon/param-delete-content-btn.component.mjs +0 -15
- package/esm2022/lib/components/inputs/sub-components/param-invalid-icon/param-invalid-icon.component.mjs +0 -12
- package/esm2022/lib/components/menu-constructor/index.mjs +0 -5
- package/esm2022/lib/components/menu-constructor/sproc-menu-constructor.component.mjs +0 -559
- package/esm2022/lib/components/menu-constructor/store/sproc-abstract-menu-constructor.store.mjs +0 -3
- package/esm2022/lib/components/menu-constructor/store/sproc-menu-constructor.consts.mjs +0 -5
- package/esm2022/lib/components/menu-constructor/store/sproc-menu.tokens.mjs +0 -3
- package/esm2022/lib/components/page-menu/index.mjs +0 -6
- package/esm2022/lib/components/page-menu/schema/sproc-page-menu.consts.mjs +0 -9
- package/esm2022/lib/components/page-menu/schema/sproc-page-menu.schema.mjs +0 -2
- package/esm2022/lib/components/page-menu/schema/sproc-page-menu.tokens.mjs +0 -4
- package/esm2022/lib/components/page-menu/schema/sproc-page-menu.types.mjs +0 -3
- package/esm2022/lib/components/page-menu/sproc-page-menu.component.mjs +0 -275
- package/esm2022/lib/components/paginator/paginator.component.mjs +0 -159
- package/esm2022/lib/components/paginator/types/paginator.types.mjs +0 -2
- package/esm2022/lib/components/register-table/consts/register-table.consts.mjs +0 -4
- package/esm2022/lib/components/register-table/directives/cell-template.directive.mjs +0 -19
- package/esm2022/lib/components/register-table/directives/header-template.directive.mjs +0 -18
- package/esm2022/lib/components/register-table/index.mjs +0 -4
- package/esm2022/lib/components/register-table/model/schema.mjs +0 -10
- package/esm2022/lib/components/register-table/pipes/class-by-type.pipe.mjs +0 -33
- package/esm2022/lib/components/register-table/pipes/sticky-column.pipe.mjs +0 -17
- package/esm2022/lib/components/register-table/register-table.component.mjs +0 -544
- package/esm2022/lib/components/reset-settings-form/reset-settings-form.component.mjs +0 -18
- package/esm2022/lib/components/search-input/search-input.component.mjs +0 -28
- package/esm2022/lib/components/sliding-panel/sliding-panel.component.mjs +0 -48
- package/esm2022/lib/components/sliding-panel/sliding-panel.module.mjs +0 -19
- package/esm2022/lib/consts/date-time.consts.mjs +0 -2
- package/esm2022/lib/consts/index.mjs +0 -4
- package/esm2022/lib/consts/inputs.consts.mjs +0 -4
- package/esm2022/lib/consts/month.consts.mjs +0 -77
- package/esm2022/lib/consts/params.consts.mjs +0 -2
- package/esm2022/lib/consts/register-base.consts.mjs +0 -26
- package/esm2022/lib/core/form-group-wrapper/errors-consts.mjs +0 -8
- package/esm2022/lib/core/form-group-wrapper/form-group-wrapper.mjs +0 -81
- package/esm2022/lib/core/form-group-wrapper/index.mjs +0 -2
- package/esm2022/lib/core/index.mjs +0 -5
- package/esm2022/lib/core/input-control/index.mjs +0 -2
- package/esm2022/lib/core/input-control/input-control.mjs +0 -11
- package/esm2022/lib/core/param/index.mjs +0 -6
- package/esm2022/lib/core/param/param-base.mjs +0 -215
- package/esm2022/lib/core/param/param-date-base.mjs +0 -26
- package/esm2022/lib/core/param/param-select-base.mjs +0 -114
- package/esm2022/lib/core/param/param-text-base.mjs +0 -25
- package/esm2022/lib/core/param/param.tokens.mjs +0 -4
- package/esm2022/lib/core/register-base/index.mjs +0 -3
- package/esm2022/lib/core/register-base/register-base.mjs +0 -575
- package/esm2022/lib/core/register-base/register-base.store.mjs +0 -43
- package/esm2022/lib/directives/date/date-time.types.mjs +0 -34
- package/esm2022/lib/directives/date/format-date.pipe.mjs +0 -33
- package/esm2022/lib/directives/index.mjs +0 -3
- package/esm2022/lib/directives/number/number-only.directive.mjs +0 -41
- package/esm2022/lib/directives/sticky/index.mjs +0 -3
- package/esm2022/lib/directives/sticky/sticky-relative.directive.mjs +0 -32
- package/esm2022/lib/directives/sticky/sticky-relative.service.mjs +0 -32
- package/esm2022/lib/directives/sticky/sticky.directive.mjs +0 -169
- package/esm2022/lib/services/date-time.service.mjs +0 -314
- package/esm2022/lib/services/dialog/dialog.service.mjs +0 -53
- package/esm2022/lib/services/dialog/dialog.types.mjs +0 -2
- package/esm2022/lib/services/dialog/index.mjs +0 -3
- package/esm2022/lib/services/dom-intersection.service.mjs +0 -22
- package/esm2022/lib/services/filter/filters-state.service.mjs +0 -65
- package/esm2022/lib/services/filter/filters-transmit.service.mjs +0 -82
- package/esm2022/lib/services/filter/filters.service.mjs +0 -23
- package/esm2022/lib/services/index.mjs +0 -8
- package/esm2022/lib/services/inputs-state.service.mjs +0 -130
- package/esm2022/lib/services/inputs.service.mjs +0 -88
- package/esm2022/lib/services/key-pressed.service.mjs +0 -37
- package/esm2022/lib/services/resize-window-observer.service.mjs +0 -33
- package/esm2022/lib/services/selected-objects-state.service.mjs +0 -123
- package/esm2022/lib/store/fast-query-store.service.mjs +0 -110
- package/esm2022/lib/store/index.mjs +0 -2
- package/esm2022/lib/types/event.types.mjs +0 -2
- package/esm2022/lib/types/hasura.types.mjs +0 -2
- package/esm2022/lib/types/index.mjs +0 -7
- package/esm2022/lib/types/inputs.types.mjs +0 -19
- package/esm2022/lib/types/params.types.mjs +0 -2
- package/esm2022/lib/types/register-base.types.mjs +0 -6
- package/esm2022/lib/types/sub-types.mjs +0 -2
- package/esm2022/lib/types/user-profile.types.mjs +0 -2
- package/esm2022/lib/utils/functions.mjs +0 -10
- package/esm2022/lib/utils/get-url-segment.mjs +0 -35
- package/esm2022/lib/utils/index.mjs +0 -5
- package/esm2022/lib/utils/prizm.shared.module.mjs +0 -284
- package/esm2022/lib/utils/rxjs.mjs +0 -28
- package/esm2022/lib/utils/select-all-utils.mjs +0 -11
- package/esm2022/ngx-register-base.mjs +0 -5
- package/esm2022/public-api.mjs +0 -9
- package/fesm2022/ngx-register-base.mjs +0 -7465
- package/fesm2022/ngx-register-base.mjs.map +0 -1
- package/index.d.ts +0 -5
- package/lib/components/checkbox-selector/checkbox-selector.component.d.ts +0 -33
- package/lib/components/checkbox-selector/checkbox-selector.types.d.ts +0 -7
- package/lib/components/column-settings/column-settings.component.d.ts +0 -80
- package/lib/components/column-settings/components/column-settings-template/column-settings-template.component.d.ts +0 -24
- package/lib/components/column-settings/consts/column-settings.consts.d.ts +0 -8
- package/lib/components/column-settings/types/column-settings.types.d.ts +0 -22
- package/lib/components/divider/divider.component.d.ts +0 -6
- package/lib/components/filter-button/filter-button.component.d.ts +0 -8
- package/lib/components/filters/components/filter-list/filter-edit/filter-edit.component.d.ts +0 -14
- package/lib/components/filters/components/filter-list/filter-list-footer/filter-list-footer.component.d.ts +0 -25
- package/lib/components/filters/components/filter-list/filter-list-header/filter-list-header.component.d.ts +0 -39
- package/lib/components/filters/components/filter-list/filter-list-saved/filter-list-saved.component.d.ts +0 -41
- package/lib/components/filters/components/filter-list/filter-list.service.d.ts +0 -20
- package/lib/components/filters/components/filter-list/filters-section/filters-section.component.d.ts +0 -15
- package/lib/components/filters/components/filter-list.module.d.ts +0 -15
- package/lib/components/filters/register-table-filter.component.d.ts +0 -40
- package/lib/components/filters/register-table-filter.module.d.ts +0 -13
- package/lib/components/inputs/inputs.module.d.ts +0 -31
- package/lib/components/inputs/param-calendar-year/param-calendar-year.component.d.ts +0 -19
- package/lib/components/inputs/param-custom/param-custom.component.d.ts +0 -6
- package/lib/components/inputs/param-date/param-date.component.d.ts +0 -20
- package/lib/components/inputs/param-date-range/param-date-range.component.d.ts +0 -26
- package/lib/components/inputs/param-date-time/param-date-time.component.d.ts +0 -25
- package/lib/components/inputs/param-date-time-range/param-date-time-range.component.d.ts +0 -28
- package/lib/components/inputs/param-month/param-month.component.d.ts +0 -18
- package/lib/components/inputs/param-month-range/param-month-range.component.d.ts +0 -21
- package/lib/components/inputs/param-multi-select/param-multi-select.component.d.ts +0 -46
- package/lib/components/inputs/param-select/param-select.component.d.ts +0 -30
- package/lib/components/inputs/param-switcher/param-switcher.component.d.ts +0 -8
- package/lib/components/inputs/param-switcher-date-time-range/consts/param-switcher-date-time-range.consts.d.ts +0 -2
- package/lib/components/inputs/param-switcher-date-time-range/param-switcher-date-time-range.component.d.ts +0 -19
- package/lib/components/inputs/param-switcher-date-time-range/types/param-switcher-date-time-range.types.d.ts +0 -8
- package/lib/components/inputs/param-text/param-text.component.d.ts +0 -10
- package/lib/components/inputs/param-textarea/param-textarea.component.d.ts +0 -10
- package/lib/components/inputs/param-toggle/param-toggle.component.d.ts +0 -9
- package/lib/components/inputs/param-tree/consts/param-tree.consts.d.ts +0 -7
- package/lib/components/inputs/param-tree/param-tree.component.d.ts +0 -41
- package/lib/components/inputs/param-tree/services/param-tree.service.d.ts +0 -37
- package/lib/components/inputs/param-tree/services/sync-tree-loader.service.d.ts +0 -10
- package/lib/components/inputs/param-tree/types/param-tree.types.d.ts +0 -32
- package/lib/components/inputs/param-tree/utils/param-tree.utils.d.ts +0 -7
- package/lib/components/inputs/param-tree-multi-select/param-tree-multi-select.component.d.ts +0 -31
- package/lib/components/inputs/param-tree-select/param-tree-select.component.d.ts +0 -30
- package/lib/components/inputs/sub-components/param-delete-content-icon/param-delete-content-btn.component.d.ts +0 -6
- package/lib/components/inputs/sub-components/param-invalid-icon/param-invalid-icon.component.d.ts +0 -5
- package/lib/components/menu-constructor/sproc-menu-constructor.component.d.ts +0 -113
- package/lib/components/menu-constructor/store/sproc-abstract-menu-constructor.store.d.ts +0 -24
- package/lib/components/menu-constructor/store/sproc-menu-constructor.consts.d.ts +0 -36
- package/lib/components/page-menu/schema/sproc-page-menu.consts.d.ts +0 -7
- package/lib/components/page-menu/schema/sproc-page-menu.schema.d.ts +0 -30
- package/lib/components/page-menu/schema/sproc-page-menu.tokens.d.ts +0 -3
- package/lib/components/page-menu/schema/sproc-page-menu.types.d.ts +0 -36
- package/lib/components/page-menu/sproc-page-menu.component.d.ts +0 -48
- package/lib/components/paginator/paginator.component.d.ts +0 -52
- package/lib/components/paginator/types/paginator.types.d.ts +0 -15
- package/lib/components/register-table/consts/register-table.consts.d.ts +0 -3
- package/lib/components/register-table/directives/cell-template.directive.d.ts +0 -9
- package/lib/components/register-table/directives/header-template.directive.d.ts +0 -9
- package/lib/components/register-table/model/schema.d.ts +0 -52
- package/lib/components/register-table/pipes/class-by-type.pipe.d.ts +0 -8
- package/lib/components/register-table/pipes/sticky-column.pipe.d.ts +0 -7
- package/lib/components/register-table/register-table.component.d.ts +0 -165
- package/lib/components/reset-settings-form/reset-settings-form.component.d.ts +0 -9
- package/lib/components/search-input/search-input.component.d.ts +0 -11
- package/lib/components/sliding-panel/sliding-panel.component.d.ts +0 -14
- package/lib/components/sliding-panel/sliding-panel.module.d.ts +0 -9
- package/lib/consts/date-time.consts.d.ts +0 -1
- package/lib/consts/index.d.ts +0 -3
- package/lib/consts/inputs.consts.d.ts +0 -4
- package/lib/consts/month.consts.d.ts +0 -49
- package/lib/consts/params.consts.d.ts +0 -1
- package/lib/consts/register-base.consts.d.ts +0 -19
- package/lib/core/form-group-wrapper/errors-consts.d.ts +0 -5
- package/lib/core/form-group-wrapper/form-group-wrapper.d.ts +0 -15
- package/lib/core/input-control/input-control.d.ts +0 -11
- package/lib/core/param/param-base.d.ts +0 -68
- package/lib/core/param/param-date-base.d.ts +0 -18
- package/lib/core/param/param-select-base.d.ts +0 -42
- package/lib/core/param/param-text-base.d.ts +0 -15
- package/lib/core/register-base/register-base.d.ts +0 -168
- package/lib/core/register-base/register-base.store.d.ts +0 -35
- package/lib/directives/date/date-time.types.d.ts +0 -32
- package/lib/directives/date/format-date.pipe.d.ts +0 -10
- package/lib/directives/number/number-only.directive.d.ts +0 -10
- package/lib/directives/sticky/sticky-relative.directive.d.ts +0 -13
- package/lib/directives/sticky/sticky-relative.service.d.ts +0 -15
- package/lib/directives/sticky/sticky.directive.d.ts +0 -27
- package/lib/services/date-time.service.d.ts +0 -80
- package/lib/services/dialog/dialog.service.d.ts +0 -22
- package/lib/services/dom-intersection.service.d.ts +0 -8
- package/lib/services/filter/filters-state.service.d.ts +0 -21
- package/lib/services/filter/filters-transmit.service.d.ts +0 -28
- package/lib/services/filter/filters.service.d.ts +0 -12
- package/lib/services/inputs-state.service.d.ts +0 -57
- package/lib/services/inputs.service.d.ts +0 -28
- package/lib/services/key-pressed.service.d.ts +0 -15
- package/lib/services/resize-window-observer.service.d.ts +0 -11
- package/lib/services/selected-objects-state.service.d.ts +0 -47
- package/lib/store/fast-query-store.service.d.ts +0 -19
- package/lib/types/hasura.types.d.ts +0 -35
- package/lib/types/inputs.types.d.ts +0 -41
- package/lib/types/params.types.d.ts +0 -27
- package/lib/types/register-base.types.d.ts +0 -123
- package/lib/types/sub-types.d.ts +0 -8
- package/lib/types/user-profile.types.d.ts +0 -17
- package/lib/utils/functions.d.ts +0 -3
- package/lib/utils/get-url-segment.d.ts +0 -7
- package/lib/utils/prizm.shared.module.d.ts +0 -14
- package/lib/utils/rxjs.d.ts +0 -10
- package/lib/utils/select-all-utils.d.ts +0 -8
- package/schematics/ng-update/replace-menu-state-token/index.d.ts +0 -2
- package/schematics/ng-update/replace-menu-state-token/index.js +0 -29
- package/schematics/ng-update/replace-menu-state-token/index.js.map +0 -1
- package/schematics/ng-update/update-prefix/index.d.ts +0 -2
- package/schematics/ng-update/update-prefix/index.js +0 -33
- package/schematics/ng-update/update-prefix/index.js.map +0 -1
- package/schematics/utils/utils.js +0 -25
- package/schematics/utils/utils.js.map +0 -1
- /package/{lib/components/column-settings/index.d.ts → src/lib/components/column-settings/index.ts} +0 -0
- /package/{lib/components/filters/index.d.ts → src/lib/components/filters/index.ts} +0 -0
- /package/{lib/components/index.d.ts → src/lib/components/index.ts} +0 -0
- /package/{lib/components/inputs/index.d.ts → src/lib/components/inputs/index.ts} +0 -0
- /package/{lib/components/inputs/param-switcher-date-time-range/index.d.ts → src/lib/components/inputs/param-switcher-date-time-range/index.ts} +0 -0
- /package/{lib/components/inputs/param-tree/index.d.ts → src/lib/components/inputs/param-tree/index.ts} +0 -0
- /package/{lib/components/menu-constructor/index.d.ts → src/lib/components/menu-constructor/index.ts} +0 -0
- /package/{lib/components/page-menu/index.d.ts → src/lib/components/page-menu/index.ts} +0 -0
- /package/{lib/components/register-table/index.d.ts → src/lib/components/register-table/index.ts} +0 -0
- /package/{lib/core/form-group-wrapper/index.d.ts → src/lib/core/form-group-wrapper/index.ts} +0 -0
- /package/{lib/core/index.d.ts → src/lib/core/index.ts} +0 -0
- /package/{lib/core/input-control/index.d.ts → src/lib/core/input-control/index.ts} +0 -0
- /package/{lib/core/param/index.d.ts → src/lib/core/param/index.ts} +0 -0
- /package/{lib/core/register-base/index.d.ts → src/lib/core/register-base/index.ts} +0 -0
- /package/{lib/directives/index.d.ts → src/lib/directives/index.ts} +0 -0
- /package/{lib/directives/sticky/index.d.ts → src/lib/directives/sticky/index.ts} +0 -0
- /package/{lib/services/dialog/index.d.ts → src/lib/services/dialog/index.ts} +0 -0
- /package/{lib/services/index.d.ts → src/lib/services/index.ts} +0 -0
- /package/{lib/store/index.d.ts → src/lib/store/index.ts} +0 -0
- /package/{lib/types/index.d.ts → src/lib/types/index.ts} +0 -0
- /package/{lib/utils/index.d.ts → src/lib/utils/index.ts} +0 -0
- /package/{public-api.d.ts → src/public-api.ts} +0 -0
|
@@ -0,0 +1,854 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AfterViewInit,
|
|
3
|
+
ChangeDetectorRef,
|
|
4
|
+
DestroyRef,
|
|
5
|
+
Directive,
|
|
6
|
+
inject,
|
|
7
|
+
Injector,
|
|
8
|
+
OnDestroy,
|
|
9
|
+
OnInit,
|
|
10
|
+
} from '@angular/core';
|
|
11
|
+
import { Router } from '@angular/router';
|
|
12
|
+
import {
|
|
13
|
+
BehaviorSubject,
|
|
14
|
+
catchError,
|
|
15
|
+
combineLatest,
|
|
16
|
+
debounceTime,
|
|
17
|
+
filter as rxjsFilter,
|
|
18
|
+
map,
|
|
19
|
+
Observable,
|
|
20
|
+
ReplaySubject,
|
|
21
|
+
Subscription,
|
|
22
|
+
switchMap,
|
|
23
|
+
take,
|
|
24
|
+
tap,
|
|
25
|
+
throwError,
|
|
26
|
+
} from 'rxjs';
|
|
27
|
+
import {
|
|
28
|
+
ERegisterObjectState,
|
|
29
|
+
IRegisterBase,
|
|
30
|
+
IRegisterObject,
|
|
31
|
+
ITpUserSettings,
|
|
32
|
+
ITpUserSettingsSettingsFilter,
|
|
33
|
+
ObjectsSubscriptionConfig,
|
|
34
|
+
IUserProfile,
|
|
35
|
+
EInputsAction,
|
|
36
|
+
EInputsState,
|
|
37
|
+
GqlField,
|
|
38
|
+
GqlFields,
|
|
39
|
+
} from '../../types';
|
|
40
|
+
import {
|
|
41
|
+
EColumnStatus,
|
|
42
|
+
IColumnSettings,
|
|
43
|
+
IColumnSettingsChanges,
|
|
44
|
+
} from '../../components/column-settings/types/column-settings.types';
|
|
45
|
+
import {
|
|
46
|
+
IColumnData,
|
|
47
|
+
IHasuraQueryFilter,
|
|
48
|
+
RegisterTableCellSorter,
|
|
49
|
+
ThWidthEntry,
|
|
50
|
+
} from '../../components';
|
|
51
|
+
import {
|
|
52
|
+
ApplySelectionTypes,
|
|
53
|
+
SelectionTypes,
|
|
54
|
+
} from '../../components/checkbox-selector/checkbox-selector.types';
|
|
55
|
+
import {
|
|
56
|
+
FiltersStateService,
|
|
57
|
+
FiltersService,
|
|
58
|
+
FiltersTransmitService,
|
|
59
|
+
SelectedObjectsStateService,
|
|
60
|
+
} from '../../services';
|
|
61
|
+
import {
|
|
62
|
+
SEARCH_INPUT_DEBOUNCE_TIME_MLS,
|
|
63
|
+
SETTINGS_TYPE,
|
|
64
|
+
USER_PROFILE_LOADER,
|
|
65
|
+
USER_SETTINGS_LOADER,
|
|
66
|
+
} from '../../consts/register-base.consts';
|
|
67
|
+
import { getLastSegmentOfPathName, isNonNull } from '../../utils';
|
|
68
|
+
import { FormGroupWrapper } from '../form-group-wrapper';
|
|
69
|
+
import { DEFAULT_LIMIT } from '../../services/inputs-state.service';
|
|
70
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
71
|
+
import _ from 'lodash';
|
|
72
|
+
import { ScalarUUID } from 'hasura';
|
|
73
|
+
import { RegisterBaseStore } from './register-base.store';
|
|
74
|
+
|
|
75
|
+
@Directive()
|
|
76
|
+
export abstract class RegisterBase<T extends IRegisterBase, Form = any>
|
|
77
|
+
implements OnInit, AfterViewInit, OnDestroy
|
|
78
|
+
{
|
|
79
|
+
/** Сервисы управления фильтрами */
|
|
80
|
+
protected readonly filtersService = inject(FiltersService);
|
|
81
|
+
protected readonly stateService = inject(FiltersStateService);
|
|
82
|
+
protected readonly transmitter = inject(FiltersTransmitService, { optional: true });
|
|
83
|
+
/** Сервис управления пользователем */
|
|
84
|
+
protected readonly userService = inject(USER_PROFILE_LOADER);
|
|
85
|
+
/** Сервис управления данными в реестре */
|
|
86
|
+
protected readonly baseStore = inject(RegisterBaseStore<T>, { optional: true });
|
|
87
|
+
// TODO удалить optional: true после выполнения задачи SMA2-3134
|
|
88
|
+
protected readonly selectedService = inject(SelectedObjectsStateService<T>, {
|
|
89
|
+
optional: true,
|
|
90
|
+
});
|
|
91
|
+
// TODO protected readonly navigationService = inject(NavigationService);
|
|
92
|
+
protected readonly router = inject(Router);
|
|
93
|
+
protected readonly cdr = inject(ChangeDetectorRef);
|
|
94
|
+
protected readonly destroyRef = inject(DestroyRef);
|
|
95
|
+
|
|
96
|
+
private readonly settingsService = inject(USER_SETTINGS_LOADER);
|
|
97
|
+
|
|
98
|
+
public readonly filterApplied$: Observable<boolean> = this.stateService.gqlValues$.pipe(
|
|
99
|
+
map((filter) => Number(filter.length) > 0)
|
|
100
|
+
);
|
|
101
|
+
public readonly page$ = this.stateService.page$;
|
|
102
|
+
public readonly limit$ = this.stateService.limit$;
|
|
103
|
+
public readonly selectedRecordsLoading$ = new BehaviorSubject(false);
|
|
104
|
+
|
|
105
|
+
public columnsData: IColumnData[];
|
|
106
|
+
public columns: string[];
|
|
107
|
+
public data: T[] = [];
|
|
108
|
+
public visibleData: T[] = [];
|
|
109
|
+
public dataCount = 0;
|
|
110
|
+
/** @deprecated Используйте selectedObjectsFromState */
|
|
111
|
+
public selectedObjects = new Set<any>();
|
|
112
|
+
/** @deprecated Используйте selectedIdsFromState */
|
|
113
|
+
public selectedIds = new Set<ScalarUUID>();
|
|
114
|
+
public _user = this.userService.getUserProfile();
|
|
115
|
+
public stickyLeftIds: string[] = [];
|
|
116
|
+
public stickyRightIds: string[] = [];
|
|
117
|
+
public currentFilter: IHasuraQueryFilter<T> | null = null;
|
|
118
|
+
/**
|
|
119
|
+
* Форма фильтров
|
|
120
|
+
*/
|
|
121
|
+
protected filtersForm!: FormGroupWrapper<Form>;
|
|
122
|
+
protected filterState: ITpUserSettingsSettingsFilter[] = [];
|
|
123
|
+
|
|
124
|
+
private _limit!: number;
|
|
125
|
+
private _offset!: number;
|
|
126
|
+
private _filterState!: GqlFields;
|
|
127
|
+
private _modulePath = getLastSegmentOfPathName(this.router.url);
|
|
128
|
+
private _defaultFilterApplied$ = new ReplaySubject<boolean>();
|
|
129
|
+
/**
|
|
130
|
+
* Всего записей, без учета фильтра
|
|
131
|
+
*/
|
|
132
|
+
public abstract totalNotFiltered$: Observable<number>;
|
|
133
|
+
/**
|
|
134
|
+
* Маршруты для бредкрамба
|
|
135
|
+
*/
|
|
136
|
+
public abstract routes: any[];
|
|
137
|
+
/**
|
|
138
|
+
* Контрол строки поиска
|
|
139
|
+
*/
|
|
140
|
+
public searchInput = this.filtersService.searchInput!;
|
|
141
|
+
/**
|
|
142
|
+
* Действие завершено
|
|
143
|
+
*/
|
|
144
|
+
public abstract actionCompleted$: ReplaySubject<boolean>;
|
|
145
|
+
/**
|
|
146
|
+
* Получение общего количества записей
|
|
147
|
+
*/
|
|
148
|
+
public abstract fetchTotalObjects: (
|
|
149
|
+
observableOrValue: Record<string, any> | Observable<Record<string, any>>
|
|
150
|
+
) => Subscription;
|
|
151
|
+
/**
|
|
152
|
+
* Запрос на количество отфильтрованных записей
|
|
153
|
+
*/
|
|
154
|
+
public fetchTotalFilteredObjects:
|
|
155
|
+
| ((observableOrValue: Record<string, any> | Observable<Record<string, any>>) => Subscription)
|
|
156
|
+
| undefined;
|
|
157
|
+
/**
|
|
158
|
+
* Подписка на получение всех объектов и с обратным вызовом
|
|
159
|
+
*/
|
|
160
|
+
public abstract objectsSubscription: (
|
|
161
|
+
observableOrValue: ObjectsSubscriptionConfig<T> | Observable<ObjectsSubscriptionConfig<T>>
|
|
162
|
+
) => Subscription;
|
|
163
|
+
/**
|
|
164
|
+
* Базовый фильтр, по умолчанию
|
|
165
|
+
*/
|
|
166
|
+
public abstract baseFilter: (user: IUserProfile | undefined) => Record<string, any>;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Сборка фильтра
|
|
170
|
+
*/
|
|
171
|
+
public abstract buildFilter(
|
|
172
|
+
limit?: number,
|
|
173
|
+
offset?: number,
|
|
174
|
+
gqlFilter?: GqlFields,
|
|
175
|
+
sorter?: RegisterTableCellSorter<T>[]
|
|
176
|
+
): any;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Сборка фильтров реестра
|
|
180
|
+
*/
|
|
181
|
+
protected abstract get buildForm(): FormGroupWrapper<Form>;
|
|
182
|
+
|
|
183
|
+
public get limit(): number {
|
|
184
|
+
return this._limit;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
public get offset(): number {
|
|
188
|
+
return this._offset;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** Uuid'ы всех выбранных или исключаемых объектов реестра (зависит от состояния еще не загруженных объектов) */
|
|
192
|
+
public get idsFromState(): Set<ScalarUUID> {
|
|
193
|
+
const service: SelectedObjectsStateService<T> | null = this.selectedService;
|
|
194
|
+
|
|
195
|
+
if (!service) {
|
|
196
|
+
throw new Error('SelectedObjectsStateService не запровайжен');
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return service.keys();
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/** Все выбранные uuid'ы реестра */
|
|
203
|
+
public get selectedIdsFromState(): Set<ScalarUUID> {
|
|
204
|
+
const service: SelectedObjectsStateService<T> | null = this.selectedService;
|
|
205
|
+
|
|
206
|
+
if (!service) {
|
|
207
|
+
throw new Error('SelectedObjectsStateService не запровайжен');
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return service.selectedKeys();
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/** Все выбранные объекты реестра */
|
|
214
|
+
public get selectedObjectsFromState(): Set<T> {
|
|
215
|
+
const service: SelectedObjectsStateService<T> | null = this.selectedService;
|
|
216
|
+
|
|
217
|
+
if (!service) {
|
|
218
|
+
throw new Error('SelectedObjectsStateService не запровайжен');
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return service.selectedValues();
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
private _columnsSettings: ITpUserSettings | undefined;
|
|
225
|
+
private _pageRowsLimitSetting: ITpUserSettings | undefined;
|
|
226
|
+
|
|
227
|
+
private readonly _defaultColumnsWidths: Map<string, string | undefined>;
|
|
228
|
+
|
|
229
|
+
private readonly _selectionType$ =
|
|
230
|
+
this.selectedService?.selectionType$ ?? new BehaviorSubject<ApplySelectionTypes>(null);
|
|
231
|
+
|
|
232
|
+
public readonly stateObjects = this.selectedService?.state;
|
|
233
|
+
|
|
234
|
+
protected constructor(
|
|
235
|
+
protected readonly injector: Injector,
|
|
236
|
+
columnsData: IColumnData[]
|
|
237
|
+
) {
|
|
238
|
+
this.columnsData = columnsData;
|
|
239
|
+
this._defaultColumnsWidths = new Map(columnsData.map((col) => [col.name, col.width]));
|
|
240
|
+
this.columns = this._getDefaultColumnsRecursive(columnsData);
|
|
241
|
+
this._subscribeOnSettings();
|
|
242
|
+
this._fetchSavedPageRowsLimit();
|
|
243
|
+
const state = this.router.getCurrentNavigation()?.extras?.state;
|
|
244
|
+
if (state) {
|
|
245
|
+
this.filterState = this.parseToFilters(state);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
private _subscribeOnSettings(): void {
|
|
250
|
+
this.settingsService.settings$
|
|
251
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
252
|
+
.subscribe(([userSetting]) => {
|
|
253
|
+
const { tableColumnsWidth } = userSetting?.settings ?? {};
|
|
254
|
+
const type = userSetting?.settings_type;
|
|
255
|
+
|
|
256
|
+
if (type && type !== SETTINGS_TYPE.COLUMNS) {
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
const cleanedCurrent = this._omitUndefined(
|
|
261
|
+
this._columnsSettings?.settings.tableColumnsWidth
|
|
262
|
+
);
|
|
263
|
+
const cleanedNew = this._omitUndefined(tableColumnsWidth);
|
|
264
|
+
|
|
265
|
+
if (!_.isEqual(cleanedCurrent, cleanedNew)) {
|
|
266
|
+
this._setColumnsWidth(tableColumnsWidth);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
this._columnsSettings = userSetting;
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
private _omitUndefined(arr: ThWidthEntry[] | undefined) {
|
|
274
|
+
return _.map(arr ?? [], (obj) => _.omitBy(obj, _.isUndefined));
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
private _setColumnsWidth(columnsWidth: ThWidthEntry[] | undefined): void {
|
|
278
|
+
const thsWidthMap = new Map(columnsWidth?.map(({ name, width }) => [name, width]));
|
|
279
|
+
|
|
280
|
+
this.columnsData = this.columnsData.map((col) => {
|
|
281
|
+
const defaultWidth = this._defaultColumnsWidths.get(col.name)!;
|
|
282
|
+
const currentWidth = thsWidthMap.has(col.name) ? thsWidthMap.get(col.name) : null;
|
|
283
|
+
|
|
284
|
+
const width = currentWidth === null ? defaultWidth : currentWidth;
|
|
285
|
+
|
|
286
|
+
return {
|
|
287
|
+
...col,
|
|
288
|
+
width,
|
|
289
|
+
};
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
private _fetchSavedPageRowsLimit(): void {
|
|
294
|
+
this.settingsService
|
|
295
|
+
.fetchUserSettings$(
|
|
296
|
+
{
|
|
297
|
+
id_user: {
|
|
298
|
+
_eq: this._user.id,
|
|
299
|
+
},
|
|
300
|
+
settings_type: {
|
|
301
|
+
_eq: SETTINGS_TYPE.REGISTER_PAGE_ROWS_LIMIT,
|
|
302
|
+
},
|
|
303
|
+
module_name: {
|
|
304
|
+
_eq: this._modulePath,
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
true
|
|
308
|
+
)
|
|
309
|
+
.subscribe(([firstSetting]) => {
|
|
310
|
+
this._pageRowsLimitSetting = firstSetting;
|
|
311
|
+
const { pageRowsLimit } = firstSetting?.settings ?? {};
|
|
312
|
+
|
|
313
|
+
this.stateService.setLimit(pageRowsLimit ?? DEFAULT_LIMIT);
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
public ngOnInit(): void {
|
|
318
|
+
this.filtersForm = this.buildForm;
|
|
319
|
+
this.filtersService.init(this.filtersForm);
|
|
320
|
+
this.stateService.setState({ state: EInputsState.HIDDEN, action: EInputsAction.OPEN });
|
|
321
|
+
|
|
322
|
+
this.fetchTotalObjects(this.baseFilter(this._user));
|
|
323
|
+
this._subscribeOnMutationCompleted();
|
|
324
|
+
this.subscribeOnPaging();
|
|
325
|
+
|
|
326
|
+
// TODO проверить нужна ли Перезагрузка страницы
|
|
327
|
+
// if (this.navigationService.previousUrl === null) {
|
|
328
|
+
// this.stateService.setOffset(0);
|
|
329
|
+
// this.stateService.setPage(1);
|
|
330
|
+
// }
|
|
331
|
+
|
|
332
|
+
this.baseStore?.count$?.subscribe((count) => {
|
|
333
|
+
this.dataCount = count;
|
|
334
|
+
this.stateService.setCount(count);
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
public ngAfterViewInit(searchLimiter = 2): void {
|
|
339
|
+
this._setFilters();
|
|
340
|
+
this.subscribeOnSearchChanges(searchLimiter);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
private _setFilters(): void {
|
|
344
|
+
const queryFilters = this.transmitter?.filters;
|
|
345
|
+
const querySearch = this.transmitter?.search;
|
|
346
|
+
let filters: ITpUserSettingsSettingsFilter[] | undefined;
|
|
347
|
+
|
|
348
|
+
if (querySearch) {
|
|
349
|
+
this.searchInput.setValue(querySearch);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
if (!queryFilters || queryFilters.length > 0) {
|
|
353
|
+
filters = queryFilters || [];
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
this.applyBaseFilter();
|
|
357
|
+
this._initDefaultFilter(filters);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
protected applyBaseFilter(_data?: any): void {}
|
|
361
|
+
|
|
362
|
+
public ngOnDestroy(): void {
|
|
363
|
+
this.actionCompleted$.complete();
|
|
364
|
+
this.selectedRecordsLoading$.complete();
|
|
365
|
+
this.filtersService.clear();
|
|
366
|
+
this.stateService.setOffset(0);
|
|
367
|
+
this.stateService.setGqlValues({});
|
|
368
|
+
|
|
369
|
+
if (this.searchInput?.value) {
|
|
370
|
+
this.stateService.setSearchFilterValue('');
|
|
371
|
+
this.stateService.setGqlValues(this.filtersService.gqlFilter);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
protected applyFilters(filters: ITpUserSettingsSettingsFilter[]): void {
|
|
376
|
+
this.filtersService.setUserSettingsFilterValues(filters);
|
|
377
|
+
this.stateService.setGqlValues(this.filtersService.gqlFilter);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
protected setData(data: T[], count?: number): void {
|
|
381
|
+
this.data = data;
|
|
382
|
+
|
|
383
|
+
if (count !== undefined) {
|
|
384
|
+
this.dataCount = count;
|
|
385
|
+
this.stateService.setCount(count);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
this.cdr.markForCheck();
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
protected updateAllStateObjectsByState(state: ERegisterObjectState): void {
|
|
392
|
+
this.selectedService?.setAllStateObjectsByState(state);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
protected updateStateObjectByKey(key: ScalarUUID, updates: Partial<IRegisterObject<T>>): void {
|
|
396
|
+
this.selectedService?.setStateObjectByKey(key, updates);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
protected clearSelections(data?: T[]): void {
|
|
400
|
+
this.selectedIds.clear();
|
|
401
|
+
this.selectedObjects.clear();
|
|
402
|
+
|
|
403
|
+
if (this.selectedService) {
|
|
404
|
+
this.selectedService?.resetState(data);
|
|
405
|
+
this.buildActions({
|
|
406
|
+
row: [],
|
|
407
|
+
count: 0,
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
protected actionCompleted(): void {
|
|
413
|
+
const filter = this.buildFilter(this.limit, this.offset, this._filterState);
|
|
414
|
+
this.currentFilter = filter;
|
|
415
|
+
|
|
416
|
+
this.clearSelections();
|
|
417
|
+
this.objectsSubscription({ filter });
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
protected buildActions(_data: { row: T[]; count: number }): void {}
|
|
421
|
+
|
|
422
|
+
protected subscribeOnSearchChanges(limiter: number): void {
|
|
423
|
+
this.searchInput?.valueChanges
|
|
424
|
+
.pipe(
|
|
425
|
+
rxjsFilter((value) => !value || value.length > limiter),
|
|
426
|
+
debounceTime(SEARCH_INPUT_DEBOUNCE_TIME_MLS),
|
|
427
|
+
takeUntilDestroyed(this.destroyRef)
|
|
428
|
+
)
|
|
429
|
+
.subscribe(() => {
|
|
430
|
+
this.stateService.setGqlValues(this.filtersService.gqlFilter);
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
public updateRegister(): void {
|
|
435
|
+
this.stateService.setLimit(this.stateService.limit);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
public subscribeOnPaging(): void {
|
|
439
|
+
this._defaultFilterApplied$
|
|
440
|
+
.pipe(
|
|
441
|
+
take(1),
|
|
442
|
+
switchMap(() =>
|
|
443
|
+
combineLatest([
|
|
444
|
+
this.stateService.limit$.pipe(rxjsFilter(isNonNull)),
|
|
445
|
+
this.stateService.offset$,
|
|
446
|
+
this.stateService.gqlValues$.pipe(
|
|
447
|
+
tap((data) => {
|
|
448
|
+
if (Number(data.length) > 0) {
|
|
449
|
+
this.selectChanged(null);
|
|
450
|
+
}
|
|
451
|
+
})
|
|
452
|
+
),
|
|
453
|
+
this.stateService.sorter$,
|
|
454
|
+
]).pipe(debounceTime(250))
|
|
455
|
+
),
|
|
456
|
+
catchError((e) => {
|
|
457
|
+
console.error('pagination', e);
|
|
458
|
+
|
|
459
|
+
return throwError(() => new Error(e));
|
|
460
|
+
}),
|
|
461
|
+
takeUntilDestroyed(this.destroyRef)
|
|
462
|
+
)
|
|
463
|
+
.subscribe(([limit, offset, gqlFilter, sorter]) => {
|
|
464
|
+
const filter = this.buildFilter(limit, offset, gqlFilter, sorter);
|
|
465
|
+
const gqlFilterUpdated = !_.isEqual(this._filterState, gqlFilter);
|
|
466
|
+
this.currentFilter = filter;
|
|
467
|
+
this._filterState = gqlFilter;
|
|
468
|
+
this._limit = limit;
|
|
469
|
+
this._offset = offset;
|
|
470
|
+
if (this.stateObjects) {
|
|
471
|
+
if (gqlFilterUpdated) {
|
|
472
|
+
this.selectedService?.resetState();
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
this.objectsSubscription({ filter, callback: this._setStateObjects.bind(this) });
|
|
476
|
+
} else {
|
|
477
|
+
this.objectsSubscription({ filter });
|
|
478
|
+
}
|
|
479
|
+
this.fetchTotalFilteredObjects?.(filter.where);
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
private _setStateObjects(data: T[]): void {
|
|
484
|
+
this.selectedService?.loadStateObjects(data);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
public selectChanged(value: ApplySelectionTypes): void {
|
|
488
|
+
this._selectionType$.next(value);
|
|
489
|
+
|
|
490
|
+
const stateObjects = this.stateObjects;
|
|
491
|
+
|
|
492
|
+
if (stateObjects) {
|
|
493
|
+
this._changeStateObjects(stateObjects(), value);
|
|
494
|
+
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
const filter = this._selectChangedFilter(value);
|
|
499
|
+
this.currentFilter = filter;
|
|
500
|
+
|
|
501
|
+
this.buildActions({
|
|
502
|
+
row: [...(this.selectedObjects ?? [])],
|
|
503
|
+
count: this.selectedObjects ? this.selectedObjects.size : 0,
|
|
504
|
+
});
|
|
505
|
+
|
|
506
|
+
if (!filter) {
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
this.selectedRecordsLoading$.next(true);
|
|
511
|
+
this.objectsSubscription({
|
|
512
|
+
filter,
|
|
513
|
+
callback: this._setSelected.bind(this),
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
private _changeStateObjects(
|
|
518
|
+
stateObjects: Map<ScalarUUID, IRegisterObject<T>>,
|
|
519
|
+
value: ApplySelectionTypes
|
|
520
|
+
): void {
|
|
521
|
+
if (value === SelectionTypes.ALL) {
|
|
522
|
+
this.updateAllStateObjectsByState(ERegisterObjectState.SELECTED);
|
|
523
|
+
} else if (value === SelectionTypes.INVERSE) {
|
|
524
|
+
this._inverseStateObjects(stateObjects);
|
|
525
|
+
} else if (value === SelectionTypes.VISIBLE) {
|
|
526
|
+
this._selectVisibleStateObjects();
|
|
527
|
+
} else if (typeof value === 'number') {
|
|
528
|
+
this._selectFirstNStateObjects(value);
|
|
529
|
+
} else {
|
|
530
|
+
this.clearSelections(this.data);
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
this.buildActions({
|
|
534
|
+
row: [...this.selectedObjectsFromState],
|
|
535
|
+
count: this.selectedObjectsFromState.size,
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
private _inverseStateObjects(stateObjects: Map<ScalarUUID, IRegisterObject<T>>): void {
|
|
540
|
+
for (const [key, { state }] of stateObjects) {
|
|
541
|
+
const inverseState =
|
|
542
|
+
state === ERegisterObjectState.SELECTED
|
|
543
|
+
? ERegisterObjectState.UNSELECTED
|
|
544
|
+
: ERegisterObjectState.SELECTED;
|
|
545
|
+
|
|
546
|
+
this.updateStateObjectByKey(key, { state: inverseState });
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
private _selectVisibleStateObjects(): void {
|
|
551
|
+
this.updateAllStateObjectsByState(ERegisterObjectState.UNSELECTED);
|
|
552
|
+
for (const visibleObject of this.visibleData) {
|
|
553
|
+
this.updateStateObjectByKey(visibleObject.id, { state: ERegisterObjectState.SELECTED });
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
private _selectFirstNStateObjects(value: number): void {
|
|
558
|
+
this.updateAllStateObjectsByState(ERegisterObjectState.UNSELECTED);
|
|
559
|
+
|
|
560
|
+
if (value > this.limit) {
|
|
561
|
+
const { sorter } = this.stateService;
|
|
562
|
+
const filter = this.buildFilter(
|
|
563
|
+
value,
|
|
564
|
+
this.offset,
|
|
565
|
+
this._filterState,
|
|
566
|
+
sorter.length > 0 ? sorter : undefined
|
|
567
|
+
);
|
|
568
|
+
this.objectsSubscription({
|
|
569
|
+
filter,
|
|
570
|
+
callback: this._selectFirstNLoadingObjects.bind(this),
|
|
571
|
+
noSet: true,
|
|
572
|
+
});
|
|
573
|
+
} else {
|
|
574
|
+
const firstNObjects = this.data.slice(0, value);
|
|
575
|
+
this._selectFirstNLoadingObjects(firstNObjects);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
private _selectFirstNLoadingObjects(objects: T[]): void {
|
|
580
|
+
for (const object of objects) {
|
|
581
|
+
this.updateStateObjectByKey(object.id, { state: ERegisterObjectState.SELECTED, object });
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
public filterToggle(): void {
|
|
586
|
+
this.stateService.toggle();
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
public onPaginatorChange(paginatorChange: {
|
|
590
|
+
first: number;
|
|
591
|
+
page: number;
|
|
592
|
+
pagesCount: number | null;
|
|
593
|
+
rows: number;
|
|
594
|
+
}): void {
|
|
595
|
+
const { rows, first, page } = paginatorChange;
|
|
596
|
+
|
|
597
|
+
if (this.stateService.limit !== rows) {
|
|
598
|
+
this.stateService.setLimit(rows);
|
|
599
|
+
this._savePageRowsLimit(rows);
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
if (this.stateService.offset !== first - 1) {
|
|
603
|
+
this.stateService.setOffset(first - 1);
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
if (this.stateService.page !== page) {
|
|
607
|
+
this.stateService.setPage(page);
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
private _savePageRowsLimit(pageRowsLimit: number): void {
|
|
612
|
+
this.settingsService
|
|
613
|
+
.upsertReturningOne$(SETTINGS_TYPE.REGISTER_PAGE_ROWS_LIMIT)
|
|
614
|
+
.subscribe((setting) => {
|
|
615
|
+
this._pageRowsLimitSetting = setting || undefined;
|
|
616
|
+
});
|
|
617
|
+
this.settingsService.upsertUserSettingsByUserId({
|
|
618
|
+
settings: {
|
|
619
|
+
id: this._pageRowsLimitSetting?.id,
|
|
620
|
+
settings_type: SETTINGS_TYPE.REGISTER_PAGE_ROWS_LIMIT,
|
|
621
|
+
module_name: this._modulePath,
|
|
622
|
+
settings: { pageRowsLimit },
|
|
623
|
+
},
|
|
624
|
+
hidden: true,
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
public updateColumnSettings({ settings }: IColumnSettingsChanges): void {
|
|
629
|
+
if (settings) {
|
|
630
|
+
this.stickyLeftIds = this._getColumnIdsRecursive(settings.stickyLeft);
|
|
631
|
+
this.stickyRightIds = this._getColumnIdsRecursive(
|
|
632
|
+
settings.stickyRight,
|
|
633
|
+
(el) => el.status === EColumnStatus.DEFAULT
|
|
634
|
+
);
|
|
635
|
+
this.columns = [
|
|
636
|
+
...this.stickyLeftIds,
|
|
637
|
+
...this._getColumnIdsRecursive(
|
|
638
|
+
settings.columns,
|
|
639
|
+
(el) => el.status === EColumnStatus.DEFAULT
|
|
640
|
+
),
|
|
641
|
+
...this.stickyRightIds,
|
|
642
|
+
];
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
this.cdr.markForCheck();
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
private _getColumnIdsRecursive(
|
|
649
|
+
columns: IColumnSettings[],
|
|
650
|
+
predicate?: (value: IColumnSettings, index: number, array: IColumnSettings[]) => unknown
|
|
651
|
+
): string[] {
|
|
652
|
+
const filteredColumns = predicate
|
|
653
|
+
? columns.filter((col, index, array) => predicate(col, index, array))
|
|
654
|
+
: columns;
|
|
655
|
+
|
|
656
|
+
return filteredColumns.flatMap((column) => {
|
|
657
|
+
const { id, children } = column;
|
|
658
|
+
|
|
659
|
+
if (children) {
|
|
660
|
+
return [id, ...this._getColumnIdsRecursive(children, predicate)];
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
return [id];
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
public updateSort(sort: RegisterTableCellSorter<any>[]): void {
|
|
668
|
+
this.stateService.setSorter(sort);
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
protected saveThsWidthToUserSettings(tableColumnsWidth: ThWidthEntry[]): void {
|
|
672
|
+
const settings = this._columnsSettings;
|
|
673
|
+
if (settings) {
|
|
674
|
+
settings.settings.tableColumnsWidth = tableColumnsWidth;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
this.settingsService.upsertUserSettingsByUserId({
|
|
678
|
+
settings: {
|
|
679
|
+
id: this._columnsSettings?.id,
|
|
680
|
+
settings_type: SETTINGS_TYPE.COLUMNS,
|
|
681
|
+
module_name: this._modulePath,
|
|
682
|
+
settings: { ...this._columnsSettings?.settings, tableColumnsWidth },
|
|
683
|
+
},
|
|
684
|
+
hidden: true,
|
|
685
|
+
updateSettings: true,
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
protected get filtersAreOpened(): boolean {
|
|
690
|
+
return this.stateService.state.state !== EInputsState.HIDDEN;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
private _subscribeOnMutationCompleted(): void {
|
|
694
|
+
this.actionCompleted$
|
|
695
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
696
|
+
.subscribe(() => this.actionCompleted());
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
private _initDefaultFilter(queryFilters: ITpUserSettingsSettingsFilter[] | undefined): void {
|
|
700
|
+
this.settingsService
|
|
701
|
+
.fetchUserSettings$({
|
|
702
|
+
id_user: {
|
|
703
|
+
_eq: this._user.id,
|
|
704
|
+
},
|
|
705
|
+
settings_type: {
|
|
706
|
+
_in: [SETTINGS_TYPE.FILTER, SETTINGS_TYPE.REGISTER_PINNED_INPUTS],
|
|
707
|
+
},
|
|
708
|
+
module_name: {
|
|
709
|
+
_eq: this._modulePath,
|
|
710
|
+
},
|
|
711
|
+
})
|
|
712
|
+
.pipe(take(1))
|
|
713
|
+
.subscribe((userSettings) => {
|
|
714
|
+
const pinnedFilter = userSettings.find(
|
|
715
|
+
({ settings_type: type }) => type === SETTINGS_TYPE.REGISTER_PINNED_INPUTS
|
|
716
|
+
);
|
|
717
|
+
const isPinned = !!pinnedFilter?.settings.pinned;
|
|
718
|
+
const favoriteFilter = userSettings.find(({ settings }) => settings.favorite);
|
|
719
|
+
|
|
720
|
+
if (isPinned) {
|
|
721
|
+
this.stateService.setPin(true);
|
|
722
|
+
this.stateService.setState({
|
|
723
|
+
state: EInputsState.FILTER_LIST,
|
|
724
|
+
action: EInputsAction.APPLY_SAVED_FILTER,
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
if (queryFilters || this.searchInput?.getRawValue()) {
|
|
729
|
+
this.applyFilters(queryFilters ?? []);
|
|
730
|
+
} else if (pinnedFilter && isPinned) {
|
|
731
|
+
this._applyFilterSettings(pinnedFilter);
|
|
732
|
+
} else if (favoriteFilter) {
|
|
733
|
+
this._applyFilterSettings(favoriteFilter);
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
this._defaultFilterApplied$.next(true);
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
private _applyFilterSettings(settings: ITpUserSettings): void {
|
|
741
|
+
this.filtersService.setUserSettingsFilterValues(settings.settings.filter ?? []);
|
|
742
|
+
const { gqlFilter } = this.filtersService;
|
|
743
|
+
this.stateService.setGqlValues(gqlFilter);
|
|
744
|
+
this.stateService.setState({
|
|
745
|
+
state: EInputsState.HIDDEN,
|
|
746
|
+
action: EInputsAction.APPLY_SAVED_FILTER,
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
private _selectChangedFilter(selection: ApplySelectionTypes): any {
|
|
751
|
+
let filter = null;
|
|
752
|
+
|
|
753
|
+
if (selection === null) {
|
|
754
|
+
this.clearSelections();
|
|
755
|
+
return;
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
if (selection === SelectionTypes.ALL || typeof selection === 'number') {
|
|
759
|
+
filter = this._handleAllOrNumberSelection(selection);
|
|
760
|
+
} else if (selection === SelectionTypes.VISIBLE) {
|
|
761
|
+
this._selectVisibleItems();
|
|
762
|
+
} else if (selection === SelectionTypes.INVERSE) {
|
|
763
|
+
filter = this._handleInverseSelection();
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
return filter;
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
private _handleAllOrNumberSelection(selection: ApplySelectionTypes): any {
|
|
770
|
+
let filter = null;
|
|
771
|
+
const { sorter } = this.stateService;
|
|
772
|
+
|
|
773
|
+
if (selection === SelectionTypes.ALL) {
|
|
774
|
+
filter = this.buildFilter(undefined, undefined, this._filterState);
|
|
775
|
+
} else if (typeof selection === 'number') {
|
|
776
|
+
if (selection > this.limit) {
|
|
777
|
+
filter = this.buildFilter(
|
|
778
|
+
selection,
|
|
779
|
+
0,
|
|
780
|
+
this._filterState,
|
|
781
|
+
sorter.length > 0 ? sorter : undefined
|
|
782
|
+
);
|
|
783
|
+
} else {
|
|
784
|
+
this._selectFirstNItems(selection);
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
return filter;
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
private _selectFirstNItems(count: number): void {
|
|
792
|
+
this.selectedObjects = new Set(this.data.slice(0, count));
|
|
793
|
+
this.selectedIds = new Set(this.data.map((d) => d.id).slice(0, count));
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
private _selectVisibleItems(): void {
|
|
797
|
+
this.selectedObjects = new Set(this.visibleData);
|
|
798
|
+
this.selectedIds = new Set(this.visibleData.map((d) => d.id));
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
private _handleInverseSelection(): any {
|
|
802
|
+
const inverseFilter = { id: { _nin: [...this.selectedIds] } } as GqlField;
|
|
803
|
+
const updatedFilterState = Array.isArray(this._filterState)
|
|
804
|
+
? [...this._filterState, inverseFilter]
|
|
805
|
+
: [this._filterState, inverseFilter];
|
|
806
|
+
|
|
807
|
+
return this.buildFilter(undefined, undefined, updatedFilterState);
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
private _setSelected(data: T[]): void {
|
|
811
|
+
this.selectedObjects = new Set(data);
|
|
812
|
+
this.selectedIds = new Set(data.map((d) => d.id));
|
|
813
|
+
this.selectedRecordsLoading$.next(false);
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
protected parseToFilters(input: { [key: string]: any }): ITpUserSettingsSettingsFilter[] {
|
|
817
|
+
return Object.entries(input).map(([key, value]) => ({
|
|
818
|
+
id: key,
|
|
819
|
+
value,
|
|
820
|
+
}));
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
protected get selectedCount(): number {
|
|
824
|
+
const selectedSize = this.selectedService?.selectedValues()?.size ?? null;
|
|
825
|
+
const unselectedSize = this.selectedService?.unselectedValues()?.size ?? 0;
|
|
826
|
+
const unfetchedObjects = this.selectedService?.stateUnfetchedObjects();
|
|
827
|
+
const isNotSelected = unfetchedObjects !== ERegisterObjectState.SELECTED;
|
|
828
|
+
|
|
829
|
+
if (selectedSize === null) {
|
|
830
|
+
return this.selectedIds.size;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
return isNotSelected ? selectedSize : this.dataCount - unselectedSize;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
private _getDefaultColumnsRecursive(columnsData: IColumnData[]): string[] {
|
|
837
|
+
return columnsData.flatMap((column) => {
|
|
838
|
+
const { name, children } = column;
|
|
839
|
+
|
|
840
|
+
if (children) {
|
|
841
|
+
return [name, ...this._getDefaultColumnsRecursive(children)];
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
return [name];
|
|
845
|
+
});
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
protected get notAllFetched(): boolean {
|
|
849
|
+
const unfetchedState = this.selectedService!.stateUnfetchedObjects();
|
|
850
|
+
const allFetched = this.stateObjects!().size === this.dataCount;
|
|
851
|
+
|
|
852
|
+
return unfetchedState === ERegisterObjectState.SELECTED && !allFetched;
|
|
853
|
+
}
|
|
854
|
+
}
|