ywana-core8 0.0.542 → 0.0.545
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 +18 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +18 -8
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +18 -8
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/CollectionPage.js +1 -1
- package/src/domain/TablePage.js +7 -7
- package/src/html/tree.js +4 -2
package/package.json
CHANGED
@@ -238,7 +238,7 @@ export const CollectionTree = (props) => {
|
|
238
238
|
const title = typeof node.name === 'boolean' ? `${node.field} = ${node.name}` : node.name
|
239
239
|
return (
|
240
240
|
<TreeNode key={node.name} icon={null} label={title} open={true}>
|
241
|
-
{node.nodes ? renderNodes(node.nodes) : node.items.map(item => <TreeItem icon={icon} key={item.id} id={item.id} label={item.name} onSelect={select}>item</TreeItem>)}
|
241
|
+
{node.nodes ? renderNodes(node.nodes) : node.items.map(item => <TreeItem icon={icon} key={item.id} id={item.id} label={item.name} onSelect={select} selected={item.id === pageContext.selected}>item</TreeItem>)}
|
242
242
|
</TreeNode>
|
243
243
|
)
|
244
244
|
})
|
package/src/domain/TablePage.js
CHANGED
@@ -18,7 +18,7 @@ export const TablePage = (props) => {
|
|
18
18
|
const site = useContext(SiteContext)
|
19
19
|
const { id = "table",
|
20
20
|
icon, title, name,
|
21
|
-
schema, url, field, host,
|
21
|
+
schema, url, field, host, params = "",
|
22
22
|
autosave = true, delay = 1000,
|
23
23
|
editable,
|
24
24
|
actions = [], dev = false, tableActions, selectionActions = [],
|
@@ -31,7 +31,7 @@ export const TablePage = (props) => {
|
|
31
31
|
} = props
|
32
32
|
|
33
33
|
const [pageContext, setPageContext] = useContext(PageContext)
|
34
|
-
const context = TableContext(url, field, host, urlQuery)
|
34
|
+
const context = TableContext(url, field, host, urlQuery, params)
|
35
35
|
const { selected } = pageContext
|
36
36
|
const timer = useRef(null)
|
37
37
|
const [form, setForm] = useState(selected)
|
@@ -493,9 +493,9 @@ export const TableEditor = (props) => {
|
|
493
493
|
/**
|
494
494
|
* Table Context
|
495
495
|
*/
|
496
|
-
const TableContext = (url, field, host, urlQuery) => {
|
496
|
+
const TableContext = (url, field, host, urlQuery, params) => {
|
497
497
|
|
498
|
-
const API = TableAPI(url, host)
|
498
|
+
const API = TableAPI(url, host, params)
|
499
499
|
|
500
500
|
return {
|
501
501
|
|
@@ -615,13 +615,13 @@ const TableContext = (url, field, host, urlQuery) => {
|
|
615
615
|
/**
|
616
616
|
* table API
|
617
617
|
*/
|
618
|
-
const TableAPI = (url, host) => {
|
618
|
+
const TableAPI = (url, host, params = "") => {
|
619
619
|
|
620
620
|
const http = HTTPClient(host || window.API || process.env.REACT_APP_API, Session);
|
621
621
|
|
622
622
|
return {
|
623
623
|
all(filters) {
|
624
|
-
let queryParams = "?"
|
624
|
+
let queryParams = "?" + params
|
625
625
|
if (filters) {
|
626
626
|
const filterQuery = Object.keys(filters).reduce((query, key) => {
|
627
627
|
const value = filters[key]
|
@@ -639,7 +639,7 @@ const TableAPI = (url, host) => {
|
|
639
639
|
}, "")
|
640
640
|
queryParams = queryParams.concat(filterQuery)
|
641
641
|
}
|
642
|
-
return http.GET(url + queryParams)
|
642
|
+
return http.GET(url + queryParams )
|
643
643
|
},
|
644
644
|
|
645
645
|
find(id) {
|
package/src/html/tree.js
CHANGED
@@ -33,14 +33,16 @@ export const TreeNode = ({ icon = 'folder', label, tooltip, open=false, children
|
|
33
33
|
/**
|
34
34
|
* Tree Item
|
35
35
|
*/
|
36
|
-
export const TreeItem = ({ id, icon = 'description', label, actions, onSelect }) => {
|
36
|
+
export const TreeItem = ({ id, icon = 'description', label, actions, onSelect, selected = false }) => {
|
37
37
|
|
38
38
|
function select() {
|
39
39
|
if (onSelect) onSelect(id)
|
40
40
|
}
|
41
41
|
|
42
|
+
const style = selected ? "selected" : ""
|
43
|
+
|
42
44
|
return (
|
43
|
-
<div className=
|
45
|
+
<div className={`tree-item final ${style}`} onClick={select}>
|
44
46
|
<Icon icon={icon} size="small" small />
|
45
47
|
<div className="label">{label}</div>
|
46
48
|
<div className="actions">{actions}</div>
|