ywana-core8 0.0.515 → 0.0.516
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +11 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +11 -3
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +11 -3
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/CollectionPage.js +10 -4
package/package.json
CHANGED
@@ -22,7 +22,7 @@ export const CollectionPage = (props) => {
|
|
22
22
|
actions = [], onSelect,
|
23
23
|
canFilter = false, canAdd = false, canDelete = false, canEdit = false,
|
24
24
|
autosave = false, delay = 1000,
|
25
|
-
groupBy, levels,
|
25
|
+
groupBy, levels, sorter,
|
26
26
|
editor,
|
27
27
|
children
|
28
28
|
} = props
|
@@ -68,7 +68,7 @@ export const CollectionPage = (props) => {
|
|
68
68
|
<Header title={<Text>Lista de {name}</Text>} >
|
69
69
|
</Header>
|
70
70
|
{canFilter ? <CollectionFilters schema={schema}/> : null }
|
71
|
-
{levels ? <CollectionTree levels={levels} onSelect={onSelect}/> : <CollectionList groupBy={groupBy} onSelect={onSelect}/>}
|
71
|
+
{levels ? <CollectionTree levels={levels} onSelect={onSelect} sorter={sorter}/> : <CollectionList groupBy={groupBy} onSelect={onSelect}/>}
|
72
72
|
</menu>
|
73
73
|
<main key={id} className="collection-page">
|
74
74
|
<CollectionEditor icon={icon} schema={schema} layout={editor} autosave={autosave} delay={delay} />
|
@@ -166,7 +166,7 @@ const CollectionList = (props) => {
|
|
166
166
|
*/
|
167
167
|
export const CollectionTree = (props) => {
|
168
168
|
|
169
|
-
const { levels, onSelect } = props
|
169
|
+
const { levels, onSelect, sorter } = props
|
170
170
|
const [pageContext, setPageContext] = useContext(PageContext)
|
171
171
|
const { all = [] } = pageContext
|
172
172
|
|
@@ -213,7 +213,13 @@ export const CollectionTree = (props) => {
|
|
213
213
|
})
|
214
214
|
}
|
215
215
|
|
216
|
-
const
|
216
|
+
const items = sorter ? all.sort((a,b) => {
|
217
|
+
const labelA = `${a.studio}${a.name}`
|
218
|
+
const labelB = `${b.studio}${b.name}`
|
219
|
+
return labelA.localeCompare(labelB)
|
220
|
+
}) : all
|
221
|
+
|
222
|
+
const nodes = generateNodes(levels, items)
|
217
223
|
return (
|
218
224
|
<main>
|
219
225
|
<Tree>
|