ywana-core8 0.0.680 → 0.0.682
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 +136 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +5 -13
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +136 -74
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +9405 -9342
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/CollectionPage.js +4 -64
package/package.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
import equal from 'deep-equal'
|
2
2
|
import React, { Fragment, useContext, useEffect, useRef, useState, useMemo } from 'react'
|
3
|
-
import { HTTPClient, Session } from '../http'
|
4
3
|
import { PageContext } from '../site'
|
5
|
-
import {
|
6
|
-
import {
|
4
|
+
import { SiteContext } from '../site/siteContext'
|
5
|
+
import { Button, Header, Icon, List, Menu, MenuIcon, MenuItem, Text, Tree, TreeItem, TreeNode, TextField, Chip, Tooltip } from '../html'
|
7
6
|
import { ContentEditor, TabbedContentEditor, TreededContentEditor } from './ContentEditor'
|
8
7
|
import { CreateContentDialog } from './CreateContentDialog'
|
9
|
-
import {
|
8
|
+
import { CollectionAPI } from './CollectionAPI'
|
9
|
+
import { Content, TYPES } from './ContentType'
|
10
10
|
import "./CollectionPage.css"
|
11
11
|
|
12
12
|
/**
|
@@ -523,63 +523,3 @@ export const CollectionContext = (url, field, host, page, fetching, versioning =
|
|
523
523
|
}
|
524
524
|
}
|
525
525
|
|
526
|
-
/**
|
527
|
-
* Collection API
|
528
|
-
*/
|
529
|
-
const CollectionAPI = (url, host) => {
|
530
|
-
|
531
|
-
const http = HTTPClient(host || window.API || process.env.REACT_APP_API, Session);
|
532
|
-
|
533
|
-
return {
|
534
|
-
all(filters, page) {
|
535
|
-
let queryParams = page ? `?page=${page}&` : "?"
|
536
|
-
if (filters) {
|
537
|
-
const filterQuery = Object.keys(filters).reduce((query, key) => {
|
538
|
-
const value = filters[key]
|
539
|
-
if (typeof (value) === 'boolean') {
|
540
|
-
return query.concat(`${key}=${value}&`)
|
541
|
-
} else if (Array.isArray(value)) {
|
542
|
-
const param = value.length === 0 ? '' : value.reduce((param, item) => {
|
543
|
-
param = param.concat(`${key}=${item}&`)
|
544
|
-
return param
|
545
|
-
}, "")
|
546
|
-
return query.concat(param)
|
547
|
-
} else {
|
548
|
-
return query.concat(`${key}=%${filters[key]}%&`)
|
549
|
-
}
|
550
|
-
}, "")
|
551
|
-
queryParams = queryParams.concat(filterQuery)
|
552
|
-
}
|
553
|
-
return http.GET(url + queryParams)
|
554
|
-
},
|
555
|
-
|
556
|
-
find(id) {
|
557
|
-
return http.GET(`${url}/${id}`)
|
558
|
-
},
|
559
|
-
|
560
|
-
create(form) {
|
561
|
-
const body = JSON.stringify(form)
|
562
|
-
return http.POST(url, body)
|
563
|
-
},
|
564
|
-
|
565
|
-
update(form) {
|
566
|
-
const body = JSON.stringify(form)
|
567
|
-
return http.PUT(`${url}/${form.id}`, body)
|
568
|
-
},
|
569
|
-
|
570
|
-
patch(id, form) {
|
571
|
-
const body = JSON.stringify(form)
|
572
|
-
return http.PATCH(`${url}/${id}`, body)
|
573
|
-
},
|
574
|
-
|
575
|
-
updateProperty(id, propertyName, form) {
|
576
|
-
const body = JSON.stringify(form)
|
577
|
-
return http.PUT(`${url}/${id}/${propertyName}`, body)
|
578
|
-
},
|
579
|
-
|
580
|
-
remove(id) {
|
581
|
-
return http.DELETE(`${url}/${id}`)
|
582
|
-
}
|
583
|
-
|
584
|
-
}
|
585
|
-
}
|