@progress/kendo-angular-grid 21.4.1-develop.1 → 22.0.0-develop.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/column-menu/column-menu-item-base.d.ts +1 -1
- package/columns/column-base.d.ts +1 -1
- package/common/toolbar-tool-base.directive.d.ts +1 -1
- package/editing/toolbar-editing-tool-base.directive.d.ts +1 -1
- package/editing-directives/editing-directive-base.d.ts +1 -1
- package/editing-directives/row-editing-directive-base.d.ts +1 -1
- package/fesm2022/progress-kendo-angular-grid.mjs +666 -666
- package/filtering/base-filter-cell.component.d.ts +1 -1
- package/filtering/boolean-filter.component.d.ts +1 -1
- package/filtering/date-filter.component.d.ts +1 -1
- package/filtering/filter-host.directive.d.ts +1 -1
- package/filtering/filter-input-wrapper.component.d.ts +1 -1
- package/filtering/numeric-filter.component.d.ts +1 -1
- package/filtering/operators/filter-operator.base.d.ts +1 -1
- package/filtering/string-filter.component.d.ts +1 -1
- package/localization/messages.d.ts +1 -1
- package/package.json +28 -36
- package/schematics/ngAdd/index.js +7 -7
- package/selection/selection-default.d.ts +1 -1
- package/esm2022/adaptiveness/adaptive-mode.mjs +0 -5
- package/esm2022/adaptiveness/adaptive-renderer.component.mjs +0 -1270
- package/esm2022/aggregates/aggregate-types.mjs +0 -5
- package/esm2022/aggregates/selection-aggregate.service.mjs +0 -200
- package/esm2022/aggregates/status-bar-template.directive.mjs +0 -30
- package/esm2022/aggregates/status-bar.component.mjs +0 -70
- package/esm2022/column-menu/column-chooser-content.component.mjs +0 -318
- package/esm2022/column-menu/column-chooser.component.mjs +0 -230
- package/esm2022/column-menu/column-list-kb-nav.service.mjs +0 -40
- package/esm2022/column-menu/column-list.component.mjs +0 -478
- package/esm2022/column-menu/column-locked-change-event.mjs +0 -19
- package/esm2022/column-menu/column-menu-autosize-all.component.mjs +0 -89
- package/esm2022/column-menu/column-menu-autosize.component.mjs +0 -97
- package/esm2022/column-menu/column-menu-chooser.component.mjs +0 -151
- package/esm2022/column-menu/column-menu-container.component.mjs +0 -67
- package/esm2022/column-menu/column-menu-expandable-item.interface.mjs +0 -5
- package/esm2022/column-menu/column-menu-filter.component.mjs +0 -152
- package/esm2022/column-menu/column-menu-item-base.mjs +0 -44
- package/esm2022/column-menu/column-menu-item-content-template.directive.mjs +0 -45
- package/esm2022/column-menu/column-menu-item.component.mjs +0 -514
- package/esm2022/column-menu/column-menu-item.directive.mjs +0 -164
- package/esm2022/column-menu/column-menu-lock.component.mjs +0 -118
- package/esm2022/column-menu/column-menu-position.component.mjs +0 -196
- package/esm2022/column-menu/column-menu-settings.interface.mjs +0 -5
- package/esm2022/column-menu/column-menu-sort.component.mjs +0 -119
- package/esm2022/column-menu/column-menu-stick.component.mjs +0 -120
- package/esm2022/column-menu/column-menu-template.directive.mjs +0 -47
- package/esm2022/column-menu/column-menu.component.mjs +0 -839
- package/esm2022/column-menu/column-menu.service.mjs +0 -71
- package/esm2022/column-menu/column-sticky-change-event.mjs +0 -19
- package/esm2022/column-menu/column-visibility-change-event.mjs +0 -19
- package/esm2022/column-menu/utils.mjs +0 -52
- package/esm2022/column-resizing/column-handle.directive.mjs +0 -499
- package/esm2022/column-resizing/column-resize.interface.mjs +0 -5
- package/esm2022/column-resizing/column-resizing.service.mjs +0 -214
- package/esm2022/column-resizing/table.directive.mjs +0 -141
- package/esm2022/columns/cell-rowspan.mjs +0 -5
- package/esm2022/columns/checkbox-column.component.mjs +0 -106
- package/esm2022/columns/column-base.mjs +0 -432
- package/esm2022/columns/column-common.mjs +0 -73
- package/esm2022/columns/column-group.component.mjs +0 -135
- package/esm2022/columns/column-list.mjs +0 -94
- package/esm2022/columns/column.component.mjs +0 -198
- package/esm2022/columns/columns-container.mjs +0 -101
- package/esm2022/columns/command-column.component.mjs +0 -80
- package/esm2022/columns/reorder-column.component.mjs +0 -114
- package/esm2022/columns/sort-settings.mjs +0 -18
- package/esm2022/columns/span-column.component.mjs +0 -195
- package/esm2022/common/adaptiveness.service.mjs +0 -72
- package/esm2022/common/cell-click-event-args.interface.mjs +0 -5
- package/esm2022/common/clipboard-types.mjs +0 -5
- package/esm2022/common/clipboard.directive.mjs +0 -197
- package/esm2022/common/clipboard.service.mjs +0 -221
- package/esm2022/common/column-info.service.mjs +0 -92
- package/esm2022/common/create-form-group.mjs +0 -5
- package/esm2022/common/data-layout-mode.mjs +0 -5
- package/esm2022/common/default-track-by.mjs +0 -13
- package/esm2022/common/dom-events.service.mjs +0 -27
- package/esm2022/common/error-messages.mjs +0 -64
- package/esm2022/common/event-emitter.mjs +0 -39
- package/esm2022/common/fetch-data-callback.mjs +0 -5
- package/esm2022/common/field-datatype.mjs +0 -5
- package/esm2022/common/filter-descriptor-differ.mjs +0 -69
- package/esm2022/common/filter-operator.interface.mjs +0 -5
- package/esm2022/common/grid-col-size.mjs +0 -5
- package/esm2022/common/id.service.mjs +0 -59
- package/esm2022/common/pager-settings.mjs +0 -20
- package/esm2022/common/preventable-event.mjs +0 -24
- package/esm2022/common/provider.service.mjs +0 -42
- package/esm2022/common/remove-confirmation.mjs +0 -5
- package/esm2022/common/resizable-settings.mjs +0 -9
- package/esm2022/common/single-popup.service.mjs +0 -158
- package/esm2022/common/size-options.mjs +0 -5
- package/esm2022/common/sort.service.mjs +0 -14
- package/esm2022/common/toolbar-tool-base.directive.mjs +0 -85
- package/esm2022/constants.mjs +0 -16
- package/esm2022/data/change-event-args.interface.mjs +0 -5
- package/esm2022/data/change-notification.service.mjs +0 -30
- package/esm2022/data/data-item.interface.mjs +0 -5
- package/esm2022/data/data-mapping.service.mjs +0 -136
- package/esm2022/data/data.collection.mjs +0 -87
- package/esm2022/data/data.iterators.mjs +0 -221
- package/esm2022/data/grid-item.interface.mjs +0 -5
- package/esm2022/data/group-footer-item.interface.mjs +0 -5
- package/esm2022/data/group-item.interface.mjs +0 -5
- package/esm2022/databinding.directive.mjs +0 -233
- package/esm2022/directives.mjs +0 -504
- package/esm2022/dragdrop/column-reorder-config.mjs +0 -5
- package/esm2022/dragdrop/column-reorder-event.mjs +0 -31
- package/esm2022/dragdrop/column-reorder.service.mjs +0 -20
- package/esm2022/dragdrop/common.mjs +0 -69
- package/esm2022/dragdrop/context-types.mjs +0 -5
- package/esm2022/dragdrop/drag-and-drop.service.mjs +0 -65
- package/esm2022/dragdrop/drag-hint.service.mjs +0 -137
- package/esm2022/dragdrop/draggable-column.directive.mjs +0 -137
- package/esm2022/dragdrop/drop-cue.service.mjs +0 -46
- package/esm2022/dragdrop/drop-target.directive.mjs +0 -71
- package/esm2022/editing/add-command-tool.directive.mjs +0 -59
- package/esm2022/editing/add-command.directive.mjs +0 -93
- package/esm2022/editing/add-event-args.interface.mjs +0 -5
- package/esm2022/editing/cancel-command-tool.directive.mjs +0 -64
- package/esm2022/editing/cancel-command.directive.mjs +0 -127
- package/esm2022/editing/cancel-event-args.interface.mjs +0 -5
- package/esm2022/editing/cell-close-event.mjs +0 -38
- package/esm2022/editing/edit-command-tool.directive.mjs +0 -60
- package/esm2022/editing/edit-command.directive.mjs +0 -124
- package/esm2022/editing/edit-event-args.interface.mjs +0 -5
- package/esm2022/editing/edit-row-options.interface.mjs +0 -5
- package/esm2022/editing/edit-template.directive.mjs +0 -43
- package/esm2022/editing/edit.service.mjs +0 -182
- package/esm2022/editing/form/dialog-form.component.mjs +0 -102
- package/esm2022/editing/form/form-formfield.component.mjs +0 -188
- package/esm2022/editing/form/form.component.mjs +0 -169
- package/esm2022/editing/form/index.mjs +0 -8
- package/esm2022/editing/form/models.mjs +0 -5
- package/esm2022/editing/local-data-changes.service.mjs +0 -18
- package/esm2022/editing/remove-command-tool.directive.mjs +0 -61
- package/esm2022/editing/remove-command.directive.mjs +0 -123
- package/esm2022/editing/remove-event-args.interface.mjs +0 -5
- package/esm2022/editing/save-command-tool.directive.mjs +0 -65
- package/esm2022/editing/save-command.directive.mjs +0 -126
- package/esm2022/editing/save-event-args.interface.mjs +0 -5
- package/esm2022/editing/toolbar-editing-tool-base.directive.mjs +0 -99
- package/esm2022/editing-directives/create-form-group-args.interface.mjs +0 -5
- package/esm2022/editing-directives/edit-service.interface.mjs +0 -5
- package/esm2022/editing-directives/editing-directive-base.mjs +0 -167
- package/esm2022/editing-directives/external-editing.directive.mjs +0 -151
- package/esm2022/editing-directives/in-cell-editing.directive.mjs +0 -97
- package/esm2022/editing-directives/local-edit.service.mjs +0 -64
- package/esm2022/editing-directives/local-row-edit.service.mjs +0 -13
- package/esm2022/editing-directives/reactive-editing.directive.mjs +0 -60
- package/esm2022/editing-directives/row-editing-directive-base.mjs +0 -53
- package/esm2022/editing-directives/template-editing.directive.mjs +0 -72
- package/esm2022/editing-directives/utils.mjs +0 -18
- package/esm2022/excel/excel-command-tool.directive.mjs +0 -58
- package/esm2022/excel/excel-command.directive.mjs +0 -98
- package/esm2022/excel/excel-export-event.mjs +0 -18
- package/esm2022/excel/excel.component.mjs +0 -223
- package/esm2022/excel/excel.module.mjs +0 -45
- package/esm2022/excel/excel.service.mjs +0 -29
- package/esm2022/filtering/base-filter-cell.component.mjs +0 -174
- package/esm2022/filtering/boolean-filter.component.mjs +0 -83
- package/esm2022/filtering/cell/autocomplete-filter-cell.component.mjs +0 -114
- package/esm2022/filtering/cell/boolean-filter-cell.component.mjs +0 -113
- package/esm2022/filtering/cell/date-filter-cell.component.mjs +0 -141
- package/esm2022/filtering/cell/filter-cell-component.factory.mjs +0 -19
- package/esm2022/filtering/cell/filter-cell-host.directive.mjs +0 -33
- package/esm2022/filtering/cell/filter-cell-operators.component.mjs +0 -242
- package/esm2022/filtering/cell/filter-cell-template.directive.mjs +0 -46
- package/esm2022/filtering/cell/filter-cell-wrapper.component.mjs +0 -74
- package/esm2022/filtering/cell/filter-cell.component.mjs +0 -91
- package/esm2022/filtering/cell/numeric-filter-cell.component.mjs +0 -155
- package/esm2022/filtering/cell/string-filter-cell.component.mjs +0 -127
- package/esm2022/filtering/date-filter.component.mjs +0 -172
- package/esm2022/filtering/filter-component.interface.mjs +0 -5
- package/esm2022/filtering/filter-host.directive.mjs +0 -58
- package/esm2022/filtering/filter-input-wrapper.component.mjs +0 -119
- package/esm2022/filtering/filter-input.directive.mjs +0 -123
- package/esm2022/filtering/filter-row.component.mjs +0 -131
- package/esm2022/filtering/filter.service.mjs +0 -44
- package/esm2022/filtering/filterable.mjs +0 -16
- package/esm2022/filtering/menu/boolean-filter-menu.component.mjs +0 -167
- package/esm2022/filtering/menu/date-filter-menu-input.component.mjs +0 -179
- package/esm2022/filtering/menu/date-filter-menu.component.mjs +0 -212
- package/esm2022/filtering/menu/filter-menu-component.factory.mjs +0 -19
- package/esm2022/filtering/menu/filter-menu-container.component.mjs +0 -418
- package/esm2022/filtering/menu/filter-menu-dropdownlist.directive.mjs +0 -44
- package/esm2022/filtering/menu/filter-menu-host.directive.mjs +0 -46
- package/esm2022/filtering/menu/filter-menu-input-wrapper.component.mjs +0 -158
- package/esm2022/filtering/menu/filter-menu-template.directive.mjs +0 -48
- package/esm2022/filtering/menu/filter-menu.component.mjs +0 -221
- package/esm2022/filtering/menu/filter-radio-button.directive.mjs +0 -34
- package/esm2022/filtering/menu/menu-tabbing.service.mjs +0 -22
- package/esm2022/filtering/menu/numeric-filter-menu-input.component.mjs +0 -184
- package/esm2022/filtering/menu/numeric-filter-menu.component.mjs +0 -230
- package/esm2022/filtering/menu/string-filter-menu-input.component.mjs +0 -107
- package/esm2022/filtering/menu/string-filter-menu.component.mjs +0 -198
- package/esm2022/filtering/multicheckbox-filter.component.mjs +0 -324
- package/esm2022/filtering/numeric-filter.component.mjs +0 -145
- package/esm2022/filtering/operators/after-eq-filter-operator.component.mjs +0 -72
- package/esm2022/filtering/operators/after-filter-operator.component.mjs +0 -72
- package/esm2022/filtering/operators/before-eq-filter-operator.component.mjs +0 -72
- package/esm2022/filtering/operators/before-filter-operator.component.mjs +0 -72
- package/esm2022/filtering/operators/contains-filter-operator.component.mjs +0 -63
- package/esm2022/filtering/operators/ends-with-filter-operator.component.mjs +0 -63
- package/esm2022/filtering/operators/eq-filter-operator.component.mjs +0 -111
- package/esm2022/filtering/operators/filter-operator.base.mjs +0 -101
- package/esm2022/filtering/operators/gt-filter-operator.component.mjs +0 -63
- package/esm2022/filtering/operators/gte-filter-operator.component.mjs +0 -63
- package/esm2022/filtering/operators/is-empty-filter-operator.component.mjs +0 -63
- package/esm2022/filtering/operators/is-not-empty-filter-operator.component.mjs +0 -63
- package/esm2022/filtering/operators/is-not-null-filter-operator.component.mjs +0 -110
- package/esm2022/filtering/operators/isnull-filter-operator.component.mjs +0 -110
- package/esm2022/filtering/operators/lt-filter-operator.component.mjs +0 -63
- package/esm2022/filtering/operators/lte-filter-operator.component.mjs +0 -63
- package/esm2022/filtering/operators/neq-filter-operator.component.mjs +0 -110
- package/esm2022/filtering/operators/not-contains-filter-operator.component.mjs +0 -63
- package/esm2022/filtering/operators/starts-with-filter-operator.component.mjs +0 -63
- package/esm2022/filtering/string-filter.component.mjs +0 -90
- package/esm2022/grid.component.mjs +0 -4598
- package/esm2022/grid.module.mjs +0 -241
- package/esm2022/grouping/group-footer-template.directive.mjs +0 -44
- package/esm2022/grouping/group-header-column-template.directive.mjs +0 -45
- package/esm2022/grouping/group-header-template.directive.mjs +0 -46
- package/esm2022/grouping/group-header.component.mjs +0 -351
- package/esm2022/grouping/group-info.service.mjs +0 -43
- package/esm2022/grouping/group-key.interface.mjs +0 -5
- package/esm2022/grouping/group-panel.component.mjs +0 -487
- package/esm2022/grouping/group-rows-args.interface.mjs +0 -5
- package/esm2022/grouping/group-settings.mjs +0 -5
- package/esm2022/grouping/groups.service.mjs +0 -69
- package/esm2022/grouping/utils.mjs +0 -14
- package/esm2022/highlight/highlight-item.mjs +0 -5
- package/esm2022/highlight/highlight.directive.mjs +0 -132
- package/esm2022/index.mjs +0 -221
- package/esm2022/layout/browser-support.service.mjs +0 -94
- package/esm2022/layout/resizable.directive.mjs +0 -83
- package/esm2022/layout/resize.service.mjs +0 -29
- package/esm2022/layout/responsive.service.mjs +0 -34
- package/esm2022/layout/row-sync.mjs +0 -47
- package/esm2022/layout/sizing-options.service.mjs +0 -18
- package/esm2022/localization/custom-messages.component.mjs +0 -54
- package/esm2022/localization/localized-messages.directive.mjs +0 -39
- package/esm2022/localization/messages.mjs +0 -895
- package/esm2022/navigation/default-focusable-element.mjs +0 -50
- package/esm2022/navigation/focus-group.mjs +0 -73
- package/esm2022/navigation/focus-root.mjs +0 -50
- package/esm2022/navigation/focusable-element.interface.mjs +0 -5
- package/esm2022/navigation/focusable.directive.mjs +0 -150
- package/esm2022/navigation/grid-focusable-element.mjs +0 -28
- package/esm2022/navigation/item-map.mjs +0 -59
- package/esm2022/navigation/logical-cell.directive.mjs +0 -224
- package/esm2022/navigation/logical-cell.interface.mjs +0 -5
- package/esm2022/navigation/logical-row.directive.mjs +0 -131
- package/esm2022/navigation/logical-row.interface.mjs +0 -5
- package/esm2022/navigation/navigable-settings.mjs +0 -5
- package/esm2022/navigation/navigation-cell.interface.mjs +0 -5
- package/esm2022/navigation/navigation-change.interface.mjs +0 -5
- package/esm2022/navigation/navigation-cursor.mjs +0 -224
- package/esm2022/navigation/navigation-metadata.mjs +0 -35
- package/esm2022/navigation/navigation-mode.mjs +0 -5
- package/esm2022/navigation/navigation-model.mjs +0 -138
- package/esm2022/navigation/navigation-row.interface.mjs +0 -5
- package/esm2022/navigation/navigation.service.mjs +0 -998
- package/esm2022/navigation/toolbar-tool-name.mjs +0 -18
- package/esm2022/package-metadata.mjs +0 -16
- package/esm2022/pdf/export-element.mjs +0 -135
- package/esm2022/pdf/grid-query.mjs +0 -45
- package/esm2022/pdf/pdf-command-tool.directive.mjs +0 -60
- package/esm2022/pdf/pdf-command.directive.mjs +0 -98
- package/esm2022/pdf/pdf-export-event.mjs +0 -16
- package/esm2022/pdf/pdf-margin.component.mjs +0 -38
- package/esm2022/pdf/pdf-margin.interface.mjs +0 -5
- package/esm2022/pdf/pdf-template.directive.mjs +0 -43
- package/esm2022/pdf/pdf.component.mjs +0 -331
- package/esm2022/pdf/pdf.module.mjs +0 -47
- package/esm2022/pdf/pdf.service.mjs +0 -42
- package/esm2022/progress-kendo-angular-grid.mjs +0 -8
- package/esm2022/rendering/cell-loading.template.directive.mjs +0 -39
- package/esm2022/rendering/cell-template.directive.mjs +0 -44
- package/esm2022/rendering/cell.component.mjs +0 -717
- package/esm2022/rendering/common/cell-context.mjs +0 -13
- package/esm2022/rendering/common/col-group.component.mjs +0 -98
- package/esm2022/rendering/common/dom-queries.mjs +0 -162
- package/esm2022/rendering/common/field-accessor.pipe.mjs +0 -48
- package/esm2022/rendering/common/format.pipe.mjs +0 -37
- package/esm2022/rendering/common/loading.component.mjs +0 -60
- package/esm2022/rendering/common/row-args.mjs +0 -5
- package/esm2022/rendering/common/row-class.mjs +0 -5
- package/esm2022/rendering/common/spacer.component.mjs +0 -62
- package/esm2022/rendering/constants.mjs +0 -20
- package/esm2022/rendering/details/detail-collapse-event.mjs +0 -27
- package/esm2022/rendering/details/detail-expand-event.mjs +0 -27
- package/esm2022/rendering/details/detail-template.directive.mjs +0 -61
- package/esm2022/rendering/details/details.service.mjs +0 -56
- package/esm2022/rendering/details-expand.directive.mjs +0 -136
- package/esm2022/rendering/footer/footer-template.directive.mjs +0 -48
- package/esm2022/rendering/footer/footer.component.mjs +0 -266
- package/esm2022/rendering/grid-table.directive.mjs +0 -52
- package/esm2022/rendering/groups-expand.directive.mjs +0 -149
- package/esm2022/rendering/header/header-template.directive.mjs +0 -45
- package/esm2022/rendering/header/header.component.mjs +0 -1055
- package/esm2022/rendering/list.component.mjs +0 -1176
- package/esm2022/rendering/loading-template.directive.mjs +0 -38
- package/esm2022/rendering/no-records-template.directive.mjs +0 -38
- package/esm2022/rendering/rowspan.service.mjs +0 -24
- package/esm2022/rendering/table-body.component.mjs +0 -1250
- package/esm2022/rendering/toolbar/toolbar-focusable.directive.mjs +0 -83
- package/esm2022/rendering/toolbar/toolbar-navigation.service.mjs +0 -58
- package/esm2022/rendering/toolbar/toolbar-position.mjs +0 -5
- package/esm2022/rendering/toolbar/toolbar-template.directive.mjs +0 -55
- package/esm2022/rendering/toolbar/toolbar.component.mjs +0 -159
- package/esm2022/rendering/toolbar/tools/ai-assistant/ai-assistant.component.mjs +0 -272
- package/esm2022/rendering/toolbar/tools/ai-assistant/ai-request-response.service.mjs +0 -624
- package/esm2022/rendering/toolbar/tools/ai-assistant/ai-tool.directive.mjs +0 -273
- package/esm2022/rendering/toolbar/tools/ai-assistant/models.mjs +0 -43
- package/esm2022/rendering/toolbar/tools/ai-assistant/utils.mjs +0 -92
- package/esm2022/rendering/toolbar/tools/column-chooser-tool.directive.mjs +0 -238
- package/esm2022/rendering/toolbar/tools/filter-command-tool.directive.mjs +0 -219
- package/esm2022/rendering/toolbar/tools/filter-tool-wrapper.component.mjs +0 -151
- package/esm2022/rendering/toolbar/tools/filter-toolbar-tool.component.mjs +0 -223
- package/esm2022/rendering/toolbar/tools/group-command-tool.directive.mjs +0 -208
- package/esm2022/rendering/toolbar/tools/group-toolbar-tool.component.mjs +0 -451
- package/esm2022/rendering/toolbar/tools/select-all-command-tool.directive.mjs +0 -93
- package/esm2022/rendering/toolbar/tools/sort-command-tool.directive.mjs +0 -222
- package/esm2022/rendering/toolbar/tools/sort-toolbar-tool.component.mjs +0 -245
- package/esm2022/row-reordering/drag-handle-template.directive.mjs +0 -44
- package/esm2022/row-reordering/drag-hint-template.directive.mjs +0 -42
- package/esm2022/row-reordering/row-reorder.service.mjs +0 -280
- package/esm2022/row-reordering/types.mjs +0 -5
- package/esm2022/row-reordering/utils.mjs +0 -88
- package/esm2022/scrolling/content-scroll-event.mjs +0 -5
- package/esm2022/scrolling/row-height.service.mjs +0 -55
- package/esm2022/scrolling/scroll-bottom-event.mjs +0 -5
- package/esm2022/scrolling/scroll-request.service.mjs +0 -24
- package/esm2022/scrolling/scroll-sync.service.mjs +0 -80
- package/esm2022/scrolling/scroller.service.mjs +0 -254
- package/esm2022/scrolling/scrollmode.mjs +0 -5
- package/esm2022/scrolling/suspend.service.mjs +0 -17
- package/esm2022/selection/cell-selection.service.mjs +0 -349
- package/esm2022/selection/marquee.directive.mjs +0 -188
- package/esm2022/selection/pair-set.mjs +0 -158
- package/esm2022/selection/selectall-checkbox.directive.mjs +0 -143
- package/esm2022/selection/selection-checkbox.directive.mjs +0 -132
- package/esm2022/selection/selection-default.mjs +0 -208
- package/esm2022/selection/selection.directive.mjs +0 -53
- package/esm2022/selection/selection.service.mjs +0 -466
- package/esm2022/selection/types.mjs +0 -5
- package/esm2022/state-management/grid-state.models.mjs +0 -26
- package/esm2022/state-management/redo-command-tool.mjs +0 -74
- package/esm2022/state-management/undo-command-tool.mjs +0 -74
- package/esm2022/state-management/undo-redo.directive.mjs +0 -249
- package/esm2022/state-management/undo-redo.service.mjs +0 -21
- package/esm2022/state-management/undo-redo.stack.mjs +0 -238
- package/esm2022/utils.mjs +0 -216
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { Directive, EventEmitter, Input, Output } from '@angular/core';
|
|
6
|
-
import { UndoRedoStack } from './undo-redo.stack';
|
|
7
|
-
import { GridComponent } from '../grid.component';
|
|
8
|
-
import { UndoRedoEvent } from './grid-state.models';
|
|
9
|
-
import { Subscription } from 'rxjs';
|
|
10
|
-
import { EditService } from '../editing/edit.service';
|
|
11
|
-
import { filter } from 'rxjs/operators';
|
|
12
|
-
import { UndoRedoService } from './undo-redo.service';
|
|
13
|
-
import { hasObservers, isPresent } from '@progress/kendo-angular-common';
|
|
14
|
-
import { ChangeNotificationService } from '../data/change-notification.service';
|
|
15
|
-
import { ContextService } from '../common/provider.service';
|
|
16
|
-
import { LocalDataChangesService } from '../editing/local-data-changes.service';
|
|
17
|
-
import { recursiveFlatMap } from '../utils';
|
|
18
|
-
import * as i0 from "@angular/core";
|
|
19
|
-
import * as i1 from "../grid.component";
|
|
20
|
-
import * as i2 from "../editing/edit.service";
|
|
21
|
-
import * as i3 from "./undo-redo.service";
|
|
22
|
-
import * as i4 from "../data/change-notification.service";
|
|
23
|
-
import * as i5 from "../common/provider.service";
|
|
24
|
-
import * as i6 from "../editing/local-data-changes.service";
|
|
25
|
-
/**
|
|
26
|
-
* Represents the directive that manages undo-redo operations in the Grid.
|
|
27
|
-
* Use this directive to enable undo and redo functionality for user actions in the Grid.
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```html
|
|
31
|
-
* <kendo-grid [data]="data" kendoGridUndoRedo></kendo-grid>
|
|
32
|
-
* ```
|
|
33
|
-
* @remarks
|
|
34
|
-
* Applied to: {@link GridComponent}.
|
|
35
|
-
*/
|
|
36
|
-
export class UndoRedoDirective {
|
|
37
|
-
host;
|
|
38
|
-
editService;
|
|
39
|
-
undoRedoService;
|
|
40
|
-
changeNotification;
|
|
41
|
-
ctx;
|
|
42
|
-
localDataChangesService;
|
|
43
|
-
/**
|
|
44
|
-
* Sets the maximum number of actions to keep in the undo-redo stack.
|
|
45
|
-
* @default 10
|
|
46
|
-
*/
|
|
47
|
-
maxStoredStates = 10;
|
|
48
|
-
/**
|
|
49
|
-
* Defines the property name of the data item unique key that will be used to identify the items when performing undo-redo actions.
|
|
50
|
-
*/
|
|
51
|
-
itemIdKey;
|
|
52
|
-
/**
|
|
53
|
-
* Fires when you perform the undo action. Provides the Grid state to apply.
|
|
54
|
-
*/
|
|
55
|
-
onUndo = new EventEmitter();
|
|
56
|
-
/**
|
|
57
|
-
* Fires when you perform the redo action. Provides the Grid state to apply.
|
|
58
|
-
*/
|
|
59
|
-
onRedo = new EventEmitter();
|
|
60
|
-
/**
|
|
61
|
-
* Returns all undo-redo actions currently in the stack.
|
|
62
|
-
*/
|
|
63
|
-
get undoRedoItems() {
|
|
64
|
-
return this.stack.toArray();
|
|
65
|
-
}
|
|
66
|
-
stack;
|
|
67
|
-
subs = new Subscription();
|
|
68
|
-
addToState = true;
|
|
69
|
-
constructor(host, editService, undoRedoService, changeNotification, ctx, localDataChangesService) {
|
|
70
|
-
this.host = host;
|
|
71
|
-
this.editService = editService;
|
|
72
|
-
this.undoRedoService = undoRedoService;
|
|
73
|
-
this.changeNotification = changeNotification;
|
|
74
|
-
this.ctx = ctx;
|
|
75
|
-
this.localDataChangesService = localDataChangesService;
|
|
76
|
-
this.host.undoRedoService = this.undoRedoService;
|
|
77
|
-
}
|
|
78
|
-
ngOnInit() {
|
|
79
|
-
this.stack = new UndoRedoStack(this.maxStoredStates);
|
|
80
|
-
this.subs = this.host.gridStateChange.subscribe((state) => {
|
|
81
|
-
if (this.addToState) {
|
|
82
|
-
this.stack.add({
|
|
83
|
-
originalEvent: {
|
|
84
|
-
skip: state.skip,
|
|
85
|
-
take: state.take,
|
|
86
|
-
sort: state.sort,
|
|
87
|
-
filter: state.filter,
|
|
88
|
-
group: state.group
|
|
89
|
-
},
|
|
90
|
-
gridState: state
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
let stackEndPointReached;
|
|
94
|
-
if (this.stack.canUndo) {
|
|
95
|
-
stackEndPointReached = this.stack.canRedo ? false : 'end';
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
stackEndPointReached = 'start';
|
|
99
|
-
}
|
|
100
|
-
this.undoRedoService.stackEndReached.next(stackEndPointReached);
|
|
101
|
-
});
|
|
102
|
-
this.subs.add(this.editService.changes
|
|
103
|
-
.pipe(filter((event) => event.action === 'save' || event.action === 'remove'))
|
|
104
|
-
.subscribe(event => {
|
|
105
|
-
this.stack.add({
|
|
106
|
-
originalEvent: { ...event, dataItem: structuredClone(event.dataItem) },
|
|
107
|
-
gridState: this.host.currentState
|
|
108
|
-
});
|
|
109
|
-
this.addToState = false;
|
|
110
|
-
this.host.gridStateChange.emit(this.stack.current.gridState);
|
|
111
|
-
this.addToState = true;
|
|
112
|
-
this.updateUndoRedoDisabled();
|
|
113
|
-
}));
|
|
114
|
-
this.subs.add(this.changeNotification.changes.subscribe(() => {
|
|
115
|
-
if (!this.ctx.dataBindingDirective) {
|
|
116
|
-
this.stack.current.gridState = this.host.currentState;
|
|
117
|
-
}
|
|
118
|
-
}));
|
|
119
|
-
['Undo', 'Redo'].forEach((action) => {
|
|
120
|
-
this.subs.add(this.undoRedoService[`on${action}`].subscribe(() => {
|
|
121
|
-
if (!this.stack[`can${action}`]) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
let eventData;
|
|
125
|
-
if (action === 'Undo') {
|
|
126
|
-
const isSaveOrRemove = this.stack.current.originalEvent.action === 'save' || this.stack.current.originalEvent.action === 'remove';
|
|
127
|
-
eventData = isSaveOrRemove ? this.stack.current : this.stack.peekPrev();
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
eventData = this.stack.peekNext();
|
|
131
|
-
}
|
|
132
|
-
const event = new UndoRedoEvent(eventData);
|
|
133
|
-
if (hasObservers(this[`on${action}`])) {
|
|
134
|
-
this[`on${action}`].emit(event);
|
|
135
|
-
if (event.isDefaultPrevented()) {
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
this.stack[`${action.toLowerCase()}`]();
|
|
140
|
-
this.updateUndoRedoDisabled();
|
|
141
|
-
const originalAction = event.originalEvent.action;
|
|
142
|
-
const isLocalData = isPresent(this.ctx?.dataBindingDirective);
|
|
143
|
-
if (!isLocalData) {
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
const isSaveOrRemove = originalAction === 'save' || originalAction === 'remove';
|
|
147
|
-
if (isSaveOrRemove) {
|
|
148
|
-
if (originalAction === 'save') {
|
|
149
|
-
const stateItem = this.getGridDataItems(this.stack.current.gridState.currentData).find(item => item[this.itemIdKey] === event.originalEvent.dataItem[this.itemIdKey]);
|
|
150
|
-
this.localDataChangesService?.data.splice(event.originalEvent.rowIndex, 1, stateItem);
|
|
151
|
-
}
|
|
152
|
-
else if (action === 'Undo') {
|
|
153
|
-
this.localDataChangesService?.data.splice(event.originalEvent.rowIndex, 0, event.originalEvent.dataItem);
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
this.localDataChangesService?.data.splice(event.originalEvent.rowIndex, 1);
|
|
157
|
-
}
|
|
158
|
-
this.localDataChangesService?.changes.emit();
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
this.host.loadState({ ...this.stack.current.gridState, currentData: null });
|
|
162
|
-
if (this.isDataStateChangeEvent(event.originalEvent)) {
|
|
163
|
-
const { skip, take, sort, filter, group } = event.gridState;
|
|
164
|
-
this.host.dataStateChange.emit({ skip, take, sort, filter, group });
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}));
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
ngAfterViewInit() {
|
|
171
|
-
this.stack.add({
|
|
172
|
-
originalEvent: {
|
|
173
|
-
skip: this.host.skip,
|
|
174
|
-
take: this.host.pageSize,
|
|
175
|
-
sort: this.host.sort,
|
|
176
|
-
filter: this.host.filter,
|
|
177
|
-
group: this.host.group
|
|
178
|
-
}, gridState: this.host.currentState
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
ngOnDestroy() {
|
|
182
|
-
this.stack.clear();
|
|
183
|
-
this.stack = null;
|
|
184
|
-
this.subs.unsubscribe();
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Re-applies the last action that you reverted with the `undo` method.
|
|
188
|
-
*/
|
|
189
|
-
redo() {
|
|
190
|
-
if (this.stack.canRedo) {
|
|
191
|
-
this.stack.redo();
|
|
192
|
-
this.host.loadState(this.stack.current.gridState);
|
|
193
|
-
if (!this.stack.canRedo) {
|
|
194
|
-
this.undoRedoService.stackEndReached.next('end');
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Reverts the last user action that you performed.
|
|
200
|
-
*/
|
|
201
|
-
undo() {
|
|
202
|
-
if (this.stack.canUndo) {
|
|
203
|
-
this.stack.undo();
|
|
204
|
-
this.host.loadState(this.stack.current.gridState);
|
|
205
|
-
if (!this.stack.canUndo) {
|
|
206
|
-
this.undoRedoService.stackEndReached.next('start');
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
updateUndoRedoDisabled() {
|
|
211
|
-
if (!this.stack.canRedo) {
|
|
212
|
-
this.undoRedoService.stackEndReached.next('end');
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
if (!this.stack.canUndo) {
|
|
216
|
-
this.undoRedoService.stackEndReached.next('start');
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
this.undoRedoService.stackEndReached.next(false);
|
|
220
|
-
}
|
|
221
|
-
getGridDataItems(data) {
|
|
222
|
-
return Array.isArray(data) ? data.flatMap(recursiveFlatMap) :
|
|
223
|
-
data.data.flatMap(recursiveFlatMap);
|
|
224
|
-
}
|
|
225
|
-
isDataStateChangeEvent(event) {
|
|
226
|
-
return event && ['skip', 'take', 'sort', 'filter', 'group'].some(prop => prop in event);
|
|
227
|
-
}
|
|
228
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UndoRedoDirective, deps: [{ token: i1.GridComponent }, { token: i2.EditService }, { token: i3.UndoRedoService }, { token: i4.ChangeNotificationService }, { token: i5.ContextService }, { token: i6.LocalDataChangesService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
229
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: UndoRedoDirective, isStandalone: true, selector: "[kendoGridUndoRedo]", inputs: { maxStoredStates: "maxStoredStates", itemIdKey: "itemIdKey" }, outputs: { onUndo: "undo", onRedo: "redo" }, providers: [UndoRedoService], exportAs: ["kendoGridUndoRedo"], ngImport: i0 });
|
|
230
|
-
}
|
|
231
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UndoRedoDirective, decorators: [{
|
|
232
|
-
type: Directive,
|
|
233
|
-
args: [{
|
|
234
|
-
selector: '[kendoGridUndoRedo]',
|
|
235
|
-
standalone: true,
|
|
236
|
-
exportAs: 'kendoGridUndoRedo',
|
|
237
|
-
providers: [UndoRedoService]
|
|
238
|
-
}]
|
|
239
|
-
}], ctorParameters: () => [{ type: i1.GridComponent }, { type: i2.EditService }, { type: i3.UndoRedoService }, { type: i4.ChangeNotificationService }, { type: i5.ContextService }, { type: i6.LocalDataChangesService }], propDecorators: { maxStoredStates: [{
|
|
240
|
-
type: Input
|
|
241
|
-
}], itemIdKey: [{
|
|
242
|
-
type: Input
|
|
243
|
-
}], onUndo: [{
|
|
244
|
-
type: Output,
|
|
245
|
-
args: ['undo']
|
|
246
|
-
}], onRedo: [{
|
|
247
|
-
type: Output,
|
|
248
|
-
args: ['redo']
|
|
249
|
-
}] } });
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { Injectable } from '@angular/core';
|
|
6
|
-
import { Subject } from 'rxjs';
|
|
7
|
-
import * as i0 from "@angular/core";
|
|
8
|
-
/**
|
|
9
|
-
* @hidden
|
|
10
|
-
*/
|
|
11
|
-
export class UndoRedoService {
|
|
12
|
-
originalEvent;
|
|
13
|
-
onUndo = new Subject();
|
|
14
|
-
onRedo = new Subject();
|
|
15
|
-
stackEndReached = new Subject();
|
|
16
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UndoRedoService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
17
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UndoRedoService });
|
|
18
|
-
}
|
|
19
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UndoRedoService, decorators: [{
|
|
20
|
-
type: Injectable
|
|
21
|
-
}] });
|
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { isPresent } from "@progress/kendo-angular-common";
|
|
6
|
-
/**
|
|
7
|
-
* @hidden
|
|
8
|
-
* A linked-list based implementation of an undo-redo stack.
|
|
9
|
-
* Maintains a chain of states that can be navigated forward and backward.
|
|
10
|
-
*/
|
|
11
|
-
export class UndoRedoStack {
|
|
12
|
-
maxSize;
|
|
13
|
-
/** The current active node in the undo-redo history */
|
|
14
|
-
currentNode = null;
|
|
15
|
-
/** The root node of the stack (first state) */
|
|
16
|
-
rootNode = null;
|
|
17
|
-
/** Track the size of the stack */
|
|
18
|
-
_size = 0;
|
|
19
|
-
/**
|
|
20
|
-
* Creates a new UndoRedoStack.
|
|
21
|
-
* @param maxSize Optional maximum number of states to maintain (unlimited if not provided)
|
|
22
|
-
*/
|
|
23
|
-
constructor(maxSize = -1) {
|
|
24
|
-
this.maxSize = maxSize;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Gets the current number of states in the stack
|
|
28
|
-
*/
|
|
29
|
-
get size() {
|
|
30
|
-
return this._size;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Gets the current active state
|
|
34
|
-
*/
|
|
35
|
-
get current() {
|
|
36
|
-
return this.currentNode ? this.currentNode.state : null;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Checks if undo is available (if there's a previous state)
|
|
40
|
-
*/
|
|
41
|
-
get canUndo() {
|
|
42
|
-
return isPresent(this.currentNode?.previous);
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Checks if redo is available (if there's a next state)
|
|
46
|
-
*/
|
|
47
|
-
get canRedo() {
|
|
48
|
-
return isPresent(this.currentNode?.next);
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Adds a new state to the undo-redo stack
|
|
52
|
-
* @param state The state to add
|
|
53
|
-
* @param id Optional identifier for the state
|
|
54
|
-
* @returns The newly created node
|
|
55
|
-
*/
|
|
56
|
-
add(state, id) {
|
|
57
|
-
const newNode = {
|
|
58
|
-
state,
|
|
59
|
-
previous: this.currentNode,
|
|
60
|
-
next: null,
|
|
61
|
-
id
|
|
62
|
-
};
|
|
63
|
-
// If we have a current node, update its next reference
|
|
64
|
-
if (this.currentNode) {
|
|
65
|
-
// If we're adding after a node that already had a "next",
|
|
66
|
-
// we need to discard that branch of history
|
|
67
|
-
if (this.currentNode.next) {
|
|
68
|
-
this.truncateForward(this.currentNode);
|
|
69
|
-
}
|
|
70
|
-
this.currentNode.next = newNode;
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
// This is the first node
|
|
74
|
-
this.rootNode = newNode;
|
|
75
|
-
}
|
|
76
|
-
this.currentNode = newNode;
|
|
77
|
-
this._size++;
|
|
78
|
-
// If we've exceeded the max size, remove oldest nodes
|
|
79
|
-
this.enforceMaxSize();
|
|
80
|
-
return newNode;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Finds a node by its identifier
|
|
84
|
-
* @param id The identifier to search for
|
|
85
|
-
* @returns The found node or null if not found
|
|
86
|
-
*/
|
|
87
|
-
find(id) {
|
|
88
|
-
if (!this.rootNode) {
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
let node = this.rootNode;
|
|
92
|
-
while (node) {
|
|
93
|
-
if (node.id === id) {
|
|
94
|
-
return node;
|
|
95
|
-
}
|
|
96
|
-
node = node.next;
|
|
97
|
-
}
|
|
98
|
-
return null;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Removes a node by its identifier
|
|
102
|
-
* @param id The identifier of the node to remove
|
|
103
|
-
* @returns True if the node was found and removed, false otherwise
|
|
104
|
-
*/
|
|
105
|
-
remove(id) {
|
|
106
|
-
const nodeToRemove = this.find(id);
|
|
107
|
-
if (!nodeToRemove) {
|
|
108
|
-
return false;
|
|
109
|
-
}
|
|
110
|
-
// Handle removal of current node
|
|
111
|
-
if (nodeToRemove === this.currentNode) {
|
|
112
|
-
this.currentNode = nodeToRemove.previous || nodeToRemove.next;
|
|
113
|
-
}
|
|
114
|
-
// Connect previous and next nodes
|
|
115
|
-
if (nodeToRemove.previous) {
|
|
116
|
-
nodeToRemove.previous.next = nodeToRemove.next;
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
// Removing the root node
|
|
120
|
-
this.rootNode = nodeToRemove.next;
|
|
121
|
-
}
|
|
122
|
-
if (nodeToRemove.next) {
|
|
123
|
-
nodeToRemove.next.previous = nodeToRemove.previous;
|
|
124
|
-
}
|
|
125
|
-
// Clean up references to help garbage collection
|
|
126
|
-
nodeToRemove.previous = null;
|
|
127
|
-
nodeToRemove.next = null;
|
|
128
|
-
this._size--;
|
|
129
|
-
return true;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Performs an undo operation, moving to the previous state
|
|
133
|
-
* @returns The previous state or null if can't undo
|
|
134
|
-
*/
|
|
135
|
-
undo() {
|
|
136
|
-
if (!this.canUndo) {
|
|
137
|
-
return null;
|
|
138
|
-
}
|
|
139
|
-
this.currentNode = this.currentNode.previous;
|
|
140
|
-
return this.currentNode.state;
|
|
141
|
-
}
|
|
142
|
-
peekNext() {
|
|
143
|
-
return this.currentNode.next?.state || null;
|
|
144
|
-
}
|
|
145
|
-
peekPrev() {
|
|
146
|
-
return this.currentNode.previous?.state || null;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Performs a redo operation, moving to the next state
|
|
150
|
-
* @returns The next state or null if can't redo
|
|
151
|
-
*/
|
|
152
|
-
redo() {
|
|
153
|
-
if (!this.canRedo) {
|
|
154
|
-
return null;
|
|
155
|
-
}
|
|
156
|
-
this.currentNode = this.currentNode.next;
|
|
157
|
-
return this.currentNode.state;
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Clears all history
|
|
161
|
-
*/
|
|
162
|
-
clear() {
|
|
163
|
-
this.currentNode = null;
|
|
164
|
-
this.rootNode = null;
|
|
165
|
-
this._size = 0;
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Removes all states after the specified node
|
|
169
|
-
* @param node The node to truncate from
|
|
170
|
-
* @returns The number of nodes removed
|
|
171
|
-
*/
|
|
172
|
-
truncateForward(node) {
|
|
173
|
-
if (!node.next) {
|
|
174
|
-
return 0;
|
|
175
|
-
}
|
|
176
|
-
let removedCount = 0;
|
|
177
|
-
let currentNext = node.next;
|
|
178
|
-
while (currentNext) {
|
|
179
|
-
const temp = currentNext.next;
|
|
180
|
-
// Clean up references for garbage collection
|
|
181
|
-
currentNext.previous = null;
|
|
182
|
-
currentNext.next = null;
|
|
183
|
-
currentNext = temp;
|
|
184
|
-
removedCount++;
|
|
185
|
-
}
|
|
186
|
-
// Update the node's next pointer
|
|
187
|
-
node.next = null;
|
|
188
|
-
this._size -= removedCount;
|
|
189
|
-
return removedCount;
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Ensures the stack doesn't exceed the maximum size by removing oldest nodes
|
|
193
|
-
*/
|
|
194
|
-
enforceMaxSize() {
|
|
195
|
-
if (this.maxSize <= 0 || this._size <= this.maxSize) {
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
let nodesToRemove = this._size - this.maxSize;
|
|
199
|
-
let currentNode = this.rootNode;
|
|
200
|
-
// Find the new root node
|
|
201
|
-
while (nodesToRemove > 0 && currentNode) {
|
|
202
|
-
currentNode = currentNode.next;
|
|
203
|
-
nodesToRemove--;
|
|
204
|
-
}
|
|
205
|
-
if (currentNode) {
|
|
206
|
-
// Disconnect from previous history
|
|
207
|
-
currentNode.previous = null;
|
|
208
|
-
// Update root node
|
|
209
|
-
this.rootNode = currentNode;
|
|
210
|
-
// Update size
|
|
211
|
-
this._size = this.maxSize;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* Gets all states in the stack as an array (from oldest to newest)
|
|
216
|
-
*/
|
|
217
|
-
toArray() {
|
|
218
|
-
const result = [];
|
|
219
|
-
let node = this.rootNode;
|
|
220
|
-
while (node) {
|
|
221
|
-
result.push(node.state);
|
|
222
|
-
node = node.next;
|
|
223
|
-
}
|
|
224
|
-
return result;
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Gets the history nodes as an array (useful for debugging)
|
|
228
|
-
*/
|
|
229
|
-
getNodes() {
|
|
230
|
-
const result = [];
|
|
231
|
-
let node = this.rootNode;
|
|
232
|
-
while (node) {
|
|
233
|
-
result.push(node);
|
|
234
|
-
node = node.next;
|
|
235
|
-
}
|
|
236
|
-
return result;
|
|
237
|
-
}
|
|
238
|
-
}
|