ywana-core8 0.0.352 → 0.0.355

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.352",
3
+ "version": "0.0.355",
4
4
  "description": "ywana-core8",
5
5
  "author": "Ernesto Roldan Garcia",
6
6
  "license": "MIT",
@@ -29,6 +29,7 @@
29
29
  "react-dom": "^17.0.2"
30
30
  },
31
31
  "dependencies": {
32
+ "crypto-js": "^4.1.1",
32
33
  "deep-equal": "^2.0.5",
33
34
  "material-design-icons-iconfont": "^6.1.1",
34
35
  "moment": "^2.29.1",
package/src/html/menu.css CHANGED
@@ -1,6 +1,5 @@
1
1
  .menu-icon {
2
2
  position: relative;
3
- width: 3rem;
4
3
  }
5
4
 
6
5
  .menu-icon > .overlay {
@@ -44,7 +43,6 @@
44
43
  .menu-icon > menu li {
45
44
  min-height: 3rem;
46
45
  padding: 0 0.5rem;
47
-
48
46
  display: flex;
49
47
  align-items: center;
50
48
  }
@@ -57,10 +55,12 @@
57
55
  flex: 1;
58
56
  display: flex;
59
57
  align-items: center;
58
+ cursor: pointer;
60
59
  }
61
60
 
62
61
  .menu-item > .icon {
63
62
  color: var(--text-color-light);
63
+ cursor: pointer;
64
64
  }
65
65
 
66
66
  .menu-item > label {
@@ -69,11 +69,13 @@
69
69
  padding: 0 0.5rem 0 0;
70
70
  color: var(--text-color);
71
71
  font-size: 0.9rem;
72
+ cursor: pointer;
72
73
  }
73
74
 
74
75
  .menu-item.disabled > label,
75
76
  .menu-item.disabled > .icon {
76
77
  color: var(--text-color-lighter);
78
+ cursor: initial;
77
79
  }
78
80
 
79
81
  .menu-item > .meta {
package/src/html/menu.js CHANGED
@@ -25,7 +25,7 @@ export const Menu = (props) => {
25
25
  */
26
26
  export const MenuIcon = (props) => {
27
27
 
28
- const { icon = "more_vert", children, align } = props
28
+ const { icon = "more_vert", children, align, size="normal" } = props
29
29
  const [open, setOpen] = useState(false)
30
30
 
31
31
  function toggle() {
@@ -35,7 +35,7 @@ export const MenuIcon = (props) => {
35
35
  return (
36
36
  <MenuContext.Provider value={[open, setOpen]}>
37
37
  <div className="menu-icon">
38
- <Icon icon={icon} clickable action={toggle} />
38
+ <Icon icon={icon} size={size} clickable action={toggle} />
39
39
  {open ? (
40
40
  <menu className={`${align}`}>
41
41
  {children}
@@ -1,8 +1,10 @@
1
1
  import React, { useState } from 'react'
2
+ import { useEffect } from 'react/cjs/react.production.min'
2
3
  import { Text, TEXTFORMATS } from './text'
3
4
 
4
5
  const TextTest = (prop) => {
5
6
 
7
+
6
8
  return (
7
9
  <>
8
10
  <Text format={TEXTFORMATS.NUMERIC}>846964.4199142859</Text>
@@ -0,0 +1,39 @@
1
+ import React, { useState, useEffect } from 'react'
2
+ import { TextField } from '../html'
3
+ import CryptoJS from 'crypto-js';
4
+ import { useEffect } from 'react/cjs/react.production.min';
5
+
6
+
7
+ const Token = () => {
8
+
9
+ const [encrypted, setEncrypted] = useState("")
10
+ const [decrypted, setDecrypted] = useState("")
11
+
12
+
13
+ function decryptData(encrypted, secret) {
14
+ const bytes = CryptoJS.AES.decrypt(encrypted, secret);
15
+ const originalText = bytes.toString(CryptoJS.enc.Utf8);
16
+ return originalText;
17
+ }
18
+
19
+ function encryptData(message, secret) {
20
+ return CryptoJS.AES.encrypt(message, secret).toString();
21
+ }
22
+
23
+ function change(id, value) {
24
+ const secret = '12345678';
25
+ const e = encryptData(value, secret)
26
+ setEncrypted(e)
27
+ const d = decryptData(e, secret)
28
+ setDecrypted(d)
29
+ }
30
+
31
+ return (
32
+ <>
33
+ <TextField label="Text" onChange={(id, value) => change(id, value)}></TextField>
34
+ <TextField label="Encrypted" value={encrypted}></TextField>
35
+ <TextField label="Decrypted" value={decrypted}></TextField>
36
+ </>
37
+ )
38
+ }
39
+
package/src/site/site.css CHANGED
@@ -109,6 +109,10 @@
109
109
 
110
110
  .site6>footer {
111
111
  grid-area: footer;
112
+ }
113
+
114
+ .site6>.site-console {
115
+ grid-area: footer;
112
116
  min-height: 20rem;
113
117
  background-color: rgb(222, 222, 222);
114
118
  color: #FFF;
package/src/site/site.js CHANGED
@@ -104,7 +104,7 @@ export const SiteProvider = ({ children, siteLang, siteDictionary, showConsole }
104
104
  /**
105
105
  * Site
106
106
  */
107
- export const Site = ({ icon, logo, title, toolbar, children, init, min, lang, dictionary }) => {
107
+ export const Site = ({ icon, logo, title, toolbar, footer, children, init, min, lang, dictionary }) => {
108
108
  return (
109
109
  <SiteProvider siteLang={lang} siteDictionary={dictionary}>
110
110
  <div className="site6">
@@ -121,6 +121,7 @@ export const Site = ({ icon, logo, title, toolbar, children, init, min, lang, di
121
121
  <SitePromptDialog />
122
122
  <SitePreview />
123
123
  <SiteNotifications />
124
+ <SiteFooter>{footer}</SiteFooter>
124
125
  </div>
125
126
  </SiteProvider>
126
127
  )
@@ -141,6 +142,7 @@ const SiteHeader = (props) => {
141
142
  <Header icon={icon} title={title} />
142
143
  )
143
144
  }
145
+
144
146
  /**
145
147
  * Site ToolBar
146
148
  */
@@ -154,6 +156,19 @@ const SiteToolBar = ({ children }) => {
154
156
  )
155
157
  }
156
158
 
159
+ /**
160
+ * Site Footer
161
+ */
162
+ const SiteFooter = ({ children }) => {
163
+ const context = useContext(SiteContext)
164
+ const { breadcrumb } = context
165
+ return (
166
+ <footer>
167
+ {children}
168
+ </footer>
169
+ )
170
+ }
171
+
157
172
  /**
158
173
  * Site Aside
159
174
  */
@@ -9,8 +9,11 @@ import { Dialog } from './dialog'
9
9
  import { Button } from '../html'
10
10
 
11
11
  const SiteTest = (prop) => {
12
+
13
+ const footer = <div>FOOTER</div>
14
+
12
15
  return (
13
- <Site icon="star" title="Site Test" init={"PAGE2"}>
16
+ <Site icon="star" title="Site Test" init={"PAGE2"} footer={footer}>
14
17
  <Page id="PAGE1" section="SECTION1" icon="description" title="Page 1" layout="workspace">
15
18
  <Page1 />
16
19
  </Page>
@@ -0,0 +1,118 @@
1
+ .file-explorer {
2
+ width: 100%;
3
+ height: 100%;
4
+ display: grid;
5
+ grid-template-areas:
6
+ "header header header"
7
+ "nav nav nav"
8
+ "menu main aside"
9
+ "footer footer footer";
10
+ grid-template-columns: auto 1fr auto;
11
+ grid-template-rows: auto auto 1fr auto;
12
+ padding: 2px;
13
+ }
14
+
15
+ .file-explorer>* {
16
+ margin: 2px;
17
+ }
18
+
19
+ .file-explorer>header {
20
+ grid-area: header;
21
+ }
22
+
23
+ .file-explorer>nav {
24
+ grid-area: nav;
25
+ }
26
+
27
+ .file-explorer>menu {
28
+ grid-area: menu;
29
+ padding: 0;
30
+ }
31
+
32
+ .file-explorer>main {
33
+ grid-area: main;
34
+ border-left: solid 1px var(--divider-color);
35
+ display: flex;
36
+ flex-direction: column;
37
+ overflow: hidden;
38
+ }
39
+
40
+ .file-explorer>aside {
41
+ grid-area: aside;
42
+ }
43
+
44
+ .file-explorer>footer {
45
+ grid-area: footer;
46
+ }
47
+
48
+ .file-view {
49
+ flex: 1;
50
+ overflow: auto;
51
+ display: flex;
52
+ flex-wrap: wrap;
53
+ gap: .5rem;
54
+ }
55
+
56
+ .file-icon {
57
+ margin: .5rem;
58
+ border: solid 1px var(--divider-color);
59
+ width: 8rem;
60
+ height: 10rem;
61
+ position: relative;
62
+ display: flex;
63
+ flex-direction: column;
64
+ }
65
+
66
+ .file-icon--selected {
67
+ background-color: var(--divider-color);
68
+ }
69
+
70
+ .file-icon:hover {
71
+ cursor: pointer;
72
+ box-shadow: var(--shadow1);
73
+ }
74
+
75
+ .file-icon>header {
76
+ position: absolute;
77
+ top: 0px;
78
+ left: 0px;
79
+ width: 100%;
80
+ height: 2rem;
81
+ display: flex;
82
+ justify-content: space-between;
83
+ color: var(--text-color-lighter);
84
+ }
85
+
86
+ .file-icon>picture {
87
+ flex: 1;
88
+ padding: 0 1rem;
89
+ }
90
+
91
+ .file-icon>picture>img {
92
+ width: 100%;
93
+ height: 100%;
94
+ object-fit: contain;
95
+ }
96
+
97
+ .file-icon>main {
98
+ height: 2rem;
99
+ overflow: hidden;
100
+ display: flex;
101
+ flex-direction: column;
102
+ align-items: center;
103
+ }
104
+
105
+ .file-icon>main>label {
106
+ font-size: .8rem;
107
+ color: var(--text-color);
108
+ }
109
+
110
+ .file-icon>footer {
111
+ width: 100%;
112
+ height: 1.5rem;
113
+ overflow: hidden;
114
+ border-top: solid 1px var(--divider-color);
115
+ display: flex;
116
+ align-items: center;
117
+ padding: 0 .5rem;
118
+ }
@@ -0,0 +1,77 @@
1
+ import React, {useState} from 'react'
2
+ import { MenuIcon, MenuItem, Icon } from '../../html'
3
+ import './Explorer.css'
4
+
5
+ /**
6
+ * File Explorer
7
+ */
8
+ export const FileExplorer = (props) => {
9
+ const { files = [], onSelect } = props
10
+ return (
11
+ <div className="file-explorer">
12
+ <header>header</header>
13
+ <nav>nav</nav>
14
+ <menu>menu</menu>
15
+ <main>
16
+ <FileIconsView files={files} />
17
+ </main>
18
+ <aside></aside>
19
+ <footer>footer</footer>
20
+ </div>
21
+ )
22
+ }
23
+
24
+ /**
25
+ * File Icons View
26
+ */
27
+ export const FileIconsView = (props) => {
28
+ const { files = [], onSelect } = props
29
+ const [selected, setSelected] = useState()
30
+
31
+ function select(id) {
32
+ setSelected(id)
33
+ if (onSelect) onSelect(id)
34
+ }
35
+
36
+ function isSelected(id) {
37
+ return selected === id
38
+ }
39
+
40
+ return (
41
+ <div className="file-view file-view--icons">
42
+ {files.map(file => <FileIcon file={file} onSelect={select} selected={isSelected(file.id)} />)}
43
+ </div>
44
+ )
45
+ }
46
+
47
+ /**
48
+ * File Icon
49
+ */
50
+ const FileIcon = (props) => {
51
+
52
+ const { file = {}, selected = false, onSelect } = props
53
+ const { id, icon, label, actions = [], src = "https://findicons.com/files/icons/2813/flat_jewels/256/file.png", footer } = file
54
+
55
+ function select() {
56
+ if (onSelect && !selected) onSelect(id)
57
+ }
58
+
59
+ const style = selected ? 'file-icon--selected' :''
60
+ return (
61
+ <div className={`file-icon ${style}`} onClick={select}>
62
+ <header>
63
+ {icon? <Icon size="small" icon={icon} /> : null }
64
+ <MenuIcon size="small">
65
+ {actions.map(action => <MenuItem icon={action.icon} label={action.label} onSelect={action.execute} />)}
66
+ </MenuIcon>
67
+ </header>
68
+ <picture>
69
+ <img src={src}></img>
70
+ </picture>
71
+ <main>
72
+ <label>{label}</label>
73
+ </main>
74
+ { footer ? <footer>{footer}</footer> : null }
75
+ </div>
76
+ )
77
+ }
@@ -0,0 +1,35 @@
1
+ import React from 'react'
2
+ import { Button } from '../../html'
3
+ import { FileExplorer, FileIconsView } from './explorer'
4
+
5
+ const thumb1 = "https://findicons.com/files/icons/2813/flat_jewels/256/file.png"
6
+
7
+ const files = [
8
+ { id: "0001", icon: "star", label: "File 1", src:thumb1, actions: [ { icon:"info", label:"Action1", execute: () => alert("Action1")} ], footer: <span>ok</span> },
9
+ { id: "0002", icon: "star", label: "File 2", src:thumb1 },
10
+ { id: "0003", icon: "star", label: "File 3", src:thumb1 },
11
+ { id: "0004", icon: "star", label: "File 4", src:thumb1 },
12
+ { id: "0005", icon: "star", label: "File 5", src:thumb1 },
13
+ { id: "0006", icon: "star", label: "File 6", src:thumb1 },
14
+ { id: "0007", icon: "star", label: "File 7", src:thumb1 },
15
+ { id: "0008", icon: "star", label: "File 8", src:thumb1 },
16
+ { id: "0009", icon: "star", label: "File 9", src:thumb1 },
17
+ { id: "0010", icon: "star", label: "File 10", src:thumb1 },
18
+ ]
19
+
20
+ const FileExplorerTest = (props) => {
21
+ return (
22
+ <div style={{ padding: "1rem", flex: "1", height: "100%" }}>
23
+ <FileExplorer files={files} />
24
+ </div>
25
+ )
26
+ }
27
+
28
+
29
+ const FileIconViewTest = (props) => {
30
+ return (
31
+ <div style={{ padding: "1rem", flex: "1", height: "100%" }}>
32
+ <FileIconsView files={files} />
33
+ </div>
34
+ )
35
+ }
@@ -5,4 +5,5 @@ export * from './kanban/Kanban'
5
5
  export * from './avatar/avatar'
6
6
  export * from './waiter'
7
7
  export * from './planner/Planner'
8
- export * from './upload'
8
+ export * from './upload'
9
+ export * from './explorer/Explorer'