ywana-core8 0.0.552 → 0.0.555
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 +22 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +22 -9
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +22 -9
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/ContentViewer.js +1 -1
- package/src/html/property.js +10 -4
- package/src/site/view.js +6 -2
- package/src/widgets/calendar/Calendar.js +1 -1
package/package.json
CHANGED
@@ -52,7 +52,7 @@ const FieldViewer = (props) => {
|
|
52
52
|
|
53
53
|
switch (type) {
|
54
54
|
case TYPES.STRING:
|
55
|
-
return <Property label={label} value={value} />
|
55
|
+
return <Property label={label} value={value} options={field.options}/>
|
56
56
|
case TYPES.ENTITY:
|
57
57
|
return <EntityViewer field={field} value={value} />
|
58
58
|
case TYPES.ARRAY:
|
package/src/html/property.js
CHANGED
@@ -7,7 +7,7 @@ import './property.css'
|
|
7
7
|
*/
|
8
8
|
export const Property = (props) => {
|
9
9
|
|
10
|
-
const { id, className, label, name, initial, value, editable = false, onChange } = props
|
10
|
+
const { id, className, label, name, initial, value, editable = false, onChange, options } = props
|
11
11
|
|
12
12
|
function change(event) {
|
13
13
|
if (onChange) {
|
@@ -20,13 +20,19 @@ export const Property = (props) => {
|
|
20
20
|
if (onChange) onChange(id, "")
|
21
21
|
}
|
22
22
|
|
23
|
+
let value2 = value || initial
|
24
|
+
|
25
|
+
if (options) {
|
26
|
+
const opt = options.find(option => option.value == value2)
|
27
|
+
if (opt) value2 = opt.label
|
28
|
+
}
|
29
|
+
|
23
30
|
return (
|
24
31
|
<div className={`property property-${id} ${className}`}>
|
25
32
|
<div className="property-name">{name || label}</div>
|
26
|
-
{ initial ? <div className='property-value'>{initial}</div> : null}
|
27
33
|
<div className="property-value">
|
28
|
-
{editable ? <input type="text" value={
|
29
|
-
{editable &&
|
34
|
+
{editable ? <input type="text" value={value2} onChange={change}/> : value2}
|
35
|
+
{editable && value2.length > 0 ? <Icon icon="close" size="small" clickable action={clear} /> : null }
|
30
36
|
</div>
|
31
37
|
</div>
|
32
38
|
)
|
package/src/site/view.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, { useState } from 'react'
|
1
|
+
import React, { useState, useEffect } from 'react'
|
2
2
|
import { Icon, MenuIcon, Tabs, Tab, Stack } from '../html'
|
3
3
|
import './view.css'
|
4
4
|
|
@@ -36,11 +36,15 @@ export const View = (props) => {
|
|
36
36
|
|
37
37
|
export const TabbedView = (props) => {
|
38
38
|
|
39
|
-
const { title, className } = props
|
39
|
+
const { title, className, selected } = props
|
40
40
|
const [tab, setTab] = useState(0)
|
41
41
|
const children = React.Children.toArray(props.children);
|
42
42
|
const tabs = children.map(child => <Tab key={child.props.label} label={child.props.label}></Tab>)
|
43
43
|
|
44
|
+
useEffect(() => {
|
45
|
+
if (selected && selected !== tab) setTab(selected)
|
46
|
+
}, [selected])
|
47
|
+
|
44
48
|
const toolbar = (
|
45
49
|
<Tabs selected={tab} onChange={tab => setTab(tab)}>
|
46
50
|
{tabs}
|
@@ -19,7 +19,7 @@ export const Calendar = (props) => {
|
|
19
19
|
}, [])
|
20
20
|
|
21
21
|
useEffect(() => {
|
22
|
-
if (onChange) {
|
22
|
+
if (position && onChange) {
|
23
23
|
const firstDayOfMonth = position.clone().startOf('month');
|
24
24
|
const firstDayOfRange = firstDayOfMonth.clone().startOf('isoweek');
|
25
25
|
const lastDayOfMonth = position.clone().endOf('month');
|