package.build.lib.columnHelper.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of table-core Show documentation
Show all versions of table-core Show documentation
Headless UI for building powerful tables & datagrids for TS/JS.
The newest version!
/**
* table-core
*
* Copyright (c) TanStack
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
// type Person = {
// firstName: string
// lastName: string
// age: number
// visits: number
// status: string
// progress: number
// createdAt: Date
// nested: {
// foo: [
// {
// bar: 'bar'
// }
// ]
// bar: { subBar: boolean }[]
// baz: {
// foo: 'foo'
// bar: {
// baz: 'baz'
// }
// }
// }
// }
// const test: DeepKeys = 'nested.foo.0.bar'
// const test2: DeepKeys = 'nested.bar'
// const helper = createColumnHelper()
// helper.accessor('nested.foo', {
// cell: info => info.getValue(),
// })
// helper.accessor('nested.foo.0.bar', {
// cell: info => info.getValue(),
// })
// helper.accessor('nested.bar', {
// cell: info => info.getValue(),
// })
function createColumnHelper() {
return {
accessor: (accessor, column) => {
return typeof accessor === 'function' ? {
...column,
accessorFn: accessor
} : {
...column,
accessorKey: accessor
};
},
display: column => column,
group: column => column
};
}
exports.createColumnHelper = createColumnHelper;
//# sourceMappingURL=columnHelper.js.map
© 2015 - 2024 Weber Informatics LLC | Privacy Policy