UNPKG

@public-ui/components

Version:

Contains all web components that belong to KoliBri - The accessible HTML-Standard.

24 lines (23 loc) 785 B
/*! * KoliBri - The accessible HTML-Standard */ import { parseJson, setState } from "../utils"; import { isObject } from "../validators"; export const validateTableSelection = (component, value) => { const parseSerializedValue = () => { try { return parseJson(value); } catch (_a) { return undefined; } }; const validateObject = (value) => { return value && isObject(value) && typeof value.label === 'function' && (!value.selectedKeys || Array.isArray(value.selectedKeys)); }; const objectValue = typeof value === 'string' ? parseSerializedValue() : value; if (validateObject(objectValue)) { setState(component, '_selection', value); } }; //# sourceMappingURL=table-selection.js.map