ywana-core8 0.0.628 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ywana-core8",
3
- "version": "0.0.628",
3
+ "version": "0.0.629",
4
4
  "description": "ywana-core8",
5
5
  "homepage": "https://ywana.github.io/workspace",
6
6
  "author": "Ernesto Roldan Garcia",
@@ -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
- await pageContext.update(form)
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