ywana-core8 0.0.626 → 0.0.629
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 +60 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +16 -0
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +60 -25
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +60 -25
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/CollectionPage.js +8 -4
- package/src/html/textfield.css +2 -1
- package/src/html/textfield.js +1 -1
package/package.json
CHANGED
@@ -21,7 +21,7 @@ export const CollectionPage = (props) => {
|
|
21
21
|
schema, url, field, host, page, fetching = false,
|
22
22
|
actions = [], onSelect,
|
23
23
|
canFilter = false, canAdd = false, canDelete = false, canEdit = false, searchBy, addValidator,
|
24
|
-
autosave = false, delay = 1000,
|
24
|
+
autosave = false, delay = 1000, patch = false,
|
25
25
|
groupBy, levels, sorter,
|
26
26
|
editor,
|
27
27
|
footer,
|
@@ -86,7 +86,7 @@ export const CollectionPage = (props) => {
|
|
86
86
|
{levels ? <CollectionTree schema={schema} icon={icon} levels={levels} onSelect={onSelect} sorter={sorter} searchBy={searchBy} /> : <CollectionList groupBy={groupBy} onSelect={onSelect} searchBy={searchBy} />}
|
87
87
|
</menu>
|
88
88
|
<main key={id} className={`collection-page ${className}`}>
|
89
|
-
<CollectionEditor icon={icon} schema={schema} layout={editor} autosave={autosave} delay={delay} canDelete={canDelete} canEdit={canEdit} onReload={reloadSelection} />
|
89
|
+
<CollectionEditor icon={icon} schema={schema} layout={editor} autosave={autosave} delay={delay} canDelete={canDelete} canEdit={canEdit} onReload={reloadSelection} patch={patch}/>
|
90
90
|
{children ? <article>{children}</article> : null}
|
91
91
|
<footer>
|
92
92
|
{footer}
|
@@ -310,7 +310,7 @@ export const CollectionTree = (props) => {
|
|
310
310
|
const CollectionEditor = (props) => {
|
311
311
|
const [pageContext, setPageContext] = useContext(PageContext)
|
312
312
|
const { selected } = pageContext
|
313
|
-
const { icon, schema, layout, autosave = false, delay = 1000, canDelete, canEdit, onReload } = props
|
313
|
+
const { icon, schema, layout, autosave = false, delay = 1000, canDelete, canEdit, onReload, patch=false } = props
|
314
314
|
const timer = useRef(null)
|
315
315
|
const [form, setForm] = useState(selected)
|
316
316
|
|
@@ -348,7 +348,11 @@ const CollectionEditor = (props) => {
|
|
348
348
|
}
|
349
349
|
|
350
350
|
async function save() {
|
351
|
-
|
351
|
+
if (patch) {
|
352
|
+
await pageContext.patch(form.id, form)
|
353
|
+
} else {
|
354
|
+
await pageContext.update(form)
|
355
|
+
}
|
352
356
|
setPageContext(Object.assign({}, pageContext))
|
353
357
|
}
|
354
358
|
|
package/src/html/textfield.css
CHANGED
package/src/html/textfield.js
CHANGED
@@ -183,7 +183,7 @@ export const DropDown = (props) => {
|
|
183
183
|
}
|
184
184
|
}
|
185
185
|
|
186
|
-
const title = editable ? <div className='row'>{props.label}<Icon className="decorator" icon="edit" size="small" /></div> : props.label
|
186
|
+
const title = editable ? <div className='row'>{props.label}<Icon className="decorator" icon="edit" size="small" /></div> : props.label
|
187
187
|
return (
|
188
188
|
<div className="dropdown">
|
189
189
|
<TextField {...props} label={title} onClick={onFocus} value={label} onChange={change} onBlur={blur} readOnly={!predictive && !editable} />
|