ywana-core8 0.0.582 → 0.0.585
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 +30 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +4 -0
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +30 -6
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +30 -6
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/TablePage.js +13 -6
- package/src/html/accordion.css +4 -0
- package/src/html/accordion.js +7 -2
- package/src/html/table.js +2 -2
- package/src/http/client.js +1 -1
- package/src/http/token.test.js +2 -3
- package/src/widgets/planner/Planner.js +1 -1
package/package.json
CHANGED
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/html/accordion.css
CHANGED
package/src/html/accordion.js
CHANGED
@@ -2,10 +2,12 @@ import React, {useState, useEffect} from 'react'
|
|
2
2
|
import { Icon } from './icon'
|
3
3
|
import './accordion.css'
|
4
4
|
|
5
|
+
/**
|
6
|
+
* Accordion
|
7
|
+
*/
|
5
8
|
export const Accordion = (props) => {
|
6
9
|
|
7
10
|
const { className, sections = [], onCheck } = props
|
8
|
-
|
9
11
|
const [openSections, setOpenSections] = useState([])
|
10
12
|
const [checkedSections, setCheckedSections] = useState([])
|
11
13
|
|
@@ -42,6 +44,9 @@ export const Accordion = (props) => {
|
|
42
44
|
)
|
43
45
|
}
|
44
46
|
|
47
|
+
/**
|
48
|
+
* AccordionSection
|
49
|
+
*/
|
45
50
|
const AccordionSection = (props) => {
|
46
51
|
|
47
52
|
const { checked, icon, title, subtitle, open = false, onToggle, onCheck, toolbar, info, children } = props
|
@@ -49,7 +54,7 @@ const AccordionSection = (props) => {
|
|
49
54
|
const checkedIcon = checked === undefined || checked === null ? null : checked === false ? "check_box_outline_blank" : "check_box"
|
50
55
|
|
51
56
|
return (
|
52
|
-
<section className={`accordion-section`}>
|
57
|
+
<section key={title} className={`accordion-section`}>
|
53
58
|
<header>
|
54
59
|
{ checkedIcon ? <Icon className="accordion-section-checker" icon={checkedIcon} clickable action={onCheck}/> : '' }
|
55
60
|
{ icon ? <Icon className="accordion-section-icon" icon={icon} /> : '' }
|
package/src/html/table.js
CHANGED
@@ -111,7 +111,7 @@ export const DataTable = (props) => {
|
|
111
111
|
</thead>
|
112
112
|
<tbody>
|
113
113
|
{rows.length > 0 ?
|
114
|
-
multiSort(rows, sortDir).map((row,index) => (
|
114
|
+
multiSort(rows, sortDir).map((row, index) => (
|
115
115
|
<DataTableRow key={row.id} index={index} row={row} columns={columns} onSelect={select} onDrop={moveRow} editable={editable} expanded={expanded} />
|
116
116
|
)) : (
|
117
117
|
<tr>
|
@@ -138,7 +138,7 @@ const DataTableRow = (props) => {
|
|
138
138
|
const { className } = row
|
139
139
|
const [isInfoOpen, toggleInfo] = useState(expanded)
|
140
140
|
const infoIcon = isInfoOpen ? 'expand_more' : 'expand_less'
|
141
|
-
const style = isInfoOpen ? "expanded" : ""
|
141
|
+
const style = isInfoOpen ? "expanded" : ""
|
142
142
|
return (
|
143
143
|
<Fragment>
|
144
144
|
<tr className={`${style} ${className}`} onClick={ev => onSelect(row, ev)}>
|
package/src/http/client.js
CHANGED
package/src/http/token.test.js
CHANGED
@@ -7,9 +7,8 @@ import { useEffect } from 'react/cjs/react.production.min';
|
|
7
7
|
const Token = () => {
|
8
8
|
|
9
9
|
const [encrypted, setEncrypted] = useState("")
|
10
|
-
const [decrypted, setDecrypted] = useState("")
|
10
|
+
const [decrypted, setDecrypted] = useState("1")
|
11
11
|
|
12
|
-
|
13
12
|
function decryptData(encrypted, secret) {
|
14
13
|
const bytes = CryptoJS.AES.decrypt(encrypted, secret);
|
15
14
|
const originalText = bytes.toString(CryptoJS.enc.Utf8);
|
@@ -21,7 +20,7 @@ const Token = () => {
|
|
21
20
|
}
|
22
21
|
|
23
22
|
function change(id, value) {
|
24
|
-
const secret = '
|
23
|
+
const secret = 'BCDF956E21C79A36';
|
25
24
|
const e = encryptData(value, secret)
|
26
25
|
setEncrypted(e)
|
27
26
|
const d = decryptData(e, secret)
|
@@ -137,7 +137,7 @@ export const Planner = ({ title, events = [], lanes = [], navigation = true, onS
|
|
137
137
|
const isThisMonday = (date.moment.isSame(weekStart))
|
138
138
|
|
139
139
|
return (
|
140
|
-
<div className="column-header" ref={isThisMonday ? thisMondayElement : null}>
|
140
|
+
<div key={`column-${date.moment.dayOfYear}`} className="column-header" ref={isThisMonday ? thisMondayElement : null}>
|
141
141
|
<div className={`date-header ${weekend} ${thisWeek}`}>
|
142
142
|
<Text use="headline6">{date.moment.format("DD")}</Text>
|
143
143
|
|