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

Feat(front): Make columns movable and further configurable #28

Open
dd84ai opened this issue Jul 16, 2024 · 3 comments
Open

Feat(front): Make columns movable and further configurable #28

dd84ai opened this issue Jul 16, 2024 · 3 comments
Labels
lang-javascript Requires dealing with javascript type-frontend Requires dealing with javascript wontfix This will not be worked on

Comments

@dd84ai
Copy link
Member

dd84ai commented Jul 16, 2024

feature requester:

Wildkins — 07/09/2024 6:17 PM let me move the internal nickname column over
  • Create openable menu where all columns are listed.
    • For each column u can disable column off
    • Set a different order number
    • Resizing capabilities?
    • Persist choices in session storage? Have button to reset then too

Perhaps swapping code will be useful for that?

/**
 * Swap any nodes, not siblings, not adjecent siblings, no temp nodes, no cloning, no jquery... IE9+
 * @param {HTMLElement} n1
 * @param {HTMLElement} n2
 */
function swapNodes(nodeA, nodeB) {

    const parentA = nodeA.parentNode;
    const siblingA = nodeA.nextSibling === nodeB ? nodeA : nodeA.nextSibling;

    // Move `nodeA` to before the `nodeB`
    nodeB.parentNode.insertBefore(nodeA, nodeB);

    // Move `nodeB` to before the sibling of `nodeA`
    parentA.insertBefore(nodeB, siblingA);
}

/**
 * @param {HTMLElement} arrow
 */
function swapColumnLeft(arrow, event) {
    swapColumns(arrow, -1);
    event.stopPropagation(); // prevent default
}


/**
 * @param {HTMLElement} arrow
 */
function swapColumnRight(arrow, event) {
    swapColumns(arrow, 1);
    event.stopPropagation(); // prevent default
}

var functionLock = false;


/** 
 * @param {HTMLElement} arrow
 * @param {number} shift
 */
function swapColumns(arrow, shift) {
    /* arrow = document.querySelector("#table-top-main table th"); */
    // 

    if (functionLock) {
        return
    } else {
        functionLock = true
    }

    let th = arrow.closest("th");
    let ths = document.querySelectorAll("#table-top-main table th");

    let ths_index = Array.prototype.indexOf.call(ths, th);

    let extra_shift = 0; // to skip none values
    let shift_vector = shift; // always -1 or +1
    try {
        while (ths[ths_index + shift + extra_shift].style.display == "none") {
            extra_shift = extra_shift + shift_vector;
        }
    }
    catch (err) {
        console.log("failed getting extra_shift")
        console.log(err)
    }


    swapNodes(ths[ths_index + shift + extra_shift], ths[ths_index]);

    const rows = document.querySelectorAll("#table-top-main table tbody tr");
    let index = ths_index;

    if (shift > 0) {
        for (const row of rows) {
            swapNodes(row.children[index + shift + extra_shift], row.children[index]);
        }
    } else {
        for (const row of rows) {
            swapNodes(row.children[index], row.children[index + shift + extra_shift]);
        }
    }

    functionLock = false
}
@dd84ai dd84ai mentioned this issue Jul 16, 2024
39 tasks
@dd84ai dd84ai changed the title Wildkins — 07/09/2024 6:17 PM let me move the internal nickname column over Create opennable menu to configure columns Jul 16, 2024
@dd84ai dd84ai added type-frontend Requires dealing with javascript lang-javascript Requires dealing with javascript labels Jul 16, 2024
@dd84ai dd84ai changed the title Create opennable menu to configure columns Feat(front): Create opennable menu to configure columns Jul 16, 2024
@dd84ai dd84ai moved this to Todo in @dd84ai's Dark Tools Jul 17, 2024
@dd84ai dd84ai removed the status in @dd84ai's Dark Tools Jul 17, 2024
@dd84ai
Copy link
Member Author

dd84ai commented Oct 22, 2024

Sounds like too much javascript effort perhaps for some fragile functionality. With through column size optimizations i think it is not necessary feature.

@dd84ai dd84ai closed this as completed Oct 22, 2024
@dd84ai dd84ai reopened this Oct 24, 2024
@dd84ai dd84ai changed the title Feat(front): Create opennable menu to configure columns Feat(front): Make columns hidable and movable Oct 24, 2024
@dd84ai
Copy link
Member Author

dd84ai commented Oct 24, 2024

At least we can offer hide button
that just hides the text in curret column, that will lead to it being minimized.
Hide cell and column text and leave button to unhide

At least do hiding

@dd84ai dd84ai changed the title Feat(front): Make columns hidable and movable Feat(front): Make columns hidable (and optionally movable that could be a completely separate task) Oct 24, 2024
@dd84ai dd84ai moved this from Done to Todo in @dd84ai's Dark Tools Oct 26, 2024
@dd84ai dd84ai changed the title Feat(front): Make columns hidable (and optionally movable that could be a completely separate task) Feat(front): Make columns movable and further configurable Oct 26, 2024
@dd84ai dd84ai added the wontfix This will not be worked on label Oct 26, 2024
@dd84ai
Copy link
Member Author

dd84ai commented Oct 26, 2024

#48 will be done by me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang-javascript Requires dealing with javascript type-frontend Requires dealing with javascript wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant