ywana-core8 0.0.353 → 0.0.356
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 +118 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +123 -1
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +117 -15
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +118 -14
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/html/menu.css +0 -1
- package/src/html/menu.js +2 -2
- package/src/html/text.test.js +2 -0
- package/src/http/token.test.js +28 -20
- package/src/site/site.css +4 -0
- package/src/site/site.js +16 -1
- package/src/site/site.test.js +4 -1
- package/src/widgets/explorer/Explorer.css +118 -0
- package/src/widgets/explorer/Explorer.js +77 -0
- package/src/widgets/explorer/Explorer.test.js +35 -0
- package/src/widgets/index.js +2 -1
package/package.json
CHANGED
package/src/html/menu.css
CHANGED
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}
|
package/src/html/text.test.js
CHANGED
@@ -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>
|
package/src/http/token.test.js
CHANGED
@@ -1,31 +1,39 @@
|
|
1
|
-
import React, { useState } from 'react'
|
2
|
-
import {
|
3
|
-
import
|
4
|
-
import
|
5
|
-
import Base64 from 'crypto-js/enc-base64';
|
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';
|
6
5
|
|
7
|
-
const TokenTest = (prop) => {
|
8
6
|
|
9
|
-
|
10
|
-
const [hash, setHash] = useState()
|
11
|
-
const [decripted, setDecripted] = useState()
|
7
|
+
const Token = () => {
|
12
8
|
|
13
|
-
|
9
|
+
const [encrypted, setEncrypted] = useState("")
|
10
|
+
const [decrypted, setDecrypted] = useState("")
|
14
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;
|
15
17
|
}
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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)
|
20
29
|
}
|
21
30
|
|
22
31
|
return (
|
23
32
|
<>
|
24
|
-
<TextField label="Text" onChange={(id, value) =>
|
25
|
-
<
|
26
|
-
<TextField label="
|
27
|
-
<Button label="DECRYPT" action={decryptData}></Button>
|
28
|
-
<TextField label="Decrypted" value={decripted} />
|
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>
|
29
36
|
</>
|
30
37
|
)
|
31
|
-
}
|
38
|
+
}
|
39
|
+
|
package/src/site/site.css
CHANGED
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
|
*/
|
package/src/site/site.test.js
CHANGED
@@ -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
|
+
min-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
|
+
flex: 1;
|
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
|
+
}
|
package/src/widgets/index.js
CHANGED