UNPKG

@adaptabletools/adaptable

Version:

Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements

22 lines (21 loc) 721 B
export function toDisplayValueDefault(value) { if (!Array.isArray(value)) { return `${value}`; } return value.map((v) => (Array.isArray(v) ? v.join('-') : v)).join(', '); } export function toDisplayValueFromOptionTree(paths, options) { const valueToLabel = new Map(); const walk = (node) => { valueToLabel.set(node.value, node.label); if (Array.isArray(node.children)) { node.children.forEach(walk); } }; options.forEach(walk); return paths .map((path) => Array.isArray(path) ? path.map((segment) => valueToLabel.get(segment) ?? String(segment)).join('-') : valueToLabel.get(path) ?? String(path)) .join(', '); }