ywana-core8 0.0.617 → 0.0.620
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 +14 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +14 -6
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +14 -6
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/CollectionPage.js +11 -6
package/package.json
CHANGED
@@ -79,7 +79,7 @@ export const CollectionPage = (props) => {
|
|
79
79
|
</Header>
|
80
80
|
<menu className={`collection-page ${className}`}>
|
81
81
|
<Header title={<Text>{name}</Text>} >
|
82
|
-
{
|
82
|
+
{canFilter ? showFilter ? <Icon icon="filter_list" size="small" clickable action={toggleFilters} /> : <Icon icon="filter_list_off" size="small" clickable action={toggleFilters} /> : false}
|
83
83
|
</Header>
|
84
84
|
{canFilter && showFilter ? <CollectionFilters schema={schema} /> : null}
|
85
85
|
{levels ? <CollectionTree schema={schema} icon={icon} levels={levels} onSelect={onSelect} sorter={sorter} searchBy={searchBy} /> : <CollectionList groupBy={groupBy} onSelect={onSelect} searchBy={searchBy} />}
|
@@ -229,13 +229,18 @@ export const CollectionTree = (props) => {
|
|
229
229
|
|
230
230
|
function group(items, by) {
|
231
231
|
|
232
|
-
const options = schema[by].options
|
232
|
+
const options = schema[by] ? schema[by].options : null
|
233
233
|
|
234
234
|
return items.reduce((nodes, field) => {
|
235
235
|
let node = nodes.find(n => n.name === field[by])
|
236
236
|
if (!node) {
|
237
|
-
let name =
|
238
|
-
|
237
|
+
let name = field[by]
|
238
|
+
let title = field[by]
|
239
|
+
if (options) {
|
240
|
+
const opt = options.find(option => option.value === field[by])
|
241
|
+
if (opt) title = opt.label
|
242
|
+
}
|
243
|
+
node = { name, items: [], field: by, title }
|
239
244
|
nodes.push(node)
|
240
245
|
}
|
241
246
|
node.items.push(field)
|
@@ -252,7 +257,7 @@ export const CollectionTree = (props) => {
|
|
252
257
|
|
253
258
|
function renderNodes(nodes) {
|
254
259
|
return nodes.map(node => {
|
255
|
-
const title = typeof node.name === 'boolean' ? `${node.field} = ${node.name}` : node.
|
260
|
+
const title = typeof node.name === 'boolean' ? `${node.field} = ${node.name}` : node.title
|
256
261
|
return (
|
257
262
|
<TreeNode key={node.name} icon={null} label={title} open={true}>
|
258
263
|
{node.nodes ? renderNodes(node.nodes) : node.items.map(item => {
|
@@ -384,7 +389,7 @@ export const CollectionContext = (url, field, host, page, fetching) => {
|
|
384
389
|
changeFilters(filters) {
|
385
390
|
this.filters = filters
|
386
391
|
},
|
387
|
-
|
392
|
+
|
388
393
|
async load() {
|
389
394
|
try {
|
390
395
|
const data = await API.all(null, page);
|