Skip to content

Commit d09e8b3

Browse files
authored
Allow drag rows into table wrapper (#10369)
* allow drag into table wrapper * angular, vue and tests * refactored and check if no rows
1 parent 9e97014 commit d09e8b3

16 files changed

+24
-20
lines changed

packages/survey-angular-ui/src/questions/matrixtable.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div #contentElement [class]="question.cssClasses.tableWrapper">
1+
<div #contentElement [class]="question.cssClasses.tableWrapper" [attr.data-sv-drop-target-matrix-row]="question.renderedTable.wrapperDropTargetId">
22
<table [class]="question.getTableCss()">
33
<thead *ngIf="table.showHeader">
44
<tr>

packages/survey-core/src/question_matrixdropdownrendered.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,9 @@ export class QuestionMatrixDropdownRenderedTable extends Base {
329329
public set renderedRows(val: Array<QuestionMatrixDropdownRenderedRow>) {
330330
this.renderedRowsAnimation.sync(val);
331331
}
332+
public get wrapperDropTargetId() {
333+
return this.renderedRows[this.renderedRows.length - 1]?.dropTargetId;
334+
}
332335

333336
public constructor(public matrix: QuestionMatrixDropdownModelBase) {
334337
super();

packages/survey-react-ui/src/reactquestion_matrixdropdownbase.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ export class SurveyQuestionMatrixDropdownBase extends SurveyQuestionElementBase
256256
}
257257
renderTableDiv(): React.JSX.Element {
258258
return (
259-
<div className={this.question.cssClasses.tableWrapper} ref={(root) => (this.setControl(root))}>
259+
<div className={this.question.cssClasses.tableWrapper} data-sv-drop-target-matrix-row={this.question.renderedTable.wrapperDropTargetId} ref={(root) => (this.setControl(root))}>
260260
<SurveyQuestionMatrixTable question={this.question} creator={this.creator} wrapCell={(cell, element, reason) => this.wrapCell(cell, element, reason)}></SurveyQuestionMatrixTable>
261261
</div>
262262
);

packages/survey-vue3-ui/src/MatrixTable.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<div
33
:style="{ overflowX: question.showHorizontalScroll ? 'scroll' : '' as any }"
44
:class="question.cssClasses.tableWrapper"
5+
:data-sv-drop-target-matrix-row="question.renderedTable.wrapperDropTargetId"
56
>
67
<table :class="question.getTableCss()">
78
<thead v-if="table.showHeader">

tests/markup/snapshots/martix-celltype-text-a11y.snap.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="sd-table-wrapper">
1+
<div class="sd-table-wrapper" data-sv-drop-target-matrix-row="testid0row7">
22
<table class="sd-matrixdropdown sd-table sd-table--align-middle sd-table--columnsautowidth">
33
<thead>
44
<tr>

tests/markup/snapshots/matrixdropdown-cell-errors-top.snap.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="sd-table-wrapper">
1+
<div class="sd-table-wrapper" data-sv-drop-target-matrix-row="testid0row1">
22
<table class="sd-matrixdropdown sd-table sd-table--align-middle sd-table--columnsautowidth">
33
<thead>
44
<tr>

tests/markup/snapshots/matrixdropdown-disabled.snap.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="sd-table-wrapper">
1+
<div class="sd-table-wrapper" data-sv-drop-target-matrix-row="testid0row3">
22
<table class="sd-matrixdropdown sd-table sd-table--align-middle sd-table--columnsautowidth">
33
<thead>
44
<tr>

tests/markup/snapshots/matrixdropdown-hidden-question-mobile.snap.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="sd-table-wrapper">
1+
<div class="sd-table-wrapper" data-sv-drop-target-matrix-row="testid0row1">
22
<table class="sd-matrixdropdown sd-table sd-table--align-middle">
33
<thead>
44
<tr>

tests/markup/snapshots/matrixdropdown-readonly.snap.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="sd-table-wrapper">
1+
<div class="sd-table-wrapper" data-sv-drop-target-matrix-row="testid0row3">
22
<table class="sd-matrixdropdown sd-table sd-table--align-middle sd-table--columnsautowidth">
33
<thead>
44
<tr>

tests/markup/snapshots/matrixdropdown.snap.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="sd-table-wrapper">
1+
<div class="sd-table-wrapper" data-sv-drop-target-matrix-row="testid0row3">
22
<table class="sd-matrixdropdown sd-table sd-table--align-middle sd-table--columnsautowidth">
33
<thead>
44
<tr>

0 commit comments

Comments
 (0)