MCPcopy Create free account
hub / github.com/TechJeeper/Printventory / showSearchableListDialog

Function showSearchableListDialog

renderer.js:16328–16547  ·  view source on GitHub ↗
(fieldType, targetSelectId, mode = 'filter', containerId = null, isRemove = false)

Source from the content-addressed store, hash-verified

16326 }
16327 return base;
16328}
16329
16330function ensureListViewColumnState() {
16331 if (!listViewColumnState) {
16332 listViewColumnState = getDefaultListViewColumnState();
16333 }
16334 return listViewColumnState;
16335}
16336
16337function listViewColDisplayMode(colId) {
16338 return colId === 'name' ? '' : 'flex';
16339}
16340
16341function applyListViewColumnToElement(el, colId) {
16342 if (!el || !colId) return;
16343 const state = ensureListViewColumnState();
16344 const def = LIST_VIEW_COLUMN_DEFS.find(c => c.id === colId);
16345 if (!def) return;
16346 const visible = state.visibility[colId] !== false;
16347 const w = state.widths[colId] ?? def.defaultWidth;
16348 if (!visible) {
16349 el.style.display = 'none';
16350 return;
16351 }
16352 const mode = listViewColDisplayMode(colId);
16353 if (mode) {
16354 el.style.display = mode;
16355 } else {
16356 el.style.removeProperty('display');
16357 }
16358 el.style.flexShrink = '0';
16359 el.style.width = `${w}px`;
16360 el.style.minWidth = `${w}px`;
16361 if (colId === 'tags') {
16362 el.style.maxWidth = `${w}px`;
16363 } else {
16364 el.style.removeProperty('maxWidth');
16365 }
16366}
16367
16368function applyListViewColumnLayoutToSubtree(root) {
16369 if (!root) return;
16370 root.querySelectorAll('[data-list-col]').forEach(el => {
16371 applyListViewColumnToElement(el, el.getAttribute('data-list-col'));
16372 });
16373}
16374
16375function applyListViewColumnLayoutToGrid() {
16376 const grid = document.querySelector('.file-grid');
16377 if (!grid) return;
16378 applyListViewColumnLayoutToSubtree(grid);
16379}
16380
16381async function persistListViewColumnState() {
16382 if (!window.electron?.saveSetting) return;
16383 const state = ensureListViewColumnState();
16384 try {
16385 await window.electron.saveSetting(

Callers 1

initializeListButtonsFunction · 0.85

Calls 1

renderListItemsFunction · 0.85

Tested by

no test coverage detected