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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ywana-core8",
3
- "version": "0.0.859",
3
+ "version": "0.0.861",
4
4
  "description": "ywana-core8",
5
5
  "homepage": "https://ywana.github.io/workspace",
6
6
  "author": "Ernesto Roldan Garcia",
@@ -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={`${id}_${value}`} field={field} value={value} onChange={change} />
24
+ <DynamicFormField key={id} field={field} value={value} onChange={change} />
25
25
  )
26
26
  })}
27
27
  </div>
@@ -6,6 +6,7 @@ export const FORMATS = {
6
6
  DATE: 'date',
7
7
  DATERANGE: 'DATERANGE',
8
8
  TIME: 'time',
9
+ DATETIME: 'datetime',
9
10
  EMAIL: 'email',
10
11
  HTML: 'HTML',
11
12
  URL: 'URL',
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'
@@ -16,7 +16,7 @@ export const Section = (props) => {
16
16
  }, [open])
17
17
 
18
18
  const toggle = () => {
19
- setOpen(!open)
19
+ setOpen(!isOpen)
20
20
  }
21
21
 
22
22
  return (
@@ -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
 
@@ -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 (site && site.changeFocus) {
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
- const [focused, setFocused] = useState()
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: center;
11
+ align-items: flex-end;
12
12
  background-color: rgb(200,200,200);
13
13
  min-height: 2rem;
14
- padding-left: 1rem;
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);