@zeedhi/common 3.0.2 → 3.0.4
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/coverage/clover.xml +1712 -3006
- package/coverage/coverage-final.json +142 -171
- package/coverage/lcov-report/index.html +40 -130
- package/coverage/lcov-report/src/components/index.html +5 -5
- package/coverage/lcov-report/src/components/index.ts.html +154 -160
- package/coverage/lcov-report/src/components/zd-alert/alert.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-alert/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-badge/badge.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-badge/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-breadcrumbs/breadcrumbs.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-breadcrumbs/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-button/button.ts.html +35 -35
- package/coverage/lcov-report/src/components/zd-button/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-button-group/button-group.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-button-group/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-card/card.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-card/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-carousel/carousel.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-carousel/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-checkbox/checkbox.ts.html +5 -5
- package/coverage/lcov-report/src/components/zd-checkbox/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-checkbox-multiple/checkbox-multiple.ts.html +6 -6
- package/coverage/lcov-report/src/components/zd-checkbox-multiple/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-chip/chip.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-chip/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-code-viewer/code-viewer.ts.html +4 -4
- package/coverage/lcov-report/src/components/zd-code-viewer/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-col/col.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-col/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-collapse-card/collapse-card.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-collapse-card/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-component/child-not-found.ts.html +2 -2
- package/coverage/lcov-report/src/components/zd-component/component-render.ts.html +5 -5
- package/coverage/lcov-report/src/components/zd-component/component.ts.html +63 -63
- package/coverage/lcov-report/src/components/zd-component/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-container/container.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-container/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-currency/currency.ts.html +9 -9
- package/coverage/lcov-report/src/components/zd-currency/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-date-input/date-input.ts.html +33 -15
- package/coverage/lcov-report/src/components/zd-date-input/index.html +7 -7
- package/coverage/lcov-report/src/components/zd-date-range/date-range.ts.html +146 -38
- package/coverage/lcov-report/src/components/zd-date-range/index.html +9 -9
- package/coverage/lcov-report/src/components/zd-dialog/dialog.ts.html +30 -30
- package/coverage/lcov-report/src/components/zd-dialog/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-divider/divider.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-divider/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-dropdown/dropdown.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-dropdown/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-footer/footer.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-footer/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-form/form.ts.html +22 -22
- package/coverage/lcov-report/src/components/zd-form/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-frame/frame.ts.html +7 -7
- package/coverage/lcov-report/src/components/zd-frame/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-frame-page/frame-page.ts.html +4 -4
- package/coverage/lcov-report/src/components/zd-frame-page/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-grid/data-navigator.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-grid/data-selector.ts.html +4 -4
- package/coverage/lcov-report/src/components/zd-grid/grid-column.ts.html +11 -11
- package/coverage/lcov-report/src/components/zd-grid/grid-events.ts.html +4 -4
- package/coverage/lcov-report/src/components/zd-grid/grid.ts.html +85 -85
- package/coverage/lcov-report/src/components/zd-grid/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-grid/index.ts.html +12 -12
- package/coverage/lcov-report/src/components/zd-grid/iterable-table.ts.html +11 -11
- package/coverage/lcov-report/src/components/zd-grid/keymap-merger.ts.html +15 -15
- package/coverage/lcov-report/src/components/zd-grid/keymap-navigation.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-grid/table-action-builder.ts.html +5 -5
- package/coverage/lcov-report/src/components/zd-grid/view-navigator.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-grid-editable/data-editor-with-add.ts.html +32 -32
- package/coverage/lcov-report/src/components/zd-grid-editable/data-editor.ts.html +15 -15
- package/coverage/lcov-report/src/components/zd-grid-editable/errors/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-grid-editable/errors/index.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-grid-editable/errors/not-editing.ts.html +2 -2
- package/coverage/lcov-report/src/components/zd-grid-editable/errors/row-not-found.ts.html +2 -2
- package/coverage/lcov-report/src/components/zd-grid-editable/grid-column-editable.ts.html +7 -7
- package/coverage/lcov-report/src/components/zd-grid-editable/grid-editable-controller.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-grid-editable/grid-editable-events.ts.html +5 -5
- package/coverage/lcov-report/src/components/zd-grid-editable/grid-editable.ts.html +9 -9
- package/coverage/lcov-report/src/components/zd-grid-editable/index.html +5 -5
- package/coverage/lcov-report/src/components/zd-grid-editable/index.ts.html +13 -10
- package/coverage/lcov-report/src/components/zd-grid-editable/keymap-editing.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-header/header.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-header/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-icon/icon.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-icon/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-image/image.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-image/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-increment/increment.ts.html +5 -5
- package/coverage/lcov-report/src/components/zd-increment/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-input/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-input/input-factory.ts.html +4 -4
- package/coverage/lcov-report/src/components/zd-input/input.ts.html +48 -48
- package/coverage/lcov-report/src/components/zd-iterable/column-not-found.ts.html +2 -2
- package/coverage/lcov-report/src/components/zd-iterable/column.ts.html +96 -96
- package/coverage/lcov-report/src/components/zd-iterable/conditions-manager.ts.html +24 -24
- package/coverage/lcov-report/src/components/zd-iterable/index.html +15 -15
- package/coverage/lcov-report/src/components/zd-iterable/iterable-columns-button-controller.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-iterable/iterable-columns-button.ts.html +15 -15
- package/coverage/lcov-report/src/components/zd-iterable/iterable-controller.ts.html +4 -4
- package/coverage/lcov-report/src/components/zd-iterable/iterable-page-component.ts.html +5 -5
- package/coverage/lcov-report/src/components/zd-iterable/iterable-page-info.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-iterable/iterable-page-size.ts.html +5 -5
- package/coverage/lcov-report/src/components/zd-iterable/iterable-pagination.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-iterable/iterable.ts.html +43 -43
- package/coverage/lcov-report/src/components/zd-iterable/search.ts.html +8 -8
- package/coverage/lcov-report/src/components/zd-iterable-component-render/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-iterable-component-render/iterable-component-render.ts.html +5 -5
- package/coverage/lcov-report/src/components/zd-layout/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-layout/layout.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-list/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-list/item-not-found.ts.html +2 -2
- package/coverage/lcov-report/src/components/zd-list/list-group.ts.html +4 -4
- package/coverage/lcov-report/src/components/zd-list/list-item.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-list/list.ts.html +4 -4
- package/coverage/lcov-report/src/components/zd-loading/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-loading/loading.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-login/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-login/login-button.ts.html +4 -4
- package/coverage/lcov-report/src/components/zd-login/login.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-main/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-main/main.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-master-detail/detail-not-found.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-master-detail/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-master-detail/master-detail.ts.html +6 -6
- package/coverage/lcov-report/src/components/zd-master-detail/master-not-found.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-menu/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-menu/menu-button.ts.html +4 -4
- package/coverage/lcov-report/src/components/zd-menu/menu-group.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-menu/menu-link.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-menu/menu-separator.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-menu/menu.ts.html +4 -4
- package/coverage/lcov-report/src/components/zd-modal/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-modal/modal-close-button.ts.html +4 -4
- package/coverage/lcov-report/src/components/zd-modal/modal.ts.html +27 -27
- package/coverage/lcov-report/src/components/zd-month/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-month/month.ts.html +6 -6
- package/coverage/lcov-report/src/components/zd-number-input/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-number-input/number-input.ts.html +9 -9
- package/coverage/lcov-report/src/components/zd-password/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-password/password.ts.html +7 -7
- package/coverage/lcov-report/src/components/zd-progress/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-progress/progress.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-radio/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-radio/radio.ts.html +6 -6
- package/coverage/lcov-report/src/components/zd-row/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-row/row.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-select/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-select/select.ts.html +9 -9
- package/coverage/lcov-report/src/components/zd-select-multiple/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-select-multiple/select-multiple.ts.html +5 -5
- package/coverage/lcov-report/src/components/zd-svg-map/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-svg-map/svg-map.ts.html +4 -4
- package/coverage/lcov-report/src/components/zd-switch/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-switch/switch.ts.html +5 -5
- package/coverage/lcov-report/src/components/zd-table/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-table/table.ts.html +4 -4
- package/coverage/lcov-report/src/components/zd-tabs/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-tabs/tab-not-found.ts.html +2 -2
- package/coverage/lcov-report/src/components/zd-tabs/tab.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-tabs/tabs.ts.html +5 -5
- package/coverage/lcov-report/src/components/zd-tag/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-tag/tag.ts.html +4 -4
- package/coverage/lcov-report/src/components/zd-text/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-text/text.ts.html +10 -10
- package/coverage/lcov-report/src/components/zd-text-input/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-text-input/text-input.ts.html +25 -16
- package/coverage/lcov-report/src/components/zd-textarea/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-textarea/textarea.ts.html +5 -5
- package/coverage/lcov-report/src/components/zd-time/index.html +7 -7
- package/coverage/lcov-report/src/components/zd-time/time-format-selector.ts.html +2 -2
- package/coverage/lcov-report/src/components/zd-time/time.ts.html +32 -14
- package/coverage/lcov-report/src/components/zd-toggleable/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-toggleable/toggleable.ts.html +5 -5
- package/coverage/lcov-report/src/components/zd-tooltip/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-tooltip/tooltip.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-tree/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-tree/tree.ts.html +7 -7
- package/coverage/lcov-report/src/components/zd-tree-grid/index.html +1 -1
- package/coverage/lcov-report/src/components/zd-tree-grid/index.ts.html +7 -7
- package/coverage/lcov-report/src/components/zd-tree-grid/iterable-tree.ts.html +2 -2
- package/coverage/lcov-report/src/components/zd-tree-grid/keymap-tree.ts.html +2 -2
- package/coverage/lcov-report/src/components/zd-tree-grid/tree-data-navigator.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-tree-grid/tree-data-selector.ts.html +3 -3
- package/coverage/lcov-report/src/components/zd-tree-grid/tree-grid.ts.html +11 -11
- package/coverage/lcov-report/src/error/delete-rows.ts.html +3 -3
- package/coverage/lcov-report/src/error/index.html +9 -24
- package/coverage/lcov-report/src/error/index.ts.html +94 -0
- package/coverage/lcov-report/src/error/non-initialized.ts.html +5 -5
- package/coverage/lcov-report/src/error/zeedhi-error.ts.html +3 -3
- package/coverage/lcov-report/src/index.html +5 -5
- package/coverage/lcov-report/src/index.ts.html +13 -13
- package/coverage/lcov-report/src/services/index.html +1 -1
- package/coverage/lcov-report/src/services/index.ts.html +5 -5
- package/coverage/lcov-report/src/services/zd-alert/alert-queue.ts.html +3 -3
- package/coverage/lcov-report/src/services/zd-alert/alert-replace.ts.html +3 -3
- package/coverage/lcov-report/src/services/zd-alert/alert-service.ts.html +5 -5
- package/coverage/lcov-report/src/services/zd-alert/alert-stack.ts.html +3 -3
- package/coverage/lcov-report/src/services/zd-alert/index.html +1 -1
- package/coverage/lcov-report/src/services/zd-alert/index.ts.html +6 -6
- package/coverage/lcov-report/src/services/zd-dialog/dialog-service.ts.html +4 -4
- package/coverage/lcov-report/src/services/zd-dialog/index.html +1 -1
- package/coverage/lcov-report/src/services/zd-loading/index.html +1 -1
- package/coverage/lcov-report/src/services/zd-loading/loading-service.ts.html +2 -2
- package/coverage/lcov-report/src/services/zd-modal/index.html +1 -1
- package/coverage/lcov-report/src/services/zd-modal/modal-service.ts.html +10 -10
- package/coverage/lcov-report/src/utils/data-value-out/data-value-out.ts.html +3 -3
- package/coverage/lcov-report/src/utils/data-value-out/index.html +1 -1
- package/coverage/lcov-report/src/utils/data-value-out/index.ts.html +3 -3
- package/coverage/lcov-report/src/utils/datasource-searcher/datasource-searcher.ts.html +3 -3
- package/coverage/lcov-report/src/utils/datasource-searcher/index.html +1 -1
- package/coverage/lcov-report/src/utils/datasource-searcher/index.ts.html +3 -3
- package/coverage/lcov-report/src/utils/icons/icons.ts.html +6 -6
- package/coverage/lcov-report/src/utils/icons/index.html +1 -1
- package/coverage/lcov-report/src/utils/index.html +7 -22
- package/coverage/lcov-report/src/utils/index.ts.html +10 -19
- package/coverage/lcov-report/src/utils/omit/index.html +1 -1
- package/coverage/lcov-report/src/utils/omit/omit.ts.html +2 -2
- package/coverage/lcov-report/src/utils/theme/index.html +1 -1
- package/coverage/lcov-report/src/utils/theme/theme.ts.html +4 -4
- package/coverage/lcov-report/src/utils/tree-data-structure/index.html +1 -1
- package/coverage/lcov-report/src/utils/tree-data-structure/index.ts.html +3 -3
- package/coverage/lcov-report/src/utils/tree-data-structure/tree-data-structure.ts.html +2 -2
- package/coverage/lcov-report/src/utils/unique-by/index.html +1 -1
- package/coverage/lcov-report/src/utils/unique-by/unique-by.ts.html +3 -3
- package/coverage/lcov-report/tests/unit/components/zd-component/ComponentMock.ts.html +1 -1
- package/coverage/lcov-report/tests/unit/components/zd-component/index.html +1 -1
- package/coverage/lcov.info +2471 -5080
- package/dist/types/components/index.d.ts +0 -1
- package/dist/types/components/zd-date-input/date-input.d.ts +1 -0
- package/dist/types/components/zd-date-range/date-range.d.ts +8 -2
- package/dist/types/components/zd-grid-editable/index.d.ts +1 -0
- package/dist/types/components/zd-text-input/interfaces.d.ts +1 -0
- package/dist/types/components/zd-text-input/text-input.d.ts +1 -0
- package/dist/types/components/zd-time/time.d.ts +1 -0
- package/dist/types/error/index.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/utils/index.d.ts +0 -3
- package/dist/zd-common.js +185 -3432
- package/dist/zd-common.min.js +185 -3432
- package/package.json +3 -3
- package/src/components/index.ts +0 -2
- package/src/components/zd-date-input/date-input.ts +6 -0
- package/src/components/zd-date-range/date-range.ts +47 -11
- package/src/components/zd-grid-editable/index.ts +1 -0
- package/src/components/zd-text-input/interfaces.ts +1 -0
- package/src/components/zd-text-input/text-input.ts +3 -0
- package/src/components/zd-time/time.ts +7 -1
- package/src/error/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/utils/index.ts +0 -3
- package/src/components/tek-grid/columns-searcher.ts +0 -22
- package/src/components/tek-grid/dynamic-filter-datasource-factory.ts +0 -20
- package/src/components/tek-grid/filter-helper.ts +0 -20
- package/src/components/tek-grid/grid-filter-button.ts +0 -422
- package/src/components/tek-grid/grouped-data-manager.ts +0 -448
- package/src/components/tek-grid/grouped-data-selector.ts +0 -40
- package/src/components/tek-grid/grouped-view-navigator.ts +0 -85
- package/src/components/tek-grid/index.ts +0 -18
- package/src/components/tek-grid/interfaces.ts +0 -329
- package/src/components/tek-grid/keymap-grouped.ts +0 -21
- package/src/components/tek-grid/layout-options.ts +0 -248
- package/src/components/tek-grid/tek-datasource/index.ts +0 -3
- package/src/components/tek-grid/tek-datasource/interfaces.ts +0 -36
- package/src/components/tek-grid/tek-datasource/tek-memory-datasource.ts +0 -314
- package/src/components/tek-grid/tek-datasource/tek-rest-datasource.ts +0 -224
- package/src/components/tek-grid/tek-grid-column.ts +0 -193
- package/src/components/tek-grid/tek-grid-columns-button/tek-grid-columns-button-controller.ts +0 -28
- package/src/components/tek-grid/tek-grid-columns-button/tek-grid-columns-button.ts +0 -37
- package/src/components/tek-grid/tek-grid-controller.ts +0 -140
- package/src/components/tek-grid/tek-grid-events.ts +0 -105
- package/src/components/tek-grid/tek-grid-toolbar-provider/export-options/button-option.ts +0 -26
- package/src/components/tek-grid/tek-grid-toolbar-provider/export-options/index.ts +0 -3
- package/src/components/tek-grid/tek-grid-toolbar-provider/export-options/interfaces.ts +0 -6
- package/src/components/tek-grid/tek-grid-toolbar-provider/export-options/multi-option.ts +0 -85
- package/src/components/tek-grid/tek-grid-toolbar-provider/index.ts +0 -2
- package/src/components/tek-grid/tek-grid-toolbar-provider/tek-grid-toolbar-provider.ts +0 -367
- package/src/components/tek-grid/tek-grid.ts +0 -1122
- package/src/error/tek-grid-delete-rows.ts +0 -15
- package/src/error/teknisa-common-error.ts +0 -8
- package/src/utils/config/config.ts +0 -8
- package/src/utils/is-filled-object/is-filled-object.ts +0 -5
- package/src/utils/is-nil.ts +0 -3
- package/tests/unit/components/tek-grid/button-option.spec.ts +0 -49
- package/tests/unit/components/tek-grid/columns-searcher.spec.ts +0 -112
- package/tests/unit/components/tek-grid/dynamic-filter-datasource-factory.spec.ts +0 -90
- package/tests/unit/components/tek-grid/filter-helper.spec.ts +0 -52
- package/tests/unit/components/tek-grid/grid-filter-button.spec.ts +0 -842
- package/tests/unit/components/tek-grid/grouped-data-manager.spec.ts +0 -593
- package/tests/unit/components/tek-grid/grouped-data-selector.spec.ts +0 -136
- package/tests/unit/components/tek-grid/grouped-view-navigator.spec.ts +0 -244
- package/tests/unit/components/tek-grid/keymap-grouped.spec.ts +0 -20
- package/tests/unit/components/tek-grid/layout-options.spec.ts +0 -1020
- package/tests/unit/components/tek-grid/multi-option.spec.ts +0 -139
- package/tests/unit/components/tek-grid/tek-grid-column.spec.ts +0 -312
- package/tests/unit/components/tek-grid/tek-grid-columns-button.spec.ts +0 -228
- package/tests/unit/components/tek-grid/tek-grid-controller.spec.ts +0 -253
- package/tests/unit/components/tek-grid/tek-grid-events.spec.ts +0 -186
- package/tests/unit/components/tek-grid/tek-grid-toolbar-provider.spec.ts +0 -34
- package/tests/unit/components/tek-grid/tek-grid.spec.ts +0 -895
- package/tests/unit/components/tek-grid/tek-memory-datasource.spec.ts +0 -482
- package/tests/unit/components/tek-grid/tek-rest-datasource.spec.ts +0 -422
package/dist/zd-common.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Metadata, Utils, DatasourceFactory, AccessorManager, Event, KeyMap, FormatterParserProvider, Validation, Mask, Accessor, Loader, dayjs, Config, I18n, DateHelper, Router, MethodNotAssignedError, Http, Cookie, ViewService, InstanceNotFoundError
|
|
1
|
+
import { Metadata, Utils, DatasourceFactory, AccessorManager, Event, KeyMap, FormatterParserProvider, Validation, Mask, Accessor, Loader, dayjs, Config, I18n, DateHelper, Router, MethodNotAssignedError, Http, Cookie, ViewService, InstanceNotFoundError } from '@zeedhi/core';
|
|
2
2
|
import AutoNumeric from '@zeedhi/autonumeric';
|
|
3
3
|
export { default as AutoNumeric } from '@zeedhi/autonumeric';
|
|
4
4
|
import isUndefined from 'lodash.isundefined';
|
|
@@ -338,10 +338,6 @@ const uniqueBy = (a, key) => {
|
|
|
338
338
|
});
|
|
339
339
|
};
|
|
340
340
|
|
|
341
|
-
const isFilledObject = (obj) => {
|
|
342
|
-
return !!obj && typeof obj === 'object' && !Array.isArray(obj) && !!Object.keys(obj).length;
|
|
343
|
-
};
|
|
344
|
-
|
|
345
341
|
class DatasourceSearcher {
|
|
346
342
|
dsSearch = {
|
|
347
343
|
SEARCH: (value, searchIn) => ({
|
|
@@ -847,10 +843,6 @@ class TreeDataStructure {
|
|
|
847
843
|
}
|
|
848
844
|
}
|
|
849
845
|
|
|
850
|
-
function isNil(value) {
|
|
851
|
-
return value === null || value === undefined;
|
|
852
|
-
}
|
|
853
|
-
|
|
854
846
|
/**
|
|
855
847
|
* Child not found error
|
|
856
848
|
*/
|
|
@@ -2173,6 +2165,7 @@ class TextInput extends Input {
|
|
|
2173
2165
|
* Defines text input value should concat the suffix text.
|
|
2174
2166
|
*/
|
|
2175
2167
|
valueWithSuffix = textInputDefaults.valueWithSuffix;
|
|
2168
|
+
inputMode;
|
|
2176
2169
|
formatterFn = FormatterParserProvider.getFormatter('ZdTextInput');
|
|
2177
2170
|
parserFn = FormatterParserProvider.getParser('ZdTextInput');
|
|
2178
2171
|
/* istanbul ignore next */
|
|
@@ -2191,6 +2184,7 @@ class TextInput extends Input {
|
|
|
2191
2184
|
this.type = props.type || this.type;
|
|
2192
2185
|
this.valueWithPrefix = this.getInitValue('valueWithPrefix', props.valueWithPrefix, this.valueWithPrefix);
|
|
2193
2186
|
this.valueWithSuffix = this.getInitValue('valueWithSuffix', props.valueWithSuffix, this.valueWithSuffix);
|
|
2187
|
+
this.inputMode = this.getInitValue('inputMode', props.inputMode, this.inputMode);
|
|
2194
2188
|
}
|
|
2195
2189
|
onCreated() {
|
|
2196
2190
|
super.onCreated();
|
|
@@ -2363,6 +2357,7 @@ class DateInput extends TextInput {
|
|
|
2363
2357
|
parserFn = FormatterParserProvider.getParser('ZdDateInput');
|
|
2364
2358
|
initialMask;
|
|
2365
2359
|
isSimpleDisplay;
|
|
2360
|
+
inputMode = 'none';
|
|
2366
2361
|
/* istanbul ignore next */
|
|
2367
2362
|
/**
|
|
2368
2363
|
* Creates a new Date.
|
|
@@ -2424,6 +2419,10 @@ class DateInput extends TextInput {
|
|
|
2424
2419
|
return;
|
|
2425
2420
|
this.internalDisplayValue = this.formatter(value);
|
|
2426
2421
|
this.internalValue = value;
|
|
2422
|
+
if (!value) {
|
|
2423
|
+
this.dateObject = null;
|
|
2424
|
+
return;
|
|
2425
|
+
}
|
|
2427
2426
|
if (this.isValidFormatDate(value, this.dateFormat)) {
|
|
2428
2427
|
this.dateObject = dayjs(value, this.dateFormat);
|
|
2429
2428
|
}
|
|
@@ -10915,3473 +10914,192 @@ class TreeGrid extends Iterable {
|
|
|
10915
10914
|
}
|
|
10916
10915
|
}
|
|
10917
10916
|
|
|
10918
|
-
|
|
10919
|
-
|
|
10920
|
-
|
|
10921
|
-
|
|
10922
|
-
|
|
10923
|
-
|
|
10924
|
-
|
|
10925
|
-
|
|
10926
|
-
|
|
10927
|
-
|
|
10928
|
-
|
|
10929
|
-
|
|
10930
|
-
|
|
10931
|
-
|
|
10932
|
-
|
|
10933
|
-
|
|
10934
|
-
};
|
|
10935
|
-
|
|
10936
|
-
class TekMemoryDatasource extends MemoryDatasource {
|
|
10937
|
-
/** Dynamic filter data */
|
|
10938
|
-
dynamicFilter;
|
|
10939
|
-
/** Search Join data */
|
|
10940
|
-
searchJoin;
|
|
10917
|
+
/**
|
|
10918
|
+
* Base class for Checkbox multiple component.
|
|
10919
|
+
*/
|
|
10920
|
+
class CheckboxMultiple extends Input {
|
|
10921
|
+
/**
|
|
10922
|
+
* Quantity of columns that will be rendered on non vertical case
|
|
10923
|
+
*/
|
|
10924
|
+
columns = 4;
|
|
10925
|
+
/**
|
|
10926
|
+
* Field on datasource.data that will be used to set checkbox's label
|
|
10927
|
+
*/
|
|
10928
|
+
dataLabel = '';
|
|
10929
|
+
/**
|
|
10930
|
+
* Source of checkbox items
|
|
10931
|
+
*/
|
|
10932
|
+
datasource;
|
|
10941
10933
|
/**
|
|
10942
|
-
*
|
|
10934
|
+
* Field on datasource.data that will be used to set checkbox's value
|
|
10943
10935
|
*/
|
|
10944
|
-
|
|
10936
|
+
dataValue = '';
|
|
10945
10937
|
/**
|
|
10946
|
-
*
|
|
10938
|
+
* Defines the checkbox list direction
|
|
10947
10939
|
*/
|
|
10948
|
-
|
|
10940
|
+
vertical = true;
|
|
10949
10941
|
/**
|
|
10950
|
-
*
|
|
10942
|
+
* Defines if field value should be an object
|
|
10951
10943
|
*/
|
|
10952
|
-
|
|
10944
|
+
returnObject = false;
|
|
10945
|
+
/* istanbul ignore next */
|
|
10953
10946
|
/**
|
|
10954
|
-
* Create new
|
|
10955
|
-
* @param props
|
|
10947
|
+
* Create a new Checkbox Multiple.
|
|
10948
|
+
* @param props CheckBpox Multiple properties
|
|
10956
10949
|
*/
|
|
10957
10950
|
constructor(props) {
|
|
10958
10951
|
super(props);
|
|
10959
|
-
|
|
10960
|
-
|
|
10961
|
-
|
|
10952
|
+
this.columns = this.getInitValue('columns', props.columns, this.columns);
|
|
10953
|
+
this.dataLabel = this.getInitValue('dataLabel', props.dataLabel, this.dataLabel);
|
|
10954
|
+
this.dataValue = this.getInitValue('dataValue', props.dataValue, this.dataValue);
|
|
10955
|
+
this.vertical = this.getInitValue('vertical', props.vertical, this.vertical);
|
|
10956
|
+
this.returnObject = this.getInitValue('returnObject', props.returnObject, this.returnObject);
|
|
10957
|
+
if (!Accessor.isAccessorDefinition(props.value)) {
|
|
10958
|
+
this.value = this.getInitValue('value', props.value, []);
|
|
10962
10959
|
}
|
|
10963
|
-
|
|
10964
|
-
|
|
10965
|
-
|
|
10960
|
+
if (props.datasource && props.datasource.type === 'simple') {
|
|
10961
|
+
this.dataValue = 'value';
|
|
10962
|
+
this.dataLabel = this.dataValue;
|
|
10963
|
+
}
|
|
10964
|
+
this.datasource = DatasourceFactory.factory(props.datasource);
|
|
10966
10965
|
}
|
|
10967
|
-
|
|
10968
|
-
|
|
10969
|
-
this.
|
|
10966
|
+
onBeforeDestroy() {
|
|
10967
|
+
super.onBeforeDestroy();
|
|
10968
|
+
this.datasource.destroy();
|
|
10970
10969
|
}
|
|
10971
|
-
|
|
10972
|
-
|
|
10973
|
-
|
|
10974
|
-
this.updateReservedKeys();
|
|
10975
|
-
super.updateInternalProperties(datasource);
|
|
10976
|
-
const queryString = URL.getParsedQueryStringFromUrl();
|
|
10977
|
-
this.dynamicFilter = this.getEncodedParam(queryString.dynamic_filter, datasource.dynamicFilter);
|
|
10978
|
-
this.searchJoin = this.getEncodedParam(queryString.search_join, datasource.searchJoin);
|
|
10979
|
-
}
|
|
10980
|
-
getEncodedParam(urlParam, datasourceParam = {}) {
|
|
10981
|
-
return urlParam ? JSON.parse(atob(urlParam)) : datasourceParam;
|
|
10982
|
-
}
|
|
10983
|
-
getQueryStringValues() {
|
|
10984
|
-
const values = super.getQueryStringValues();
|
|
10985
|
-
if (this.dynamicFilter && Object.keys(this.dynamicFilter).length) {
|
|
10986
|
-
values.dynamic_filter = btoa(JSON.stringify(this.dynamicFilter));
|
|
10987
|
-
}
|
|
10988
|
-
if (this.searchJoin && Object.keys(this.searchJoin).length) {
|
|
10989
|
-
values.search_join = btoa(JSON.stringify(this.searchJoin));
|
|
10990
|
-
}
|
|
10991
|
-
return values;
|
|
10992
|
-
}
|
|
10993
|
-
getUrlQueryString() {
|
|
10994
|
-
const superQueryString = super.getUrlQueryString();
|
|
10995
|
-
const query = URL.getParsedQueryStringFromUrl();
|
|
10996
|
-
let dynamicFilterQuerystring = '';
|
|
10997
|
-
if (query.dynamic_filter) {
|
|
10998
|
-
dynamicFilterQuerystring = `&${URL.getFormattedQueryString({
|
|
10999
|
-
dynamic_filter: query.dynamic_filter,
|
|
11000
|
-
})}`;
|
|
11001
|
-
}
|
|
11002
|
-
let searchJoinQuerystring = '';
|
|
11003
|
-
if (query.search_join) {
|
|
11004
|
-
searchJoinQuerystring = `&${URL.getFormattedQueryString({
|
|
11005
|
-
search_join: query.search_join,
|
|
11006
|
-
})}`;
|
|
11007
|
-
}
|
|
11008
|
-
return superQueryString + dynamicFilterQuerystring + searchJoinQuerystring;
|
|
11009
|
-
}
|
|
11010
|
-
/**
|
|
11011
|
-
* Adds a new dynamic filter position or replace if exists
|
|
11012
|
-
* @param column Dynamic Filter column name
|
|
11013
|
-
* @param value Dynamic Filter value
|
|
11014
|
-
* @returns Promise with data collection
|
|
11015
|
-
*/
|
|
11016
|
-
addDynamicFilter(column, value) {
|
|
11017
|
-
if (this.isValidDynamicFilterValue(column, value)) {
|
|
11018
|
-
this.dynamicFilter[column] = value;
|
|
11019
|
-
return this.updateDynamicFilter();
|
|
11020
|
-
}
|
|
11021
|
-
return this.removeDynamicFilter(column);
|
|
10970
|
+
onCreated() {
|
|
10971
|
+
super.onCreated();
|
|
10972
|
+
this.datasource?.initialize();
|
|
11022
10973
|
}
|
|
10974
|
+
}
|
|
10975
|
+
InputFactory.register('ZdCheckboxMultiple', CheckboxMultiple);
|
|
10976
|
+
|
|
10977
|
+
/**
|
|
10978
|
+
* Base class for Chip component.
|
|
10979
|
+
*/
|
|
10980
|
+
class Chip extends Button {
|
|
11023
10981
|
/**
|
|
11024
|
-
*
|
|
11025
|
-
* @param column Dynamic Filter column name
|
|
11026
|
-
* @returns Promise with data collection
|
|
10982
|
+
* Determines whether the chip is active or not
|
|
11027
10983
|
*/
|
|
11028
|
-
|
|
11029
|
-
delete this.dynamicFilter[column];
|
|
11030
|
-
return this.updateDynamicFilter();
|
|
11031
|
-
}
|
|
10984
|
+
active = true;
|
|
11032
10985
|
/**
|
|
11033
|
-
*
|
|
11034
|
-
* @param filter Dynamic Filter value
|
|
11035
|
-
* @returns Promise with data collection
|
|
10986
|
+
* Configure the active CSS class applied when the link is active
|
|
11036
10987
|
*/
|
|
11037
|
-
|
|
11038
|
-
this.dynamicFilter = {};
|
|
11039
|
-
Object.keys(filter).forEach((column) => {
|
|
11040
|
-
if (this.isValidDynamicFilterValue(column, filter[column])) {
|
|
11041
|
-
this.dynamicFilter[column] = filter[column];
|
|
11042
|
-
}
|
|
11043
|
-
else {
|
|
11044
|
-
delete this.dynamicFilter[column];
|
|
11045
|
-
}
|
|
11046
|
-
});
|
|
11047
|
-
return this.updateDynamicFilter();
|
|
11048
|
-
}
|
|
10988
|
+
activeClass = '';
|
|
11049
10989
|
/**
|
|
11050
|
-
*
|
|
11051
|
-
* @returns Promise with data collection
|
|
10990
|
+
* Adds remove button
|
|
11052
10991
|
*/
|
|
11053
|
-
|
|
11054
|
-
this.dynamicFilter = {};
|
|
11055
|
-
return this.updateDynamicFilter();
|
|
11056
|
-
}
|
|
10992
|
+
closable = false;
|
|
11057
10993
|
/**
|
|
11058
|
-
*
|
|
11059
|
-
* @returns Promise with data collection
|
|
10994
|
+
* Change the default icon used for close chips
|
|
11060
10995
|
*/
|
|
11061
|
-
|
|
11062
|
-
this.page = this.firstPage;
|
|
11063
|
-
this.selectedRows = [];
|
|
11064
|
-
this.visibleSelectedRows = [];
|
|
11065
|
-
if (this.watchUrl) {
|
|
11066
|
-
if (this.dynamicFilter && Object.keys(this.dynamicFilter).length) {
|
|
11067
|
-
URL.updateQueryString({
|
|
11068
|
-
dynamic_filter: btoa(JSON.stringify(this.dynamicFilter)),
|
|
11069
|
-
});
|
|
11070
|
-
}
|
|
11071
|
-
else {
|
|
11072
|
-
URL.updateQueryString({
|
|
11073
|
-
dynamic_filter: undefined,
|
|
11074
|
-
});
|
|
11075
|
-
}
|
|
11076
|
-
}
|
|
11077
|
-
return this.get();
|
|
11078
|
-
}
|
|
10996
|
+
closeIcon = 'delete';
|
|
11079
10997
|
/**
|
|
11080
|
-
*
|
|
11081
|
-
* @param value Filter value
|
|
11082
|
-
* @returns Is valid filter value
|
|
10998
|
+
* Makes the chip draggable
|
|
11083
10999
|
*/
|
|
11084
|
-
|
|
11085
|
-
return (!this.reservedKeys[column] &&
|
|
11086
|
-
value &&
|
|
11087
|
-
value.length > 0 &&
|
|
11088
|
-
value.every((filterValue) => this.dynamicFilterOperations[filterValue.operation] &&
|
|
11089
|
-
this.dynamicFilterRelations[filterValue.relation] &&
|
|
11090
|
-
filterValue.value !== '' &&
|
|
11091
|
-
filterValue.value !== null));
|
|
11092
|
-
}
|
|
11093
|
-
clone() {
|
|
11094
|
-
return {
|
|
11095
|
-
...super.clone(),
|
|
11096
|
-
dynamicFilter: this.dynamicFilter,
|
|
11097
|
-
searchJoin: this.searchJoin,
|
|
11098
|
-
type: 'tek-memory',
|
|
11099
|
-
};
|
|
11100
|
-
}
|
|
11000
|
+
draggable = false;
|
|
11101
11001
|
/**
|
|
11102
|
-
*
|
|
11002
|
+
* Explicitly define the chip as a link
|
|
11103
11003
|
*/
|
|
11104
|
-
|
|
11105
|
-
|
|
11106
|
-
|
|
11107
|
-
|
|
11108
|
-
|
|
11109
|
-
|
|
11110
|
-
|
|
11111
|
-
|
|
11112
|
-
|
|
11113
|
-
|
|
11114
|
-
|
|
11115
|
-
|
|
11116
|
-
|
|
11117
|
-
}
|
|
11118
|
-
return this.getRowBySearch(searchRow);
|
|
11119
|
-
};
|
|
11120
|
-
// only after do the search
|
|
11121
|
-
const searchData = this.search ? this.filteredData.filter(searchWithoutSearchJoin) : this.filteredData;
|
|
11122
|
-
let searchIds = searchData.map((row) => row[this.uniqueKey]);
|
|
11123
|
-
if (this.searchJoin && Object.keys(this.searchJoin).length) {
|
|
11124
|
-
const searchJoinData = this.filteredData.filter((row) => this.getRowBySearchJoin(row));
|
|
11125
|
-
// get the ids from search and searchJoin
|
|
11126
|
-
searchIds = searchIds.concat(searchJoinData.map((row) => row[this.uniqueKey])).sort();
|
|
11127
|
-
}
|
|
11128
|
-
// filter filteredData using searchIds
|
|
11129
|
-
this.filteredData = this.allData.filter((row) => searchIds.indexOf(row[this.uniqueKey]) !== -1);
|
|
11130
|
-
}
|
|
11131
|
-
getRowByDynamicFilter(row) {
|
|
11132
|
-
let filtered;
|
|
11133
|
-
try {
|
|
11134
|
-
Object.keys(this.dynamicFilter).forEach((key) => {
|
|
11135
|
-
const filterItems = this.dynamicFilter[key];
|
|
11136
|
-
filterItems.forEach((item) => {
|
|
11137
|
-
if (filtered === false && item.relation === 'AND')
|
|
11138
|
-
return;
|
|
11139
|
-
if (filtered === true && item.relation === 'OR')
|
|
11140
|
-
return;
|
|
11141
|
-
const columnValue = Utils.normalize(row[key].toString());
|
|
11142
|
-
let value = '';
|
|
11143
|
-
if (Array.isArray(item.value)) {
|
|
11144
|
-
value = item.value.map((val) => Utils.normalize(val.toString()));
|
|
11145
|
-
switch (item.operation) {
|
|
11146
|
-
case 'IN':
|
|
11147
|
-
filtered = value.includes(columnValue);
|
|
11148
|
-
break;
|
|
11149
|
-
case 'NOT_IN':
|
|
11150
|
-
filtered = !value.includes(columnValue);
|
|
11151
|
-
break;
|
|
11152
|
-
case 'BETWEEN':
|
|
11153
|
-
filtered =
|
|
11154
|
-
(Number(columnValue) || columnValue) >= (Number(value[0]) || value[0]) &&
|
|
11155
|
-
(Number(columnValue) || columnValue) <= (Number(value[1]) || value[1]);
|
|
11156
|
-
break;
|
|
11157
|
-
default:
|
|
11158
|
-
break;
|
|
11159
|
-
}
|
|
11160
|
-
}
|
|
11161
|
-
else {
|
|
11162
|
-
value = Utils.normalize(item.value.toString());
|
|
11163
|
-
switch (item.operation) {
|
|
11164
|
-
case 'CONTAINS':
|
|
11165
|
-
filtered = columnValue.indexOf(value) !== -1;
|
|
11166
|
-
break;
|
|
11167
|
-
case 'NOT_CONTAINS':
|
|
11168
|
-
filtered = columnValue.indexOf(value) === -1;
|
|
11169
|
-
break;
|
|
11170
|
-
case 'EQUALS':
|
|
11171
|
-
filtered = columnValue === value;
|
|
11172
|
-
break;
|
|
11173
|
-
case 'NOT_EQUALS':
|
|
11174
|
-
filtered = columnValue !== value;
|
|
11175
|
-
break;
|
|
11176
|
-
case 'GREATER_THAN':
|
|
11177
|
-
filtered = (Number(columnValue) || columnValue) > (Number(value) || value);
|
|
11178
|
-
break;
|
|
11179
|
-
case 'LESS_THAN':
|
|
11180
|
-
filtered = (Number(columnValue) || columnValue) < (Number(value) || value);
|
|
11181
|
-
break;
|
|
11182
|
-
case 'GREATER_THAN_EQUALS':
|
|
11183
|
-
filtered = (Number(columnValue) || columnValue) >= (Number(value) || value);
|
|
11184
|
-
break;
|
|
11185
|
-
case 'LESS_THAN_EQUALS':
|
|
11186
|
-
filtered = (Number(columnValue) || columnValue) <= (Number(value) || value);
|
|
11187
|
-
break;
|
|
11188
|
-
default:
|
|
11189
|
-
break;
|
|
11190
|
-
}
|
|
11191
|
-
}
|
|
11192
|
-
});
|
|
11193
|
-
});
|
|
11194
|
-
}
|
|
11195
|
-
catch {
|
|
11196
|
-
// do nothing
|
|
11197
|
-
}
|
|
11198
|
-
return filtered;
|
|
11199
|
-
}
|
|
11200
|
-
getRowBySearchJoin(row) {
|
|
11201
|
-
return Object.keys(this.searchJoin).some((key) => this.searchJoin[key].includes(row[key]));
|
|
11202
|
-
}
|
|
11203
|
-
hasFilter(columnName) {
|
|
11204
|
-
return this.dynamicFilter[columnName] && this.dynamicFilter[columnName].length > 0;
|
|
11205
|
-
}
|
|
11206
|
-
}
|
|
11207
|
-
DatasourceFactory.register('tek-memory', TekMemoryDatasource);
|
|
11208
|
-
|
|
11209
|
-
class TekRestDatasource extends RestDatasource {
|
|
11210
|
-
/** Dynamic filter data */
|
|
11211
|
-
dynamicFilter;
|
|
11212
|
-
/** Search Join data */
|
|
11213
|
-
searchJoin;
|
|
11004
|
+
link = false;
|
|
11005
|
+
/**
|
|
11006
|
+
* Removes background and applies border and text color
|
|
11007
|
+
*/
|
|
11008
|
+
outlined = false;
|
|
11009
|
+
/**
|
|
11010
|
+
* Applies the ripple
|
|
11011
|
+
*/
|
|
11012
|
+
ripple = true;
|
|
11013
|
+
/**
|
|
11014
|
+
* Applies a large border radius on the chip
|
|
11015
|
+
*/
|
|
11016
|
+
round = true;
|
|
11214
11017
|
/**
|
|
11215
|
-
*
|
|
11018
|
+
* Value Model
|
|
11216
11019
|
*/
|
|
11217
|
-
|
|
11020
|
+
value = false;
|
|
11218
11021
|
/**
|
|
11219
|
-
*
|
|
11022
|
+
* Makes the component extra large
|
|
11220
11023
|
*/
|
|
11221
|
-
|
|
11024
|
+
xLarge = false;
|
|
11222
11025
|
/**
|
|
11223
|
-
*
|
|
11026
|
+
* Makes the component extra small
|
|
11224
11027
|
*/
|
|
11225
|
-
|
|
11028
|
+
xSmall = false;
|
|
11029
|
+
/* istanbul ignore next */
|
|
11226
11030
|
/**
|
|
11227
|
-
* Create new
|
|
11228
|
-
* @param props
|
|
11031
|
+
* Create a new Chip
|
|
11032
|
+
* @param props Chip definition
|
|
11229
11033
|
*/
|
|
11230
11034
|
constructor(props) {
|
|
11231
|
-
super(
|
|
11232
|
-
|
|
11233
|
-
|
|
11234
|
-
|
|
11235
|
-
|
|
11236
|
-
this.
|
|
11035
|
+
super(props);
|
|
11036
|
+
this.active = this.getInitValue('active', props.active, this.active);
|
|
11037
|
+
this.activeClass = this.getInitValue('activeClass', props.activeClass, this.activeClass);
|
|
11038
|
+
this.closable = this.getInitValue('closable', props.closable, this.closable);
|
|
11039
|
+
this.closeIcon = this.getInitValue('closeIcon', props.closeIcon, this.closeIcon);
|
|
11040
|
+
this.draggable = this.getInitValue('draggable', props.draggable, this.draggable);
|
|
11041
|
+
this.link = this.getInitValue('link', props.link, this.link);
|
|
11042
|
+
this.outlined = this.getInitValue('outlined', props.outlined, this.outlined);
|
|
11043
|
+
this.ripple = this.getInitValue('ripple', props.ripple, this.ripple);
|
|
11044
|
+
this.round = this.getInitValue('round', props.round, this.round);
|
|
11045
|
+
this.value = this.getInitValue('value', props.value, this.value);
|
|
11046
|
+
this.xLarge = this.getInitValue('xLarge', props.xLarge, this.xLarge);
|
|
11047
|
+
this.xSmall = this.getInitValue('xSmall', props.xSmall, this.xSmall);
|
|
11237
11048
|
this.createAccessors();
|
|
11238
|
-
this.createObjAccessors(this.dynamicFilter, 'dynamicFilter');
|
|
11239
|
-
this.createObjAccessors(this.searchJoin, 'searchJoin');
|
|
11240
|
-
}
|
|
11241
|
-
updateReservedKeys() {
|
|
11242
|
-
this.reservedKeys.dynamic_filter = true;
|
|
11243
|
-
this.reservedKeys.search_join = true;
|
|
11244
11049
|
}
|
|
11245
|
-
|
|
11246
|
-
|
|
11247
|
-
|
|
11248
|
-
|
|
11249
|
-
|
|
11250
|
-
|
|
11251
|
-
|
|
11252
|
-
|
|
11253
|
-
}
|
|
11254
|
-
getEncodedParam(urlParam, datasourceParam = {}) {
|
|
11255
|
-
return urlParam ? JSON.parse(atob(urlParam)) : datasourceParam;
|
|
11256
|
-
}
|
|
11257
|
-
getQueryStringValues() {
|
|
11258
|
-
const values = super.getQueryStringValues();
|
|
11259
|
-
if (this.dynamicFilter && Object.keys(this.dynamicFilter).length) {
|
|
11260
|
-
values.dynamic_filter = btoa(JSON.stringify(this.dynamicFilter));
|
|
11261
|
-
}
|
|
11262
|
-
if (this.searchJoin && Object.keys(this.searchJoin).length) {
|
|
11263
|
-
values.search_join = btoa(JSON.stringify(this.searchJoin));
|
|
11264
|
-
}
|
|
11265
|
-
return values;
|
|
11266
|
-
}
|
|
11267
|
-
getUrlQueryString() {
|
|
11268
|
-
const superQueryString = super.getUrlQueryString();
|
|
11269
|
-
const query = URL.getParsedQueryStringFromUrl();
|
|
11270
|
-
let dynamicFilterQuerystring = '';
|
|
11271
|
-
if (query.dynamic_filter) {
|
|
11272
|
-
dynamicFilterQuerystring = `&${URL.getFormattedQueryString({
|
|
11273
|
-
dynamic_filter: query.dynamic_filter,
|
|
11274
|
-
})}`;
|
|
11275
|
-
}
|
|
11276
|
-
let searchJoinQuerystring = '';
|
|
11277
|
-
if (query.search_join) {
|
|
11278
|
-
searchJoinQuerystring = `&${URL.getFormattedQueryString({
|
|
11279
|
-
search_join: query.search_join,
|
|
11280
|
-
})}`;
|
|
11281
|
-
}
|
|
11282
|
-
return superQueryString + dynamicFilterQuerystring + searchJoinQuerystring;
|
|
11283
|
-
}
|
|
11284
|
-
/**
|
|
11285
|
-
* Adds a new dynamic filter position or replace if exists
|
|
11286
|
-
* @param column Dynamic Filter column name
|
|
11287
|
-
* @param value Dynamic Filter value
|
|
11288
|
-
* @returns Promise with data collection
|
|
11050
|
+
}
|
|
11051
|
+
|
|
11052
|
+
/**
|
|
11053
|
+
* Base class for Progress component
|
|
11054
|
+
*/
|
|
11055
|
+
class Progress extends ComponentRender {
|
|
11056
|
+
/**
|
|
11057
|
+
* Set component's background color
|
|
11289
11058
|
*/
|
|
11290
|
-
|
|
11291
|
-
if (this.isValidDynamicFilterValue(column, value)) {
|
|
11292
|
-
this.dynamicFilter[column] = value;
|
|
11293
|
-
return this.updateDynamicFilter();
|
|
11294
|
-
}
|
|
11295
|
-
return this.removeDynamicFilter(column);
|
|
11296
|
-
}
|
|
11059
|
+
backgroundColor = 'primary';
|
|
11297
11060
|
/**
|
|
11298
|
-
*
|
|
11299
|
-
* @param column Dynamic Filter column name
|
|
11300
|
-
* @returns Promise with data collection
|
|
11061
|
+
* Set component's background opacity
|
|
11301
11062
|
*/
|
|
11302
|
-
|
|
11303
|
-
delete this.dynamicFilter[column];
|
|
11304
|
-
return this.updateDynamicFilter();
|
|
11305
|
-
}
|
|
11063
|
+
backgroundOpacity = '0.5';
|
|
11306
11064
|
/**
|
|
11307
|
-
*
|
|
11308
|
-
* @param filter Dynamic Filter value
|
|
11309
|
-
* @returns Promise with data collection
|
|
11065
|
+
* Defines the value color
|
|
11310
11066
|
*/
|
|
11311
|
-
|
|
11312
|
-
this.dynamicFilter = {};
|
|
11313
|
-
Object.keys(filter).forEach((column) => {
|
|
11314
|
-
if (this.isValidDynamicFilterValue(column, filter[column])) {
|
|
11315
|
-
this.dynamicFilter[column] = filter[column];
|
|
11316
|
-
}
|
|
11317
|
-
else {
|
|
11318
|
-
delete this.dynamicFilter[column];
|
|
11319
|
-
}
|
|
11320
|
-
});
|
|
11321
|
-
return this.updateDynamicFilter();
|
|
11322
|
-
}
|
|
11067
|
+
color = 'primary';
|
|
11323
11068
|
/**
|
|
11324
|
-
*
|
|
11325
|
-
* @returns Promise with data collection
|
|
11069
|
+
* Sets the height for the component
|
|
11326
11070
|
*/
|
|
11327
|
-
|
|
11328
|
-
this.dynamicFilter = {};
|
|
11329
|
-
return this.updateDynamicFilter();
|
|
11330
|
-
}
|
|
11071
|
+
height = 4;
|
|
11331
11072
|
/**
|
|
11332
|
-
*
|
|
11333
|
-
* @returns Promise with data collection
|
|
11073
|
+
* Animates the component constantly
|
|
11334
11074
|
*/
|
|
11335
|
-
|
|
11336
|
-
this.page = this.firstPage;
|
|
11337
|
-
this.selectedRows = [];
|
|
11338
|
-
this.visibleSelectedRows = [];
|
|
11339
|
-
if (this.watchUrl) {
|
|
11340
|
-
if (this.dynamicFilter && Object.keys(this.dynamicFilter).length) {
|
|
11341
|
-
URL.updateQueryString({
|
|
11342
|
-
dynamic_filter: btoa(JSON.stringify(this.dynamicFilter)),
|
|
11343
|
-
});
|
|
11344
|
-
}
|
|
11345
|
-
else {
|
|
11346
|
-
URL.updateQueryString({
|
|
11347
|
-
dynamic_filter: undefined,
|
|
11348
|
-
});
|
|
11349
|
-
}
|
|
11350
|
-
}
|
|
11351
|
-
return this.get();
|
|
11352
|
-
}
|
|
11075
|
+
indeterminate = false;
|
|
11353
11076
|
/**
|
|
11354
|
-
*
|
|
11355
|
-
* @param value Filter value
|
|
11356
|
-
* @returns Is valid filter value
|
|
11077
|
+
* Render components on the progress component
|
|
11357
11078
|
*/
|
|
11358
|
-
|
|
11359
|
-
return (!this.reservedKeys[column] &&
|
|
11360
|
-
value &&
|
|
11361
|
-
value.length > 0 &&
|
|
11362
|
-
value.every((filterValue) => this.dynamicFilterOperations[filterValue.operation] &&
|
|
11363
|
-
this.dynamicFilterRelations[filterValue.relation] &&
|
|
11364
|
-
filterValue.value !== '' &&
|
|
11365
|
-
filterValue.value !== null));
|
|
11366
|
-
}
|
|
11079
|
+
centerSlot = [];
|
|
11367
11080
|
/**
|
|
11368
|
-
*
|
|
11081
|
+
* The percentage value for current progress
|
|
11369
11082
|
*/
|
|
11370
|
-
|
|
11371
|
-
|
|
11372
|
-
|
|
11373
|
-
|
|
11374
|
-
|
|
11375
|
-
|
|
11376
|
-
|
|
11377
|
-
|
|
11378
|
-
|
|
11379
|
-
|
|
11380
|
-
|
|
11381
|
-
|
|
11382
|
-
|
|
11383
|
-
|
|
11384
|
-
|
|
11385
|
-
}
|
|
11386
|
-
hasFilter(columnName) {
|
|
11387
|
-
return this.dynamicFilter[columnName] && this.dynamicFilter[columnName].length > 0;
|
|
11388
|
-
}
|
|
11389
|
-
clone() {
|
|
11390
|
-
return {
|
|
11391
|
-
...super.clone(),
|
|
11392
|
-
dynamicFilter: this.dynamicFilter,
|
|
11393
|
-
searchJoin: this.searchJoin,
|
|
11394
|
-
type: 'tek-rest',
|
|
11395
|
-
};
|
|
11396
|
-
}
|
|
11397
|
-
}
|
|
11398
|
-
DatasourceFactory.register('tek-rest', TekRestDatasource);
|
|
11399
|
-
|
|
11400
|
-
class ButtonOption {
|
|
11401
|
-
config;
|
|
11402
|
-
constructor(config) {
|
|
11403
|
-
this.config = config;
|
|
11404
|
-
}
|
|
11405
|
-
buildComponent(grid) {
|
|
11406
|
-
const { type, label, portrait = true, iconName } = this.config;
|
|
11407
|
-
const orientation = portrait ? 'portrait' : 'landscape';
|
|
11408
|
-
return {
|
|
11409
|
-
label,
|
|
11410
|
-
iconName,
|
|
11411
|
-
name: `${grid.name}_export_${type}_${orientation}`,
|
|
11412
|
-
component: 'ZdButton',
|
|
11413
|
-
flat: true,
|
|
11414
|
-
events: {
|
|
11415
|
-
click: () => grid.getReport(type, portrait),
|
|
11416
|
-
},
|
|
11417
|
-
};
|
|
11418
|
-
}
|
|
11419
|
-
}
|
|
11420
|
-
|
|
11421
|
-
class MultiOption {
|
|
11422
|
-
config;
|
|
11423
|
-
constructor(config) {
|
|
11424
|
-
this.config = config;
|
|
11425
|
-
}
|
|
11426
|
-
formatName(id, type, grid) {
|
|
11427
|
-
return `${grid.name}_export_${type}_${id}`;
|
|
11428
|
-
}
|
|
11429
|
-
buildTooltip(option, type, grid) {
|
|
11430
|
-
const { label } = option;
|
|
11431
|
-
return {
|
|
11432
|
-
name: this.formatName(`tooltip_${label}`, type, grid),
|
|
11433
|
-
component: 'ZdTooltip',
|
|
11434
|
-
bottom: true,
|
|
11435
|
-
label,
|
|
11436
|
-
children: [],
|
|
11437
|
-
};
|
|
11438
|
-
}
|
|
11439
|
-
buildButton(option, type, grid) {
|
|
11440
|
-
const { cssClass, label, iconName, reportParams } = option;
|
|
11441
|
-
const { portrait: optionPortrait, rowObj } = reportParams || {};
|
|
11442
|
-
return {
|
|
11443
|
-
name: this.formatName(`button_${label}`, type, grid),
|
|
11444
|
-
component: 'ZdButton',
|
|
11445
|
-
cssClass,
|
|
11446
|
-
icon: true,
|
|
11447
|
-
iconName,
|
|
11448
|
-
events: {
|
|
11449
|
-
click: () => grid.getReport(type, optionPortrait, rowObj),
|
|
11450
|
-
},
|
|
11451
|
-
};
|
|
11452
|
-
}
|
|
11453
|
-
buildDivider(option, type, grid) {
|
|
11454
|
-
const { label } = option;
|
|
11455
|
-
return {
|
|
11456
|
-
name: this.formatName(`divider_${label}`, type, grid),
|
|
11457
|
-
component: 'ZdDivider',
|
|
11458
|
-
cssClass: 'zd-my-1',
|
|
11459
|
-
vertical: true,
|
|
11460
|
-
};
|
|
11461
|
-
}
|
|
11462
|
-
buildComponent(grid) {
|
|
11463
|
-
const { type, label, multiOption } = this.config;
|
|
11464
|
-
const optionComponents = multiOption.flatMap((option) => [
|
|
11465
|
-
{
|
|
11466
|
-
...this.buildTooltip(option, type, grid),
|
|
11467
|
-
children: [this.buildButton(option, type, grid)],
|
|
11468
|
-
},
|
|
11469
|
-
this.buildDivider(option, type, grid),
|
|
11470
|
-
]);
|
|
11471
|
-
optionComponents.pop();
|
|
11472
|
-
const text = {
|
|
11473
|
-
name: this.formatName('text', type, grid),
|
|
11474
|
-
component: 'ZdText',
|
|
11475
|
-
cssClass: 'zd-display-flex zd-align-center zd-flex-grow-1 tek-grid-export-multioption-text',
|
|
11476
|
-
events: {
|
|
11477
|
-
click: ({ event }) => event?.stopPropagation(),
|
|
11478
|
-
},
|
|
11479
|
-
text: label || '',
|
|
11480
|
-
};
|
|
11481
|
-
const result = {
|
|
11482
|
-
name: this.formatName('row', type, grid),
|
|
11483
|
-
component: 'ZdRow',
|
|
11484
|
-
cssClass: 'zd-display-flex zd-ma-0 zd-py-0 zd-gap-x-1 tek-grid-export-multioption-row',
|
|
11485
|
-
children: [text, ...optionComponents],
|
|
11486
|
-
};
|
|
11487
|
-
return result;
|
|
11083
|
+
value = 0;
|
|
11084
|
+
/* istanbul ignore next */
|
|
11085
|
+
/**
|
|
11086
|
+
* Create a new Progress
|
|
11087
|
+
* @param props Progress definition
|
|
11088
|
+
*/
|
|
11089
|
+
constructor(props) {
|
|
11090
|
+
super(props);
|
|
11091
|
+
this.backgroundColor = this.getInitValue('backgroundColor', props.backgroundColor, this.backgroundColor);
|
|
11092
|
+
this.backgroundOpacity = this.getInitValue('backgroundOpacity', props.backgroundOpacity, this.backgroundOpacity);
|
|
11093
|
+
this.color = this.getInitValue('color', props.color, this.color);
|
|
11094
|
+
this.height = this.getInitValue('height', props.height, this.height);
|
|
11095
|
+
this.indeterminate = this.getInitValue('indeterminate', props.indeterminate, this.indeterminate);
|
|
11096
|
+
this.centerSlot = this.getInitValue('centerSlot', props.centerSlot, this.centerSlot);
|
|
11097
|
+
this.value = this.getInitValue('value', props.value, this.value);
|
|
11488
11098
|
}
|
|
11489
11099
|
}
|
|
11490
11100
|
|
|
11491
11101
|
/**
|
|
11492
|
-
* Base
|
|
11493
|
-
*/
|
|
11494
|
-
class TeknisaCommonError extends Error {
|
|
11495
|
-
constructor(message) {
|
|
11496
|
-
super(`[Teknisa Common err]: ${message}`);
|
|
11497
|
-
}
|
|
11498
|
-
}
|
|
11499
|
-
|
|
11500
|
-
/**
|
|
11501
|
-
* TekGridDelete rows error
|
|
11502
|
-
*/
|
|
11503
|
-
class TekGridDeleteRowsError extends TeknisaCommonError {
|
|
11504
|
-
constructor() {
|
|
11505
|
-
super("TekGrid can't automatically delete rows when selectAllPages property is true." +
|
|
11506
|
-
' You should delete them manually using the beforeDelete event and preventing' +
|
|
11507
|
-
' the default execution');
|
|
11508
|
-
this.name = 'TekGridDeleteRowsError';
|
|
11509
|
-
}
|
|
11510
|
-
}
|
|
11511
|
-
|
|
11512
|
-
class TekGridToolbarProvider {
|
|
11513
|
-
grid;
|
|
11514
|
-
groupsVisibility;
|
|
11515
|
-
constructor(grid, groupsVisibility) {
|
|
11516
|
-
this.grid = grid;
|
|
11517
|
-
this.groupsVisibility = groupsVisibility;
|
|
11518
|
-
}
|
|
11519
|
-
atoms = {
|
|
11520
|
-
TITLE: '_gridTitle',
|
|
11521
|
-
HIDE_BUTTON: '_hideButton',
|
|
11522
|
-
ADD_BUTTON: '_addButton',
|
|
11523
|
-
DELETE_BUTTON: '_deleteButton',
|
|
11524
|
-
REFRESH_BUTTON: '_refreshButton',
|
|
11525
|
-
COLUMNS_BUTTON: '_columnsButton',
|
|
11526
|
-
LAYOUT_BUTTON: '_layout_options',
|
|
11527
|
-
EXPORT_BUTTON: '_exportButton',
|
|
11528
|
-
ACTIONS_BUTTON: '_actionsButton',
|
|
11529
|
-
SAVE_BUTTON: '_saveButton',
|
|
11530
|
-
CANCEL_BUTTON: '_cancelButton',
|
|
11531
|
-
SEARCH: '_gridSearch',
|
|
11532
|
-
FILTER_BUTTON: '_filterButton',
|
|
11533
|
-
FILTER_MODAL: '-filter-modal',
|
|
11534
|
-
FILTER_FORM: '-filter-form',
|
|
11535
|
-
EXPORT_DROPDOWN: '_export_dropdown',
|
|
11536
|
-
ACTIONS_DROPDOWN: '_actions_dropdown',
|
|
11537
|
-
HIDE_TOOLTIP: '_hideTooltip',
|
|
11538
|
-
TOOLBAR_DIV: '_toolbarDiv',
|
|
11539
|
-
NOT_EDITING_SPAN: '_notEditingSpan',
|
|
11540
|
-
ADD_TOOLTIP: '_add_tooltip',
|
|
11541
|
-
DELETE_TOOLTIP: '_delete_tooltip',
|
|
11542
|
-
DIVIDER1: '_divider1',
|
|
11543
|
-
REFRESH_TOOLTIP: '_refresh_tooltip',
|
|
11544
|
-
DIVIDER2: '_divider2',
|
|
11545
|
-
COLUMNS_TOOLTIP: '_columns_button_tooltip',
|
|
11546
|
-
DIVIDER_ACTIONS: '_dividerActions',
|
|
11547
|
-
DIVIDER3: '_divider3',
|
|
11548
|
-
FILTER_TOOLTIP: '_filter_tooltip',
|
|
11549
|
-
};
|
|
11550
|
-
getAtomName(key) {
|
|
11551
|
-
return `${this.grid.name}${this.atoms[key]}`;
|
|
11552
|
-
}
|
|
11553
|
-
getAtomInstance(key) {
|
|
11554
|
-
return Metadata.getInstance(`${this.grid.name}${this.atoms[key]}`);
|
|
11555
|
-
}
|
|
11556
|
-
getOption(config) {
|
|
11557
|
-
if (config.multiOption)
|
|
11558
|
-
return new MultiOption(config);
|
|
11559
|
-
return new ButtonOption(config);
|
|
11560
|
-
}
|
|
11561
|
-
getExportConfigButtons() {
|
|
11562
|
-
return this.grid.exportConfig.map((config) => {
|
|
11563
|
-
const option = this.getOption(config);
|
|
11564
|
-
return option.buildComponent(this.grid);
|
|
11565
|
-
});
|
|
11566
|
-
}
|
|
11567
|
-
hideButtonClick({ event }) {
|
|
11568
|
-
if (!event.defaultPrevented) {
|
|
11569
|
-
const instance = Metadata.getInstance(`${this.grid.name}_toolbarDiv`);
|
|
11570
|
-
if (instance) {
|
|
11571
|
-
instance.isVisible = !instance.isVisible;
|
|
11572
|
-
}
|
|
11573
|
-
}
|
|
11574
|
-
}
|
|
11575
|
-
cancelChanges({ event }) {
|
|
11576
|
-
this.grid.callEvent('beforeCancel', { component: this.grid, event });
|
|
11577
|
-
if (!event.defaultPrevented) {
|
|
11578
|
-
const cancel = async () => {
|
|
11579
|
-
await this.grid.cancelEditedRows();
|
|
11580
|
-
this.grid.editingNewRows = false;
|
|
11581
|
-
};
|
|
11582
|
-
cancel();
|
|
11583
|
-
this.grid.callEvent('afterCancel', { component: this.grid });
|
|
11584
|
-
}
|
|
11585
|
-
}
|
|
11586
|
-
saveChanges({ event }) {
|
|
11587
|
-
this.grid.callEvent('beforeSave', { component: this.grid, event });
|
|
11588
|
-
if (!event.defaultPrevented) {
|
|
11589
|
-
const save = async () => {
|
|
11590
|
-
await this.grid.saveEditedRows();
|
|
11591
|
-
this.grid.editingNewRows = false;
|
|
11592
|
-
};
|
|
11593
|
-
save();
|
|
11594
|
-
this.grid.callEvent('afterSave', { component: this.grid });
|
|
11595
|
-
}
|
|
11596
|
-
}
|
|
11597
|
-
addButtonClick({ event }) {
|
|
11598
|
-
if (this.grid.editNewRowsOnly) {
|
|
11599
|
-
this.grid.editingNewRows = true;
|
|
11600
|
-
}
|
|
11601
|
-
this.grid.callEvent('addClick', { component: this.grid, event });
|
|
11602
|
-
}
|
|
11603
|
-
deleteButtonClick({ event }) {
|
|
11604
|
-
this.grid.callEvent('beforeDelete', { component: this.grid, event });
|
|
11605
|
-
if (!event.defaultPrevented) {
|
|
11606
|
-
if (this.grid.selectAllPages) {
|
|
11607
|
-
throw new TekGridDeleteRowsError();
|
|
11608
|
-
}
|
|
11609
|
-
this.grid.deleteRows();
|
|
11610
|
-
this.grid.callEvent('afterDelete', { component: this.grid });
|
|
11611
|
-
}
|
|
11612
|
-
}
|
|
11613
|
-
reloadGrid({ event }) {
|
|
11614
|
-
this.grid.callEvent('beforeReload', { component: this.grid, event });
|
|
11615
|
-
if (event?.defaultPrevented)
|
|
11616
|
-
return;
|
|
11617
|
-
this.grid.reload();
|
|
11618
|
-
}
|
|
11619
|
-
getProperties() {
|
|
11620
|
-
const exportConfigButtons = this.getExportConfigButtons();
|
|
11621
|
-
return [
|
|
11622
|
-
{
|
|
11623
|
-
name: this.getAtomName('TITLE'),
|
|
11624
|
-
component: 'ZdText',
|
|
11625
|
-
cssClass: 'toolbar-title',
|
|
11626
|
-
tag: 'h2',
|
|
11627
|
-
text: this.grid.title,
|
|
11628
|
-
title: this.grid.title,
|
|
11629
|
-
},
|
|
11630
|
-
{
|
|
11631
|
-
name: `${this.grid.name}_spacer`,
|
|
11632
|
-
component: 'VSpacer',
|
|
11633
|
-
},
|
|
11634
|
-
{
|
|
11635
|
-
name: this.getAtomName('HIDE_TOOLTIP'),
|
|
11636
|
-
component: 'ZdTooltip',
|
|
11637
|
-
label: `{{GridController_${this.grid.name}.tooltipName}}`,
|
|
11638
|
-
bottom: true,
|
|
11639
|
-
children: [
|
|
11640
|
-
{
|
|
11641
|
-
name: this.getAtomName('HIDE_BUTTON'),
|
|
11642
|
-
component: 'ZdButton',
|
|
11643
|
-
flat: true,
|
|
11644
|
-
icon: true,
|
|
11645
|
-
iconName: 'mdi-chevron-right',
|
|
11646
|
-
color: 'grey',
|
|
11647
|
-
isVisible: `{{GridController_${this.grid.name}.isNotEditing}}`,
|
|
11648
|
-
cssClass: `{{GridController_${this.grid.name}.toolbarClass}}`,
|
|
11649
|
-
events: {
|
|
11650
|
-
click: this.hideButtonClick.bind(this),
|
|
11651
|
-
},
|
|
11652
|
-
},
|
|
11653
|
-
],
|
|
11654
|
-
},
|
|
11655
|
-
{
|
|
11656
|
-
name: this.getAtomName('TOOLBAR_DIV'),
|
|
11657
|
-
component: 'ZdTag',
|
|
11658
|
-
tag: 'div',
|
|
11659
|
-
cssStyle: 'display: flex; align-items: center',
|
|
11660
|
-
isVisible: `{{GridController_${this.grid.name}.showToolbar}}`,
|
|
11661
|
-
children: [
|
|
11662
|
-
{
|
|
11663
|
-
name: this.getAtomName('NOT_EDITING_SPAN'),
|
|
11664
|
-
component: 'ZdTag',
|
|
11665
|
-
tag: 'span',
|
|
11666
|
-
cssStyle: 'display: flex',
|
|
11667
|
-
isVisible: `{{GridController_${this.grid.name}.isNotEditing}}`,
|
|
11668
|
-
children: [
|
|
11669
|
-
{
|
|
11670
|
-
name: this.getAtomName('ADD_TOOLTIP'),
|
|
11671
|
-
component: 'ZdTooltip',
|
|
11672
|
-
label: 'TEKGRID_ADD',
|
|
11673
|
-
bottom: true,
|
|
11674
|
-
children: [
|
|
11675
|
-
{
|
|
11676
|
-
name: this.getAtomName('ADD_BUTTON'),
|
|
11677
|
-
component: 'ZdButton',
|
|
11678
|
-
icon: true,
|
|
11679
|
-
iconName: 'mdi-plus-box',
|
|
11680
|
-
isVisible: `{{GridController_${this.grid.name}.showAddButton}}`,
|
|
11681
|
-
events: {
|
|
11682
|
-
click: this.addButtonClick.bind(this),
|
|
11683
|
-
},
|
|
11684
|
-
},
|
|
11685
|
-
],
|
|
11686
|
-
},
|
|
11687
|
-
{
|
|
11688
|
-
name: this.getAtomName('DELETE_TOOLTIP'),
|
|
11689
|
-
component: 'ZdTooltip',
|
|
11690
|
-
label: 'TEKGRID_DELETE',
|
|
11691
|
-
bottom: true,
|
|
11692
|
-
children: [
|
|
11693
|
-
{
|
|
11694
|
-
name: this.getAtomName('DELETE_BUTTON'),
|
|
11695
|
-
component: 'ZdButton',
|
|
11696
|
-
icon: true,
|
|
11697
|
-
iconName: 'mdi-trash-can-outline',
|
|
11698
|
-
isVisible: `{{GridController_${this.grid.name}.showDeleteButton}}`,
|
|
11699
|
-
disabled: `{{GridController_${this.grid.name}.disableDeleteButton}}`,
|
|
11700
|
-
events: {
|
|
11701
|
-
click: this.deleteButtonClick.bind(this),
|
|
11702
|
-
},
|
|
11703
|
-
},
|
|
11704
|
-
],
|
|
11705
|
-
},
|
|
11706
|
-
{
|
|
11707
|
-
name: this.getAtomName('DIVIDER1'),
|
|
11708
|
-
component: 'ZdDivider',
|
|
11709
|
-
cssClass: 'toolbar-divider',
|
|
11710
|
-
vertical: true,
|
|
11711
|
-
isVisible: `{{GridController_${this.grid.name}.showDivider1}}`,
|
|
11712
|
-
},
|
|
11713
|
-
{
|
|
11714
|
-
name: this.getAtomName('REFRESH_TOOLTIP'),
|
|
11715
|
-
component: 'ZdTooltip',
|
|
11716
|
-
label: 'TEKGRID_REFRESH',
|
|
11717
|
-
bottom: true,
|
|
11718
|
-
children: [
|
|
11719
|
-
{
|
|
11720
|
-
name: this.getAtomName('REFRESH_BUTTON'),
|
|
11721
|
-
component: 'ZdButton',
|
|
11722
|
-
icon: true,
|
|
11723
|
-
iconName: 'refresh',
|
|
11724
|
-
isVisible: `{{GridController_${this.grid.name}.showReloadButton}}`,
|
|
11725
|
-
events: {
|
|
11726
|
-
click: this.reloadGrid.bind(this),
|
|
11727
|
-
},
|
|
11728
|
-
},
|
|
11729
|
-
],
|
|
11730
|
-
},
|
|
11731
|
-
{
|
|
11732
|
-
name: this.getAtomName('DIVIDER2'),
|
|
11733
|
-
component: 'ZdDivider',
|
|
11734
|
-
cssClass: 'toolbar-divider',
|
|
11735
|
-
vertical: true,
|
|
11736
|
-
isVisible: `{{GridController_${this.grid.name}.showDivider2}}`,
|
|
11737
|
-
},
|
|
11738
|
-
{
|
|
11739
|
-
name: this.getAtomName('COLUMNS_BUTTON'),
|
|
11740
|
-
component: 'TekGridColumnsButton',
|
|
11741
|
-
isVisible: `{{GridController_${this.grid.name}.showColumnsButton}}`,
|
|
11742
|
-
iterableComponentName: this.grid.name,
|
|
11743
|
-
hideGroups: this.groupsVisibility === 'hide',
|
|
11744
|
-
ignoreColumns: `{{GridController_${this.grid.name}.columnsButtonIgnore}}`,
|
|
11745
|
-
},
|
|
11746
|
-
{
|
|
11747
|
-
name: this.getAtomName('LAYOUT_BUTTON'),
|
|
11748
|
-
component: 'TekGridLayoutOptions',
|
|
11749
|
-
isVisible: `{{GridController_${this.grid.name}.showLayoutOptionsButton}}`,
|
|
11750
|
-
},
|
|
11751
|
-
{
|
|
11752
|
-
name: this.getAtomName('DIVIDER_ACTIONS'),
|
|
11753
|
-
component: 'ZdDivider',
|
|
11754
|
-
cssClass: 'toolbar-divider',
|
|
11755
|
-
vertical: true,
|
|
11756
|
-
isVisible: `{{GridController_${this.grid.name}.showActionAndExportButton}}`,
|
|
11757
|
-
},
|
|
11758
|
-
{
|
|
11759
|
-
name: this.getAtomName('EXPORT_DROPDOWN'),
|
|
11760
|
-
component: 'ZdDropdown',
|
|
11761
|
-
cssClass: 'tekgrid-actions-dropdown',
|
|
11762
|
-
offsetY: true,
|
|
11763
|
-
activator: {
|
|
11764
|
-
name: this.getAtomName('EXPORT_BUTTON'),
|
|
11765
|
-
component: 'ZdButton',
|
|
11766
|
-
icon: true,
|
|
11767
|
-
iconName: 'mdi-file-download-outline',
|
|
11768
|
-
isVisible: `{{GridController_${this.grid.name}.showExportButton}}`,
|
|
11769
|
-
},
|
|
11770
|
-
children: this.grid.exportActions || exportConfigButtons,
|
|
11771
|
-
},
|
|
11772
|
-
{
|
|
11773
|
-
name: this.getAtomName('ACTIONS_DROPDOWN'),
|
|
11774
|
-
component: 'ZdDropdown',
|
|
11775
|
-
cssClass: 'tekgrid-actions-dropdown',
|
|
11776
|
-
offsetY: true,
|
|
11777
|
-
activator: {
|
|
11778
|
-
name: this.getAtomName('ACTIONS_BUTTON'),
|
|
11779
|
-
component: 'ZdButton',
|
|
11780
|
-
icon: true,
|
|
11781
|
-
iconName: 'mdi-dots-vertical',
|
|
11782
|
-
isVisible: `{{GridController_${this.grid.name}.showActionsButton}}`,
|
|
11783
|
-
},
|
|
11784
|
-
children: this.grid.actions,
|
|
11785
|
-
},
|
|
11786
|
-
{
|
|
11787
|
-
name: this.getAtomName('DIVIDER3'),
|
|
11788
|
-
component: 'ZdDivider',
|
|
11789
|
-
cssClass: 'toolbar-divider',
|
|
11790
|
-
vertical: true,
|
|
11791
|
-
isVisible: `{{GridController_${this.grid.name}.showDivider3}}`,
|
|
11792
|
-
},
|
|
11793
|
-
],
|
|
11794
|
-
},
|
|
11795
|
-
{
|
|
11796
|
-
name: this.getAtomName('SAVE_BUTTON'),
|
|
11797
|
-
component: 'ZdButton',
|
|
11798
|
-
label: 'TEKGRID_SAVE',
|
|
11799
|
-
isVisible: `{{GridController_${this.grid.name}.showEditButtons}}`,
|
|
11800
|
-
small: true,
|
|
11801
|
-
events: {
|
|
11802
|
-
click: this.saveChanges.bind(this),
|
|
11803
|
-
},
|
|
11804
|
-
},
|
|
11805
|
-
{
|
|
11806
|
-
name: this.getAtomName('CANCEL_BUTTON'),
|
|
11807
|
-
component: 'ZdButton',
|
|
11808
|
-
label: 'TEKGRID_CANCEL',
|
|
11809
|
-
outline: true,
|
|
11810
|
-
cssClass: 'zd-mx-2',
|
|
11811
|
-
isVisible: `{{GridController_${this.grid.name}.showEditButtons}}`,
|
|
11812
|
-
small: true,
|
|
11813
|
-
events: {
|
|
11814
|
-
click: this.cancelChanges.bind(this),
|
|
11815
|
-
},
|
|
11816
|
-
},
|
|
11817
|
-
{
|
|
11818
|
-
name: this.getAtomName('SEARCH'),
|
|
11819
|
-
component: 'ZdSearch',
|
|
11820
|
-
cssClass: 'zd-grid-search',
|
|
11821
|
-
iterableComponentName: `${this.grid.name}`,
|
|
11822
|
-
isVisible: `{{GridController_${this.grid.name}.showSearchInput}}`,
|
|
11823
|
-
},
|
|
11824
|
-
{
|
|
11825
|
-
name: this.getAtomName('FILTER_TOOLTIP'),
|
|
11826
|
-
component: 'ZdTooltip',
|
|
11827
|
-
label: 'TEKGRID_FILTER',
|
|
11828
|
-
bottom: true,
|
|
11829
|
-
children: [
|
|
11830
|
-
{
|
|
11831
|
-
name: this.getAtomName('FILTER_BUTTON'),
|
|
11832
|
-
component: 'TekGridFilterButton',
|
|
11833
|
-
grid: this.grid,
|
|
11834
|
-
gridName: this.grid.name,
|
|
11835
|
-
showCheckboxAll: this.grid.showCheckboxAllFilter,
|
|
11836
|
-
isVisible: `{{GridController_${this.grid.name}.showFilterButton}}`,
|
|
11837
|
-
},
|
|
11838
|
-
],
|
|
11839
|
-
},
|
|
11840
|
-
],
|
|
11841
|
-
},
|
|
11842
|
-
];
|
|
11843
|
-
}
|
|
11844
|
-
}
|
|
11845
|
-
|
|
11846
|
-
class ColumnsSearcher {
|
|
11847
|
-
async searchColumn(columns, search) {
|
|
11848
|
-
const lookupColumns = columns.filter((column) => !!column.componentProps?.datasource && !column.skipLookupSearch);
|
|
11849
|
-
const searchJoin = {};
|
|
11850
|
-
if (search) {
|
|
11851
|
-
const promises = lookupColumns.map(async (column) => {
|
|
11852
|
-
const searchData = await column.memorySearch(search);
|
|
11853
|
-
const lookupId = column.componentProps.datasource.uniqueKey;
|
|
11854
|
-
searchJoin[column.name] = searchData.map((row) => row[lookupId]);
|
|
11855
|
-
});
|
|
11856
|
-
await Promise.all(promises);
|
|
11857
|
-
}
|
|
11858
|
-
return searchJoin;
|
|
11859
|
-
}
|
|
11860
|
-
}
|
|
11861
|
-
|
|
11862
|
-
class DynamicFilterDatasourceFactory {
|
|
11863
|
-
factory(options) {
|
|
11864
|
-
return DatasourceFactory.factory({
|
|
11865
|
-
data: this.getFilterOptionsData(options),
|
|
11866
|
-
loadAll: true,
|
|
11867
|
-
translate: ['text'],
|
|
11868
|
-
});
|
|
11869
|
-
}
|
|
11870
|
-
getFilterOptionsData(options) {
|
|
11871
|
-
const optionsKeys = Object.keys(options);
|
|
11872
|
-
return optionsKeys.map((item) => ({
|
|
11873
|
-
text: `TEKGRID_${item}`,
|
|
11874
|
-
value: item,
|
|
11875
|
-
}));
|
|
11876
|
-
}
|
|
11877
|
-
}
|
|
11878
|
-
|
|
11879
|
-
class TekFilterHelper {
|
|
11880
|
-
static getLabel(name) {
|
|
11881
|
-
return DateHelper.getLabel(name);
|
|
11882
|
-
}
|
|
11883
|
-
static getValue(name, column) {
|
|
11884
|
-
return DateHelper.getValue(name, column.componentProps.dateFormat);
|
|
11885
|
-
}
|
|
11886
|
-
static register(name, label, fn) {
|
|
11887
|
-
DateHelper.register(name, label, fn);
|
|
11888
|
-
}
|
|
11889
|
-
static unregister(name) {
|
|
11890
|
-
DateHelper.unregister(name);
|
|
11891
|
-
}
|
|
11892
|
-
}
|
|
11893
|
-
|
|
11894
|
-
/**
|
|
11895
|
-
* Base class for TekGrid Filter Button component
|
|
11896
|
-
*/
|
|
11897
|
-
class TekGridFilterButton extends Button {
|
|
11898
|
-
gridName;
|
|
11899
|
-
grid;
|
|
11900
|
-
showCheckboxAll = false;
|
|
11901
|
-
filterModal;
|
|
11902
|
-
filterFormInputs = {};
|
|
11903
|
-
constructor(props) {
|
|
11904
|
-
super(props);
|
|
11905
|
-
this.gridName = this.getInitValue('gridName', props.gridName, this.gridName);
|
|
11906
|
-
this.grid = this.getInitValue('grid', props.grid, undefined);
|
|
11907
|
-
this.showCheckboxAll = this.getInitValue('showCheckboxAll', props.showCheckboxAll, this.showCheckboxAll);
|
|
11908
|
-
this.createAccessors();
|
|
11909
|
-
if (!this.grid)
|
|
11910
|
-
this.loadGrid();
|
|
11911
|
-
}
|
|
11912
|
-
loadGrid(gridName) {
|
|
11913
|
-
if (gridName)
|
|
11914
|
-
this.gridName = gridName;
|
|
11915
|
-
if (!this.gridName)
|
|
11916
|
-
return;
|
|
11917
|
-
this.grid = Metadata.getInstances(this.gridName)[0];
|
|
11918
|
-
}
|
|
11919
|
-
click(event) {
|
|
11920
|
-
this.callEvent('click', { component: this, event });
|
|
11921
|
-
this.grid.callEvent('filterClick', { component: this.grid, event });
|
|
11922
|
-
if (!event?.defaultPrevented) {
|
|
11923
|
-
this.createFilterFromColumns.call(this);
|
|
11924
|
-
}
|
|
11925
|
-
}
|
|
11926
|
-
loadFilterValues({ component }) {
|
|
11927
|
-
const changedCompNames = [];
|
|
11928
|
-
const { datasource } = this.grid;
|
|
11929
|
-
if (datasource instanceof TekRestDatasource || datasource instanceof TekMemoryDatasource) {
|
|
11930
|
-
const { dynamicFilter } = datasource;
|
|
11931
|
-
const newDynamicFilter = { ...this.grid.defaultFilter, ...dynamicFilter };
|
|
11932
|
-
Object.keys(newDynamicFilter).forEach((column) => {
|
|
11933
|
-
if (newDynamicFilter[column] && newDynamicFilter[column].length > 0) {
|
|
11934
|
-
newDynamicFilter[column].forEach((filterItem, index) => {
|
|
11935
|
-
const relation = filterItem.relation || 'AND';
|
|
11936
|
-
const operation = filterItem.operation || 'CONTAINS';
|
|
11937
|
-
const compName = `${this.grid.name}-filter-${relation}-${operation}-${column}-${index}`;
|
|
11938
|
-
changedCompNames.push(compName);
|
|
11939
|
-
component.value[compName] = filterItem.value;
|
|
11940
|
-
let helperValue = '';
|
|
11941
|
-
const columnObj = this.grid.getColumn(column);
|
|
11942
|
-
if (columnObj instanceof TekGridColumn) {
|
|
11943
|
-
const { filterProps } = columnObj;
|
|
11944
|
-
if (!Array.isArray(filterProps)) {
|
|
11945
|
-
helperValue = filterProps.helperValue || '';
|
|
11946
|
-
}
|
|
11947
|
-
else {
|
|
11948
|
-
filterProps.forEach((prop) => {
|
|
11949
|
-
if ((prop.relation || 'AND') === relation && (prop.operation || 'CONTAINS') === operation) {
|
|
11950
|
-
helperValue = prop.helperValue || '';
|
|
11951
|
-
}
|
|
11952
|
-
});
|
|
11953
|
-
}
|
|
11954
|
-
const inputObj = Metadata.getInstances(compName);
|
|
11955
|
-
if (helperValue && inputObj.length && inputObj[0]) {
|
|
11956
|
-
inputObj[0].hint = TekFilterHelper.getLabel(helperValue);
|
|
11957
|
-
}
|
|
11958
|
-
}
|
|
11959
|
-
});
|
|
11960
|
-
}
|
|
11961
|
-
});
|
|
11962
|
-
}
|
|
11963
|
-
else {
|
|
11964
|
-
const { filter } = datasource;
|
|
11965
|
-
const newFilter = { ...this.grid.defaultFilter, ...filter };
|
|
11966
|
-
Object.keys(newFilter).forEach((item) => {
|
|
11967
|
-
if (newFilter[item]) {
|
|
11968
|
-
const compName = `${this.grid.name}-filter-AND-CONTAINS-${item}-0`;
|
|
11969
|
-
changedCompNames.push(compName);
|
|
11970
|
-
component.value[compName] = newFilter[item];
|
|
11971
|
-
}
|
|
11972
|
-
});
|
|
11973
|
-
}
|
|
11974
|
-
Object.keys(component.value).forEach((compName) => {
|
|
11975
|
-
if (changedCompNames.indexOf(compName) === -1) {
|
|
11976
|
-
component.value[compName] = null;
|
|
11977
|
-
}
|
|
11978
|
-
});
|
|
11979
|
-
}
|
|
11980
|
-
hideFilterModal() {
|
|
11981
|
-
this.filterModal.hide();
|
|
11982
|
-
}
|
|
11983
|
-
destroyFilterModal() {
|
|
11984
|
-
if (this.filterModal)
|
|
11985
|
-
this.filterModal.destroy();
|
|
11986
|
-
}
|
|
11987
|
-
createFilterFromColumns() {
|
|
11988
|
-
if (!this.filterModal) {
|
|
11989
|
-
const originalProps = {
|
|
11990
|
-
height: 'auto',
|
|
11991
|
-
maxHeight: '18.75rem',
|
|
11992
|
-
persistent: true,
|
|
11993
|
-
title: 'FILTER',
|
|
11994
|
-
};
|
|
11995
|
-
const mergeModalFilterProps = Object.assign(originalProps, this.grid.modalFilterProps);
|
|
11996
|
-
const filterModalDef = {
|
|
11997
|
-
name: `${this.grid.name}-filter-modal`,
|
|
11998
|
-
persistent: mergeModalFilterProps.persistent,
|
|
11999
|
-
grid: mergeModalFilterProps.grid,
|
|
12000
|
-
cssClass: mergeModalFilterProps.cssClass,
|
|
12001
|
-
cssStyle: mergeModalFilterProps.cssStyle,
|
|
12002
|
-
draggable: mergeModalFilterProps.draggable,
|
|
12003
|
-
dragHandle: mergeModalFilterProps.dragHandle,
|
|
12004
|
-
fullscreen: mergeModalFilterProps.fullscreen,
|
|
12005
|
-
light: mergeModalFilterProps.light,
|
|
12006
|
-
dark: mergeModalFilterProps.dark,
|
|
12007
|
-
escKeydownStop: false,
|
|
12008
|
-
children: [
|
|
12009
|
-
{
|
|
12010
|
-
name: `${this.grid.name}-filter-header-container`,
|
|
12011
|
-
component: 'ZdContainer',
|
|
12012
|
-
cssClass: 'zd-pa-0 zd-display-flex',
|
|
12013
|
-
children: [
|
|
12014
|
-
{
|
|
12015
|
-
name: `${this.grid.name}-filter-title`,
|
|
12016
|
-
component: 'ZdText',
|
|
12017
|
-
cssStyle: `color: ${'var(--v-primary-base);'}`,
|
|
12018
|
-
text: mergeModalFilterProps.title,
|
|
12019
|
-
tag: 'h3',
|
|
12020
|
-
},
|
|
12021
|
-
{
|
|
12022
|
-
name: `${this.grid.name}-filter-spacer`,
|
|
12023
|
-
component: 'VSpacer',
|
|
12024
|
-
},
|
|
12025
|
-
{
|
|
12026
|
-
name: `${this.grid.name}-filter-close-button`,
|
|
12027
|
-
component: 'ZdModalCloseButton',
|
|
12028
|
-
small: true,
|
|
12029
|
-
modalName: `${this.grid.name}-filter-modal`,
|
|
12030
|
-
},
|
|
12031
|
-
],
|
|
12032
|
-
},
|
|
12033
|
-
{
|
|
12034
|
-
name: `${this.grid.name}-filter-content-container`,
|
|
12035
|
-
component: 'ZdContainer',
|
|
12036
|
-
scrollView: true,
|
|
12037
|
-
cssClass: 'zd-my-2 zd-pa-0 tek-grid-filter-content-container',
|
|
12038
|
-
maxHeight: mergeModalFilterProps.maxHeight,
|
|
12039
|
-
height: mergeModalFilterProps.height,
|
|
12040
|
-
children: [
|
|
12041
|
-
{
|
|
12042
|
-
name: `${this.grid.name}-filter-form`,
|
|
12043
|
-
component: 'ZdForm',
|
|
12044
|
-
cssClass: 'zd-my-2 zd-pa-0',
|
|
12045
|
-
children: this.getFilterModalComponents(),
|
|
12046
|
-
events: {
|
|
12047
|
-
onMounted: this.loadFilterValues.bind(this),
|
|
12048
|
-
},
|
|
12049
|
-
},
|
|
12050
|
-
],
|
|
12051
|
-
},
|
|
12052
|
-
{
|
|
12053
|
-
name: `${this.grid.name}-filter-footer-container`,
|
|
12054
|
-
component: 'ZdContainer',
|
|
12055
|
-
cssClass: 'zd-pa-0',
|
|
12056
|
-
children: [
|
|
12057
|
-
{
|
|
12058
|
-
name: `${this.grid.name}-filter-footer`,
|
|
12059
|
-
component: 'ZdFooter',
|
|
12060
|
-
color: 'transparent',
|
|
12061
|
-
padless: true,
|
|
12062
|
-
leftSlot: [
|
|
12063
|
-
{
|
|
12064
|
-
name: `${this.grid.name}-filter-clearButton`,
|
|
12065
|
-
component: 'ZdButton',
|
|
12066
|
-
label: 'CLEAR',
|
|
12067
|
-
outline: true,
|
|
12068
|
-
events: {
|
|
12069
|
-
click: this.clearFilter.bind(this),
|
|
12070
|
-
},
|
|
12071
|
-
},
|
|
12072
|
-
],
|
|
12073
|
-
rightSlot: [
|
|
12074
|
-
{
|
|
12075
|
-
name: `${this.grid.name}-filter-cancelButton`,
|
|
12076
|
-
component: 'ZdButton',
|
|
12077
|
-
label: 'CANCEL',
|
|
12078
|
-
keyMap: {
|
|
12079
|
-
esc: {
|
|
12080
|
-
event: this.hideFilterModal.bind(this),
|
|
12081
|
-
focus: true,
|
|
12082
|
-
visible: true,
|
|
12083
|
-
input: true,
|
|
12084
|
-
stop: true,
|
|
12085
|
-
},
|
|
12086
|
-
},
|
|
12087
|
-
outline: true,
|
|
12088
|
-
events: {
|
|
12089
|
-
click: this.hideFilterModal.bind(this),
|
|
12090
|
-
},
|
|
12091
|
-
},
|
|
12092
|
-
{
|
|
12093
|
-
name: `${this.grid.name}-filter-okButton`,
|
|
12094
|
-
component: 'ZdButton',
|
|
12095
|
-
label: 'OK',
|
|
12096
|
-
events: {
|
|
12097
|
-
click: this.applyFilter.bind(this),
|
|
12098
|
-
},
|
|
12099
|
-
keyMap: {
|
|
12100
|
-
'mod+enter': {
|
|
12101
|
-
event: this.applyFilter.bind(this),
|
|
12102
|
-
focus: true,
|
|
12103
|
-
input: true,
|
|
12104
|
-
stop: true,
|
|
12105
|
-
visible: true,
|
|
12106
|
-
},
|
|
12107
|
-
},
|
|
12108
|
-
},
|
|
12109
|
-
],
|
|
12110
|
-
},
|
|
12111
|
-
],
|
|
12112
|
-
},
|
|
12113
|
-
],
|
|
12114
|
-
};
|
|
12115
|
-
this.filterModal = ModalService.create(filterModalDef);
|
|
12116
|
-
}
|
|
12117
|
-
else {
|
|
12118
|
-
this.loadFilterValues({ component: Metadata.getInstance(`${this.grid.name}-filter-form`) });
|
|
12119
|
-
}
|
|
12120
|
-
this.filterModal.show();
|
|
12121
|
-
}
|
|
12122
|
-
onBeforeDestroy() {
|
|
12123
|
-
super.onBeforeDestroy();
|
|
12124
|
-
this.destroyFilterModal();
|
|
12125
|
-
}
|
|
12126
|
-
formatFormValue(filterForm) {
|
|
12127
|
-
// TODO: add this logic when SelectMultiple is implemented
|
|
12128
|
-
// return Object.keys(filterForm.value).reduce((result, item) => {
|
|
12129
|
-
// try {
|
|
12130
|
-
// const itemInstance = filterForm.getChildInstance<Input>(item);
|
|
12131
|
-
// if (!(itemInstance instanceof SelectMultiple) || !itemInstance.checkboxAll) return result;
|
|
12132
|
-
// // when selectmultiple with checkboxAll, should either remove it from the filter or
|
|
12133
|
-
// // change the value to T, depending on selectAllCompatibilityMode
|
|
12134
|
-
// if ((Config as ITekConfig).selectAllCompatibilityMode) {
|
|
12135
|
-
// result[item] = 'T';
|
|
12136
|
-
// return result;
|
|
12137
|
-
// }
|
|
12138
|
-
// delete result[item];
|
|
12139
|
-
// return result;
|
|
12140
|
-
// } catch (e) {
|
|
12141
|
-
// return result;
|
|
12142
|
-
// }
|
|
12143
|
-
// }, { ...filterForm.value });
|
|
12144
|
-
return filterForm.value;
|
|
12145
|
-
}
|
|
12146
|
-
async applyFilter({ event }) {
|
|
12147
|
-
const filterForm = Metadata.getInstance(`${this.grid.name}-filter-form`);
|
|
12148
|
-
const isFormValid = await filterForm.validate();
|
|
12149
|
-
if (isFormValid.valid) {
|
|
12150
|
-
const { datasource } = this.grid;
|
|
12151
|
-
const filter = {};
|
|
12152
|
-
const formValue = this.formatFormValue(filterForm);
|
|
12153
|
-
if (datasource instanceof TekRestDatasource || datasource instanceof TekMemoryDatasource) {
|
|
12154
|
-
Object.keys(formValue).forEach((item) => {
|
|
12155
|
-
const itemValue = formValue[item];
|
|
12156
|
-
if (itemValue && !(Array.isArray(itemValue) && !itemValue.length)) {
|
|
12157
|
-
const relationAndOperationAndName = item.split(`${this.grid.name}-filter-`)[1];
|
|
12158
|
-
const [relation, operation] = relationAndOperationAndName.split('-');
|
|
12159
|
-
let columnName = relationAndOperationAndName.split(`${relation}-${operation}-`)[1];
|
|
12160
|
-
columnName = columnName.split('-').slice(0, -1).join('-'); // remove index
|
|
12161
|
-
if (!filter[columnName]) {
|
|
12162
|
-
filter[columnName] = [];
|
|
12163
|
-
}
|
|
12164
|
-
const value = itemValue;
|
|
12165
|
-
filter[columnName].push({
|
|
12166
|
-
relation,
|
|
12167
|
-
operation,
|
|
12168
|
-
value,
|
|
12169
|
-
});
|
|
12170
|
-
}
|
|
12171
|
-
});
|
|
12172
|
-
datasource.dynamicFilter = filter;
|
|
12173
|
-
this.setFilter(filter, event, datasource.setDynamicFilter.bind(datasource));
|
|
12174
|
-
}
|
|
12175
|
-
else {
|
|
12176
|
-
Object.keys(formValue).forEach((item) => {
|
|
12177
|
-
let columnName = item.split(`${this.grid.name}-filter-AND-CONTAINS-`)[1];
|
|
12178
|
-
columnName = columnName.split('-').slice(0, -1).join('-'); // remove index
|
|
12179
|
-
if (formValue[item]) {
|
|
12180
|
-
filter[columnName] = formValue[item];
|
|
12181
|
-
}
|
|
12182
|
-
});
|
|
12183
|
-
datasource.filter = filter;
|
|
12184
|
-
this.setFilter(filter, event, datasource.setFilter.bind(datasource));
|
|
12185
|
-
}
|
|
12186
|
-
this.grid.changeLayout(event);
|
|
12187
|
-
}
|
|
12188
|
-
}
|
|
12189
|
-
setFilter(filter, event, filterFn) {
|
|
12190
|
-
this.grid.callEvent('beforeApplyFilter', { component: this.grid, event });
|
|
12191
|
-
if (event.defaultPrevented)
|
|
12192
|
-
return;
|
|
12193
|
-
filterFn(filter);
|
|
12194
|
-
this.hideFilterModal();
|
|
12195
|
-
}
|
|
12196
|
-
clearFilter() {
|
|
12197
|
-
const filterForm = Metadata.getInstance(`${this.grid.name}-filter-form`);
|
|
12198
|
-
Object.keys(filterForm.value).forEach((item) => {
|
|
12199
|
-
filterForm.value[item] = null;
|
|
12200
|
-
});
|
|
12201
|
-
}
|
|
12202
|
-
sortFilterIndex(col1, col2) {
|
|
12203
|
-
const index1 = col1.filterIndex !== undefined ? col1.filterIndex : Number.MAX_SAFE_INTEGER;
|
|
12204
|
-
const index2 = col2.filterIndex !== undefined ? col2.filterIndex : Number.MAX_SAFE_INTEGER;
|
|
12205
|
-
return index1 - index2;
|
|
12206
|
-
}
|
|
12207
|
-
getFilterModalComponents() {
|
|
12208
|
-
const filterColumns = [];
|
|
12209
|
-
let columnComponentName;
|
|
12210
|
-
[...this.grid.columns].sort(this.sortFilterIndex).forEach((column) => {
|
|
12211
|
-
const filterProps = Array.isArray(column.filterProps) ? column.filterProps : [column.filterProps];
|
|
12212
|
-
if (column.filterable && filterProps && filterProps.length > 0) {
|
|
12213
|
-
this.filterFormInputs[column.name] = [];
|
|
12214
|
-
filterProps.forEach((filterItem, index) => {
|
|
12215
|
-
const { datasource } = this.grid;
|
|
12216
|
-
if (datasource instanceof TekRestDatasource || datasource instanceof TekMemoryDatasource) {
|
|
12217
|
-
const relation = filterItem.relation || 'AND';
|
|
12218
|
-
const operation = filterItem.operation || 'CONTAINS';
|
|
12219
|
-
columnComponentName = `${this.grid.name}-filter-${relation}-${operation}-${column.name}-${index}`;
|
|
12220
|
-
}
|
|
12221
|
-
else {
|
|
12222
|
-
columnComponentName = `${this.grid.name}-filter-AND-CONTAINS-${column.name}-${index}`;
|
|
12223
|
-
}
|
|
12224
|
-
this.filterFormInputs[column.name].push(columnComponentName);
|
|
12225
|
-
const newColumnComponent = {
|
|
12226
|
-
label: column.label,
|
|
12227
|
-
...column.componentProps,
|
|
12228
|
-
...filterItem,
|
|
12229
|
-
name: columnComponentName,
|
|
12230
|
-
};
|
|
12231
|
-
if (filterItem.helperOptions) {
|
|
12232
|
-
if (!newColumnComponent.events)
|
|
12233
|
-
newColumnComponent.events = {};
|
|
12234
|
-
newColumnComponent.events.change = this.changeHelperEvent.bind(this, column);
|
|
12235
|
-
}
|
|
12236
|
-
if (newColumnComponent.component === 'ZdSelectMultiple') {
|
|
12237
|
-
newColumnComponent.showCheckboxAll = newColumnComponent.showCheckboxAll ?? this.showCheckboxAll;
|
|
12238
|
-
}
|
|
12239
|
-
filterColumns.push(newColumnComponent);
|
|
12240
|
-
});
|
|
12241
|
-
}
|
|
12242
|
-
});
|
|
12243
|
-
return filterColumns;
|
|
12244
|
-
}
|
|
12245
|
-
changeHelperEvent(column, { component }) {
|
|
12246
|
-
const { helperValue } = component;
|
|
12247
|
-
const componentName = component.name;
|
|
12248
|
-
if (!Array.isArray(column.filterProps)) {
|
|
12249
|
-
column.filterProps.helperValue = helperValue;
|
|
12250
|
-
}
|
|
12251
|
-
else {
|
|
12252
|
-
column.filterProps.forEach((prop) => {
|
|
12253
|
-
const relationAndOperationAndName = componentName.split(`${this.grid.name}-filter-`)[1];
|
|
12254
|
-
const [relation, operation] = relationAndOperationAndName.split('-');
|
|
12255
|
-
if ((prop.relation || 'AND') === relation && (prop.operation || 'CONTAINS') === operation) {
|
|
12256
|
-
prop.helperValue = helperValue;
|
|
12257
|
-
}
|
|
12258
|
-
});
|
|
12259
|
-
}
|
|
12260
|
-
}
|
|
12261
|
-
}
|
|
12262
|
-
|
|
12263
|
-
class GroupedDataManager {
|
|
12264
|
-
grid;
|
|
12265
|
-
summaryColumns = [];
|
|
12266
|
-
groups = [];
|
|
12267
|
-
summary = {};
|
|
12268
|
-
groupedData = [];
|
|
12269
|
-
groupColumnNames = [];
|
|
12270
|
-
groupColumns = [];
|
|
12271
|
-
originalDatasourceLoadAll;
|
|
12272
|
-
originalDatasourceLimit;
|
|
12273
|
-
viewUpdateScrollData;
|
|
12274
|
-
viewUpdateFixedColumns;
|
|
12275
|
-
constructor(grid) {
|
|
12276
|
-
this.grid = grid;
|
|
12277
|
-
}
|
|
12278
|
-
setViewUpdateFixedColumns(fn) {
|
|
12279
|
-
this.viewUpdateFixedColumns = fn;
|
|
12280
|
-
}
|
|
12281
|
-
setViewUpdateScrollData(fn) {
|
|
12282
|
-
this.viewUpdateScrollData = fn;
|
|
12283
|
-
}
|
|
12284
|
-
/**
|
|
12285
|
-
* Tasks that should be finished before loading the grid data
|
|
12286
|
-
*/
|
|
12287
|
-
tasksBeforeLoad = [];
|
|
12288
|
-
registerTask(task) {
|
|
12289
|
-
this.tasksBeforeLoad.push(task);
|
|
12290
|
-
}
|
|
12291
|
-
request = () => {
|
|
12292
|
-
throw new NonInitializedError(this.constructor.name);
|
|
12293
|
-
};
|
|
12294
|
-
debounceUpdateGrouping = () => {
|
|
12295
|
-
throw new NonInitializedError(this.constructor.name);
|
|
12296
|
-
};
|
|
12297
|
-
/**
|
|
12298
|
-
* Loads grid data after resolving all tasks
|
|
12299
|
-
*/
|
|
12300
|
-
async loadAfterTasks() {
|
|
12301
|
-
Promise.all(this.tasksBeforeLoad.map((promise) => promise.catch(() => undefined)));
|
|
12302
|
-
this.tasksBeforeLoad = [];
|
|
12303
|
-
return this.request();
|
|
12304
|
-
}
|
|
12305
|
-
initializeDebounceFunctions() {
|
|
12306
|
-
this.request = debounce(() => {
|
|
12307
|
-
this.grid.reload();
|
|
12308
|
-
}, 500);
|
|
12309
|
-
this.debounceUpdateGrouping = debounce((lazyLoad = false) => {
|
|
12310
|
-
this.updateGroupedData(lazyLoad);
|
|
12311
|
-
}, 100);
|
|
12312
|
-
}
|
|
12313
|
-
/**
|
|
12314
|
-
* Initializes grid groups, summary columns and registers the grid datasource callback
|
|
12315
|
-
* @param lazyLoad defines if the grid should automatically load data after updating the datasource
|
|
12316
|
-
*/
|
|
12317
|
-
initializeGrouping(lazyLoad) {
|
|
12318
|
-
this.initializeDebounceFunctions();
|
|
12319
|
-
this.initGroups();
|
|
12320
|
-
this.initSummaryColumns();
|
|
12321
|
-
this.originalDatasourceLoadAll = this.grid.datasource.loadAll;
|
|
12322
|
-
this.originalDatasourceLimit = this.grid.datasource.limit;
|
|
12323
|
-
this.grid.datasource.registerGetCallback((data) => this.onGet(data));
|
|
12324
|
-
this.updateGrouping(lazyLoad);
|
|
12325
|
-
}
|
|
12326
|
-
onGet(data) {
|
|
12327
|
-
if (this.isGrouped()) {
|
|
12328
|
-
this.buildGroupedData();
|
|
12329
|
-
}
|
|
12330
|
-
return data;
|
|
12331
|
-
}
|
|
12332
|
-
resetFooterVariables(group) {
|
|
12333
|
-
this.summaryColumns.forEach((column) => {
|
|
12334
|
-
group.footer[column.name] = {
|
|
12335
|
-
count: 0,
|
|
12336
|
-
sum: undefined,
|
|
12337
|
-
avg: undefined,
|
|
12338
|
-
min: undefined,
|
|
12339
|
-
max: undefined,
|
|
12340
|
-
};
|
|
12341
|
-
});
|
|
12342
|
-
}
|
|
12343
|
-
initGroups() {
|
|
12344
|
-
this.groups = [];
|
|
12345
|
-
this.groupColumns.forEach((column) => {
|
|
12346
|
-
const newGroup = {
|
|
12347
|
-
column,
|
|
12348
|
-
name: column.name,
|
|
12349
|
-
label: column.label,
|
|
12350
|
-
lastValue: undefined,
|
|
12351
|
-
initialized: false,
|
|
12352
|
-
footer: {},
|
|
12353
|
-
};
|
|
12354
|
-
this.resetFooterVariables(newGroup);
|
|
12355
|
-
this.groups.push(newGroup);
|
|
12356
|
-
});
|
|
12357
|
-
}
|
|
12358
|
-
getGroupedData() {
|
|
12359
|
-
return this.groupedData;
|
|
12360
|
-
}
|
|
12361
|
-
initSummaryColumns() {
|
|
12362
|
-
this.summaryColumns = this.grid.columns.filter((column) => !!column.aggregation && !column.grouped);
|
|
12363
|
-
this.summary = {};
|
|
12364
|
-
}
|
|
12365
|
-
/**
|
|
12366
|
-
* Calls updateGroupedData with debounce
|
|
12367
|
-
*/
|
|
12368
|
-
updateGrouping(lazyLoad) {
|
|
12369
|
-
this.debounceUpdateGrouping(lazyLoad);
|
|
12370
|
-
}
|
|
12371
|
-
/**
|
|
12372
|
-
* Inits summary columns, updates the grid datasource and, if needed, reloads the grid data
|
|
12373
|
-
*/
|
|
12374
|
-
async updateGroupedData(lazyLoad) {
|
|
12375
|
-
this.initSummaryColumns();
|
|
12376
|
-
this.updateGridDatasource();
|
|
12377
|
-
if (!lazyLoad) {
|
|
12378
|
-
await this.loadAfterTasks();
|
|
12379
|
-
}
|
|
12380
|
-
if (this.grid.virtualScroll && this.viewUpdateScrollData) {
|
|
12381
|
-
this.viewUpdateScrollData();
|
|
12382
|
-
}
|
|
12383
|
-
if (this.viewUpdateFixedColumns) {
|
|
12384
|
-
this.viewUpdateFixedColumns();
|
|
12385
|
-
}
|
|
12386
|
-
}
|
|
12387
|
-
/**
|
|
12388
|
-
* When using groups, should update the grid datasource order to reflect the group order
|
|
12389
|
-
* If the grid is not grouped, should not update the datasource order
|
|
12390
|
-
*/
|
|
12391
|
-
updateGridDatasource() {
|
|
12392
|
-
this.groupedData = [];
|
|
12393
|
-
this.groupColumns = this.grid.columns.filter((column) => column.grouped);
|
|
12394
|
-
this.groupColumnNames = this.groupColumns.map((column) => column.name);
|
|
12395
|
-
if (this.isGrouped()) {
|
|
12396
|
-
if (this.groupColumns.length) {
|
|
12397
|
-
const order = this.getOrder(this.groupColumnNames, this.grid.datasource.order);
|
|
12398
|
-
this.grid.datasource.order = order;
|
|
12399
|
-
}
|
|
12400
|
-
this.grid.datasource.loadAll = true;
|
|
12401
|
-
return;
|
|
12402
|
-
}
|
|
12403
|
-
this.grid.datasource.loadAll = this.originalDatasourceLoadAll;
|
|
12404
|
-
this.grid.datasource.limit = this.originalDatasourceLimit;
|
|
12405
|
-
}
|
|
12406
|
-
/**
|
|
12407
|
-
* Returns the order to be used in the grid datasource based on the group column names and the grid order
|
|
12408
|
-
*/
|
|
12409
|
-
getOrder(groupColumnNames, gridOrder) {
|
|
12410
|
-
const groupOrderColumns = groupColumnNames.map((column) => `${column}.asc`);
|
|
12411
|
-
const otherOrderColumns = gridOrder.filter((column) => groupColumnNames.indexOf(column.split('.')[0]) === -1);
|
|
12412
|
-
return [...groupOrderColumns, ...otherOrderColumns];
|
|
12413
|
-
}
|
|
12414
|
-
/**
|
|
12415
|
-
* Returns the summary data for the group
|
|
12416
|
-
*/
|
|
12417
|
-
getSummaryData(group) {
|
|
12418
|
-
const summaryData = {};
|
|
12419
|
-
this.summaryColumns.forEach((column) => {
|
|
12420
|
-
const { aggregation } = column;
|
|
12421
|
-
const currentGroup = group[column.name];
|
|
12422
|
-
if (!currentGroup) {
|
|
12423
|
-
summaryData[column.name] = 0;
|
|
12424
|
-
return;
|
|
12425
|
-
}
|
|
12426
|
-
if (aggregation === 'COUNT') {
|
|
12427
|
-
summaryData[column.name] = currentGroup.count;
|
|
12428
|
-
}
|
|
12429
|
-
else if (aggregation === 'SUM') {
|
|
12430
|
-
summaryData[column.name] = currentGroup.sum;
|
|
12431
|
-
}
|
|
12432
|
-
else if (aggregation === 'AVG') {
|
|
12433
|
-
if (currentGroup.avg) {
|
|
12434
|
-
summaryData[column.name] = currentGroup.avg;
|
|
12435
|
-
}
|
|
12436
|
-
else if (typeof currentGroup.sum === 'number') {
|
|
12437
|
-
summaryData[column.name] = currentGroup.sum / currentGroup.count;
|
|
12438
|
-
}
|
|
12439
|
-
}
|
|
12440
|
-
else if (aggregation === 'MIN') {
|
|
12441
|
-
summaryData[column.name] = currentGroup.min;
|
|
12442
|
-
}
|
|
12443
|
-
else {
|
|
12444
|
-
// if (aggregation === 'MAX') {
|
|
12445
|
-
summaryData[column.name] = currentGroup.max;
|
|
12446
|
-
}
|
|
12447
|
-
});
|
|
12448
|
-
return summaryData;
|
|
12449
|
-
}
|
|
12450
|
-
/**
|
|
12451
|
-
* Adds group footers to the grouped data
|
|
12452
|
-
*/
|
|
12453
|
-
addGroupFooters(groupIndex) {
|
|
12454
|
-
if (this.summaryColumns.length === 0) {
|
|
12455
|
-
return;
|
|
12456
|
-
}
|
|
12457
|
-
for (let i = this.groups.length - 1; i >= groupIndex; i -= 1) {
|
|
12458
|
-
if (this.groups[i].initialized) {
|
|
12459
|
-
const groupFooterRow = {
|
|
12460
|
-
groupFooter: true,
|
|
12461
|
-
groupIndex: i,
|
|
12462
|
-
groupHeaders: [],
|
|
12463
|
-
groupLabel: this.groups[i].lastGroupHeaderRow.groupLabel,
|
|
12464
|
-
groupValue: this.groups[i].lastGroupHeaderRow.groupValue,
|
|
12465
|
-
...this.getSummaryData(this.groups[i].footer),
|
|
12466
|
-
};
|
|
12467
|
-
// add header for outer groups
|
|
12468
|
-
for (let g = 0; g < i; g += 1) {
|
|
12469
|
-
const { lastGroupHeaderRow } = this.groups[g];
|
|
12470
|
-
if (lastGroupHeaderRow) {
|
|
12471
|
-
groupFooterRow.groupHeaders.push(lastGroupHeaderRow);
|
|
12472
|
-
}
|
|
12473
|
-
}
|
|
12474
|
-
this.groupedData.push(groupFooterRow);
|
|
12475
|
-
}
|
|
12476
|
-
}
|
|
12477
|
-
}
|
|
12478
|
-
getGroupValue(group, row) {
|
|
12479
|
-
const groupColumn = this.grid.getColumn(group.column.name);
|
|
12480
|
-
const cellsApplied = this.grid.getAppliedConditions({ row, column: groupColumn });
|
|
12481
|
-
if (!isFilledObject(cellsApplied)) {
|
|
12482
|
-
this.grid.reapplyConditions(row);
|
|
12483
|
-
}
|
|
12484
|
-
const groupValue = groupColumn.formatterByRow(row, cellsApplied);
|
|
12485
|
-
return groupValue;
|
|
12486
|
-
}
|
|
12487
|
-
addGroupHeader(row, group, index) {
|
|
12488
|
-
const groupValue = this.getGroupValue(group, row) || group.column.groupLabelForEmptyValue;
|
|
12489
|
-
const groupHeaderRow = {
|
|
12490
|
-
group: true,
|
|
12491
|
-
groupRow: row,
|
|
12492
|
-
groupColumnName: group.column.name,
|
|
12493
|
-
groupHeader: true,
|
|
12494
|
-
groupIndex: index,
|
|
12495
|
-
groupLabel: I18n.translate(group.label),
|
|
12496
|
-
groupValue,
|
|
12497
|
-
groupOpened: group.column.groupOpened || this.grid.groupsOpened,
|
|
12498
|
-
groupHeaders: [],
|
|
12499
|
-
children: [],
|
|
12500
|
-
};
|
|
12501
|
-
// add header for outer groups to the added row
|
|
12502
|
-
for (let i = 0; i < index; i += 1) {
|
|
12503
|
-
groupHeaderRow.groupHeaders.push(this.groups[i].lastGroupHeaderRow);
|
|
12504
|
-
}
|
|
12505
|
-
group.lastGroupHeaderRow = groupHeaderRow;
|
|
12506
|
-
group.initialized = true;
|
|
12507
|
-
this.groupedData.push(groupHeaderRow);
|
|
12508
|
-
}
|
|
12509
|
-
calcSummaryValues(column, summary, row) {
|
|
12510
|
-
const rowValue = row[column.name];
|
|
12511
|
-
if (isNil(rowValue))
|
|
12512
|
-
return;
|
|
12513
|
-
summary.count += 1;
|
|
12514
|
-
if (this.grid.events.calcSummary) {
|
|
12515
|
-
this.grid.calcSummary(column, summary, row);
|
|
12516
|
-
return;
|
|
12517
|
-
}
|
|
12518
|
-
if (summary.min === undefined)
|
|
12519
|
-
summary.min = rowValue;
|
|
12520
|
-
if (summary.max === undefined)
|
|
12521
|
-
summary.max = rowValue;
|
|
12522
|
-
summary.min = rowValue < summary.min ? rowValue : summary.min;
|
|
12523
|
-
summary.max = rowValue > summary.max ? rowValue : summary.max;
|
|
12524
|
-
if (typeof rowValue === 'number') {
|
|
12525
|
-
summary.sum = (summary.sum || 0) + rowValue;
|
|
12526
|
-
}
|
|
12527
|
-
}
|
|
12528
|
-
calcSummary(row) {
|
|
12529
|
-
if (this.summaryColumns.length === 0)
|
|
12530
|
-
return;
|
|
12531
|
-
this.summaryColumns.forEach((column) => {
|
|
12532
|
-
const columnName = column.name;
|
|
12533
|
-
if (isNil(this.summary[columnName])) {
|
|
12534
|
-
this.summary[columnName] = {
|
|
12535
|
-
count: 0,
|
|
12536
|
-
sum: undefined,
|
|
12537
|
-
avg: undefined,
|
|
12538
|
-
min: undefined,
|
|
12539
|
-
max: undefined,
|
|
12540
|
-
};
|
|
12541
|
-
}
|
|
12542
|
-
this.calcSummaryValues(column, this.summary[columnName], row);
|
|
12543
|
-
this.groups.forEach((group) => {
|
|
12544
|
-
this.calcSummaryValues(column, group.footer[columnName], row);
|
|
12545
|
-
});
|
|
12546
|
-
});
|
|
12547
|
-
}
|
|
12548
|
-
addSummary() {
|
|
12549
|
-
if (this.summaryColumns.length === 0)
|
|
12550
|
-
return;
|
|
12551
|
-
const summaryRow = {
|
|
12552
|
-
groupFooter: true,
|
|
12553
|
-
groupSummary: true,
|
|
12554
|
-
...this.getSummaryData(this.summary),
|
|
12555
|
-
};
|
|
12556
|
-
this.groupedData.push(summaryRow);
|
|
12557
|
-
}
|
|
12558
|
-
/**
|
|
12559
|
-
* It takes a flat array of data and groups it by the group columns specified in
|
|
12560
|
-
* the grid.
|
|
12561
|
-
*/
|
|
12562
|
-
buildGroupedData() {
|
|
12563
|
-
this.initGroups();
|
|
12564
|
-
this.initSummaryColumns();
|
|
12565
|
-
this.groupedData = [];
|
|
12566
|
-
const data = this.grid.getData();
|
|
12567
|
-
data.forEach((row) => {
|
|
12568
|
-
let groupBreak = false;
|
|
12569
|
-
this.groups.forEach((group, index) => {
|
|
12570
|
-
const groupValue = row[group.name];
|
|
12571
|
-
if (group.lastValue !== groupValue || groupBreak) {
|
|
12572
|
-
if (!groupBreak) {
|
|
12573
|
-
this.addGroupFooters(index);
|
|
12574
|
-
}
|
|
12575
|
-
group.lastValue = groupValue;
|
|
12576
|
-
this.resetFooterVariables(group);
|
|
12577
|
-
this.addGroupHeader(row, group, index);
|
|
12578
|
-
groupBreak = true;
|
|
12579
|
-
}
|
|
12580
|
-
});
|
|
12581
|
-
this.groups.forEach((group) => {
|
|
12582
|
-
group.lastGroupHeaderRow.children.push(row);
|
|
12583
|
-
});
|
|
12584
|
-
this.groupedData.push({
|
|
12585
|
-
...row,
|
|
12586
|
-
groupHeaders: this.groups.map((group) => group.lastGroupHeaderRow).filter(Boolean),
|
|
12587
|
-
});
|
|
12588
|
-
this.calcSummary(row);
|
|
12589
|
-
});
|
|
12590
|
-
if (this.groupedData.length > 0) {
|
|
12591
|
-
this.addGroupFooters(0);
|
|
12592
|
-
if (this.grid.showSummaryTotal) {
|
|
12593
|
-
this.addSummary();
|
|
12594
|
-
}
|
|
12595
|
-
}
|
|
12596
|
-
}
|
|
12597
|
-
openGroup(group) {
|
|
12598
|
-
group.groupOpened = !group.groupOpened;
|
|
12599
|
-
if (this.grid.virtualScroll && this.viewUpdateScrollData)
|
|
12600
|
-
this.viewUpdateScrollData();
|
|
12601
|
-
}
|
|
12602
|
-
isItemVisible(row) {
|
|
12603
|
-
return !row.groupHeaders || !row.groupHeaders.length || row.groupHeaders.every((group) => group.groupOpened);
|
|
12604
|
-
}
|
|
12605
|
-
isGrouped() {
|
|
12606
|
-
return !!this.groupColumnNames.length || (this.grid.showSummaryTotal && !!this.summaryColumns.length);
|
|
12607
|
-
}
|
|
12608
|
-
isColumnSearchable(column) {
|
|
12609
|
-
return !this.grid.searchVisibleOnly || column.isVisible || column.grouped;
|
|
12610
|
-
}
|
|
12611
|
-
directionalLeft() {
|
|
12612
|
-
const { currentRow } = this.grid.datasource;
|
|
12613
|
-
if (currentRow.group && currentRow.groupOpened) {
|
|
12614
|
-
currentRow.groupOpened = false;
|
|
12615
|
-
return;
|
|
12616
|
-
}
|
|
12617
|
-
if (this.grid.cellSelection || !currentRow.groupHeaders?.length)
|
|
12618
|
-
return;
|
|
12619
|
-
const newCurrentRow = currentRow.groupHeaders[currentRow.groupHeaders.length - 1];
|
|
12620
|
-
this.grid.setCurrentRow(newCurrentRow);
|
|
12621
|
-
}
|
|
12622
|
-
directionalRight() {
|
|
12623
|
-
const { currentRow } = this.grid.datasource;
|
|
12624
|
-
if (!currentRow.group || currentRow.groupOpened)
|
|
12625
|
-
return;
|
|
12626
|
-
currentRow.groupOpened = true;
|
|
12627
|
-
}
|
|
12628
|
-
}
|
|
12629
|
-
|
|
12630
|
-
class GroupedViewNavigator {
|
|
12631
|
-
viewNavigator;
|
|
12632
|
-
grid;
|
|
12633
|
-
constructor(iterable) {
|
|
12634
|
-
this.viewNavigator = new ViewNavigator();
|
|
12635
|
-
this.grid = iterable;
|
|
12636
|
-
}
|
|
12637
|
-
navigateLeft(param) {
|
|
12638
|
-
this.viewNavigator.navigateLeft(param);
|
|
12639
|
-
}
|
|
12640
|
-
navigateRight(param) {
|
|
12641
|
-
this.viewNavigator.navigateRight(param);
|
|
12642
|
-
}
|
|
12643
|
-
setViewNavigate(viewNavigate) {
|
|
12644
|
-
this.viewNavigator.setViewNavigate(viewNavigate);
|
|
12645
|
-
}
|
|
12646
|
-
getRowIndex(groupedData, index) {
|
|
12647
|
-
if (index)
|
|
12648
|
-
return index;
|
|
12649
|
-
const { currentRow } = this.grid.datasource;
|
|
12650
|
-
return groupedData.findIndex((row) => {
|
|
12651
|
-
if (currentRow.group) {
|
|
12652
|
-
return row.group && row.groupValue === currentRow.groupValue;
|
|
12653
|
-
}
|
|
12654
|
-
const rowKey = this.grid.getRowKey(row);
|
|
12655
|
-
const currentRowKey = this.grid.getRowKey(currentRow);
|
|
12656
|
-
return rowKey && rowKey === currentRowKey;
|
|
12657
|
-
});
|
|
12658
|
-
}
|
|
12659
|
-
navigateUp(index) {
|
|
12660
|
-
if (!this.grid.isGrouped() || this.grid.cellSelection) {
|
|
12661
|
-
this.viewNavigator.navigateUp();
|
|
12662
|
-
return;
|
|
12663
|
-
}
|
|
12664
|
-
const groupedData = this.grid.getGroupedData();
|
|
12665
|
-
if (!groupedData.length || index === -1)
|
|
12666
|
-
return;
|
|
12667
|
-
let rowIndex = this.getRowIndex(groupedData, index);
|
|
12668
|
-
if (rowIndex === -1)
|
|
12669
|
-
rowIndex = groupedData.length;
|
|
12670
|
-
const newRow = groupedData[rowIndex - 1];
|
|
12671
|
-
if (!newRow || !this.grid.isItemVisible(newRow) || newRow.groupFooter) {
|
|
12672
|
-
this.navigateUp(rowIndex - 1);
|
|
12673
|
-
return;
|
|
12674
|
-
}
|
|
12675
|
-
this.grid.setCurrentRow(newRow);
|
|
12676
|
-
}
|
|
12677
|
-
navigateDown(index) {
|
|
12678
|
-
if (!this.grid.isGrouped() || this.grid.cellSelection) {
|
|
12679
|
-
this.viewNavigator.navigateDown();
|
|
12680
|
-
return;
|
|
12681
|
-
}
|
|
12682
|
-
const groupedData = this.grid.getGroupedData();
|
|
12683
|
-
if (!groupedData.length || index === groupedData.length)
|
|
12684
|
-
return;
|
|
12685
|
-
const rowIndex = this.getRowIndex(groupedData, index);
|
|
12686
|
-
const newRow = groupedData[rowIndex + 1];
|
|
12687
|
-
if (!newRow || !this.grid.isItemVisible(newRow) || newRow.groupFooter) {
|
|
12688
|
-
this.navigateDown(rowIndex + 1);
|
|
12689
|
-
return;
|
|
12690
|
-
}
|
|
12691
|
-
this.grid.setCurrentRow(newRow);
|
|
12692
|
-
}
|
|
12693
|
-
}
|
|
12694
|
-
|
|
12695
|
-
const tuple = (...args) => args;
|
|
12696
|
-
const columnAggregationValues = tuple('SUM', 'MIN', 'MAX', 'AVG', 'COUNT', undefined);
|
|
12697
|
-
|
|
12698
|
-
class KeyMapGrouped {
|
|
12699
|
-
getMap(instance) {
|
|
12700
|
-
return {
|
|
12701
|
-
left: {
|
|
12702
|
-
event: instance.directionalLeft.bind(instance),
|
|
12703
|
-
stop: true,
|
|
12704
|
-
active: true,
|
|
12705
|
-
},
|
|
12706
|
-
right: {
|
|
12707
|
-
event: instance.directionalRight.bind(instance),
|
|
12708
|
-
stop: true,
|
|
12709
|
-
active: true,
|
|
12710
|
-
},
|
|
12711
|
-
};
|
|
12712
|
-
}
|
|
12713
|
-
}
|
|
12714
|
-
|
|
12715
|
-
class GroupedDataSelector extends DataSelector {
|
|
12716
|
-
selectAll(isSelected) {
|
|
12717
|
-
if (!this.iterable.selectable)
|
|
12718
|
-
return;
|
|
12719
|
-
this.iterable.selectionState = { allSelected: isSelected, except: [] };
|
|
12720
|
-
const data = this.getData();
|
|
12721
|
-
if (!isSelected) {
|
|
12722
|
-
data.forEach((row) => {
|
|
12723
|
-
const index = this.iterable.selectedRows.indexOf(row);
|
|
12724
|
-
if (index > -1) {
|
|
12725
|
-
this.iterable.selectedRows.splice(index, 1);
|
|
12726
|
-
}
|
|
12727
|
-
});
|
|
12728
|
-
return;
|
|
12729
|
-
}
|
|
12730
|
-
data.forEach((row) => {
|
|
12731
|
-
if (this.callDisableSelection(row))
|
|
12732
|
-
return;
|
|
12733
|
-
const key = this.iterable.getRowKey(row);
|
|
12734
|
-
if (key && this.iterable.selectedRows.indexOf(row) === -1) {
|
|
12735
|
-
this.iterable.selectedRows.push(row);
|
|
12736
|
-
}
|
|
12737
|
-
});
|
|
12738
|
-
}
|
|
12739
|
-
getData() {
|
|
12740
|
-
if (this.iterable.isGrouped()) {
|
|
12741
|
-
return this.iterable.getGroupedData();
|
|
12742
|
-
}
|
|
12743
|
-
return this.iterable.getData();
|
|
12744
|
-
}
|
|
12745
|
-
}
|
|
12746
|
-
|
|
12747
|
-
/**
|
|
12748
|
-
* Base class for TekGrid column
|
|
12749
|
-
*/
|
|
12750
|
-
class TekGridColumn extends GridColumnEditable {
|
|
12751
|
-
/* filter component props */
|
|
12752
|
-
filterProps = [];
|
|
12753
|
-
/* column can be use to filter */
|
|
12754
|
-
filterable = true;
|
|
12755
|
-
/* Index of the column inside filter modal */
|
|
12756
|
-
filterIndex;
|
|
12757
|
-
/* should not consider lookup column on search */
|
|
12758
|
-
skipLookupSearch = false;
|
|
12759
|
-
/* column is grouped */
|
|
12760
|
-
groupedValue = false;
|
|
12761
|
-
/* column group is opened */
|
|
12762
|
-
groupOpenedValue = false;
|
|
12763
|
-
/* Value to show when grouped value is empty */
|
|
12764
|
-
groupLabelForEmptyValue = '';
|
|
12765
|
-
/* column has aggregation */
|
|
12766
|
-
aggregationValue;
|
|
12767
|
-
/* column is visible */
|
|
12768
|
-
isVisibleValue = true;
|
|
12769
|
-
/**
|
|
12770
|
-
* Defines if the column should store the componentProps datasource.data in memory
|
|
12771
|
-
*/
|
|
12772
|
-
storeData = true;
|
|
12773
|
-
grid;
|
|
12774
|
-
/* istanbul ignore next */
|
|
12775
|
-
/**
|
|
12776
|
-
* Creates a new TekGrid Column.
|
|
12777
|
-
* @param props TekGrid column properties
|
|
12778
|
-
*/
|
|
12779
|
-
constructor(props, grid) {
|
|
12780
|
-
super(props);
|
|
12781
|
-
this.grid = grid;
|
|
12782
|
-
this.isVisible = this.getInitValue('isVisible', props.isVisible, this.isVisible);
|
|
12783
|
-
this.filterProps = this.getInitValue('filterProps', props.filterProps, this.filterProps);
|
|
12784
|
-
this.filterable = this.getInitValue('filterable', props.filterable, this.filterable);
|
|
12785
|
-
this.filterIndex = this.getInitValue('filterIndex', props.filterIndex, this.filterIndex);
|
|
12786
|
-
this.skipLookupSearch = this.getInitValue('skipLookupSearch', props.skipLookupSearch, this.skipLookupSearch);
|
|
12787
|
-
this.grouped = this.getInitValue('grouped', props.grouped, this.grouped);
|
|
12788
|
-
this.groupOpened = this.getInitValue('groupOpened', props.groupOpened, this.groupOpened);
|
|
12789
|
-
this.aggregation = this.getInitValue('aggregation', props.aggregation, this.aggregation);
|
|
12790
|
-
this.groupLabelForEmptyValue = this.getInitValue('groupLabelForEmptyValue', props.groupLabelForEmptyValue, this.groupLabelForEmptyValue);
|
|
12791
|
-
this.storeData = this.getInitValue('storeData', props.storeData, this.storeData);
|
|
12792
|
-
this.createAccessors();
|
|
12793
|
-
}
|
|
12794
|
-
async getBatchLookupData(lookupColumn, values) {
|
|
12795
|
-
const batch = [];
|
|
12796
|
-
const dataToLookup = [];
|
|
12797
|
-
values.forEach((value) => {
|
|
12798
|
-
if (this.lookupData[value]) {
|
|
12799
|
-
batch.push(this.lookupData[value]);
|
|
12800
|
-
return;
|
|
12801
|
-
}
|
|
12802
|
-
const dataIndex = this.lookupDatasource.data.findIndex((row) => row[lookupColumn] === value);
|
|
12803
|
-
if (dataIndex !== -1) {
|
|
12804
|
-
this.lookupData[value] = this.lookupDatasource.data[dataIndex];
|
|
12805
|
-
batch.push(this.lookupData[value]);
|
|
12806
|
-
return;
|
|
12807
|
-
}
|
|
12808
|
-
dataToLookup.push(value);
|
|
12809
|
-
});
|
|
12810
|
-
if (dataToLookup.length > 0) {
|
|
12811
|
-
await this.lookupFn(lookupColumn, dataToLookup);
|
|
12812
|
-
dataToLookup.forEach((value) => {
|
|
12813
|
-
const row = this.lookupData[value];
|
|
12814
|
-
if (row)
|
|
12815
|
-
batch.push(row);
|
|
12816
|
-
});
|
|
12817
|
-
}
|
|
12818
|
-
return batch;
|
|
12819
|
-
}
|
|
12820
|
-
/**
|
|
12821
|
-
* Memory search, without changing lookupDatasource
|
|
12822
|
-
*/
|
|
12823
|
-
async memorySearch(search) {
|
|
12824
|
-
if (!this.lookupDatasource) {
|
|
12825
|
-
throw new Error("Can't search in a column that doesn't have a datasource");
|
|
12826
|
-
}
|
|
12827
|
-
let { data } = this.lookupDatasource;
|
|
12828
|
-
if (this.storeData) {
|
|
12829
|
-
if (!data.length) {
|
|
12830
|
-
data = await this.lookupDatasource.get();
|
|
12831
|
-
}
|
|
12832
|
-
}
|
|
12833
|
-
else {
|
|
12834
|
-
// datasource without the lookup filters
|
|
12835
|
-
const defaultDs = DatasourceFactory.factory({
|
|
12836
|
-
...this.componentProps.datasource,
|
|
12837
|
-
lazyLoad: true,
|
|
12838
|
-
loadAll: true,
|
|
12839
|
-
});
|
|
12840
|
-
defaultDs.initialize();
|
|
12841
|
-
data = await defaultDs.get();
|
|
12842
|
-
}
|
|
12843
|
-
const { dataText } = this.componentProps;
|
|
12844
|
-
const searchIn = Array.isArray(dataText) ? dataText : [dataText];
|
|
12845
|
-
// get datasource as memory
|
|
12846
|
-
const datasource = DatasourceFactory.factory({
|
|
12847
|
-
searchIn,
|
|
12848
|
-
data,
|
|
12849
|
-
type: 'memory',
|
|
12850
|
-
loadAll: true,
|
|
12851
|
-
});
|
|
12852
|
-
datasource.initialize();
|
|
12853
|
-
return datasource.setSearch(search);
|
|
12854
|
-
}
|
|
12855
|
-
get grouped() {
|
|
12856
|
-
return this.groupedValue;
|
|
12857
|
-
}
|
|
12858
|
-
set grouped(value) {
|
|
12859
|
-
const changed = value !== this.groupedValue;
|
|
12860
|
-
this.groupedValue = value;
|
|
12861
|
-
if (changed) {
|
|
12862
|
-
this.changeGrouping();
|
|
12863
|
-
}
|
|
12864
|
-
}
|
|
12865
|
-
get aggregation() {
|
|
12866
|
-
return this.aggregationValue;
|
|
12867
|
-
}
|
|
12868
|
-
set aggregation(value) {
|
|
12869
|
-
const changed = value !== this.aggregationValue;
|
|
12870
|
-
this.aggregationValue = value;
|
|
12871
|
-
if (changed) {
|
|
12872
|
-
this.changeGrouping();
|
|
12873
|
-
}
|
|
12874
|
-
}
|
|
12875
|
-
get groupOpened() {
|
|
12876
|
-
return this.groupOpenedValue;
|
|
12877
|
-
}
|
|
12878
|
-
set groupOpened(value) {
|
|
12879
|
-
const changed = value !== this.groupOpenedValue;
|
|
12880
|
-
this.groupOpenedValue = value;
|
|
12881
|
-
if (changed) {
|
|
12882
|
-
this.changeGrouping();
|
|
12883
|
-
}
|
|
12884
|
-
}
|
|
12885
|
-
/* istanbul ignore next */
|
|
12886
|
-
// @ts-ignore
|
|
12887
|
-
get isVisible() {
|
|
12888
|
-
return this.isVisibleValue && !this.grouped;
|
|
12889
|
-
}
|
|
12890
|
-
/* istanbul ignore next */
|
|
12891
|
-
set isVisible(value) {
|
|
12892
|
-
this.isVisibleValue = value;
|
|
12893
|
-
}
|
|
12894
|
-
changeGrouping() {
|
|
12895
|
-
// wait for grid.constructor to be fully executed
|
|
12896
|
-
setTimeout(() => {
|
|
12897
|
-
this.grid.updateGrouping();
|
|
12898
|
-
});
|
|
12899
|
-
}
|
|
12900
|
-
}
|
|
12901
|
-
|
|
12902
|
-
class TekGridController {
|
|
12903
|
-
grid;
|
|
12904
|
-
openToolbar = true;
|
|
12905
|
-
constructor(grid) {
|
|
12906
|
-
this.grid = grid;
|
|
12907
|
-
this.openToolbar = this.grid.toolbarOpened;
|
|
12908
|
-
}
|
|
12909
|
-
get gridTitle() {
|
|
12910
|
-
return this.grid.title;
|
|
12911
|
-
}
|
|
12912
|
-
get showAddButton() {
|
|
12913
|
-
return this.grid.addButton;
|
|
12914
|
-
}
|
|
12915
|
-
get showDeleteButton() {
|
|
12916
|
-
return this.grid.deleteButton !== 'none';
|
|
12917
|
-
}
|
|
12918
|
-
get showFilterButton() {
|
|
12919
|
-
return this.grid.filterButton;
|
|
12920
|
-
}
|
|
12921
|
-
get showModalFilterProps() {
|
|
12922
|
-
return this.grid.modalFilterProps;
|
|
12923
|
-
}
|
|
12924
|
-
get showSearchInput() {
|
|
12925
|
-
return this.grid.showSearch;
|
|
12926
|
-
}
|
|
12927
|
-
get showToolbar() {
|
|
12928
|
-
return this.openToolbar;
|
|
12929
|
-
}
|
|
12930
|
-
set showToolbar(value) {
|
|
12931
|
-
this.openToolbar = value;
|
|
12932
|
-
}
|
|
12933
|
-
get toolbarClass() {
|
|
12934
|
-
return !this.openToolbar ? 'is-rotated' : '';
|
|
12935
|
-
}
|
|
12936
|
-
get tooltipName() {
|
|
12937
|
-
return !this.openToolbar ? 'TEKGRID_SHOW' : 'TEKGRID_HIDE';
|
|
12938
|
-
}
|
|
12939
|
-
get showReloadButton() {
|
|
12940
|
-
return this.grid.showReload;
|
|
12941
|
-
}
|
|
12942
|
-
get showDivider2() {
|
|
12943
|
-
return (this.showReloadButton &&
|
|
12944
|
-
(this.showLayoutOptionsButton ||
|
|
12945
|
-
this.showColumnsButton ||
|
|
12946
|
-
this.showActionsButton ||
|
|
12947
|
-
this.showExportButton ||
|
|
12948
|
-
this.showSearchInput));
|
|
12949
|
-
}
|
|
12950
|
-
get showColumnsButton() {
|
|
12951
|
-
return this.grid.columnsButton;
|
|
12952
|
-
}
|
|
12953
|
-
get columnsButtonIgnore() {
|
|
12954
|
-
return this.grid.columnsButtonIgnore;
|
|
12955
|
-
}
|
|
12956
|
-
get showLayoutOptionsButton() {
|
|
12957
|
-
return this.grid.showLayoutOptions;
|
|
12958
|
-
}
|
|
12959
|
-
get showDivider1() {
|
|
12960
|
-
return ((this.showAddButton || this.showDeleteButton) &&
|
|
12961
|
-
(this.showReloadButton ||
|
|
12962
|
-
this.showLayoutOptionsButton ||
|
|
12963
|
-
this.showColumnsButton ||
|
|
12964
|
-
this.showActionsButton ||
|
|
12965
|
-
this.showExportButton ||
|
|
12966
|
-
this.showSearchInput));
|
|
12967
|
-
}
|
|
12968
|
-
get showActionsButton() {
|
|
12969
|
-
return this.grid.actions.length > 0;
|
|
12970
|
-
}
|
|
12971
|
-
get showExportButton() {
|
|
12972
|
-
return this.grid.showExport;
|
|
12973
|
-
}
|
|
12974
|
-
get showActionAndExportButton() {
|
|
12975
|
-
return ((this.showLayoutOptionsButton || this.showColumnsButton) &&
|
|
12976
|
-
(this.showActionsButton || this.showExportButton || this.showSearchInput));
|
|
12977
|
-
}
|
|
12978
|
-
get showDivider3() {
|
|
12979
|
-
return (this.showActionsButton || this.showExportButton) && this.showSearchInput;
|
|
12980
|
-
}
|
|
12981
|
-
get isEditing() {
|
|
12982
|
-
return this.grid.editing;
|
|
12983
|
-
}
|
|
12984
|
-
get showEditButtons() {
|
|
12985
|
-
return this.isEditing && this.grid.showEditButtons;
|
|
12986
|
-
}
|
|
12987
|
-
get isNotEditing() {
|
|
12988
|
-
return !this.isEditing;
|
|
12989
|
-
}
|
|
12990
|
-
get disableDeleteButton() {
|
|
12991
|
-
if (this.grid.deleteButton === 'selection') {
|
|
12992
|
-
if (this.grid.selectAllPages) {
|
|
12993
|
-
const { allSelected, except } = this.grid.selectionState;
|
|
12994
|
-
return (allSelected && except.length === this.grid.datasource.total) || (!allSelected && except.length === 0);
|
|
12995
|
-
}
|
|
12996
|
-
return this.grid.selectedRows.length === 0;
|
|
12997
|
-
}
|
|
12998
|
-
if (this.grid.deleteButton === 'currentRow') {
|
|
12999
|
-
return !this.grid.datasource.currentRow[this.grid.datasource.uniqueKey];
|
|
13000
|
-
}
|
|
13001
|
-
return false;
|
|
13002
|
-
}
|
|
13003
|
-
}
|
|
13004
|
-
|
|
13005
|
-
class TekGridEvents extends GridEditableEvents {
|
|
13006
|
-
tekGrid;
|
|
13007
|
-
/**
|
|
13008
|
-
* Flag to prevent row click
|
|
13009
|
-
*/
|
|
13010
|
-
preventRowClick = false;
|
|
13011
|
-
preventRowDoubleClick = false;
|
|
13012
|
-
constructor(tekGrid) {
|
|
13013
|
-
super(tekGrid);
|
|
13014
|
-
this.tekGrid = tekGrid;
|
|
13015
|
-
}
|
|
13016
|
-
calcSummary(column, summary, row) {
|
|
13017
|
-
this.tekGrid.callEvent('calcSummary', {
|
|
13018
|
-
component: this.tekGrid,
|
|
13019
|
-
column,
|
|
13020
|
-
columnName: column.name,
|
|
13021
|
-
summary,
|
|
13022
|
-
row,
|
|
13023
|
-
rowValue: row[column.name],
|
|
13024
|
-
});
|
|
13025
|
-
}
|
|
13026
|
-
rowDoubleClick(row, event, element) {
|
|
13027
|
-
if (!this.preventRowDoubleClick) {
|
|
13028
|
-
this.tekGrid.datasource.currentRow = row;
|
|
13029
|
-
this.tekGrid.callEvent('rowDoubleClick', {
|
|
13030
|
-
event,
|
|
13031
|
-
element,
|
|
13032
|
-
row,
|
|
13033
|
-
component: this.tekGrid,
|
|
13034
|
-
column: undefined,
|
|
13035
|
-
});
|
|
13036
|
-
}
|
|
13037
|
-
this.preventRowDoubleClick = false;
|
|
13038
|
-
}
|
|
13039
|
-
/**
|
|
13040
|
-
* Dispatches group row click event
|
|
13041
|
-
* @param row Grid row
|
|
13042
|
-
* @param event DOM event
|
|
13043
|
-
* @param element DOM Element
|
|
13044
|
-
*/
|
|
13045
|
-
groupRowClick(row, event, element) {
|
|
13046
|
-
if (!this.preventRowClick) {
|
|
13047
|
-
this.tekGrid.callEvent('groupRowClick', {
|
|
13048
|
-
event,
|
|
13049
|
-
element,
|
|
13050
|
-
row,
|
|
13051
|
-
component: this.tekGrid,
|
|
13052
|
-
column: undefined,
|
|
13053
|
-
});
|
|
13054
|
-
}
|
|
13055
|
-
this.preventRowClick = false;
|
|
13056
|
-
}
|
|
13057
|
-
groupRowDoubleClick(row, event, element) {
|
|
13058
|
-
if (!this.preventRowDoubleClick) {
|
|
13059
|
-
this.tekGrid.callEvent('groupRowDoubleClick', {
|
|
13060
|
-
event,
|
|
13061
|
-
element,
|
|
13062
|
-
row,
|
|
13063
|
-
component: this.tekGrid,
|
|
13064
|
-
column: undefined,
|
|
13065
|
-
});
|
|
13066
|
-
}
|
|
13067
|
-
this.preventRowDoubleClick = false;
|
|
13068
|
-
}
|
|
13069
|
-
/**
|
|
13070
|
-
* Dispatches group select/unselect event
|
|
13071
|
-
* @param row Group row
|
|
13072
|
-
* @param isSelected Row is selected
|
|
13073
|
-
* @param event DOM event
|
|
13074
|
-
* @param element DOM Element
|
|
13075
|
-
*/
|
|
13076
|
-
selectGroupClick(row, isSelected, event, element) {
|
|
13077
|
-
if (isSelected) {
|
|
13078
|
-
this.tekGrid.callEvent('groupSelected', {
|
|
13079
|
-
event,
|
|
13080
|
-
element,
|
|
13081
|
-
row,
|
|
13082
|
-
component: this.tekGrid,
|
|
13083
|
-
column: undefined,
|
|
13084
|
-
});
|
|
13085
|
-
}
|
|
13086
|
-
else {
|
|
13087
|
-
this.tekGrid.callEvent('groupUnselected', {
|
|
13088
|
-
event,
|
|
13089
|
-
element,
|
|
13090
|
-
row,
|
|
13091
|
-
component: this.tekGrid,
|
|
13092
|
-
column: undefined,
|
|
13093
|
-
});
|
|
13094
|
-
}
|
|
13095
|
-
}
|
|
13096
|
-
}
|
|
13097
|
-
|
|
13098
|
-
/* TekGrid Class */
|
|
13099
|
-
class TekGrid extends Iterable {
|
|
13100
|
-
tableActionBuilder;
|
|
13101
|
-
iterableTable;
|
|
13102
|
-
dataSelector;
|
|
13103
|
-
tekGridEvents;
|
|
13104
|
-
dataNavigator;
|
|
13105
|
-
groupedViewNavigator;
|
|
13106
|
-
keyMapMerger;
|
|
13107
|
-
dataEditor;
|
|
13108
|
-
columnsSearcher;
|
|
13109
|
-
groupedDataManager;
|
|
13110
|
-
tekGridToolbarProvider;
|
|
13111
|
-
/* Grid Title */
|
|
13112
|
-
title = '';
|
|
13113
|
-
/* Show Add button */
|
|
13114
|
-
addButton = false;
|
|
13115
|
-
/* Show Delete button */
|
|
13116
|
-
deleteButton = 'none';
|
|
13117
|
-
/* Show Delete button */
|
|
13118
|
-
actions = [];
|
|
13119
|
-
/* Show edit button */
|
|
13120
|
-
showEditButtons = true;
|
|
13121
|
-
/* Show Filter button */
|
|
13122
|
-
filterButton = false;
|
|
13123
|
-
/* Show SearchInput */
|
|
13124
|
-
showSearch = true;
|
|
13125
|
-
/* Show Column Filter button */
|
|
13126
|
-
columnFilterButton = false;
|
|
13127
|
-
/* Show Columns button */
|
|
13128
|
-
columnsButton = false;
|
|
13129
|
-
/* Defines if the grid is the unique grid on screen */
|
|
13130
|
-
mainGrid = true;
|
|
13131
|
-
/* Columns to be ignored on columns button */
|
|
13132
|
-
columnsButtonIgnore = [];
|
|
13133
|
-
/**
|
|
13134
|
-
* Enables column dragging
|
|
13135
|
-
* @public
|
|
13136
|
-
*/
|
|
13137
|
-
dragColumns = true;
|
|
13138
|
-
/**
|
|
13139
|
-
* Enables column resizing
|
|
13140
|
-
* @public
|
|
13141
|
-
*/
|
|
13142
|
-
resizeColumns = true;
|
|
13143
|
-
/**
|
|
13144
|
-
* Enables layout saving
|
|
13145
|
-
* @public
|
|
13146
|
-
*/
|
|
13147
|
-
showLayoutOptions = true;
|
|
13148
|
-
xlsDefaultType;
|
|
13149
|
-
modalFilterProps = {
|
|
13150
|
-
name: this.name,
|
|
13151
|
-
height: 'auto',
|
|
13152
|
-
persistent: true,
|
|
13153
|
-
cssClass: '',
|
|
13154
|
-
cssStyle: '',
|
|
13155
|
-
dark: false,
|
|
13156
|
-
draggable: false,
|
|
13157
|
-
fullscreen: false,
|
|
13158
|
-
dragHandle: '',
|
|
13159
|
-
title: 'FILTER',
|
|
13160
|
-
};
|
|
13161
|
-
/**
|
|
13162
|
-
* Show export button
|
|
13163
|
-
*/
|
|
13164
|
-
showExport = false;
|
|
13165
|
-
/**
|
|
13166
|
-
* Show refresh button
|
|
13167
|
-
*/
|
|
13168
|
-
showReload = true;
|
|
13169
|
-
/**
|
|
13170
|
-
* Export config
|
|
13171
|
-
*/
|
|
13172
|
-
exportConfig = [
|
|
13173
|
-
{
|
|
13174
|
-
type: 'pdf',
|
|
13175
|
-
label: I18n.translate('TEKGRID_EXPORT_AS', { type: 'PDF' }),
|
|
13176
|
-
multiOption: [
|
|
13177
|
-
{ label: I18n.translate('TEKGRID_PORTRAIT'), iconName: 'mdi-file-outline' },
|
|
13178
|
-
{
|
|
13179
|
-
label: I18n.translate('TEKGRID_LANDSCAPE'),
|
|
13180
|
-
iconName: 'mdi-file-outline',
|
|
13181
|
-
cssClass: 'tek-grid-export-landscape',
|
|
13182
|
-
reportParams: { portrait: false },
|
|
13183
|
-
},
|
|
13184
|
-
],
|
|
13185
|
-
},
|
|
13186
|
-
{
|
|
13187
|
-
type: 'xls',
|
|
13188
|
-
label: I18n.translate('TEKGRID_EXPORT_AS', {
|
|
13189
|
-
type: 'XLS',
|
|
13190
|
-
}),
|
|
13191
|
-
},
|
|
13192
|
-
{
|
|
13193
|
-
type: 'xls2',
|
|
13194
|
-
label: I18n.translate('TEKGRID_EXPORT_AS', {
|
|
13195
|
-
type: `XLS ${I18n.translate('TEKGRID_WITH_GROUPS')}`,
|
|
13196
|
-
}),
|
|
13197
|
-
},
|
|
13198
|
-
{
|
|
13199
|
-
type: 'xls3',
|
|
13200
|
-
label: I18n.translate('TEKGRID_EXPORT_AS', {
|
|
13201
|
-
type: `XLS ${I18n.translate('TEKGRID_GRID_MIRROR')}`,
|
|
13202
|
-
}),
|
|
13203
|
-
},
|
|
13204
|
-
{
|
|
13205
|
-
type: 'csv',
|
|
13206
|
-
label: I18n.translate('TEKGRID_EXPORT_AS', { type: 'CSV' }),
|
|
13207
|
-
},
|
|
13208
|
-
];
|
|
13209
|
-
/**
|
|
13210
|
-
* Actions to overwrite the default export config
|
|
13211
|
-
*/
|
|
13212
|
-
exportActions;
|
|
13213
|
-
/**
|
|
13214
|
-
* Groups should be opened by default after building
|
|
13215
|
-
*/
|
|
13216
|
-
groupsOpened = false;
|
|
13217
|
-
/**
|
|
13218
|
-
* Show Total summary
|
|
13219
|
-
*/
|
|
13220
|
-
showSummaryTotal = true;
|
|
13221
|
-
editNewRowsOnly = false;
|
|
13222
|
-
keyShortcutKeyMapping;
|
|
13223
|
-
showCheckboxAllFilter = Config.gridShowCheckboxAllFilter || false;
|
|
13224
|
-
defaultFilter = {};
|
|
13225
|
-
toolbarOpened = true;
|
|
13226
|
-
reportTitle = '';
|
|
13227
|
-
editing = false;
|
|
13228
|
-
currentColumn = null;
|
|
13229
|
-
selectedRows = [];
|
|
13230
|
-
selectionState = {
|
|
13231
|
-
allSelected: false,
|
|
13232
|
-
except: [],
|
|
13233
|
-
};
|
|
13234
|
-
rowStyleConditions;
|
|
13235
|
-
selectAllPages = Config.gridSelectAllPages;
|
|
13236
|
-
selectable = false;
|
|
13237
|
-
disableSelection;
|
|
13238
|
-
cellSelection = false;
|
|
13239
|
-
toolbarSlot = [{ name: '<<NAME>>_gridSearch', component: 'ZdSearch' }];
|
|
13240
|
-
footerSlot = [
|
|
13241
|
-
{ name: '<<NAME>>_iterablePagination', component: 'ZdIterablePagination' },
|
|
13242
|
-
{
|
|
13243
|
-
name: '<<NAME>>_iterableInfoDiv',
|
|
13244
|
-
component: 'ZdTag',
|
|
13245
|
-
cssClass: 'zd-grid-div-footer',
|
|
13246
|
-
tag: 'div',
|
|
13247
|
-
children: [
|
|
13248
|
-
{
|
|
13249
|
-
name: '<<NAME>>_iterablePageSize',
|
|
13250
|
-
component: 'ZdIterablePageSize',
|
|
13251
|
-
iterableComponentName: '<<NAME>>',
|
|
13252
|
-
},
|
|
13253
|
-
{
|
|
13254
|
-
name: '<<NAME>>_iterablePageInfo',
|
|
13255
|
-
component: 'ZdIterablePageInfo',
|
|
13256
|
-
iterableComponentName: '<<NAME>>',
|
|
13257
|
-
},
|
|
13258
|
-
],
|
|
13259
|
-
},
|
|
13260
|
-
];
|
|
13261
|
-
noResultsText = 'NO_RESULT';
|
|
13262
|
-
noResultSlot = [
|
|
13263
|
-
{
|
|
13264
|
-
name: '<<NAME>>_no-result',
|
|
13265
|
-
component: 'ZdText',
|
|
13266
|
-
cssClass: 'no-result',
|
|
13267
|
-
text: this.noResultsText,
|
|
13268
|
-
},
|
|
13269
|
-
];
|
|
13270
|
-
errorSlot = [];
|
|
13271
|
-
dense = true;
|
|
13272
|
-
headerBackground = '';
|
|
13273
|
-
headerCellTextColor = '';
|
|
13274
|
-
height = 'auto';
|
|
13275
|
-
loadingText = 'LOADING';
|
|
13276
|
-
maxHeight = 'none';
|
|
13277
|
-
maxWidth = 'none';
|
|
13278
|
-
minHeight = 'auto';
|
|
13279
|
-
minWidth = 'auto';
|
|
13280
|
-
noDataText = 'NO_DATA';
|
|
13281
|
-
noDataSlot = [
|
|
13282
|
-
{
|
|
13283
|
-
name: '<<NAME>>_no-data',
|
|
13284
|
-
component: 'ZdText',
|
|
13285
|
-
cssClass: 'no-data',
|
|
13286
|
-
text: this.noDataText,
|
|
13287
|
-
},
|
|
13288
|
-
];
|
|
13289
|
-
showFooter = true;
|
|
13290
|
-
showHeader = true;
|
|
13291
|
-
showSelectAll = true;
|
|
13292
|
-
width = '100%';
|
|
13293
|
-
backgroundColor = 'transparent';
|
|
13294
|
-
canEditRow;
|
|
13295
|
-
showCancelColumn = false;
|
|
13296
|
-
doubleClickEdit = false;
|
|
13297
|
-
singleEdit = false;
|
|
13298
|
-
editingNewRows = false;
|
|
13299
|
-
defaultLazy = false;
|
|
13300
|
-
toolbarSlotProps = false;
|
|
13301
|
-
filterRelationsDatasource;
|
|
13302
|
-
filterOperationsDatasource;
|
|
13303
|
-
/**
|
|
13304
|
-
* TekGrid class constructor
|
|
13305
|
-
* @param props TekGrid properties
|
|
13306
|
-
*/
|
|
13307
|
-
constructor(props) {
|
|
13308
|
-
super(props);
|
|
13309
|
-
this.title = this.getInitValue('title', props.title, this.title);
|
|
13310
|
-
this.addButton = this.getInitValue('addButton', props.addButton, this.addButton);
|
|
13311
|
-
this.deleteButton = this.getInitValue('deleteButton', props.deleteButton, this.deleteButton);
|
|
13312
|
-
this.filterButton = this.getInitValue('filterButton', props.filterButton, this.filterButton);
|
|
13313
|
-
this.showSearch = this.getInitValue('showSearch', props.showSearch, this.showSearch);
|
|
13314
|
-
this.columnFilterButton = this.getInitValue('columnFilterButton', props.columnFilterButton, this.columnFilterButton);
|
|
13315
|
-
this.columnsButton = this.getInitValue('columnsButton', props.columnsButton, this.columnsButton);
|
|
13316
|
-
this.columnsButtonIgnore = this.getInitValue('columnsButtonIgnore', props.columnsButtonIgnore, this.columnsButtonIgnore);
|
|
13317
|
-
this.showEditButtons = this.getInitValue('showEditButtons', props.showEditButtons, this.showEditButtons);
|
|
13318
|
-
this.dragColumns = this.getInitValue('dragColumns', props.dragColumns, this.dragColumns);
|
|
13319
|
-
this.resizeColumns = this.getInitValue('resizeColumns', props.resizeColumns, this.resizeColumns);
|
|
13320
|
-
this.showLayoutOptions = this.getInitValue('showLayoutOptions', props.showLayoutOptions, this.showLayoutOptions);
|
|
13321
|
-
this.xlsDefaultType = this.getInitValue('xlsDefaultType', props.xlsDefaultType, this.xlsDefaultType);
|
|
13322
|
-
this.showExport = this.getInitValue('showExport', props.showExport, this.showExport);
|
|
13323
|
-
this.showReload = this.getInitValue('showReload', props.showReload, this.showReload);
|
|
13324
|
-
this.exportConfig = this.getInitValue('exportConfig', props.exportConfig, this.exportConfig);
|
|
13325
|
-
this.modalFilterProps = this.getInitValue('modalFilterProps', props.modalFilterProps, this.modalFilterProps);
|
|
13326
|
-
this.exportActions = props.exportActions || this.exportActions;
|
|
13327
|
-
this.groupsOpened = this.getInitValue('groupsOpened', props.groupsOpened, this.groupsOpened);
|
|
13328
|
-
this.showSummaryTotal = this.getInitValue('showSummaryTotal', props.showSummaryTotal, this.showSummaryTotal);
|
|
13329
|
-
this.showCheckboxAllFilter = this.getInitValue('showCheckboxAllFilter', props.showCheckboxAllFilter, this.showCheckboxAllFilter);
|
|
13330
|
-
this.defaultFilter = this.getInitValue('defaultFilter', props.defaultFilter, this.defaultFilter);
|
|
13331
|
-
this.toolbarOpened = this.getInitValue('toolbarOpened', props.toolbarOpened, this.toolbarOpened);
|
|
13332
|
-
this.editNewRowsOnly = this.getInitValue('editNewRowsOnly', props.editNewRowsOnly, this.editNewRowsOnly);
|
|
13333
|
-
this.mainGrid = this.getInitValue('mainGrid', props.mainGrid, this.mainGrid);
|
|
13334
|
-
this.reportTitle = this.getInitValue('reportTitle', props.reportTitle, this.reportTitle);
|
|
13335
|
-
this.actions = props.actions || this.actions;
|
|
13336
|
-
this.toolbarSlotProps = props.toolbarSlot !== undefined;
|
|
13337
|
-
this.cellSelection = this.getInitValue('cellSelection', props.cellSelection, this.cellSelection);
|
|
13338
|
-
this.dense = this.getInitValue('dense', props.dense, this.dense);
|
|
13339
|
-
this.disableSelection = this.getInitValue('disableSelection', props.disableSelection, this.disableSelection);
|
|
13340
|
-
this.dragColumns = this.getInitValue('dragColumns', props.dragColumns, this.dragColumns);
|
|
13341
|
-
this.fillHeight = this.getInitValue('fillHeight', props.fillHeight, this.fillHeight);
|
|
13342
|
-
this.headerCellTextColor = this.getInitValue('headerCellTextColor', props.headerCellTextColor, this.headerCellTextColor);
|
|
13343
|
-
this.height = this.getInitValue('height', props.height, this.height);
|
|
13344
|
-
this.loadingText = this.getInitValue('loadingText', props.loadingText, this.loadingText);
|
|
13345
|
-
this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
|
|
13346
|
-
this.maxWidth = this.getInitValue('maxWidth', props.maxWidth, this.maxWidth);
|
|
13347
|
-
this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
|
|
13348
|
-
this.minWidth = this.getInitValue('minWidth', props.minWidth, this.minWidth);
|
|
13349
|
-
this.noDataText = this.getInitValue('noDataText', props.noDataText, this.noDataText);
|
|
13350
|
-
this.noResultsText = this.getInitValue('noResultsText', props.noResultsText, this.noResultsText);
|
|
13351
|
-
this.resizeColumns = this.getInitValue('resizeColumns', props.resizeColumns, this.resizeColumns);
|
|
13352
|
-
this.rowStyleConditions = this.getInitValue('rowStyleConditions', props.rowStyleConditions, this.rowStyleConditions);
|
|
13353
|
-
this.selectable = this.getInitValue('selectable', props.selectable, this.selectable);
|
|
13354
|
-
this.selectAllPages = this.getInitValue('selectAllPages', props.selectAllPages, this.selectAllPages);
|
|
13355
|
-
this.showFooter = this.getInitValue('showFooter', props.showFooter, this.showFooter);
|
|
13356
|
-
this.showHeader = this.getInitValue('showHeader', props.showHeader, this.showHeader);
|
|
13357
|
-
this.showSelectAll = this.getInitValue('showSelectAll', props.showSelectAll, this.showSelectAll);
|
|
13358
|
-
this.width = this.getInitValue('width', props.width, this.width);
|
|
13359
|
-
this.backgroundColor = this.getInitValue('backgroundColor', props.backgroundColor, this.backgroundColor);
|
|
13360
|
-
// headerBackground defaults to the backgroundColor, unless backgroundColor is transparent
|
|
13361
|
-
const defaultHeaderBackground = this.backgroundColor === 'transparent' ? '' : this.backgroundColor;
|
|
13362
|
-
this.headerBackground = this.getInitValue('headerBackground', props.headerBackground, defaultHeaderBackground);
|
|
13363
|
-
this.doubleClickEdit = this.getInitValue('doubleClickEdit', props.doubleClickEdit, this.doubleClickEdit);
|
|
13364
|
-
this.singleEdit = this.getInitValue('singleEdit', props.singleEdit, this.singleEdit);
|
|
13365
|
-
this.showCancelColumn = this.getInitValue('showCancelColumn', props.showCancelColumn, this.showCancelColumn);
|
|
13366
|
-
this.canEditRow = this.getInitValue('canEditRow', props.canEditRow, this.canEditRow);
|
|
13367
|
-
this.editingNewRows = this.getInitValue('editingNewRows', props.editingNewRows, this.editingNewRows);
|
|
13368
|
-
this.toolbarSlot = props.toolbarSlot || this.toolbarSlot;
|
|
13369
|
-
this.footerSlot = props.footerSlot || this.footerSlot;
|
|
13370
|
-
this.noDataSlot = props.noDataSlot || this.noDataSlot;
|
|
13371
|
-
this.noResultSlot = props.noResultSlot || this.noResultSlot;
|
|
13372
|
-
this.errorSlot = props.errorSlot || this.errorSlot;
|
|
13373
|
-
this.noDataSlot = this.changeDefaultSlotNames(this.noDataSlot);
|
|
13374
|
-
this.footerSlot = this.changeDefaultSlotNames(this.footerSlot);
|
|
13375
|
-
this.toolbarSlot = this.changeDefaultSlotNames(this.toolbarSlot);
|
|
13376
|
-
this.noResultSlot = this.changeDefaultSlotNames(this.noResultSlot);
|
|
13377
|
-
this.errorSlot = this.changeDefaultSlotNames(this.errorSlot);
|
|
13378
|
-
this.defaultLazy = this.getDefaultLazy(props);
|
|
13379
|
-
if (this.deleteButton === 'selection') {
|
|
13380
|
-
this.selectable = true;
|
|
13381
|
-
}
|
|
13382
|
-
this.tableActionBuilder = new TableActionBuilder(this);
|
|
13383
|
-
this.iterableTable = new IterableTable(this);
|
|
13384
|
-
this.dataSelector = new GroupedDataSelector(this);
|
|
13385
|
-
this.tekGridEvents = new TekGridEvents(this);
|
|
13386
|
-
this.dataNavigator = new DataNavigator(this);
|
|
13387
|
-
this.groupedViewNavigator = new GroupedViewNavigator(this);
|
|
13388
|
-
this.dataEditor = new DataEditorWithAdd(this);
|
|
13389
|
-
this.columnsSearcher = new ColumnsSearcher();
|
|
13390
|
-
this.groupedDataManager = new GroupedDataManager(this);
|
|
13391
|
-
this.tekGridToolbarProvider = new TekGridToolbarProvider(this, 'show');
|
|
13392
|
-
}
|
|
13393
|
-
initializeDatasource(props) {
|
|
13394
|
-
let datasourceProps = clonedeep(props.datasource);
|
|
13395
|
-
// if using accessor, get props from the controller
|
|
13396
|
-
if (typeof props.datasource === 'string' && Accessor.isAccessorDefinition(props.datasource)) {
|
|
13397
|
-
const [controller, accessor] = Accessor.getAccessor(props.datasource);
|
|
13398
|
-
const instance = Loader.getInstance(controller);
|
|
13399
|
-
datasourceProps = instance[accessor];
|
|
13400
|
-
}
|
|
13401
|
-
this.datasource = DatasourceFactory.factory({
|
|
13402
|
-
...datasourceProps,
|
|
13403
|
-
searchIn: props.datasource?.searchIn || `{{IterableController_${this.name}.searchIn}}`,
|
|
13404
|
-
lazyLoad: true,
|
|
13405
|
-
});
|
|
13406
|
-
}
|
|
13407
|
-
columnHasFilter(columnName) {
|
|
13408
|
-
return this.datasource.hasFilter(columnName);
|
|
13409
|
-
}
|
|
13410
|
-
registerTask(task) {
|
|
13411
|
-
this.groupedDataManager.registerTask(task);
|
|
13412
|
-
}
|
|
13413
|
-
async loadAfterTasks() {
|
|
13414
|
-
return this.groupedDataManager.loadAfterTasks();
|
|
13415
|
-
}
|
|
13416
|
-
calcSummary(column, columnNamesummary, row) {
|
|
13417
|
-
this.tekGridEvents.calcSummary(column, columnNamesummary, row);
|
|
13418
|
-
}
|
|
13419
|
-
getDefaultLazy(props) {
|
|
13420
|
-
if (typeof props.datasource === 'object') {
|
|
13421
|
-
return props.datasource.lazyLoad;
|
|
13422
|
-
}
|
|
13423
|
-
if (typeof props.datasource === 'string' && Accessor.isAccessorDefinition(props.datasource)) {
|
|
13424
|
-
const [controller, accessor] = Accessor.getAccessor(props.datasource);
|
|
13425
|
-
const instance = Loader.getInstance(controller);
|
|
13426
|
-
return instance[accessor].lazyLoad || false;
|
|
13427
|
-
}
|
|
13428
|
-
return false;
|
|
13429
|
-
}
|
|
13430
|
-
initializeGrouping(lazyLoad) {
|
|
13431
|
-
this.groupedDataManager.initializeGrouping(lazyLoad);
|
|
13432
|
-
}
|
|
13433
|
-
updateGrouping() {
|
|
13434
|
-
return this.groupedDataManager.updateGrouping();
|
|
13435
|
-
}
|
|
13436
|
-
updateGroupedData(lazyLoad) {
|
|
13437
|
-
return this.groupedDataManager.updateGroupedData(lazyLoad);
|
|
13438
|
-
}
|
|
13439
|
-
buildGroupedData() {
|
|
13440
|
-
this.groupedDataManager.buildGroupedData();
|
|
13441
|
-
}
|
|
13442
|
-
openGroup(group) {
|
|
13443
|
-
this.groupedDataManager.openGroup(group);
|
|
13444
|
-
}
|
|
13445
|
-
isItemVisible(row) {
|
|
13446
|
-
return this.groupedDataManager.isItemVisible(row);
|
|
13447
|
-
}
|
|
13448
|
-
isGrouped() {
|
|
13449
|
-
return this.groupedDataManager.isGrouped();
|
|
13450
|
-
}
|
|
13451
|
-
isColumnSearchable(column) {
|
|
13452
|
-
return this.groupedDataManager.isColumnSearchable(column);
|
|
13453
|
-
}
|
|
13454
|
-
getGroupedData() {
|
|
13455
|
-
return this.groupedDataManager.getGroupedData();
|
|
13456
|
-
}
|
|
13457
|
-
directionalLeft(param) {
|
|
13458
|
-
this.groupedDataManager.directionalLeft(param);
|
|
13459
|
-
this.groupedViewNavigator.navigateLeft(param);
|
|
13460
|
-
}
|
|
13461
|
-
directionalRight(param) {
|
|
13462
|
-
this.groupedDataManager.directionalRight(param);
|
|
13463
|
-
this.groupedViewNavigator.navigateRight(param);
|
|
13464
|
-
}
|
|
13465
|
-
getReport() {
|
|
13466
|
-
throw new Error('Method not implemented.');
|
|
13467
|
-
}
|
|
13468
|
-
setViewUpdateFixedColumns(fn) {
|
|
13469
|
-
this.groupedDataManager.setViewUpdateFixedColumns(fn);
|
|
13470
|
-
}
|
|
13471
|
-
setViewUpdateScrollData(fn) {
|
|
13472
|
-
this.groupedDataManager.setViewUpdateScrollData(fn);
|
|
13473
|
-
}
|
|
13474
|
-
onCreated() {
|
|
13475
|
-
super.onCreated();
|
|
13476
|
-
Loader.addController(`GridController_${this.name}`, TekGridController, [this]);
|
|
13477
|
-
if (!this.toolbarSlotProps)
|
|
13478
|
-
this.toolbarSlot = this.tekGridToolbarProvider.getProperties();
|
|
13479
|
-
this.createDynamicFilterDatasources();
|
|
13480
|
-
}
|
|
13481
|
-
createDynamicFilterDatasources() {
|
|
13482
|
-
if (!(this.datasource instanceof TekRestDatasource || this.datasource instanceof TekMemoryDatasource))
|
|
13483
|
-
return;
|
|
13484
|
-
const datasourceFactory = new DynamicFilterDatasourceFactory();
|
|
13485
|
-
this.filterRelationsDatasource = datasourceFactory.factory(this.datasource.dynamicFilterRelations);
|
|
13486
|
-
this.filterOperationsDatasource = datasourceFactory.factory(this.datasource.dynamicFilterOperations);
|
|
13487
|
-
}
|
|
13488
|
-
onMounted(element) {
|
|
13489
|
-
super.onMounted(element);
|
|
13490
|
-
this.keyMapMerger = new KeyMapMerger(this, [KeyMapNavigation, KeyMapEditing, KeyMapGrouped]);
|
|
13491
|
-
this.keyMapMerger.bind(element);
|
|
13492
|
-
this.initializeGrouping(this.defaultLazy);
|
|
13493
|
-
}
|
|
13494
|
-
onBeforeDestroy() {
|
|
13495
|
-
super.onBeforeDestroy();
|
|
13496
|
-
this.keyMapMerger.unbind();
|
|
13497
|
-
}
|
|
13498
|
-
createColumn(column) {
|
|
13499
|
-
return new TekGridColumn(column, this);
|
|
13500
|
-
}
|
|
13501
|
-
getConditionalProps({ row, column }) {
|
|
13502
|
-
const rowStyle = this.getRowStyleConditions(row);
|
|
13503
|
-
const cellsApplied = this.getAppliedConditions({ row, column });
|
|
13504
|
-
return { ...rowStyle, ...cellsApplied };
|
|
13505
|
-
}
|
|
13506
|
-
changeOrder(sortBy) {
|
|
13507
|
-
return this.iterableTable.changeOrder(sortBy);
|
|
13508
|
-
}
|
|
13509
|
-
selectCell(row, column) {
|
|
13510
|
-
this.iterableTable.selectCell(row, column);
|
|
13511
|
-
}
|
|
13512
|
-
reapplyRowStyleConditions(row) {
|
|
13513
|
-
return this.iterableTable.reapplyRowStyleConditions(row);
|
|
13514
|
-
}
|
|
13515
|
-
getRowStyleConditions(row) {
|
|
13516
|
-
return this.iterableTable.getRowStyleConditions(row);
|
|
13517
|
-
}
|
|
13518
|
-
deleteRows() {
|
|
13519
|
-
return this.iterableTable.deleteRows();
|
|
13520
|
-
}
|
|
13521
|
-
selectAll(isSelected) {
|
|
13522
|
-
this.dataSelector.selectAll(isSelected);
|
|
13523
|
-
}
|
|
13524
|
-
toggleRow(row) {
|
|
13525
|
-
this.dataSelector.toggleRow(row);
|
|
13526
|
-
}
|
|
13527
|
-
selectRow(row, select) {
|
|
13528
|
-
this.dataSelector.selectRow(row, select);
|
|
13529
|
-
}
|
|
13530
|
-
callDisableSelection(row) {
|
|
13531
|
-
return this.dataSelector.callDisableSelection(row);
|
|
13532
|
-
}
|
|
13533
|
-
selectClick(row, isSelected, event, element) {
|
|
13534
|
-
this.dataSelector.selectClick(row, isSelected, event, element);
|
|
13535
|
-
}
|
|
13536
|
-
selectAllClick(isSelected, event, element) {
|
|
13537
|
-
this.dataSelector.selectAllClick(isSelected, event, element);
|
|
13538
|
-
}
|
|
13539
|
-
navigatePageUp() {
|
|
13540
|
-
this.dataNavigator.navigatePageUp();
|
|
13541
|
-
}
|
|
13542
|
-
navigatePageDown() {
|
|
13543
|
-
this.dataNavigator.navigatePageDown();
|
|
13544
|
-
}
|
|
13545
|
-
setViewNavigate(viewNavigate) {
|
|
13546
|
-
this.groupedViewNavigator.setViewNavigate(viewNavigate);
|
|
13547
|
-
}
|
|
13548
|
-
navigateLeft(params) {
|
|
13549
|
-
if (!this.cellSelection)
|
|
13550
|
-
return;
|
|
13551
|
-
this.groupedViewNavigator.navigateLeft(params);
|
|
13552
|
-
}
|
|
13553
|
-
navigateRight(params) {
|
|
13554
|
-
if (!this.cellSelection)
|
|
13555
|
-
return;
|
|
13556
|
-
this.groupedViewNavigator.navigateRight(params);
|
|
13557
|
-
}
|
|
13558
|
-
navigateUp() {
|
|
13559
|
-
this.groupedViewNavigator.navigateUp();
|
|
13560
|
-
}
|
|
13561
|
-
navigateDown() {
|
|
13562
|
-
this.groupedViewNavigator.navigateDown();
|
|
13563
|
-
}
|
|
13564
|
-
navigateDatasource(direction) {
|
|
13565
|
-
this.dataNavigator.navigateDatasource(direction);
|
|
13566
|
-
}
|
|
13567
|
-
getActionComponent(actionComponent, column, row, parentPath) {
|
|
13568
|
-
return this.tableActionBuilder.getActionComponent(actionComponent, column, row, parentPath);
|
|
13569
|
-
}
|
|
13570
|
-
addCancelColumn() {
|
|
13571
|
-
this.dataEditor.addCancelColumn();
|
|
13572
|
-
}
|
|
13573
|
-
getCancelColumnProps() {
|
|
13574
|
-
return this.dataEditor.getCancelColumnProps();
|
|
13575
|
-
}
|
|
13576
|
-
isAdded(row) {
|
|
13577
|
-
return this.dataEditor.isAdded(row);
|
|
13578
|
-
}
|
|
13579
|
-
cancelAddedRow(key) {
|
|
13580
|
-
return this.dataEditor.cancelAddedRow(key);
|
|
13581
|
-
}
|
|
13582
|
-
cancelAddedRows() {
|
|
13583
|
-
return this.dataEditor.cancelAddedRows();
|
|
13584
|
-
}
|
|
13585
|
-
getAddedRows() {
|
|
13586
|
-
return this.dataEditor.getAddedRows();
|
|
13587
|
-
}
|
|
13588
|
-
addNewRow(row, position) {
|
|
13589
|
-
return this.dataEditor.addNewRow(row, position);
|
|
13590
|
-
}
|
|
13591
|
-
getVisibleValue(row, column) {
|
|
13592
|
-
return this.dataEditor.getVisibleValue(row, column);
|
|
13593
|
-
}
|
|
13594
|
-
getEditableComponent(column, row) {
|
|
13595
|
-
return this.dataEditor.getEditableComponent(column, row);
|
|
13596
|
-
}
|
|
13597
|
-
isEdited(column, row) {
|
|
13598
|
-
return this.dataEditor.isEdited(column, row);
|
|
13599
|
-
}
|
|
13600
|
-
isValid(column, row, revalidate) {
|
|
13601
|
-
return this.dataEditor.isValid(column, row, revalidate);
|
|
13602
|
-
}
|
|
13603
|
-
checkValid(column, row) {
|
|
13604
|
-
return this.dataEditor.checkValid(column, row);
|
|
13605
|
-
}
|
|
13606
|
-
isGridValid(revalidate) {
|
|
13607
|
-
return this.dataEditor.isGridValid(revalidate);
|
|
13608
|
-
}
|
|
13609
|
-
getComponent(key, columnName) {
|
|
13610
|
-
return this.dataEditor.getComponent(key, columnName);
|
|
13611
|
-
}
|
|
13612
|
-
updateRow(newRow) {
|
|
13613
|
-
this.dataEditor.updateRow(newRow);
|
|
13614
|
-
}
|
|
13615
|
-
updateCell(rowKey, columnName, value) {
|
|
13616
|
-
this.dataEditor.updateCell(rowKey, columnName, value);
|
|
13617
|
-
}
|
|
13618
|
-
setViewEnterEdit(fn) {
|
|
13619
|
-
this.dataEditor.setViewEnterEdit(fn);
|
|
13620
|
-
}
|
|
13621
|
-
enterEdit(rowKey, columnName) {
|
|
13622
|
-
this.dataEditor.enterEdit(rowKey, columnName);
|
|
13623
|
-
}
|
|
13624
|
-
cancelEditedRows() {
|
|
13625
|
-
return this.dataEditor.cancelEditedRows();
|
|
13626
|
-
}
|
|
13627
|
-
saveEditedRows(revalidate) {
|
|
13628
|
-
return this.dataEditor.saveEditedRows(revalidate);
|
|
13629
|
-
}
|
|
13630
|
-
reapplyCanEditRow(row) {
|
|
13631
|
-
return this.dataEditor.reapplyCanEditRow(row);
|
|
13632
|
-
}
|
|
13633
|
-
getCanEditRow(row) {
|
|
13634
|
-
return this.dataEditor.getCanEditRow(row);
|
|
13635
|
-
}
|
|
13636
|
-
getEditedRows(revalidate, silent) {
|
|
13637
|
-
return this.dataEditor.getEditedRows(revalidate, silent);
|
|
13638
|
-
}
|
|
13639
|
-
getEditedRow(row) {
|
|
13640
|
-
return this.dataEditor.getEditedRow(row);
|
|
13641
|
-
}
|
|
13642
|
-
rowClick(row, event, element) {
|
|
13643
|
-
this.tekGridEvents.rowClick(row, event, element);
|
|
13644
|
-
}
|
|
13645
|
-
rowDoubleClick(row, event, element) {
|
|
13646
|
-
this.tekGridEvents.rowDoubleClick(row, event, element);
|
|
13647
|
-
}
|
|
13648
|
-
cellDoubleClick(row, column, event, element) {
|
|
13649
|
-
this.tekGridEvents.cellDoubleClick(row, column, event, element);
|
|
13650
|
-
}
|
|
13651
|
-
inlineEdit(row, column, event, element) {
|
|
13652
|
-
this.tekGridEvents.inlineEdit(row, column, event, element);
|
|
13653
|
-
}
|
|
13654
|
-
cellClick(row, column, event, element) {
|
|
13655
|
-
this.tekGridEvents.cellClick(row, column, event, element);
|
|
13656
|
-
}
|
|
13657
|
-
cellClickEvent(row, column, event, element) {
|
|
13658
|
-
this.tekGridEvents.cellClickEvent(row, column, event, element);
|
|
13659
|
-
}
|
|
13660
|
-
groupRowClick(row, event, element) {
|
|
13661
|
-
this.tekGridEvents.groupRowClick(row, event, element);
|
|
13662
|
-
}
|
|
13663
|
-
groupRowDoubleClick(row, event, element) {
|
|
13664
|
-
this.tekGridEvents.groupRowDoubleClick(row, event, element);
|
|
13665
|
-
}
|
|
13666
|
-
selectGroupClick(row, isSelected, event, element) {
|
|
13667
|
-
this.tekGridEvents.selectGroupClick(row, isSelected, event, element);
|
|
13668
|
-
}
|
|
13669
|
-
async setSearch(search) {
|
|
13670
|
-
const { datasource } = this;
|
|
13671
|
-
if (datasource instanceof TekRestDatasource || datasource instanceof TekMemoryDatasource) {
|
|
13672
|
-
datasource.searchJoin = await this.columnsSearcher.searchColumn(this.columns, search);
|
|
13673
|
-
}
|
|
13674
|
-
datasource.page = 1;
|
|
13675
|
-
return datasource.setSearch(search);
|
|
13676
|
-
}
|
|
13677
|
-
getAtomInstance(key) {
|
|
13678
|
-
return this.tekGridToolbarProvider.getAtomInstance(key);
|
|
13679
|
-
}
|
|
13680
|
-
getAtomName(key) {
|
|
13681
|
-
return this.tekGridToolbarProvider.getAtomName(key);
|
|
13682
|
-
}
|
|
13683
|
-
}
|
|
13684
|
-
Messages.add({
|
|
13685
|
-
'pt-BR': {
|
|
13686
|
-
translation: {
|
|
13687
|
-
TEKGRID_CONTAINS: 'contém',
|
|
13688
|
-
TEKGRID_NOT_CONTAINS: 'não contém',
|
|
13689
|
-
TEKGRID_EQUALS: 'é igual a',
|
|
13690
|
-
TEKGRID_NOT_EQUALS: 'é diferente de',
|
|
13691
|
-
TEKGRID_GREATER_THAN: 'é maior que',
|
|
13692
|
-
TEKGRID_LESS_THAN: 'é menor que',
|
|
13693
|
-
TEKGRID_GREATER_THAN_EQUALS: 'é maior ou igual a',
|
|
13694
|
-
TEKGRID_LESS_THAN_EQUALS: 'é menor ou igual a',
|
|
13695
|
-
TEKGRID_IN: 'um dos valores',
|
|
13696
|
-
TEKGRID_NOT_IN: 'nenhum dos valores',
|
|
13697
|
-
TEKGRID_BETWEEN: 'está entre',
|
|
13698
|
-
TEKGRID_AND: 'e',
|
|
13699
|
-
TEKGRID_OR: 'ou',
|
|
13700
|
-
TEKGRID_HIDE: 'Esconder Ações',
|
|
13701
|
-
TEKGRID_SHOW: 'Mostrar Ações',
|
|
13702
|
-
TEKGRID_ADD: 'Adicionar',
|
|
13703
|
-
TEKGRID_DELETE: 'Excluir',
|
|
13704
|
-
TEKGRID_REFRESH: 'Atualizar',
|
|
13705
|
-
TEKGRID_COLUMNS: 'Colunas',
|
|
13706
|
-
TEKGRID_SAVE: 'Salvar',
|
|
13707
|
-
TEKGRID_CANCEL: 'Cancelar',
|
|
13708
|
-
TEKGRID_APPLY: 'Aplicar',
|
|
13709
|
-
TEKGRID_FILTER: 'Filtro',
|
|
13710
|
-
TEKGRID_MULTIPLE_VALUE_HINT: 'Separe valores usando ";"',
|
|
13711
|
-
TEKGRID_EXPORT: 'Exportar',
|
|
13712
|
-
TEKGRID_EXPORT_AS: 'Exportar como {{ type }}',
|
|
13713
|
-
TEKGRID_PORTRAIT: 'Retrato',
|
|
13714
|
-
TEKGRID_LANDSCAPE: 'Paisagem',
|
|
13715
|
-
TEKGRID_COLUMN_VISIBLE: 'Visível',
|
|
13716
|
-
TEKGRID_COLUMN_GROUPED: 'Grupo',
|
|
13717
|
-
TEKGRID_COLUMN_AGGREGATION: 'Totalização',
|
|
13718
|
-
TEKGRID_COLUMN_LABEL: 'Rótulo',
|
|
13719
|
-
TEKGRID_COLUMN_ALIGNMENT: 'Alinhamento',
|
|
13720
|
-
TEKGRID_COLUMN_GROUP_OPENED: 'Aberto (grupo)',
|
|
13721
|
-
TEKGRID_COLUMN_ORDER: 'Ordem',
|
|
13722
|
-
TEKGRID_COLUMN_ORDER_DIRECTION: 'Direção (ordem)',
|
|
13723
|
-
TEKGRID_AGGREGATION_SUM: 'Soma',
|
|
13724
|
-
TEKGRID_AGGREGATION_AVG: 'Média',
|
|
13725
|
-
TEKGRID_AGGREGATION_MAX: 'Máximo',
|
|
13726
|
-
TEKGRID_AGGREGATION_MIN: 'Mínimo',
|
|
13727
|
-
TEKGRID_AGGREGATION_COUNT: 'Contador',
|
|
13728
|
-
TEKGRID_MORE_OPTIONS: 'Mais opções',
|
|
13729
|
-
TEKGRID_COLUMNS_OPTIONS: 'Configuração de colunas',
|
|
13730
|
-
TEKGRID_CLOSE: 'Fechar',
|
|
13731
|
-
TEKGRID_FIXED_COLUMNS: 'Colunas fixadas',
|
|
13732
|
-
TEKGRID_VISIBLE_COLUMNS: 'Colunas visíveis',
|
|
13733
|
-
TEKGRID_GROUPED_COLUMNS: 'Colunas agrupadas',
|
|
13734
|
-
TEKGRID_ORDER: 'Ordem',
|
|
13735
|
-
TEKGRID_OTHER_COLUMNS: 'Outras colunas',
|
|
13736
|
-
TEKGRID_DROP_COLUMNS: 'Arraste colunas aqui',
|
|
13737
|
-
TEKGRID_DETAILS_FOR: 'Detalhes para:',
|
|
13738
|
-
TEKGRID_LEFT: 'Esquerda',
|
|
13739
|
-
TEKGRID_CENTER: 'Centro',
|
|
13740
|
-
TEKGRID_RIGHT: 'Direita',
|
|
13741
|
-
TEKGRID_ASC: 'Crescente',
|
|
13742
|
-
TEKGRID_DESC: 'Decrescente',
|
|
13743
|
-
TEKGRID_SELECT_COLUMN: '(selecione uma ou mais colunas)',
|
|
13744
|
-
TEKGRID_SELECT_ALL: 'Selecionar todas',
|
|
13745
|
-
TEKGRID_HELPERVALUE_TODAY: 'Hoje',
|
|
13746
|
-
TEKGRID_HELPERVALUE_TOMORROW: 'Amanhã',
|
|
13747
|
-
TEKGRID_HELPERVALUE_YESTERDAY: 'Ontem',
|
|
13748
|
-
TEKGRID_HELPERVALUE_LAST_7_DAYS: 'Últimos 7 Dias',
|
|
13749
|
-
TEKGRID_HELPERVALUE_NEXT_7_DAYS: 'Próximos 7 Dias',
|
|
13750
|
-
TEKGRID_HELPERVALUE_CURRENT_WEEK: 'Semana Atual',
|
|
13751
|
-
TEKGRID_HELPERVALUE_CURRENT_MONTH: 'Mês Atual',
|
|
13752
|
-
TEKGRID_HELPERVALUE_CURRENT_YEAR: 'Ano Atual',
|
|
13753
|
-
TEKGRID_WITH_GROUPS: '(Com grupos)',
|
|
13754
|
-
TEKGRID_GRID_MIRROR: '(Espelho do grid)',
|
|
13755
|
-
TEKGRID_NO_DATA: 'Não há dados para gerar o relatório',
|
|
13756
|
-
},
|
|
13757
|
-
},
|
|
13758
|
-
'en-US': {
|
|
13759
|
-
translation: {
|
|
13760
|
-
TEKGRID_CONTAINS: 'contains',
|
|
13761
|
-
TEKGRID_NOT_CONTAINS: 'does not contain',
|
|
13762
|
-
TEKGRID_EQUALS: 'is equal to',
|
|
13763
|
-
TEKGRID_NOT_EQUALS: 'is different from',
|
|
13764
|
-
TEKGRID_GREATER_THAN: 'is greater than',
|
|
13765
|
-
TEKGRID_LESS_THAN: 'is less than',
|
|
13766
|
-
TEKGRID_GREATER_THAN_EQUALS: 'is greater or equals to',
|
|
13767
|
-
TEKGRID_LESS_THAN_EQUALS: 'is less or equals to',
|
|
13768
|
-
TEKGRID_IN: 'is in',
|
|
13769
|
-
TEKGRID_NOT_IN: 'is not in',
|
|
13770
|
-
TEKGRID_BETWEEN: 'is between',
|
|
13771
|
-
TEKGRID_AND: 'and',
|
|
13772
|
-
TEKGRID_OR: 'or',
|
|
13773
|
-
TEKGRID_HIDE: 'Hide Actions',
|
|
13774
|
-
TEKGRID_SHOW: 'Show Actions',
|
|
13775
|
-
TEKGRID_ADD: 'Add',
|
|
13776
|
-
TEKGRID_DELETE: 'Delete',
|
|
13777
|
-
TEKGRID_REFRESH: 'Refresh',
|
|
13778
|
-
TEKGRID_COLUMNS: 'Columns',
|
|
13779
|
-
TEKGRID_SAVE: 'Save',
|
|
13780
|
-
TEKGRID_CANCEL: 'Cancel',
|
|
13781
|
-
TEKGRID_APPLY: 'Apply',
|
|
13782
|
-
TEKGRID_FILTER: 'Filter',
|
|
13783
|
-
TEKGRID_MULTIPLE_VALUE_HINT: 'Separate values using ";"',
|
|
13784
|
-
TEKGRID_EXPORT: 'Export',
|
|
13785
|
-
TEKGRID_EXPORT_AS: 'Export as {{ type }}',
|
|
13786
|
-
TEKGRID_PORTRAIT: 'Portrait',
|
|
13787
|
-
TEKGRID_LANDSCAPE: 'Landscape',
|
|
13788
|
-
TEKGRID_COLUMN_VISIBLE: 'Visible',
|
|
13789
|
-
TEKGRID_COLUMN_GROUPED: 'Grouped',
|
|
13790
|
-
TEKGRID_COLUMN_AGGREGATION: 'Aggregation',
|
|
13791
|
-
TEKGRID_COLUMN_LABEL: 'Label',
|
|
13792
|
-
TEKGRID_COLUMN_ALIGNMENT: 'Alignment',
|
|
13793
|
-
TEKGRID_COLUMN_GROUP_OPENED: 'Opened (group)',
|
|
13794
|
-
TEKGRID_COLUMN_ORDER: 'Order',
|
|
13795
|
-
TEKGRID_COLUMN_ORDER_DIRECTION: 'Direction (order)',
|
|
13796
|
-
TEKGRID_AGGREGATION_SUM: 'Sum',
|
|
13797
|
-
TEKGRID_AGGREGATION_AVG: 'Average',
|
|
13798
|
-
TEKGRID_AGGREGATION_MAX: 'Maximum',
|
|
13799
|
-
TEKGRID_AGGREGATION_MIN: 'Minimum',
|
|
13800
|
-
TEKGRID_AGGREGATION_COUNT: 'Count',
|
|
13801
|
-
TEKGRID_MORE_OPTIONS: 'More options',
|
|
13802
|
-
TEKGRID_COLUMNS_OPTIONS: 'Columns configuration',
|
|
13803
|
-
TEKGRID_CLOSE: 'Close',
|
|
13804
|
-
TEKGRID_FIXED_COLUMNS: 'Fixed columns',
|
|
13805
|
-
TEKGRID_VISIBLE_COLUMNS: 'Visible columns',
|
|
13806
|
-
TEKGRID_GROUPED_COLUMNS: 'Grouped columns',
|
|
13807
|
-
TEKGRID_ORDER: 'Order',
|
|
13808
|
-
TEKGRID_OTHER_COLUMNS: 'Other columns',
|
|
13809
|
-
TEKGRID_DROP_COLUMNS: 'Drop columns here',
|
|
13810
|
-
TEKGRID_DETAILS_FOR: 'Details for:',
|
|
13811
|
-
TEKGRID_LEFT: 'Left',
|
|
13812
|
-
TEKGRID_CENTER: 'Center',
|
|
13813
|
-
TEKGRID_RIGHT: 'Right',
|
|
13814
|
-
TEKGRID_ASC: 'Ascending',
|
|
13815
|
-
TEKGRID_DESC: 'Descending',
|
|
13816
|
-
TEKGRID_SELECT_COLUMN: '(select one or more columns)',
|
|
13817
|
-
TEKGRID_SELECT_ALL: 'Select all',
|
|
13818
|
-
TEKGRID_HELPERVALUE_TODAY: 'Today',
|
|
13819
|
-
TEKGRID_HELPERVALUE_TOMORROW: 'Tomorrow',
|
|
13820
|
-
TEKGRID_HELPERVALUE_YESTERDAY: 'Yesterday',
|
|
13821
|
-
TEKGRID_HELPERVALUE_LAST_7_DAYS: 'Last 7 Days',
|
|
13822
|
-
TEKGRID_HELPERVALUE_NEXT_7_DAYS: 'Next 7 Days',
|
|
13823
|
-
TEKGRID_HELPERVALUE_CURRENT_WEEK: 'Current Week',
|
|
13824
|
-
TEKGRID_HELPERVALUE_CURRENT_MONTH: 'Current Month',
|
|
13825
|
-
TEKGRID_HELPERVALUE_CURRENT_YEAR: 'Current Year',
|
|
13826
|
-
TEKGRID_WITH_GROUPS: '(With groups)',
|
|
13827
|
-
TEKGRID_GRID_MIRROR: '(Grid mirror)',
|
|
13828
|
-
TEKGRID_NO_DATA: 'There is no data to generate the report',
|
|
13829
|
-
},
|
|
13830
|
-
},
|
|
13831
|
-
'es-CL': {
|
|
13832
|
-
translation: {
|
|
13833
|
-
TEKGRID_CONTAINS: 'contiene',
|
|
13834
|
-
TEKGRID_NOT_CONTAINS: 'no contiene',
|
|
13835
|
-
TEKGRID_EQUALS: 'igual',
|
|
13836
|
-
TEKGRID_NOT_EQUALS: 'es diferente de',
|
|
13837
|
-
TEKGRID_GREATER_THAN: 'es mayor que',
|
|
13838
|
-
TEKGRID_LESS_THAN: 'es menor que',
|
|
13839
|
-
TEKGRID_GREATER_THAN_EQUALS: 'es mayor o igual que',
|
|
13840
|
-
TEKGRID_LESS_THAN_EQUALS: 'es menor o igual que',
|
|
13841
|
-
TEKGRID_IN: 'uno de los valores',
|
|
13842
|
-
TEKGRID_NOT_IN: 'ninguno de los valores',
|
|
13843
|
-
TEKGRID_BETWEEN: 'está entre',
|
|
13844
|
-
TEKGRID_AND: 'e',
|
|
13845
|
-
TEKGRID_OR: 'o',
|
|
13846
|
-
TEKGRID_HIDE: 'Ocultar Acciones',
|
|
13847
|
-
TEKGRID_SHOW: 'Mostrar Acciones',
|
|
13848
|
-
TEKGRID_ADD: 'Añadir',
|
|
13849
|
-
TEKGRID_DELETE: 'Eliminar',
|
|
13850
|
-
TEKGRID_REFRESH: 'Actualizar',
|
|
13851
|
-
TEKGRID_COLUMNS: 'Colunas',
|
|
13852
|
-
TEKGRID_SAVE: 'Guardar',
|
|
13853
|
-
TEKGRID_CANCEL: 'Cancelar',
|
|
13854
|
-
TEKGRID_APPLY: 'Aplicar',
|
|
13855
|
-
TEKGRID_FILTER: 'Filtro',
|
|
13856
|
-
TEKGRID_MULTIPLE_VALUE_HINT: 'Separe los valores usando ";"',
|
|
13857
|
-
TEKGRID_EXPORT: 'Exportar',
|
|
13858
|
-
TEKGRID_EXPORT_AS: 'Exportar como {{ type }}',
|
|
13859
|
-
TEKGRID_PORTRAIT: 'Vertical',
|
|
13860
|
-
TEKGRID_LANDSCAPE: 'Horizontal',
|
|
13861
|
-
TEKGRID_COLUMN_VISIBLE: 'Visible',
|
|
13862
|
-
TEKGRID_COLUMN_GROUPED: 'Grupo',
|
|
13863
|
-
TEKGRID_COLUMN_AGGREGATION: 'Totalización',
|
|
13864
|
-
TEKGRID_COLUMN_LABEL: 'Etiqueta',
|
|
13865
|
-
TEKGRID_COLUMN_ALIGNMENT: 'alineación',
|
|
13866
|
-
TEKGRID_COLUMN_GROUP_OPENED: 'Abierto (grupo)',
|
|
13867
|
-
TEKGRID_COLUMN_ORDER: 'Orden',
|
|
13868
|
-
TEKGRID_COLUMN_ORDER_DIRECTION: 'Dirección (orden)',
|
|
13869
|
-
TEKGRID_AGGREGATION_SUM: 'Suma',
|
|
13870
|
-
TEKGRID_AGGREGATION_AVG: 'Media',
|
|
13871
|
-
TEKGRID_AGGREGATION_MAX: 'Máximo',
|
|
13872
|
-
TEKGRID_AGGREGATION_MIN: 'Mínimo',
|
|
13873
|
-
TEKGRID_AGGREGATION_COUNT: 'Contar',
|
|
13874
|
-
TEKGRID_MORE_OPTIONS: 'Mas opciones',
|
|
13875
|
-
TEKGRID_COLUMNS_OPTIONS: 'Configuración de columna',
|
|
13876
|
-
TEKGRID_CLOSE: 'Cerrar',
|
|
13877
|
-
TEKGRID_FIXED_COLUMNS: 'Columnas fijas',
|
|
13878
|
-
TEKGRID_VISIBLE_COLUMNS: 'Columnas visibles',
|
|
13879
|
-
TEKGRID_GROUPED_COLUMNS: 'Columnas agrupadas',
|
|
13880
|
-
TEKGRID_ORDER: 'Orden',
|
|
13881
|
-
TEKGRID_OTHER_COLUMNS: 'Otras columnas',
|
|
13882
|
-
TEKGRID_DROP_COLUMNS: 'Arrastra columnas aquí',
|
|
13883
|
-
TEKGRID_DETAILS_FOR: 'Detalles para',
|
|
13884
|
-
TEKGRID_LEFT: 'Izquierda',
|
|
13885
|
-
TEKGRID_CENTER: 'Centro',
|
|
13886
|
-
TEKGRID_RIGHT: 'Derecha',
|
|
13887
|
-
TEKGRID_ASC: 'Creciente',
|
|
13888
|
-
TEKGRID_DESC: 'Decreciente',
|
|
13889
|
-
TEKGRID_SELECT_COLUMN: '(seleccione una o más columnas)',
|
|
13890
|
-
TEKGRID_SELECT_ALL: 'Seleccionar todas',
|
|
13891
|
-
TEKGRID_HELPERVALUE_TODAY: 'Hoy',
|
|
13892
|
-
TEKGRID_HELPERVALUE_TOMORROW: 'Mañana',
|
|
13893
|
-
TEKGRID_HELPERVALUE_YESTERDAY: 'Ayer',
|
|
13894
|
-
TEKGRID_HELPERVALUE_LAST_7_DAYS: 'Últimos 7 días',
|
|
13895
|
-
TEKGRID_HELPERVALUE_NEXT_7_DAYS: 'Próximos 7 días',
|
|
13896
|
-
TEKGRID_HELPERVALUE_CURRENT_WEEK: 'Semana actual',
|
|
13897
|
-
TEKGRID_HELPERVALUE_CURRENT_MONTH: 'Mes actual',
|
|
13898
|
-
TEKGRID_HELPERVALUE_CURRENT_YEAR: 'Año actual',
|
|
13899
|
-
TEKGRID_WITH_GROUPS: '(Con grupos)',
|
|
13900
|
-
TEKGRID_GRID_MIRROR: '(Espejo de grid)',
|
|
13901
|
-
TEKGRID_NO_DATA: 'No hay datos para generar el reporte',
|
|
13902
|
-
},
|
|
13903
|
-
},
|
|
13904
|
-
});
|
|
13905
|
-
Messages.add({
|
|
13906
|
-
'pt-BR': {
|
|
13907
|
-
translation: {
|
|
13908
|
-
NO_NOTIFICATIONS: 'Nenhuma Notificação',
|
|
13909
|
-
MARK_ALL_AS_READ: 'Marcar todas como lidas',
|
|
13910
|
-
NOTIFICATIONS: 'Notificações',
|
|
13911
|
-
SEE_ALL_NOTIFICATIONS: 'Ver todas notificações',
|
|
13912
|
-
UNAVAILABLE_IMAGE: 'Imagem indisponível',
|
|
13913
|
-
REFRESH: 'Atualizar',
|
|
13914
|
-
ACTIONS: 'Ações',
|
|
13915
|
-
FILTER: 'Filtro',
|
|
13916
|
-
LAYOUT: 'Layout: ',
|
|
13917
|
-
NEW_LAYOUT: 'Novo layout',
|
|
13918
|
-
DEFAULT_LAYOUT: 'Padrão',
|
|
13919
|
-
LAYOUT_MODIFIED: 'O layout atual foi modificado. Crie um novo layout, sobrescreva um existente ou descarte as alterações',
|
|
13920
|
-
LAYOUT_NOT_MODIFIED: 'Crie um novo layout ou aplique um dos layouts já existentes',
|
|
13921
|
-
LAYOUT_DISCART_CHANGES: 'Descartar alterações',
|
|
13922
|
-
},
|
|
13923
|
-
},
|
|
13924
|
-
'en-US': {
|
|
13925
|
-
translation: {
|
|
13926
|
-
NO_NOTIFICATIONS: 'No Notifications',
|
|
13927
|
-
MARK_ALL_AS_READ: 'Mark all as read',
|
|
13928
|
-
NOTIFICATIONS: 'Notifications',
|
|
13929
|
-
SEE_ALL_NOTIFICATIONS: 'See all notifications',
|
|
13930
|
-
UNAVAILABLE_IMAGE: 'Unavailable image',
|
|
13931
|
-
REFRESH: 'Refresh',
|
|
13932
|
-
ACTIONS: 'Actions',
|
|
13933
|
-
FILTER: 'Filter',
|
|
13934
|
-
LAYOUT: 'Layout: ',
|
|
13935
|
-
NEW_LAYOUT: 'New layout',
|
|
13936
|
-
DEFAULT_LAYOUT: 'Default',
|
|
13937
|
-
LAYOUT_MODIFIED: 'The current layout has been modified. Create a new layout, overwrite an existing one or discard changes',
|
|
13938
|
-
LAYOUT_NOT_MODIFIED: 'Create a new layout or apply one of the existing layouts',
|
|
13939
|
-
LAYOUT_DISCART_CHANGES: 'Discard changes',
|
|
13940
|
-
},
|
|
13941
|
-
},
|
|
13942
|
-
'es-CL': {
|
|
13943
|
-
translation: {
|
|
13944
|
-
NO_NOTIFICATIONS: 'Sin Notificación',
|
|
13945
|
-
MARK_ALL_AS_READ: 'Marcar todo como leído',
|
|
13946
|
-
NOTIFICATIONS: 'Notificaciones',
|
|
13947
|
-
SEE_ALL_NOTIFICATIONS: 'Ver todas las notificaciones',
|
|
13948
|
-
UNAVAILABLE_IMAGE: 'Imagen no disponible',
|
|
13949
|
-
REFRESH: 'Actualizar',
|
|
13950
|
-
ACTIONS: 'Acciones',
|
|
13951
|
-
FILTER: 'Filtro',
|
|
13952
|
-
LAYOUT: 'Disposición: ',
|
|
13953
|
-
NEW_LAYOUT: 'Nueva disposición',
|
|
13954
|
-
DEFAULT_LAYOUT: 'Default',
|
|
13955
|
-
LAYOUT_MODIFIED: 'La disposición actual ha sido modificada. Cree una nueva disposición, sobrescriba una existente o descarte los cambios',
|
|
13956
|
-
LAYOUT_NOT_MODIFIED: 'Cree una nueva disposición o aplique una de las disposiciones existentes',
|
|
13957
|
-
LAYOUT_DISCART_CHANGES: 'Descartar los cambios',
|
|
13958
|
-
},
|
|
13959
|
-
},
|
|
13960
|
-
});
|
|
13961
|
-
|
|
13962
|
-
class TekGridLayoutOptions extends ComponentRender {
|
|
13963
|
-
currentLayoutName = '';
|
|
13964
|
-
layoutEdited = false;
|
|
13965
|
-
layouts = {};
|
|
13966
|
-
layoutNames = [];
|
|
13967
|
-
viewApplyLayout;
|
|
13968
|
-
viewGetCurrentLayout;
|
|
13969
|
-
originalColumnProps = [];
|
|
13970
|
-
originalDatasourceOrder = [];
|
|
13971
|
-
originalDatasourceDynamicFilter = {};
|
|
13972
|
-
originalDatasourceFilter = {};
|
|
13973
|
-
grid;
|
|
13974
|
-
getParentGrid() {
|
|
13975
|
-
let { parent } = this;
|
|
13976
|
-
while (parent && !(parent.constructor === Iterable || parent.constructor.prototype instanceof Iterable)) {
|
|
13977
|
-
parent = parent.parent;
|
|
13978
|
-
}
|
|
13979
|
-
return parent;
|
|
13980
|
-
}
|
|
13981
|
-
async onMounted(element) {
|
|
13982
|
-
super.onMounted(element);
|
|
13983
|
-
this.grid = this.getParentGrid();
|
|
13984
|
-
this.originalDatasourceOrder = [...this.grid.datasource.order];
|
|
13985
|
-
this.originalDatasourceDynamicFilter = {
|
|
13986
|
-
...this.grid.datasource.dynamicFilter,
|
|
13987
|
-
};
|
|
13988
|
-
this.originalDatasourceFilter = { ...this.grid.datasource.filter };
|
|
13989
|
-
this.originalColumnProps = this.grid.columns.map((column) => ({
|
|
13990
|
-
name: column.name,
|
|
13991
|
-
label: column.label,
|
|
13992
|
-
align: column.align,
|
|
13993
|
-
isVisible: column.isVisible,
|
|
13994
|
-
minWidth: column.minWidth,
|
|
13995
|
-
maxWidth: column.maxWidth,
|
|
13996
|
-
width: column.width,
|
|
13997
|
-
fixed: column.fixed,
|
|
13998
|
-
grouped: column.grouped,
|
|
13999
|
-
groupOpened: column.groupOpened,
|
|
14000
|
-
aggregation: column.aggregation,
|
|
14001
|
-
filterHelperValue: this.getHelperValue(column),
|
|
14002
|
-
}));
|
|
14003
|
-
let layoutsInfo = {};
|
|
14004
|
-
const promise = this.loadLayoutsInfo();
|
|
14005
|
-
if (this.grid instanceof TekGrid) {
|
|
14006
|
-
this.grid.registerTask(promise);
|
|
14007
|
-
}
|
|
14008
|
-
layoutsInfo = await promise;
|
|
14009
|
-
if (layoutsInfo.layouts) {
|
|
14010
|
-
this.layouts = layoutsInfo.layouts;
|
|
14011
|
-
this.layoutNames = Object.keys(this.layouts);
|
|
14012
|
-
if (layoutsInfo.currentLayoutName) {
|
|
14013
|
-
this.currentLayoutName = layoutsInfo.currentLayoutName;
|
|
14014
|
-
this.applyLayout(this.currentLayoutName, false);
|
|
14015
|
-
}
|
|
14016
|
-
}
|
|
14017
|
-
}
|
|
14018
|
-
async loadLayoutsInfo() {
|
|
14019
|
-
const eventFunction = this.events.loadLayouts || this.grid.events.loadLayouts;
|
|
14020
|
-
if (eventFunction && typeof eventFunction === 'function') {
|
|
14021
|
-
return eventFunction({ component: this.grid });
|
|
14022
|
-
}
|
|
14023
|
-
if (Config.loadGridLayoutsEndPoint) {
|
|
14024
|
-
const route = Config.loadGridLayoutsEndPoint;
|
|
14025
|
-
const response = await Http.get(`${route}?id=${this.grid.name}`);
|
|
14026
|
-
const responseData = response.data.data;
|
|
14027
|
-
return responseData.length && responseData[0] ? responseData[0].layouts : responseData.layouts || {};
|
|
14028
|
-
}
|
|
14029
|
-
return JSON.parse(localStorage.getItem(this.grid.name) || '{}');
|
|
14030
|
-
}
|
|
14031
|
-
getHelperValue(column) {
|
|
14032
|
-
if (column instanceof TekGridColumn) {
|
|
14033
|
-
if (!Array.isArray(column.filterProps))
|
|
14034
|
-
return column.filterProps.helperValue;
|
|
14035
|
-
return column.filterProps.map((prop) => prop.helperValue);
|
|
14036
|
-
}
|
|
14037
|
-
return '';
|
|
14038
|
-
}
|
|
14039
|
-
newLayout(layout) {
|
|
14040
|
-
this.fixColumns(layout);
|
|
14041
|
-
this.currentLayoutName = layout.name;
|
|
14042
|
-
this.addLayout(layout);
|
|
14043
|
-
this.layoutEdited = false;
|
|
14044
|
-
}
|
|
14045
|
-
addLayout(layout) {
|
|
14046
|
-
this.fixColumns(layout);
|
|
14047
|
-
this.layouts[layout.name] = layout;
|
|
14048
|
-
this.saveLayouts();
|
|
14049
|
-
}
|
|
14050
|
-
discardChanges() {
|
|
14051
|
-
const layoutSelected = this.layouts[this.currentLayoutName];
|
|
14052
|
-
if (this.viewApplyLayout) {
|
|
14053
|
-
this.viewApplyLayout(layoutSelected);
|
|
14054
|
-
}
|
|
14055
|
-
this.layoutEdited = false;
|
|
14056
|
-
}
|
|
14057
|
-
applyLayout(name, save = true) {
|
|
14058
|
-
this.currentLayoutName = name;
|
|
14059
|
-
const layoutSelected = this.layouts[name];
|
|
14060
|
-
if (this.viewApplyLayout) {
|
|
14061
|
-
this.viewApplyLayout(layoutSelected);
|
|
14062
|
-
}
|
|
14063
|
-
if (save) {
|
|
14064
|
-
this.saveLayouts();
|
|
14065
|
-
}
|
|
14066
|
-
this.layoutEdited = false;
|
|
14067
|
-
}
|
|
14068
|
-
saveLayouts() {
|
|
14069
|
-
this.layoutNames = Object.keys(this.layouts);
|
|
14070
|
-
const layoutInfo = {
|
|
14071
|
-
currentLayoutName: this.currentLayoutName,
|
|
14072
|
-
layouts: this.layouts,
|
|
14073
|
-
};
|
|
14074
|
-
const eventFunction = this.events.saveLayouts || this.grid.events.saveLayouts;
|
|
14075
|
-
if (eventFunction && typeof eventFunction === 'function') {
|
|
14076
|
-
eventFunction({ component: this.grid, layouts: layoutInfo });
|
|
14077
|
-
}
|
|
14078
|
-
else if (Config.saveGridLayoutsEndPoint) {
|
|
14079
|
-
const route = Config.saveGridLayoutsEndPoint;
|
|
14080
|
-
Http.post(route, { id: this.grid.name, layouts: layoutInfo });
|
|
14081
|
-
}
|
|
14082
|
-
else {
|
|
14083
|
-
localStorage.setItem(this.grid.name, JSON.stringify(layoutInfo));
|
|
14084
|
-
}
|
|
14085
|
-
}
|
|
14086
|
-
deleteLayout(name) {
|
|
14087
|
-
if (this.currentLayoutName === name) {
|
|
14088
|
-
this.currentLayoutName = '';
|
|
14089
|
-
this.applyLayout(this.currentLayoutName, false);
|
|
14090
|
-
}
|
|
14091
|
-
delete this.layouts[name];
|
|
14092
|
-
this.saveLayouts();
|
|
14093
|
-
}
|
|
14094
|
-
updateLayout(name, layout) {
|
|
14095
|
-
this.fixColumns(layout);
|
|
14096
|
-
this.currentLayoutName = name;
|
|
14097
|
-
layout.name = name;
|
|
14098
|
-
this.layouts[layout.name] = layout;
|
|
14099
|
-
this.saveLayouts();
|
|
14100
|
-
this.layoutEdited = false;
|
|
14101
|
-
}
|
|
14102
|
-
updateDefaultLayout(layout) {
|
|
14103
|
-
this.fixColumns(layout);
|
|
14104
|
-
this.originalDatasourceOrder = layout.order || this.originalDatasourceOrder;
|
|
14105
|
-
this.originalDatasourceDynamicFilter = layout.dynamicFilter || this.originalDatasourceDynamicFilter;
|
|
14106
|
-
this.originalDatasourceFilter = layout.filter || this.originalDatasourceFilter;
|
|
14107
|
-
if (layout.columns) {
|
|
14108
|
-
this.originalColumnProps = layout.columns.map((column) => {
|
|
14109
|
-
const originalColumnIdx = this.originalColumnProps.findIndex((item) => item.name === column.name);
|
|
14110
|
-
const originalColumn = originalColumnIdx !== -1 ? this.originalColumnProps[originalColumnIdx] : {};
|
|
14111
|
-
return {
|
|
14112
|
-
...originalColumn,
|
|
14113
|
-
...column,
|
|
14114
|
-
};
|
|
14115
|
-
});
|
|
14116
|
-
}
|
|
14117
|
-
if (this.currentLayoutName === '') {
|
|
14118
|
-
this.applyLayout(this.currentLayoutName, false);
|
|
14119
|
-
}
|
|
14120
|
-
}
|
|
14121
|
-
fixColumns(layout) {
|
|
14122
|
-
const hasLayoutColumns = !!layout.columns;
|
|
14123
|
-
layout.columns = layout.columns || [];
|
|
14124
|
-
const layoutColumnNames = layout.columns.map((layoutColumn) => layoutColumn.name);
|
|
14125
|
-
this.grid.columns.forEach((gridColumn) => {
|
|
14126
|
-
if (!hasLayoutColumns || layoutColumnNames.indexOf(gridColumn.name) === -1) {
|
|
14127
|
-
layout.columns.push({
|
|
14128
|
-
name: gridColumn.name,
|
|
14129
|
-
label: gridColumn.label,
|
|
14130
|
-
align: gridColumn.align,
|
|
14131
|
-
isVisible: !hasLayoutColumns && gridColumn.isVisible,
|
|
14132
|
-
width: gridColumn.width,
|
|
14133
|
-
minWidth: gridColumn.minWidth,
|
|
14134
|
-
maxWidth: gridColumn.maxWidth,
|
|
14135
|
-
fixed: gridColumn.fixed,
|
|
14136
|
-
grouped: gridColumn.grouped,
|
|
14137
|
-
groupOpened: gridColumn.groupOpened,
|
|
14138
|
-
aggregation: gridColumn.aggregation,
|
|
14139
|
-
filterHelperValue: this.getHelperValue(gridColumn),
|
|
14140
|
-
});
|
|
14141
|
-
}
|
|
14142
|
-
});
|
|
14143
|
-
}
|
|
14144
|
-
}
|
|
14145
|
-
|
|
14146
|
-
class TekGridColumnsButtonController extends IterableColumnsButtonController {
|
|
14147
|
-
changeGroupedColumn(column, { component, event, element }) {
|
|
14148
|
-
column.grouped = component.value;
|
|
14149
|
-
if (!column.grouped) {
|
|
14150
|
-
const index = this.iterableComponent.datasource.order.indexOf(`${column.name}.asc`);
|
|
14151
|
-
this.iterableComponent.datasource.order.splice(index, 1);
|
|
14152
|
-
}
|
|
14153
|
-
this.iterableComponent.changeLayout(event, element);
|
|
14154
|
-
}
|
|
14155
|
-
changeAggregationColumn(column, { component, event, element }) {
|
|
14156
|
-
const newValue = component.value || undefined;
|
|
14157
|
-
if (column.aggregation !== newValue) {
|
|
14158
|
-
this.iterableComponent.changeLayout(event, element);
|
|
14159
|
-
}
|
|
14160
|
-
column.aggregation = newValue;
|
|
14161
|
-
}
|
|
14162
|
-
showHideTekColumn(column, { component, event, element }) {
|
|
14163
|
-
if (!component.value && column.grouped)
|
|
14164
|
-
column.grouped = false;
|
|
14165
|
-
column.isVisible = component.value;
|
|
14166
|
-
this.iterableComponent.changeLayout(event, element);
|
|
14167
|
-
}
|
|
14168
|
-
}
|
|
14169
|
-
|
|
14170
|
-
/**
|
|
14171
|
-
* Base class for TekGrid Columns Button component
|
|
14172
|
-
*/
|
|
14173
|
-
class TekGridColumnsButton extends IterableColumnsButton {
|
|
14174
|
-
hideGroups = false;
|
|
14175
|
-
constructor(props) {
|
|
14176
|
-
super(props);
|
|
14177
|
-
this.hideGroups = this.getInitValue('hideGroups', props.hideGroups, this.hideGroups);
|
|
14178
|
-
this.createAccessors();
|
|
14179
|
-
}
|
|
14180
|
-
onCreated() {
|
|
14181
|
-
super.onCreated();
|
|
14182
|
-
Loader.addController(`IterableColumnsButtonController_${this.name}`, TekGridColumnsButtonController, [
|
|
14183
|
-
this.iterableComponent,
|
|
14184
|
-
]);
|
|
14185
|
-
this.controller = Loader.getInstance(`IterableColumnsButtonController_${this.name}`);
|
|
14186
|
-
}
|
|
14187
|
-
aggregationDataSet = [];
|
|
14188
|
-
getAggregationSelectData() {
|
|
14189
|
-
if (!this.aggregationDataSet.length) {
|
|
14190
|
-
this.aggregationDataSet = columnAggregationValues.filter(Boolean).map((value) => ({
|
|
14191
|
-
text: I18n.translate(`TEKGRID_AGGREGATION_${value}`),
|
|
14192
|
-
value,
|
|
14193
|
-
}));
|
|
14194
|
-
}
|
|
14195
|
-
return this.aggregationDataSet;
|
|
14196
|
-
}
|
|
14197
|
-
}
|
|
14198
|
-
|
|
14199
|
-
/**
|
|
14200
|
-
* Base class for Checkbox multiple component.
|
|
14201
|
-
*/
|
|
14202
|
-
class CheckboxMultiple extends Input {
|
|
14203
|
-
/**
|
|
14204
|
-
* Quantity of columns that will be rendered on non vertical case
|
|
14205
|
-
*/
|
|
14206
|
-
columns = 4;
|
|
14207
|
-
/**
|
|
14208
|
-
* Field on datasource.data that will be used to set checkbox's label
|
|
14209
|
-
*/
|
|
14210
|
-
dataLabel = '';
|
|
14211
|
-
/**
|
|
14212
|
-
* Source of checkbox items
|
|
14213
|
-
*/
|
|
14214
|
-
datasource;
|
|
14215
|
-
/**
|
|
14216
|
-
* Field on datasource.data that will be used to set checkbox's value
|
|
14217
|
-
*/
|
|
14218
|
-
dataValue = '';
|
|
14219
|
-
/**
|
|
14220
|
-
* Defines the checkbox list direction
|
|
14221
|
-
*/
|
|
14222
|
-
vertical = true;
|
|
14223
|
-
/**
|
|
14224
|
-
* Defines if field value should be an object
|
|
14225
|
-
*/
|
|
14226
|
-
returnObject = false;
|
|
14227
|
-
/* istanbul ignore next */
|
|
14228
|
-
/**
|
|
14229
|
-
* Create a new Checkbox Multiple.
|
|
14230
|
-
* @param props CheckBpox Multiple properties
|
|
14231
|
-
*/
|
|
14232
|
-
constructor(props) {
|
|
14233
|
-
super(props);
|
|
14234
|
-
this.columns = this.getInitValue('columns', props.columns, this.columns);
|
|
14235
|
-
this.dataLabel = this.getInitValue('dataLabel', props.dataLabel, this.dataLabel);
|
|
14236
|
-
this.dataValue = this.getInitValue('dataValue', props.dataValue, this.dataValue);
|
|
14237
|
-
this.vertical = this.getInitValue('vertical', props.vertical, this.vertical);
|
|
14238
|
-
this.returnObject = this.getInitValue('returnObject', props.returnObject, this.returnObject);
|
|
14239
|
-
if (!Accessor.isAccessorDefinition(props.value)) {
|
|
14240
|
-
this.value = this.getInitValue('value', props.value, []);
|
|
14241
|
-
}
|
|
14242
|
-
if (props.datasource && props.datasource.type === 'simple') {
|
|
14243
|
-
this.dataValue = 'value';
|
|
14244
|
-
this.dataLabel = this.dataValue;
|
|
14245
|
-
}
|
|
14246
|
-
this.datasource = DatasourceFactory.factory(props.datasource);
|
|
14247
|
-
}
|
|
14248
|
-
onBeforeDestroy() {
|
|
14249
|
-
super.onBeforeDestroy();
|
|
14250
|
-
this.datasource.destroy();
|
|
14251
|
-
}
|
|
14252
|
-
onCreated() {
|
|
14253
|
-
super.onCreated();
|
|
14254
|
-
this.datasource?.initialize();
|
|
14255
|
-
}
|
|
14256
|
-
}
|
|
14257
|
-
InputFactory.register('ZdCheckboxMultiple', CheckboxMultiple);
|
|
14258
|
-
|
|
14259
|
-
/**
|
|
14260
|
-
* Base class for Chip component.
|
|
14261
|
-
*/
|
|
14262
|
-
class Chip extends Button {
|
|
14263
|
-
/**
|
|
14264
|
-
* Determines whether the chip is active or not
|
|
14265
|
-
*/
|
|
14266
|
-
active = true;
|
|
14267
|
-
/**
|
|
14268
|
-
* Configure the active CSS class applied when the link is active
|
|
14269
|
-
*/
|
|
14270
|
-
activeClass = '';
|
|
14271
|
-
/**
|
|
14272
|
-
* Adds remove button
|
|
14273
|
-
*/
|
|
14274
|
-
closable = false;
|
|
14275
|
-
/**
|
|
14276
|
-
* Change the default icon used for close chips
|
|
14277
|
-
*/
|
|
14278
|
-
closeIcon = 'delete';
|
|
14279
|
-
/**
|
|
14280
|
-
* Makes the chip draggable
|
|
14281
|
-
*/
|
|
14282
|
-
draggable = false;
|
|
14283
|
-
/**
|
|
14284
|
-
* Explicitly define the chip as a link
|
|
14285
|
-
*/
|
|
14286
|
-
link = false;
|
|
14287
|
-
/**
|
|
14288
|
-
* Removes background and applies border and text color
|
|
14289
|
-
*/
|
|
14290
|
-
outlined = false;
|
|
14291
|
-
/**
|
|
14292
|
-
* Applies the ripple
|
|
14293
|
-
*/
|
|
14294
|
-
ripple = true;
|
|
14295
|
-
/**
|
|
14296
|
-
* Applies a large border radius on the chip
|
|
14297
|
-
*/
|
|
14298
|
-
round = true;
|
|
14299
|
-
/**
|
|
14300
|
-
* Value Model
|
|
14301
|
-
*/
|
|
14302
|
-
value = false;
|
|
14303
|
-
/**
|
|
14304
|
-
* Makes the component extra large
|
|
14305
|
-
*/
|
|
14306
|
-
xLarge = false;
|
|
14307
|
-
/**
|
|
14308
|
-
* Makes the component extra small
|
|
14309
|
-
*/
|
|
14310
|
-
xSmall = false;
|
|
14311
|
-
/* istanbul ignore next */
|
|
14312
|
-
/**
|
|
14313
|
-
* Create a new Chip
|
|
14314
|
-
* @param props Chip definition
|
|
14315
|
-
*/
|
|
14316
|
-
constructor(props) {
|
|
14317
|
-
super(props);
|
|
14318
|
-
this.active = this.getInitValue('active', props.active, this.active);
|
|
14319
|
-
this.activeClass = this.getInitValue('activeClass', props.activeClass, this.activeClass);
|
|
14320
|
-
this.closable = this.getInitValue('closable', props.closable, this.closable);
|
|
14321
|
-
this.closeIcon = this.getInitValue('closeIcon', props.closeIcon, this.closeIcon);
|
|
14322
|
-
this.draggable = this.getInitValue('draggable', props.draggable, this.draggable);
|
|
14323
|
-
this.link = this.getInitValue('link', props.link, this.link);
|
|
14324
|
-
this.outlined = this.getInitValue('outlined', props.outlined, this.outlined);
|
|
14325
|
-
this.ripple = this.getInitValue('ripple', props.ripple, this.ripple);
|
|
14326
|
-
this.round = this.getInitValue('round', props.round, this.round);
|
|
14327
|
-
this.value = this.getInitValue('value', props.value, this.value);
|
|
14328
|
-
this.xLarge = this.getInitValue('xLarge', props.xLarge, this.xLarge);
|
|
14329
|
-
this.xSmall = this.getInitValue('xSmall', props.xSmall, this.xSmall);
|
|
14330
|
-
this.createAccessors();
|
|
14331
|
-
}
|
|
14332
|
-
}
|
|
14333
|
-
|
|
14334
|
-
/**
|
|
14335
|
-
* Base class for Progress component
|
|
14336
|
-
*/
|
|
14337
|
-
class Progress extends ComponentRender {
|
|
14338
|
-
/**
|
|
14339
|
-
* Set component's background color
|
|
14340
|
-
*/
|
|
14341
|
-
backgroundColor = 'primary';
|
|
14342
|
-
/**
|
|
14343
|
-
* Set component's background opacity
|
|
14344
|
-
*/
|
|
14345
|
-
backgroundOpacity = '0.5';
|
|
14346
|
-
/**
|
|
14347
|
-
* Defines the value color
|
|
14348
|
-
*/
|
|
14349
|
-
color = 'primary';
|
|
14350
|
-
/**
|
|
14351
|
-
* Sets the height for the component
|
|
14352
|
-
*/
|
|
14353
|
-
height = 4;
|
|
14354
|
-
/**
|
|
14355
|
-
* Animates the component constantly
|
|
14356
|
-
*/
|
|
14357
|
-
indeterminate = false;
|
|
14358
|
-
/**
|
|
14359
|
-
* Render components on the progress component
|
|
14360
|
-
*/
|
|
14361
|
-
centerSlot = [];
|
|
14362
|
-
/**
|
|
14363
|
-
* The percentage value for current progress
|
|
14364
|
-
*/
|
|
14365
|
-
value = 0;
|
|
14366
|
-
/* istanbul ignore next */
|
|
14367
|
-
/**
|
|
14368
|
-
* Create a new Progress
|
|
14369
|
-
* @param props Progress definition
|
|
14370
|
-
*/
|
|
14371
|
-
constructor(props) {
|
|
14372
|
-
super(props);
|
|
14373
|
-
this.backgroundColor = this.getInitValue('backgroundColor', props.backgroundColor, this.backgroundColor);
|
|
14374
|
-
this.backgroundOpacity = this.getInitValue('backgroundOpacity', props.backgroundOpacity, this.backgroundOpacity);
|
|
14375
|
-
this.color = this.getInitValue('color', props.color, this.color);
|
|
14376
|
-
this.height = this.getInitValue('height', props.height, this.height);
|
|
14377
|
-
this.indeterminate = this.getInitValue('indeterminate', props.indeterminate, this.indeterminate);
|
|
14378
|
-
this.centerSlot = this.getInitValue('centerSlot', props.centerSlot, this.centerSlot);
|
|
14379
|
-
this.value = this.getInitValue('value', props.value, this.value);
|
|
14380
|
-
}
|
|
14381
|
-
}
|
|
14382
|
-
|
|
14383
|
-
/**
|
|
14384
|
-
* Base class for Button Group component.
|
|
11102
|
+
* Base class for Button Group component.
|
|
14385
11103
|
*/
|
|
14386
11104
|
class ButtonGroup extends ComponentRender {
|
|
14387
11105
|
/**
|
|
@@ -15500,6 +12218,7 @@ class Time extends TextInput {
|
|
|
15500
12218
|
initialMask;
|
|
15501
12219
|
isSimpleDisplay;
|
|
15502
12220
|
timeError = false;
|
|
12221
|
+
inputMode = 'none';
|
|
15503
12222
|
/**
|
|
15504
12223
|
* Create a new Time Picker.
|
|
15505
12224
|
* @param props Time properties
|
|
@@ -15687,6 +12406,9 @@ class Time extends TextInput {
|
|
|
15687
12406
|
this.removeTimeMask();
|
|
15688
12407
|
this.setTimeValue(this.formatter(this.value));
|
|
15689
12408
|
super.blur(event, element);
|
|
12409
|
+
if (!Utils.isMobile()) {
|
|
12410
|
+
this.showTimePicker = false;
|
|
12411
|
+
}
|
|
15690
12412
|
}
|
|
15691
12413
|
focus(event, element) {
|
|
15692
12414
|
this.addTimeMask();
|
|
@@ -15916,6 +12638,7 @@ class DateRange extends TextInput {
|
|
|
15916
12638
|
initialMask;
|
|
15917
12639
|
unitMask;
|
|
15918
12640
|
isSimpleDisplay;
|
|
12641
|
+
inputMode = 'none';
|
|
15919
12642
|
/* istanbul ignore next */
|
|
15920
12643
|
/**
|
|
15921
12644
|
* Creates a new Date.
|
|
@@ -16004,14 +12727,44 @@ class DateRange extends TextInput {
|
|
|
16004
12727
|
return this.internalValue;
|
|
16005
12728
|
}
|
|
16006
12729
|
set value(value) {
|
|
16007
|
-
if (
|
|
16008
|
-
|
|
16009
|
-
|
|
16010
|
-
}
|
|
16011
|
-
if (value === null) {
|
|
12730
|
+
if (!Array.isArray(value) && value !== null && value !== undefined)
|
|
12731
|
+
return;
|
|
12732
|
+
if (!value || value.length === 0) {
|
|
16012
12733
|
this.internalValue = [];
|
|
12734
|
+
this.internalDisplayValue = '';
|
|
12735
|
+
this.dateObject = [];
|
|
12736
|
+
return;
|
|
12737
|
+
}
|
|
12738
|
+
if (this.internalValue === value)
|
|
12739
|
+
return;
|
|
12740
|
+
this.internalDisplayValue = this.formatter(value);
|
|
12741
|
+
this.internalValue = value;
|
|
12742
|
+
const [startDate, endDate] = value;
|
|
12743
|
+
const isStartValid = this.isValidFormatDate(startDate, this.dateFormat);
|
|
12744
|
+
// if end date is not defined, no need to validate it
|
|
12745
|
+
const isEndValid = !endDate || this.isValidFormatDate(endDate, this.dateFormat);
|
|
12746
|
+
const areDatesValid = isStartValid && isEndValid;
|
|
12747
|
+
if (areDatesValid) {
|
|
12748
|
+
this.dateObject = this.getDatesInRange(startDate, endDate);
|
|
12749
|
+
}
|
|
12750
|
+
}
|
|
12751
|
+
/**
|
|
12752
|
+
* Returns all days ranging from start to end as dayjs objects
|
|
12753
|
+
* @returns an array of dayjs objects containing all days between start and end
|
|
12754
|
+
*/
|
|
12755
|
+
getDatesInRange(startDateStr, endDateStr) {
|
|
12756
|
+
const dates = [];
|
|
12757
|
+
let startDate = dayjs(startDateStr, this.dateFormat);
|
|
12758
|
+
if (!endDateStr)
|
|
12759
|
+
return [startDate];
|
|
12760
|
+
const endDate = dayjs(endDateStr, this.dateFormat);
|
|
12761
|
+
while (startDate.isBefore(endDate) || startDate.isSame(endDate)) {
|
|
12762
|
+
dates.push(startDate);
|
|
12763
|
+
startDate = startDate.add(1, 'day');
|
|
16013
12764
|
}
|
|
12765
|
+
return dates;
|
|
16014
12766
|
}
|
|
12767
|
+
;
|
|
16015
12768
|
/**
|
|
16016
12769
|
* Assign the updated mask to mask property
|
|
16017
12770
|
*/
|
|
@@ -16040,14 +12793,14 @@ class DateRange extends TextInput {
|
|
|
16040
12793
|
this.internalValue = this.parser(displayValue);
|
|
16041
12794
|
this.dateError = false;
|
|
16042
12795
|
if (lastValue !== this.displayValue)
|
|
16043
|
-
this.change(
|
|
12796
|
+
this.change();
|
|
16044
12797
|
}
|
|
16045
12798
|
else {
|
|
16046
12799
|
if (!displayValue) {
|
|
16047
12800
|
this.internalDisplayValue = displayValue;
|
|
16048
12801
|
this.internalValue = [];
|
|
16049
12802
|
if (lastValue !== this.displayValue)
|
|
16050
|
-
this.change(
|
|
12803
|
+
this.change();
|
|
16051
12804
|
}
|
|
16052
12805
|
this.dateError = !!displayValue;
|
|
16053
12806
|
}
|
|
@@ -16102,7 +12855,7 @@ class DateRange extends TextInput {
|
|
|
16102
12855
|
this.dateError = false;
|
|
16103
12856
|
this.value = this.parseISODateRangeValue(newValue);
|
|
16104
12857
|
if (!Utils.isEqual(lastValue, this.value))
|
|
16105
|
-
this.change(
|
|
12858
|
+
this.change();
|
|
16106
12859
|
}
|
|
16107
12860
|
formatISODateRangeValue(dates) {
|
|
16108
12861
|
let splitedValue;
|
|
@@ -16253,7 +13006,7 @@ class DateRange extends TextInput {
|
|
|
16253
13006
|
.filter((obj) => obj !== null)
|
|
16254
13007
|
.map((obj) => obj.format(this.dateFormat));
|
|
16255
13008
|
}
|
|
16256
|
-
dateObject = [
|
|
13009
|
+
dateObject = [];
|
|
16257
13010
|
getNativeDate() {
|
|
16258
13011
|
return this.dateObject.filter((obj) => obj !== null).map((obj) => obj.toDate());
|
|
16259
13012
|
}
|
|
@@ -16377,4 +13130,4 @@ Icons.addIcons({
|
|
|
16377
13130
|
layout: 'mdi-table-star',
|
|
16378
13131
|
});
|
|
16379
13132
|
|
|
16380
|
-
export { Alert, AlertQueue, AlertReplace, AlertService, AlertStack, Badge, Breadcrumbs, Button, ButtonGroup,
|
|
13133
|
+
export { Alert, AlertQueue, AlertReplace, AlertService, AlertStack, Badge, Breadcrumbs, Button, ButtonGroup, Card, Carousel, Checkbox, CheckboxMultiple, ChildNotFoundError, Chip, CodeViewer, Col, CollapseCard, Column, ColumnNotFoundError, Component, ComponentRender, ConditionsManager, Container, Currency, DataEditor, DataEditorWithAdd, DataNavigator, DataSelector, DataValueOutHelper, DatasourceSearcher, DateInput, DateRange, DeleteRowsError, DetailNotFoundError, Dialog, DialogService, Divider, Dropdown, Footer, Form, Frame, FramePage, Grid, GridColumn, GridColumnEditable, GridEditable, GridEditableController, GridEditableEvents, GridEvents, Header, Icon, Icons, Image, Increment, Input, InputFactory, Iterable, IterableColumnsButton, IterableColumnsButtonController, IterableComponentRender, IterablePageComponent, IterablePageInfo, IterablePageSize, IterablePagination, IterableTable, IterableTree, KeyMapEditing, KeyMapMerger, KeyMapNavigation, KeyMapTree, Layout, List, ListGroup, ListItem, Loading, LoadingService, Login, LoginButton, Main, MasterDetail, MasterNotFoundError, Menu, MenuButton, MenuGroup, MenuLink, MenuSeparator, Modal, ModalCloseButton, ModalService, Month, NonInitializedError, NumberInput, Password, Progress, Radio, Row, Search, Select, SelectMultiple, SvgMap, Switch, Tab, TabNotFoundError, Table, TableActionBuilder, Tabs, Tag, Text, TextInput, Textarea, Time, TimeFormatSelector, Toggleable, Tooltip, Tree, TreeDataNavigator, TreeDataSelector, TreeDataStructure, TreeGrid, ViewNavigator, ZeedhiCommonError, initTheme, omit, uniqueBy };
|