@adaptabletools/adaptable
Version:
Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
27 lines (26 loc) • 925 B
JavaScript
const SCOPE_SEP = '::';
export function scopeDragId(dragScope, id) {
return `${dragScope}${SCOPE_SEP}${id}`;
}
export function unscopeDragId(scopedId) {
const sep = scopedId.indexOf(SCOPE_SEP);
return sep === -1 ? scopedId : scopedId.slice(sep + SCOPE_SEP.length);
}
export function scopeListId(dragScope, listId) {
return scopeDragId(dragScope, listId);
}
export function unscopeListId(scopedListId) {
return unscopeDragId(scopedListId);
}
export function tabIndexFromScopedListId(scopedListId) {
const listId = unscopeListId(scopedListId);
if (listId === 'UNUSED' || listId.startsWith('UNUSED-') || listId === 'TABS') {
return null;
}
const index = Number(listId);
return Number.isNaN(index) ? null : index;
}
export function isScopedUnusedList(scopedListId) {
const listId = unscopeListId(scopedListId);
return listId === 'UNUSED' || listId.startsWith('UNUSED-');
}