ywana-core8 0.0.859 → 0.0.861
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 +32 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +11 -3
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +32 -23
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +32 -22
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain2/DynamicForm.js +1 -1
- package/src/domain2/FORMATS.js +1 -0
- package/src/html/index.js +1 -1
- package/src/html/section.js +1 -1
- package/src/html/switch.js +17 -0
- package/src/html/table.js +3 -0
- package/src/html/textfield.js +2 -8
- package/src/site/site.js +2 -13
- package/src/site/view.css +11 -3
package/package.json
CHANGED
@@ -21,7 +21,7 @@ export const DynamicForm = (props) => {
|
|
21
21
|
const { id, label, type } = field
|
22
22
|
const value = values[id] || field.default
|
23
23
|
return (
|
24
|
-
<DynamicFormField key={
|
24
|
+
<DynamicFormField key={id} field={field} value={value} onChange={change} />
|
25
25
|
)
|
26
26
|
})}
|
27
27
|
</div>
|
package/src/domain2/FORMATS.js
CHANGED
package/src/html/index.js
CHANGED
@@ -17,7 +17,7 @@ export { Text, TEXTFORMATS } from './text'
|
|
17
17
|
export { TextField, DropDown, TextArea, DateRange, PasswordField } from './textfield'
|
18
18
|
export { TokenField } from './tokenfield'
|
19
19
|
export { Tree, TreeNode, TreeItem } from './tree'
|
20
|
-
export { Switch } from './switch'
|
20
|
+
export { Switch, Switch2 } from './switch'
|
21
21
|
export { Tooltip } from './tooltip'
|
22
22
|
export { Thumbnail } from './thumbnail'
|
23
23
|
export { ColorField } from './color'
|
package/src/html/section.js
CHANGED
package/src/html/switch.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
import RSwitch from 'react-switch'
|
3
|
+
import { Icon } from './icon'
|
3
4
|
|
4
5
|
export const Switch = (props) => {
|
5
6
|
|
@@ -20,4 +21,20 @@ export const Switch = (props) => {
|
|
20
21
|
className="react-switch"
|
21
22
|
/>
|
22
23
|
)
|
24
|
+
}
|
25
|
+
|
26
|
+
export const Switch2 = (props) => {
|
27
|
+
|
28
|
+
const { checked, onChange } = props
|
29
|
+
|
30
|
+
function toggle() {
|
31
|
+
onChange(!checked)
|
32
|
+
}
|
33
|
+
|
34
|
+
const icon = checked ? "toggle_on" : "toggle_off"
|
35
|
+
return (
|
36
|
+
<div className="switch">
|
37
|
+
<Icon icon={icon} clickable action={toggle} />
|
38
|
+
</div>
|
39
|
+
)
|
23
40
|
}
|
package/src/html/table.js
CHANGED
@@ -242,6 +242,9 @@ const EntityCellViewer = ({ id, item, value }) => {
|
|
242
242
|
case FORMATS.TIME:
|
243
243
|
text = new Date(text).toLocaleString(locale, { year: 'hour', month: 'minute', day: 'second' });
|
244
244
|
break;
|
245
|
+
case FORMATS.DATETIME:
|
246
|
+
text = new Date(text).toLocaleString(locale, { year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric' });
|
247
|
+
break;
|
245
248
|
}
|
246
249
|
}
|
247
250
|
|
package/src/html/textfield.js
CHANGED
@@ -12,7 +12,7 @@ import './textarea.css'
|
|
12
12
|
export const TextField = (props) => {
|
13
13
|
|
14
14
|
const site = useContext(SiteContext)
|
15
|
-
const { id, type = 'text', label, labelPosition = 'top', placeholder, value, outlined, readOnly = false, canClear = true, onChange, onEnter, onClick, onBlur } = props
|
15
|
+
const { id, type = 'text', label, labelPosition = 'top', placeholder, value, outlined, readOnly = false, canClear = true, onChange, onEnter, onClick, onFocus, onBlur } = props
|
16
16
|
|
17
17
|
function onKeyPress(event) {
|
18
18
|
var key = event.charCode ? event.charCode : event.keyCode ? event.keyCode : 0;
|
@@ -29,13 +29,7 @@ export const TextField = (props) => {
|
|
29
29
|
}
|
30
30
|
|
31
31
|
function focus() {
|
32
|
-
if (
|
33
|
-
site.changeFocus({
|
34
|
-
lose: () => {
|
35
|
-
// DO NOTHING
|
36
|
-
}
|
37
|
-
})
|
38
|
-
}
|
32
|
+
if (onFocus) onFocus()
|
39
33
|
}
|
40
34
|
|
41
35
|
function blur() {
|
package/src/site/site.js
CHANGED
@@ -26,8 +26,7 @@ export const SiteProvider = ({ children, siteLang, siteDictionary }) => {
|
|
26
26
|
const [promptDialog, setPromptDialog] = useState()
|
27
27
|
const [preview, setPreview] = useState()
|
28
28
|
const [breadcrumb, setBreadcrumb] = useState()
|
29
|
-
|
30
|
-
|
29
|
+
|
31
30
|
const value = {
|
32
31
|
|
33
32
|
lang,
|
@@ -35,17 +34,7 @@ export const SiteProvider = ({ children, siteLang, siteDictionary }) => {
|
|
35
34
|
|
36
35
|
dictionary,
|
37
36
|
setDictionary,
|
38
|
-
|
39
|
-
focused,
|
40
|
-
changeFocus: (next) => {
|
41
|
-
if (focused) focused.lose()
|
42
|
-
setFocused(next)
|
43
|
-
},
|
44
|
-
clearFocus: () => {
|
45
|
-
if (focused) focused.lose()
|
46
|
-
setFocused(null)
|
47
|
-
},
|
48
|
-
|
37
|
+
|
49
38
|
sideNav,
|
50
39
|
setSideNav,
|
51
40
|
|
package/src/site/view.css
CHANGED
@@ -8,20 +8,28 @@
|
|
8
8
|
.view>header {
|
9
9
|
width: 100%;
|
10
10
|
display: flex;
|
11
|
-
align-items:
|
11
|
+
align-items: flex-end;
|
12
12
|
background-color: rgb(200,200,200);
|
13
13
|
min-height: 2rem;
|
14
|
-
|
14
|
+
height: 2.5rem;
|
15
|
+
max-height: 2.5rem;
|
16
|
+
}
|
17
|
+
|
18
|
+
.view>header>.icon {
|
19
|
+
height: 2.4rem;
|
20
|
+
width: 3rem
|
15
21
|
}
|
16
22
|
|
17
23
|
.view>header>label {
|
18
24
|
flex: 1;
|
25
|
+
height: 100%;
|
26
|
+
display: flex;
|
27
|
+
align-items: center;
|
19
28
|
}
|
20
29
|
|
21
30
|
.view>nav {
|
22
31
|
min-height: 2rem;
|
23
32
|
display: flex;
|
24
|
-
flex-direction: ;
|
25
33
|
align-items: center;
|
26
34
|
justify-content: flex-end;
|
27
35
|
background-color: rgb(230,230,230);
|