material-react-table-narender 2.13.17 → 2.13.19
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/dist/index.esm.js +40 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +40 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/body/MRT_TableBodyCell.tsx +1 -0
- package/src/components/footer/MRT_TableFooterCell.tsx +1 -1
- package/src/utils/cell.utils.ts +31 -2
    
        package/dist/index.js
    CHANGED
    
    | @@ -526,15 +526,42 @@ const openEditingCell = ({ cell, table, }) => { | |
| 526 526 | 
             
                }
         | 
| 527 527 | 
             
            };
         | 
| 528 528 | 
             
            const cellKeyboardShortcuts = ({ cell, cellElements, cellValue, containerElement, event, header, parentElement, table, }) => {
         | 
| 529 | 
            -
                var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
         | 
| 529 | 
            +
                var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
         | 
| 530 530 | 
             
                debugger;
         | 
| 531 531 | 
             
                const { getState, setEnableKeyboardShortcuts, } = table;
         | 
| 532 532 | 
             
                const { enableKeyboardShortcuts } = getState();
         | 
| 533 | 
            -
                if (event.altKey | 
| 533 | 
            +
                if (event.altKey) {
         | 
| 534 534 | 
             
                    event.preventDefault();
         | 
| 535 535 | 
             
                    setEnableKeyboardShortcuts(!enableKeyboardShortcuts);
         | 
| 536 536 | 
             
                    const currentCell = event.currentTarget;
         | 
| 537 | 
            -
                     | 
| 537 | 
            +
                    if (enableKeyboardShortcuts) {
         | 
| 538 | 
            +
                        const input = currentCell.querySelector('input');
         | 
| 539 | 
            +
                        const select = currentCell.querySelector('select');
         | 
| 540 | 
            +
                        const checkbox = currentCell.querySelector('input[type="checkbox"]');
         | 
| 541 | 
            +
                        const button = currentCell.querySelector('button');
         | 
| 542 | 
            +
                        const autocomplete = currentCell.querySelector('.MuiAutocomplete-root input[type="text"]');
         | 
| 543 | 
            +
                        if (autocomplete) {
         | 
| 544 | 
            +
                            autocomplete.focus();
         | 
| 545 | 
            +
                            (_a = autocomplete.select) === null || _a === void 0 ? void 0 : _a.call(autocomplete);
         | 
| 546 | 
            +
                        }
         | 
| 547 | 
            +
                        else if (input) {
         | 
| 548 | 
            +
                            input.focus();
         | 
| 549 | 
            +
                            (_b = input.select) === null || _b === void 0 ? void 0 : _b.call(input);
         | 
| 550 | 
            +
                        }
         | 
| 551 | 
            +
                        else if (select) {
         | 
| 552 | 
            +
                            select.focus();
         | 
| 553 | 
            +
                        }
         | 
| 554 | 
            +
                        else if (checkbox) {
         | 
| 555 | 
            +
                            checkbox.focus();
         | 
| 556 | 
            +
                            // checkbox.click();
         | 
| 557 | 
            +
                        }
         | 
| 558 | 
            +
                        else if (button) {
         | 
| 559 | 
            +
                            button.focus();
         | 
| 560 | 
            +
                        }
         | 
| 561 | 
            +
                        else {
         | 
| 562 | 
            +
                            currentCell.focus();
         | 
| 563 | 
            +
                        }
         | 
| 564 | 
            +
                    }
         | 
| 538 565 | 
             
                }
         | 
| 539 566 | 
             
                // if (!table.options.enableKeyboardShortcuts) return;
         | 
| 540 567 | 
             
                if (!enableKeyboardShortcuts)
         | 
| @@ -546,7 +573,7 @@ const cellKeyboardShortcuts = ({ cell, cellElements, cellValue, containerElement | |
| 546 573 | 
             
                    navigator.clipboard.writeText(cellValue);
         | 
| 547 574 | 
             
                }
         | 
| 548 575 | 
             
                else if (['Enter', ' '].includes(event.key)) {
         | 
| 549 | 
            -
                    if ((( | 
| 576 | 
            +
                    if (((_c = cell === null || cell === void 0 ? void 0 : cell.column) === null || _c === void 0 ? void 0 : _c.id) === 'mrt-row-select') {
         | 
| 550 577 | 
             
                        event.preventDefault();
         | 
| 551 578 | 
             
                        getMRT_RowSelectionHandler({
         | 
| 552 579 | 
             
                            row: cell.row,
         | 
| @@ -555,20 +582,20 @@ const cellKeyboardShortcuts = ({ cell, cellElements, cellValue, containerElement | |
| 555 582 | 
             
                            staticRowIndex: +event.target.getAttribute('data-index'),
         | 
| 556 583 | 
             
                        })(event);
         | 
| 557 584 | 
             
                    }
         | 
| 558 | 
            -
                    else if ((( | 
| 585 | 
            +
                    else if (((_d = header === null || header === void 0 ? void 0 : header.column) === null || _d === void 0 ? void 0 : _d.id) === 'mrt-row-select' &&
         | 
| 559 586 | 
             
                        table.options.enableSelectAll) {
         | 
| 560 587 | 
             
                        event.preventDefault();
         | 
| 561 588 | 
             
                        getMRT_SelectAllHandler({
         | 
| 562 589 | 
             
                            table,
         | 
| 563 590 | 
             
                        })(event);
         | 
| 564 591 | 
             
                    }
         | 
| 565 | 
            -
                    else if ((( | 
| 592 | 
            +
                    else if (((_e = cell === null || cell === void 0 ? void 0 : cell.column) === null || _e === void 0 ? void 0 : _e.id) === 'mrt-row-expand' &&
         | 
| 566 593 | 
             
                        (cell.row.getCanExpand() ||
         | 
| 567 | 
            -
                            (( | 
| 594 | 
            +
                            ((_g = (_f = table.options).renderDetailPanel) === null || _g === void 0 ? void 0 : _g.call(_f, { row: cell.row, table })))) {
         | 
| 568 595 | 
             
                        event.preventDefault();
         | 
| 569 596 | 
             
                        cell.row.toggleExpanded();
         | 
| 570 597 | 
             
                    }
         | 
| 571 | 
            -
                    else if ((( | 
| 598 | 
            +
                    else if (((_h = header === null || header === void 0 ? void 0 : header.column) === null || _h === void 0 ? void 0 : _h.id) === 'mrt-row-expand' &&
         | 
| 572 599 | 
             
                        table.options.enableExpandAll) {
         | 
| 573 600 | 
             
                        event.preventDefault();
         | 
| 574 601 | 
             
                        table.toggleAllRowsExpanded();
         | 
| @@ -577,7 +604,7 @@ const cellKeyboardShortcuts = ({ cell, cellElements, cellValue, containerElement | |
| 577 604 | 
             
                        event.preventDefault();
         | 
| 578 605 | 
             
                        cell.row.getIsPinned()
         | 
| 579 606 | 
             
                            ? cell.row.pin(false)
         | 
| 580 | 
            -
                            : cell.row.pin((( | 
| 607 | 
            +
                            : cell.row.pin(((_j = table.options.rowPinningDisplayMode) === null || _j === void 0 ? void 0 : _j.includes('bottom'))
         | 
| 581 608 | 
             
                                ? 'bottom'
         | 
| 582 609 | 
             
                                : 'top');
         | 
| 583 610 | 
             
                    }
         | 
| @@ -587,7 +614,7 @@ const cellKeyboardShortcuts = ({ cell, cellElements, cellValue, containerElement | |
| 587 614 | 
             
                            actionsButton.click();
         | 
| 588 615 | 
             
                        }
         | 
| 589 616 | 
             
                    }
         | 
| 590 | 
            -
                    else if (( | 
| 617 | 
            +
                    else if ((_k = header === null || header === void 0 ? void 0 : header.column) === null || _k === void 0 ? void 0 : _k.getCanSort()) {
         | 
| 591 618 | 
             
                        event.preventDefault();
         | 
| 592 619 | 
             
                        header.column.toggleSorting();
         | 
| 593 620 | 
             
                    }
         | 
| @@ -602,11 +629,11 @@ const cellKeyboardShortcuts = ({ cell, cellElements, cellValue, containerElement | |
| 602 629 | 
             
                        // Focus the appropriate element
         | 
| 603 630 | 
             
                        if (autocomplete) {
         | 
| 604 631 | 
             
                            autocomplete.focus();
         | 
| 605 | 
            -
                            ( | 
| 632 | 
            +
                            (_l = autocomplete.select) === null || _l === void 0 ? void 0 : _l.call(autocomplete);
         | 
| 606 633 | 
             
                        }
         | 
| 607 634 | 
             
                        else if (input) {
         | 
| 608 635 | 
             
                            input.focus();
         | 
| 609 | 
            -
                            ( | 
| 636 | 
            +
                            (_m = input.select) === null || _m === void 0 ? void 0 : _m.call(input);
         | 
| 610 637 | 
             
                        }
         | 
| 611 638 | 
             
                        else if (select) {
         | 
| 612 639 | 
             
                            select.focus();
         | 
| @@ -2389,6 +2416,7 @@ const MRT_TableBodyCell = (_a) => { | |
| 2389 2416 | 
             
                const handleKeyDown = (event) => {
         | 
| 2390 2417 | 
             
                    var _a;
         | 
| 2391 2418 | 
             
                    (_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, event);
         | 
| 2419 | 
            +
                    debugger;
         | 
| 2392 2420 | 
             
                    cellKeyboardShortcuts({
         | 
| 2393 2421 | 
             
                        cell,
         | 
| 2394 2422 | 
             
                        cellValue: cell.getValue(),
         |