-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(table): add rule focusing behavior
-on clicking the add rule button, focus the first cell of the new row -on clicking the last row, focus the clicked cell of the new row Related to camunda/camunda-modeler#928
- Loading branch information
Showing
3 changed files
with
50 additions
and
8 deletions.
There are no files selected for viewing
13 changes: 9 additions & 4 deletions
13
packages/dmn-js-decision-table/src/features/add-rule/AddRule.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
import AddRuleFootComponent from './components/AddRuleFootComponent'; | ||
|
||
export default class AddRule { | ||
constructor(components, editorActions, eventBus) { | ||
constructor(components, editorActions, eventBus, selection) { | ||
components.onGetComponent('table.foot', () => AddRuleFootComponent); | ||
|
||
eventBus.on('addRule', () => { | ||
editorActions.trigger('addRule'); | ||
eventBus.on('addRule', (e, context) => { | ||
const rule = editorActions.trigger('addRule'); | ||
const colIndex = context.colIndex || 0; | ||
if (rule.cells[colIndex]) | ||
selection.select(rule.cells[colIndex]); | ||
else | ||
selection.select(rule.cells[0]); | ||
}); | ||
} | ||
} | ||
|
||
AddRule.$inject = [ 'components', 'editorActions', 'eventBus' ]; | ||
AddRule.$inject = [ 'components', 'editorActions', 'eventBus', 'selection' ]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters