Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow ordering of the hook callbacks. #10970

Merged
merged 7 commits into from May 15, 2024
Merged

Conversation

jansiegel
Copy link
Member

Context

This PR introduces the option of adding an "order index" to the hook callbacks.

  • If the order index is > 0, the callback will be added after the others. For example, with an index of 1, the callback will be added before the ones with an index of 2, 3, etc., but after the ones with an index of 0 and lower.
  • If the order index is < 0, the callback will be added before the others. For example, with an index of -1, the callback will be added after the ones with an index of -2, -3, etc., but before the ones with an index of 0 and higher.
  • If the order index is 0 or no order index is provided, the callback will be added between the "negative" and "positive" indexes.

How has this been tested?

Added a test case for the manualColumnResize + nestedHeaders feature from handsontable/dev-handsontable#770

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature or improvement (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Additional language file or change to the existing one (translations)

Related issue(s):

  1. handsontable/dev-handsontable#770

Affected project(s):

  • handsontable
  • @handsontable/angular
  • @handsontable/react
  • @handsontable/vue
  • @handsontable/vue3

Checklist:

@jansiegel jansiegel self-assigned this May 13, 2024
Copy link

Launch the local version of documentation by running:

npm run docs:review ddd18f85775cd071ac1327d7bc0fbf307216dec5

@jansiegel jansiegel requested a review from budnix May 13, 2024 13:55
@jansiegel jansiegel marked this pull request as ready for review May 13, 2024 13:55
@@ -2911,8 +2911,14 @@ class Hooks {
createEmptyBucket() {
const bucket = Object.create(null);

bucket._order = Object.create(null);
Copy link
Member

@budnix budnix May 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you try to use the hook name under the same name, you will get an error hot.addHook('_order', () => {}). Did you consider using WeakMap here?

@budnix budnix self-requested a review May 14, 2024 13:01
@jansiegel jansiegel merged commit f0b9f34 into develop May 15, 2024
21 checks passed
@jansiegel jansiegel deleted the feature/dev-issue-770 branch May 15, 2024 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants