ywana-core8 0.0.616 → 0.0.619
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 +12 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +12 -1
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +12 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/CollectionPage.js +11 -4
- package/src/domain/ContentEditor.js +1 -1
package/package.json
CHANGED
@@ -79,10 +79,10 @@ 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
|
-
{levels ? <CollectionTree icon={icon} levels={levels} onSelect={onSelect} sorter={sorter} searchBy={searchBy} /> : <CollectionList groupBy={groupBy} onSelect={onSelect} searchBy={searchBy} />}
|
85
|
+
{levels ? <CollectionTree schema={schema} icon={icon} levels={levels} onSelect={onSelect} sorter={sorter} searchBy={searchBy} /> : <CollectionList groupBy={groupBy} onSelect={onSelect} searchBy={searchBy} />}
|
86
86
|
</menu>
|
87
87
|
<main key={id} className={`collection-page ${className}`}>
|
88
88
|
<CollectionEditor icon={icon} schema={schema} layout={editor} autosave={autosave} delay={delay} canDelete={canDelete} canEdit={canEdit} onReload={reloadSelection} />
|
@@ -206,7 +206,7 @@ const CollectionList = (props) => {
|
|
206
206
|
*/
|
207
207
|
export const CollectionTree = (props) => {
|
208
208
|
|
209
|
-
const { icon = "description", levels, onSelect, sorter, searchBy = [] } = props
|
209
|
+
const { icon = "description", levels, onSelect, sorter, searchBy = [], schema } = props
|
210
210
|
const [pageContext, setPageContext] = useContext(PageContext)
|
211
211
|
const { all = [] } = pageContext
|
212
212
|
const [filter, setFilter] = useState()
|
@@ -228,10 +228,17 @@ export const CollectionTree = (props) => {
|
|
228
228
|
}
|
229
229
|
|
230
230
|
function group(items, by) {
|
231
|
+
|
232
|
+
const options = schema[by] ? schema[by].options : null
|
233
|
+
|
231
234
|
return items.reduce((nodes, field) => {
|
232
235
|
let node = nodes.find(n => n.name === field[by])
|
233
236
|
if (!node) {
|
234
237
|
let name = field[by]
|
238
|
+
if (options) {
|
239
|
+
const opt = options.find(option => option.value === field[by])
|
240
|
+
if (opt) name = opt.label
|
241
|
+
}
|
235
242
|
node = { name, items: [], field: by }
|
236
243
|
nodes.push(node)
|
237
244
|
}
|
@@ -381,7 +388,7 @@ export const CollectionContext = (url, field, host, page, fetching) => {
|
|
381
388
|
changeFilters(filters) {
|
382
389
|
this.filters = filters
|
383
390
|
},
|
384
|
-
|
391
|
+
|
385
392
|
async load() {
|
386
393
|
try {
|
387
394
|
const data = await API.all(null, page);
|
@@ -177,7 +177,7 @@ export const TreededContentEditor = ({ content, filter, onChange }) => {
|
|
177
177
|
* FieldEditor
|
178
178
|
*/
|
179
179
|
export const FieldEditor = ({ field, onChange, content, outlined = false, onReload }) => {
|
180
|
-
const { id, type, item, label,
|
180
|
+
const { id, type, item, label, options, hidden = false } = field
|
181
181
|
|
182
182
|
function change(id, value) {
|
183
183
|
if (onChange) onChange(id, value)
|