2018-08-11 06:03:47 +00:00
|
|
|
// @flow
|
2020-06-20 20:59:15 +00:00
|
|
|
import { observer } from "mobx-react";
|
2020-08-09 05:53:59 +00:00
|
|
|
import * as React from "react";
|
2020-06-20 20:59:15 +00:00
|
|
|
import Document from "models/Document";
|
2021-01-01 00:46:33 +00:00
|
|
|
import DocumentListItem from "components/DocumentListItem";
|
2020-06-20 20:59:15 +00:00
|
|
|
import PaginatedList from "components/PaginatedList";
|
2018-08-11 06:03:47 +00:00
|
|
|
|
2021-01-30 05:36:09 +00:00
|
|
|
type Props = {|
|
2018-08-11 06:03:47 +00:00
|
|
|
documents: Document[],
|
2019-08-09 06:09:09 +00:00
|
|
|
fetch: (options: ?Object) => Promise<void>,
|
2018-08-11 06:03:47 +00:00
|
|
|
options?: Object,
|
2019-04-06 23:20:27 +00:00
|
|
|
heading?: React.Node,
|
2019-03-10 02:55:54 +00:00
|
|
|
empty?: React.Node,
|
2021-01-31 22:41:18 +00:00
|
|
|
showNestedDocuments?: boolean,
|
2021-01-30 05:36:09 +00:00
|
|
|
showCollection?: boolean,
|
|
|
|
showPublished?: boolean,
|
|
|
|
showPin?: boolean,
|
|
|
|
showDraft?: boolean,
|
|
|
|
showTemplate?: boolean,
|
|
|
|
|};
|
2018-08-11 06:03:47 +00:00
|
|
|
|
|
|
|
@observer
|
|
|
|
class PaginatedDocumentList extends React.Component<Props> {
|
|
|
|
render() {
|
2019-04-06 23:20:27 +00:00
|
|
|
const { empty, heading, documents, fetch, options, ...rest } = this.props;
|
2018-08-11 06:03:47 +00:00
|
|
|
|
2019-04-06 23:20:27 +00:00
|
|
|
return (
|
2020-01-14 02:17:56 +00:00
|
|
|
<PaginatedList
|
|
|
|
items={documents}
|
|
|
|
empty={empty}
|
|
|
|
heading={heading}
|
|
|
|
fetch={fetch}
|
|
|
|
options={options}
|
2020-08-09 01:53:11 +00:00
|
|
|
renderItem={(item) => (
|
2021-01-01 00:46:33 +00:00
|
|
|
<DocumentListItem key={item.id} document={item} {...rest} />
|
2019-03-10 02:55:54 +00:00
|
|
|
)}
|
2020-01-14 02:17:56 +00:00
|
|
|
/>
|
2018-08-11 06:03:47 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default PaginatedDocumentList;
|