Collections module additions (#201)

* Render add new link, only render delete on isnew is false

* Add header actions buttons based on state

* Add header buttons and breadcrumbs

* Style tweaks

* Add navigation guard for single collections

* Add delete button logic

* Add ability to delete items on browse

* Add select mode to tabular layout

* Add saving / deleting logic to detail view

* remove tests (temporarily)

* Remove empty tests temporarily

* Add pagination to tabular layout if collection is large

* Add server sort

* wip table tweaks

* show shadow only on scroll, fix padding on top of private view.

* Update table

* fix header hiding the scrollbar

* Fix rAF leak

* Make pagination sticky

* fix double scroll bug

* add selfScroll prop to private view

* Last try

* Lower the default limit

* Fix tests for table / private / public view

* finish header

* remove unnessesary code

* Fix debug overflow + icon alignment

* Fix breadcrumbs

* Fix item fetching

* browse view now collapses on scroll

* Add drawer-button component

* Fix styling of drawer-button drawer-detail

* Revert "browse view now collapses on scroll"

This reverts commit a8534484d496deef01e399574126f7ba877e098c.

* Final commit for the night

* Add scroll solution for header overflow

* Render table header over shadow

* Add useScrollDistance compositoin

* Add readme for scroll distance

* Restructure header bar using sticky + margin / add shadow

* Tweak box shadow to not show up at top on scroll up

* Fix tests

Co-authored-by: Nitwel <nitwel@arcor.de>
This commit is contained in:
Rijk van Zanten
2020-03-20 17:05:55 -04:00
committed by GitHub
parent a141e3a6ea
commit 3ab97ca2b2
51 changed files with 1213 additions and 431 deletions

View File

@@ -57,6 +57,13 @@ export const useCollectionsStore = createStore({
},
async dehydrate() {
this.reset();
},
getCollection(collectionKey: string) {
return (
this.state.collections.find(
collection => collection.collection === collectionKey
) || null
);
}
}
});

View File

@@ -48,6 +48,15 @@ export const useFieldsStore = createStore({
},
async dehydrate() {
this.reset();
},
getPrimaryKeyFieldForCollection(collection: string) {
/** @NOTE it's safe to assume every collection has a primary key */
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const primaryKeyField = this.state.fields.find(
field => field.collection === collection && field.primary_key === true
);
return primaryKeyField;
}
}
});