UNPKG

@pantheon-systems/design-toolkit-react

Version:
46 lines (42 loc) 2.8 kB
import _defineProperty from '@babel/runtime/helpers/defineProperty'; import { useTable, useGlobalFilter, useSortBy, usePagination, useRowSelect } from 'react-table'; function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } /* The useTable instance is documented here: https://github.com/tannerlinsley/react-table/blob/master/docs/src/pages/docs/api/useTable.md#instance-properties The useSortBy instance is documented here: https://github.com/tannerlinsley/react-table/blob/master/docs/src/pages/docs/api/useSortBy.md#instance-properties The usePagination instance is documented here: https://github.com/tannerlinsley/react-table/blob/master/docs/src/pages/docs/api/usePagination.md#instance-properties The useGlobalFilter instance is documented here: https://github.com/tannerlinsley/react-table/blob/master/docs/src/pages/docs/api/useGlobalFilter.md#instance-properties The useRowSelect instance is documented here: https://github.com/tannerlinsley/react-table/blob/master/docs/src/pages/docs/api/useRowSelect.md#instance-properties */ var useRowSelectPaginationTableWithSearch = function useRowSelectPaginationTableWithSearch(_ref) { var columns = _ref.columns, data = _ref.data, defaultPageSize = _ref.defaultPageSize, defaultSortId = _ref.defaultSortId, _ref$defaultSortDesc = _ref.defaultSortDesc, defaultSortDesc = _ref$defaultSortDesc === void 0 ? false : _ref$defaultSortDesc; var tableInstance = useTable({ columns: columns, data: data, initialState: { sortBy: [{ id: defaultSortId, desc: defaultSortDesc }], pageIndex: 0, pageSize: defaultPageSize || 10 } }, useGlobalFilter, useSortBy, usePagination, useRowSelect); return _objectSpread({ columnsLength: columns.length }, tableInstance); }; var useRowSelectPaginationTableWithSearch$1 = useRowSelectPaginationTableWithSearch; export { useRowSelectPaginationTableWithSearch$1 as default }; //# sourceMappingURL=useRowSelectPaginationTableWithSearch.js.map