ywana-core8 0.0.581 → 0.0.584
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 +150 -132
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +27 -23
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +150 -133
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +150 -132
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/CollectionPage.js +2 -1
- package/src/domain/TablePage.js +13 -6
- package/src/domain/index.js +1 -0
- package/src/html/accordion.css +4 -0
- package/src/html/accordion.js +0 -1
- package/src/http/client.js +1 -1
package/package.json
CHANGED
@@ -251,7 +251,8 @@ export const CollectionTree = (props) => {
|
|
251
251
|
<TreeNode key={node.name} icon={null} label={title} open={true}>
|
252
252
|
{node.nodes ? renderNodes(node.nodes) : node.items.map(item => {
|
253
253
|
const selected = pageContext.selected && item.id === pageContext.selected.id
|
254
|
-
|
254
|
+
const actions = []
|
255
|
+
return <TreeItem icon={icon} key={item.id} id={item.id} label={item.name} onSelect={select} selected={selected} actions={actions} />
|
255
256
|
})}
|
256
257
|
</TreeNode>
|
257
258
|
)
|
package/src/domain/TablePage.js
CHANGED
@@ -299,6 +299,14 @@ const TableFilters = (props) => {
|
|
299
299
|
return filterSchema
|
300
300
|
}, [schema])
|
301
301
|
|
302
|
+
const likes = useMemo(() => {
|
303
|
+
const fields = Object.values(schema)
|
304
|
+
return fields.reduce((likes, field) => {
|
305
|
+
if (field.like === true) likes.push(field.id)
|
306
|
+
return likes
|
307
|
+
}, [])
|
308
|
+
}, [schema])
|
309
|
+
|
302
310
|
useEffect(() => {
|
303
311
|
if (filters) setForm(filters)
|
304
312
|
}, [filters])
|
@@ -312,7 +320,7 @@ const TableFilters = (props) => {
|
|
312
320
|
}
|
313
321
|
|
314
322
|
async function reload() {
|
315
|
-
await pageContext.load(form)
|
323
|
+
await pageContext.load(form, likes)
|
316
324
|
setPageContext(Object.assign({}, pageContext))
|
317
325
|
}
|
318
326
|
|
@@ -508,11 +516,10 @@ const TableContext = (url, field, host, urlQuery, params) => {
|
|
508
516
|
filters: {},
|
509
517
|
queries: [],
|
510
518
|
|
511
|
-
async load(filter) {
|
519
|
+
async load(filter, like=[]) {
|
512
520
|
try {
|
513
521
|
const filters = filter ? Object.keys(filter).reduce((filters, key) => {
|
514
522
|
const field = filter[key];
|
515
|
-
|
516
523
|
if (field) {
|
517
524
|
if (CHECK['isObject'](field)) {
|
518
525
|
Object.keys(field).forEach(key2 => {
|
@@ -526,7 +533,7 @@ const TableContext = (url, field, host, urlQuery, params) => {
|
|
526
533
|
|
527
534
|
return filters;
|
528
535
|
}, {}) : []
|
529
|
-
const data = await API.all(filters);
|
536
|
+
const data = await API.all(filters, like);
|
530
537
|
this.all = field ? data[field] : data;
|
531
538
|
} catch (error) {
|
532
539
|
console.log(error)
|
@@ -627,7 +634,7 @@ const TableAPI = (url, host, params = "") => {
|
|
627
634
|
const http = HTTPClient(host || window.API || process.env.REACT_APP_API, Session);
|
628
635
|
|
629
636
|
return {
|
630
|
-
all(filters) {
|
637
|
+
all(filters, like = []) {
|
631
638
|
let queryParams = "?" + params
|
632
639
|
if (filters) {
|
633
640
|
const filterQuery = Object.keys(filters).reduce((query, key) => {
|
@@ -641,7 +648,7 @@ const TableAPI = (url, host, params = "") => {
|
|
641
648
|
}, "")
|
642
649
|
return query.concat(param)
|
643
650
|
} else {
|
644
|
-
return query.concat(`${key}=%${filters[key]}%&`)
|
651
|
+
return like.includes(key) ? query.concat(`${key}=%${filters[key]}%&`) : query.concat(`${key}=${filters[key]}&`)
|
645
652
|
}
|
646
653
|
}, "")
|
647
654
|
queryParams = queryParams.concat(filterQuery)
|
package/src/domain/index.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
export { TYPES, FORMATS, Content } from './ContentType'
|
2
2
|
export { ContentForm } from './ContentForm'
|
3
3
|
export { ContentEditor, TabbedContentEditor, CollectionEditor, TreededContentEditor, FieldEditor, ListEditor } from './ContentEditor'
|
4
|
+
export { ContentViewer } from './ContentViewer'
|
4
5
|
export { CreateContentDialog } from './CreateContentDialog'
|
5
6
|
export { EditContentDialog } from './EditContentDialog'
|
6
7
|
export { CollectionPage, CollectionContext, CollectionTree, CollectionFilters } from './CollectionPage'
|
package/src/html/accordion.css
CHANGED
package/src/html/accordion.js
CHANGED