ywana-core8 0.0.240 → 0.0.244
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 +277 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +207 -3
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +277 -9
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +279 -11
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/html/property.css +21 -3
- package/src/html/property.js +19 -3
- package/src/html/property.test.js +23 -0
- package/src/html/textfield.js +3 -2
- package/src/html/textfield.test.js +1 -1
- package/src/site/page.css +1 -0
- package/src/site/site.css +1 -0
- package/src/widgets/index.js +2 -1
package/package.json
CHANGED
package/src/html/property.css
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
.property {
|
2
2
|
flex:1;
|
3
|
+
max-height: 3rem;
|
3
4
|
display: flex;
|
5
|
+
flex-direction: row;
|
4
6
|
}
|
5
7
|
|
6
8
|
.property-name {
|
@@ -8,8 +10,9 @@
|
|
8
10
|
overflow: hidden;
|
9
11
|
text-overflow: ellipsis;
|
10
12
|
white-space: nowrap;
|
11
|
-
|
12
|
-
|
13
|
+
display: flex;
|
14
|
+
align-items: center;
|
15
|
+
padding: .5rem;
|
13
16
|
}
|
14
17
|
|
15
18
|
.property-value {
|
@@ -17,5 +20,20 @@
|
|
17
20
|
overflow: hidden;
|
18
21
|
text-overflow: ellipsis;
|
19
22
|
white-space: nowrap;
|
20
|
-
|
23
|
+
display: flex;
|
24
|
+
align-items: center;
|
25
|
+
position: relative;
|
26
|
+
}
|
27
|
+
|
28
|
+
.property-value>input {
|
29
|
+
width: 100%;
|
30
|
+
height: 100%;
|
31
|
+
border: solid 0px;
|
32
|
+
background-color: rgba(240,240,240,.5);
|
33
|
+
padding: .5rem;
|
34
|
+
}
|
35
|
+
|
36
|
+
.property-value>.icon {
|
37
|
+
position: absolute;
|
38
|
+
right: .5rem;
|
21
39
|
}
|
package/src/html/property.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import React from 'react'
|
2
|
+
import { Icon } from './icon'
|
2
3
|
import './property.css'
|
3
4
|
|
4
5
|
/**
|
@@ -6,12 +7,27 @@ import './property.css'
|
|
6
7
|
*/
|
7
8
|
export const Property = (props) => {
|
8
9
|
|
9
|
-
const { label, name, value} = props
|
10
|
+
const { id, className, label, name, initial, value, editable = false, onChange } = props
|
11
|
+
|
12
|
+
function change(event) {
|
13
|
+
if (onChange) {
|
14
|
+
const value = event.target.value
|
15
|
+
onChange(id, value)
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
function clear() {
|
20
|
+
if (onChange) onChange(id, "")
|
21
|
+
}
|
10
22
|
|
11
23
|
return (
|
12
|
-
<div className=
|
24
|
+
<div className={`property property-${id} ${className}`}>
|
13
25
|
<div className="property-name">{name || label}</div>
|
14
|
-
<div className=
|
26
|
+
{ initial ? <div className='property-value'>{initial}</div> : null}
|
27
|
+
<div className="property-value">
|
28
|
+
{editable ? <input type="text" value={value} onChange={change}/> : value}
|
29
|
+
{editable && value.length > 0 ? <Icon icon="close" size="small" clickable action={clear} /> : null }
|
30
|
+
</div>
|
15
31
|
</div>
|
16
32
|
)
|
17
33
|
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import { FORMATS } from '../domain/ContentType'
|
3
|
+
import { Property } from './property'
|
4
|
+
|
5
|
+
const PropertyTest = (prop) => {
|
6
|
+
|
7
|
+
const [form, setForm] = useState({
|
8
|
+
name: 'John',
|
9
|
+
address: 'Porto Colon'
|
10
|
+
})
|
11
|
+
|
12
|
+
function change(id, value) {
|
13
|
+
const next = Object.assign({}, form, { [id] : value })
|
14
|
+
setForm(next)
|
15
|
+
}
|
16
|
+
|
17
|
+
return (
|
18
|
+
<>
|
19
|
+
<Property id="name" label="Name" initial="John" value={form.name} editable={true} onChange={change}/>
|
20
|
+
<Property id="address" label="Address" initial="Porto Colon" value={form.address} editable={true} onChange={change}/>
|
21
|
+
</>
|
22
|
+
)
|
23
|
+
}
|
package/src/html/textfield.js
CHANGED
@@ -29,7 +29,7 @@ export const TextField = (props) => {
|
|
29
29
|
}
|
30
30
|
|
31
31
|
function focus() {
|
32
|
-
if (site) {
|
32
|
+
if (site && site.changeFocus) {
|
33
33
|
site.changeFocus({
|
34
34
|
lose: () => {
|
35
35
|
// DO NOTHING
|
@@ -77,11 +77,12 @@ export const TextField = (props) => {
|
|
77
77
|
event.stopPropagation()
|
78
78
|
event.preventDefault()
|
79
79
|
const value = event.target.value
|
80
|
+
console.log(value)
|
80
81
|
if (onChange) onChange(id, value)
|
81
82
|
}
|
82
83
|
|
83
84
|
function focus() {
|
84
|
-
if (site) {
|
85
|
+
if (site && site.changeFocus) {
|
85
86
|
site.changeFocus({
|
86
87
|
lose: () => {
|
87
88
|
// DO NOTHING
|
@@ -13,7 +13,7 @@ const TextFieldTest = (prop) => {
|
|
13
13
|
|
14
14
|
return (
|
15
15
|
<>
|
16
|
-
<TextArea id="text1" label="Text 1" value=
|
16
|
+
<TextArea id="text1" label="Text 1" value={form.text1} onChange={change}/>
|
17
17
|
<TextField id="date1" type="DATE" label="Date" value={form.date1} onChange={change}/>
|
18
18
|
<DropDown id="gender1" label="Gender" value={form.gender1} onChange={change} options={[ {label: "Male", value: "M"}, { label: "Female", value: "F" }]} />
|
19
19
|
</>
|
package/src/site/page.css
CHANGED
package/src/site/site.css
CHANGED
package/src/widgets/index.js
CHANGED