Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethbruskiewicz committed Feb 3, 2025
1 parent 9c4facd commit ba42d61
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions lib/toolbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@
</div>
</div>
</div>

<div class="modal fade" id="save-as-modal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
Expand Down Expand Up @@ -577,6 +578,7 @@
</div>
</div>
</div>

<div class="modal fade" id="export-to-modal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
Expand Down Expand Up @@ -635,6 +637,7 @@
</div>
</div>
</div>

<div class="modal fade" id="open-error-modal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
Expand All @@ -660,6 +663,7 @@
</div>
</div>
</div>

<div
class="modal fade"
id="upload-template-error-modal"
Expand Down Expand Up @@ -690,6 +694,7 @@
</div>
</div>
</div>

<div class="modal fade" id="jump-to-modal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
Expand Down
11 changes: 9 additions & 2 deletions lib/utils/1m.js
Original file line number Diff line number Diff line change
Expand Up @@ -792,9 +792,16 @@ export class OneToManyEventTracker extends EventTracker {
if (source === 'loadData' || !changes) return;

const rowChanges = changesToRows(changes);
const columnIndex = dh.getColumnIndexByFieldName(foreign_key_slot);
const impactedRows = computeImpactedRows(rowChanges);
const hasDeleteActions = impactedRows.some(row => row.action === ACTION.DELETE);

const isPrimaryKeyChange = changes.some(([row, col]) => col === columnIndex);

if (isPrimaryKeyChange) {
// TODO: check
return false;
}

if (hasDeleteActions) {

Check failure on line 805 in lib/utils/1m.js

View workflow job for this annotation

GitHub Actions / test

'row' is defined but never used
// WIP!
// Immediately return false to block the change
Expand All @@ -803,7 +810,7 @@ export class OneToManyEventTracker extends EventTracker {
// If the user confirmed, reapply the changes programmatically
changes.forEach(([row, col, oldValue, newValue]) => {
dh.hot.setSourceDataAtCell(row, col, newValue);
dh.hot.setDataAtCell(row, col, newValue);
// dh.hot.setDataAtCell(row, col, newValue);
});
// const newData = dh.hot.getData(); // get updated source data
// changes.forEach(([row, col, oldValue, newValue]) => {
Expand Down

0 comments on commit ba42d61

Please sign in to comment.