ywana-core8 0.0.15 → 0.0.19
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 +115 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +0 -163
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +115 -28
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +115 -28
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/publish.sh +1 -0
- package/src/domain/CollectionPage.js +2 -2
- package/src/domain/CreateContentDialog.js +26 -30
- package/src/domain/CreateContentDialog_old.js +59 -0
- package/src/domain/index.js +1 -0
- package/src/index.js +0 -1
- package/src/css/fonts.css +0 -162
- package/src/fonts/Assistant-Bold.ttf +0 -0
- package/src/fonts/Assistant-ExtraBold.ttf +0 -0
- package/src/fonts/Assistant-ExtraLight.ttf +0 -0
- package/src/fonts/Assistant-Light.ttf +0 -0
- package/src/fonts/Assistant-Medium.ttf +0 -0
- package/src/fonts/Assistant-Regular.ttf +0 -0
- package/src/fonts/Assistant-SemiBold.ttf +0 -0
- package/src/fonts/Assistant-VariableFont_wght.ttf +0 -0
package/package.json
CHANGED
package/publish.sh
CHANGED
@@ -5,7 +5,7 @@ import { PageContext } from '../site'
|
|
5
5
|
import { Button, Header, Icon, List, Menu, MenuIcon, MenuItem, Text, Tree, TreeItem, TreeNode } from '../html'
|
6
6
|
import { Content } from './ContentType'
|
7
7
|
import { ContentEditor, TabbedContentEditor, TreededContentEditor } from './ContentEditor'
|
8
|
-
import {
|
8
|
+
import { CreateContentDialog } from './CreateContentDialog_old'
|
9
9
|
import { SiteContext } from '../site/siteContext'
|
10
10
|
import "./CollectionPage.css"
|
11
11
|
|
@@ -37,7 +37,7 @@ export const CollectionPage = (props) => {
|
|
37
37
|
await pageContext.create(form);
|
38
38
|
setPageContext(Object.assign({}, pageContext))
|
39
39
|
}
|
40
|
-
site.openDialog(<
|
40
|
+
site.openDialog(<CreateContentDialog label={`${name}`} type={schema} onOK={onOK} />);
|
41
41
|
}
|
42
42
|
|
43
43
|
return (
|
@@ -1,59 +1,55 @@
|
|
1
|
-
import React, { Fragment, useContext, useMemo
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import {
|
1
|
+
import React, { Fragment, useState, useContext, useMemo } from 'react';
|
2
|
+
import { Dialog } from '../site'
|
3
|
+
import { SiteContext } from '../site/siteContext'
|
4
|
+
import { Text, Button } from '../html';
|
5
|
+
import { Content } from './ContentType'
|
6
|
+
import { ContentEditor } from './ContentEditor'
|
7
7
|
|
8
8
|
/**
|
9
9
|
* Create Content Dialog
|
10
10
|
*/
|
11
|
-
export const CreateContentDialog = ({ label, type, validator, onOK, onError
|
11
|
+
export const CreateContentDialog = ({ label, type, value = {}, filter, validator, onOK, onError }) => {
|
12
12
|
|
13
13
|
const site = useContext(SiteContext);
|
14
|
-
const [form, setForm] = useState(
|
14
|
+
const [form, setForm] = useState(value)
|
15
15
|
const [isValid, setValid] = useState(false)
|
16
16
|
const [errors, setErrors] = useState([])
|
17
17
|
|
18
|
-
function change(form
|
18
|
+
function change(form) {
|
19
19
|
setForm(form)
|
20
20
|
if (validator) {
|
21
21
|
const { validation, errors = [] } = validator(form)
|
22
|
-
setValid(
|
23
|
-
setErrors(errors)
|
22
|
+
setValid(validation)
|
23
|
+
setErrors(errors)
|
24
24
|
} else {
|
25
|
-
setValid(
|
25
|
+
setValid(true)
|
26
26
|
}
|
27
27
|
}
|
28
|
-
|
28
|
+
|
29
29
|
function onAction(action) {
|
30
|
-
if (action === 'OK' && onOK) onOK(form)
|
31
|
-
|
32
|
-
}
|
33
|
-
|
34
|
-
function isRequired(field) {
|
35
|
-
const { required = false } = field
|
36
|
-
return required
|
30
|
+
if (action === 'OK' && onOK) onOK(Object.assign({}, value, form))
|
31
|
+
site.closeDialog();
|
37
32
|
}
|
38
33
|
|
39
|
-
function
|
40
|
-
|
41
|
-
|
34
|
+
function createFilter(field, content) {
|
35
|
+
return field.required === true || field.optional === true
|
36
|
+
// TODO: execute props.filter
|
42
37
|
}
|
43
|
-
|
38
|
+
|
44
39
|
const actions = (
|
45
40
|
<Fragment>
|
46
|
-
<Button label="CLOSE" action={() => onAction("CLOSE")}/>
|
41
|
+
<Button label="CLOSE" action={() => onAction("CLOSE")} />
|
42
|
+
<div className="expand" />
|
47
43
|
<Button label="OK" action={() => onAction("OK")} disabled={!isValid} raised />
|
48
44
|
</Fragment>
|
49
45
|
)
|
50
|
-
|
51
|
-
|
52
|
-
|
46
|
+
|
47
|
+
const title = <Text use="headline6">{label}</Text>
|
48
|
+
const content = new Content(type, form)
|
53
49
|
return (
|
54
50
|
<Dialog title={title} open={true} onAction={onAction} actions={actions}>
|
55
|
-
<
|
56
|
-
{
|
51
|
+
<ContentEditor content={content} onChange={change} filter={createFilter} />
|
52
|
+
{errors.map(error => <Text use="overline" tag="div" className="error">{error}</Text>)}
|
57
53
|
</Dialog>
|
58
54
|
)
|
59
55
|
}
|
@@ -0,0 +1,59 @@
|
|
1
|
+
import React, { Fragment, useContext, useMemo, useState } from 'react';
|
2
|
+
import { Button, Text } from '../html';
|
3
|
+
import { Dialog } from '../site/dialog'
|
4
|
+
import { SiteContext } from '../site/siteContext';
|
5
|
+
import { ContentForm } from './ContentForm';
|
6
|
+
import { Content } from './ContentType';
|
7
|
+
|
8
|
+
/**
|
9
|
+
* Create Content Dialog
|
10
|
+
*/
|
11
|
+
export const CreateContentDialog = ({ label, type, validator, onOK, onError, onActionClose = true }) => {
|
12
|
+
|
13
|
+
const site = useContext(SiteContext);
|
14
|
+
const [form, setForm] = useState({})
|
15
|
+
const [isValid, setValid] = useState(false)
|
16
|
+
const [errors, setErrors] = useState([])
|
17
|
+
|
18
|
+
function change(form, validForm) {
|
19
|
+
setForm(form)
|
20
|
+
if (validator) {
|
21
|
+
const { validation, errors = [] } = validator(form)
|
22
|
+
setValid(validForm && validation)
|
23
|
+
setErrors(errors)
|
24
|
+
} else {
|
25
|
+
setValid(validForm)
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
function onAction(action) {
|
30
|
+
if (action === 'OK' && onOK) onOK(form)
|
31
|
+
if (action === 'CLOSE' || onActionClose === true) site.closeDialog();
|
32
|
+
}
|
33
|
+
|
34
|
+
function isRequired(field) {
|
35
|
+
const { required = false } = field
|
36
|
+
return required
|
37
|
+
}
|
38
|
+
|
39
|
+
function isOptional(field) {
|
40
|
+
const { creation = false } = field
|
41
|
+
return creation
|
42
|
+
}
|
43
|
+
|
44
|
+
const actions = (
|
45
|
+
<Fragment>
|
46
|
+
<Button label="CLOSE" action={() => onAction("CLOSE")}/>
|
47
|
+
<Button label="OK" action={() => onAction("OK")} disabled={!isValid} raised />
|
48
|
+
</Fragment>
|
49
|
+
)
|
50
|
+
|
51
|
+
const title = <Text use="headline6">{label}</Text>
|
52
|
+
const content = new Content(type, form)
|
53
|
+
return (
|
54
|
+
<Dialog title={title} open={true} onAction={onAction} actions={actions}>
|
55
|
+
<ContentForm content={content} filter={(field) => isRequired(field) || isOptional(field)} onChange={change} />
|
56
|
+
{ errors.map ( error => <Text use="overline" tag="div" className="error">{error}</Text> )}
|
57
|
+
</Dialog>
|
58
|
+
)
|
59
|
+
}
|
package/src/domain/index.js
CHANGED
@@ -4,3 +4,4 @@ export { ContentEditor, TabbedContentEditor, CollectionEditor, TreededContentEdi
|
|
4
4
|
export { CreateContentDialog } from './CreateContentDialog'
|
5
5
|
export { EditContentDialog } from './EditContentDialog'
|
6
6
|
export { CollectionPage, CollectionContext } from './CollectionPage'
|
7
|
+
export { TablePage } from './TablePage'
|
package/src/index.js
CHANGED
package/src/css/fonts.css
DELETED
@@ -1,162 +0,0 @@
|
|
1
|
-
/* hebrew */
|
2
|
-
@font-face {
|
3
|
-
font-family: 'Assistant';
|
4
|
-
font-style: normal;
|
5
|
-
font-weight: 200;
|
6
|
-
font-display: swap;
|
7
|
-
src: url(../fonts/Assistant-ExtraLight.ttf) format('woff2');
|
8
|
-
unicode-range: U+0590-05FF, U+20AA, U+25CC, U+FB1D-FB4F;
|
9
|
-
}
|
10
|
-
/* latin-ext */
|
11
|
-
@font-face {
|
12
|
-
font-family: 'Assistant';
|
13
|
-
font-style: normal;
|
14
|
-
font-weight: 200;
|
15
|
-
font-display: swap;
|
16
|
-
src: url(../fonts/Assistant-ExtraLight.ttf) format('woff2');
|
17
|
-
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
18
|
-
}
|
19
|
-
/* latin */
|
20
|
-
@font-face {
|
21
|
-
font-family: 'Assistant';
|
22
|
-
font-style: normal;
|
23
|
-
font-weight: 200;
|
24
|
-
font-display: swap;
|
25
|
-
src: url(../fonts/Assistant-ExtraLight.ttf) format('woff2');
|
26
|
-
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
27
|
-
}
|
28
|
-
/* hebrew */
|
29
|
-
@font-face {
|
30
|
-
font-family: 'Assistant';
|
31
|
-
font-style: normal;
|
32
|
-
font-weight: 300;
|
33
|
-
font-display: swap;
|
34
|
-
src: url(../fonts/Assistant-Light.ttf) format('woff2');
|
35
|
-
unicode-range: U+0590-05FF, U+20AA, U+25CC, U+FB1D-FB4F;
|
36
|
-
}
|
37
|
-
/* latin-ext */
|
38
|
-
@font-face {
|
39
|
-
font-family: 'Assistant';
|
40
|
-
font-style: normal;
|
41
|
-
font-weight: 300;
|
42
|
-
font-display: swap;
|
43
|
-
src: url(../fonts/Assistant-Light.ttf) format('woff2');
|
44
|
-
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
45
|
-
}
|
46
|
-
/* latin */
|
47
|
-
@font-face {
|
48
|
-
font-family: 'Assistant';
|
49
|
-
font-style: normal;
|
50
|
-
font-weight: 300;
|
51
|
-
font-display: swap;
|
52
|
-
src: url(../fonts/Assistant-Light.ttf) format('woff2');
|
53
|
-
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
54
|
-
}
|
55
|
-
/* hebrew */
|
56
|
-
@font-face {
|
57
|
-
font-family: 'Assistant';
|
58
|
-
font-style: normal;
|
59
|
-
font-weight: 400;
|
60
|
-
font-display: swap;
|
61
|
-
src: url(../fonts/Assistant-Medium.ttf) format('woff2');
|
62
|
-
unicode-range: U+0590-05FF, U+20AA, U+25CC, U+FB1D-FB4F;
|
63
|
-
}
|
64
|
-
/* latin-ext */
|
65
|
-
@font-face {
|
66
|
-
font-family: 'Assistant';
|
67
|
-
font-style: normal;
|
68
|
-
font-weight: 400;
|
69
|
-
font-display: swap;
|
70
|
-
src: url(../fonts/Assistant-Medium.ttf) format('woff2');
|
71
|
-
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
72
|
-
}
|
73
|
-
/* latin */
|
74
|
-
@font-face {
|
75
|
-
font-family: 'Assistant';
|
76
|
-
font-style: normal;
|
77
|
-
font-weight: 400;
|
78
|
-
font-display: swap;
|
79
|
-
src: url(../fonts/Assistant-Medium.ttf) format('woff2');
|
80
|
-
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
81
|
-
}
|
82
|
-
/* hebrew */
|
83
|
-
@font-face {
|
84
|
-
font-family: 'Assistant';
|
85
|
-
font-style: normal;
|
86
|
-
font-weight: 500;
|
87
|
-
font-display: swap;
|
88
|
-
src: url(../fonts/Assistant-SemiBold.ttf) format('woff2');
|
89
|
-
unicode-range: U+0590-05FF, U+20AA, U+25CC, U+FB1D-FB4F;
|
90
|
-
}
|
91
|
-
/* latin-ext */
|
92
|
-
@font-face {
|
93
|
-
font-family: 'Assistant';
|
94
|
-
font-style: normal;
|
95
|
-
font-weight: 500;
|
96
|
-
font-display: swap;
|
97
|
-
src: url(../fonts/Assistant-SemiBold.ttf) format('woff2');
|
98
|
-
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
99
|
-
}
|
100
|
-
/* latin */
|
101
|
-
@font-face {
|
102
|
-
font-family: 'Assistant';
|
103
|
-
font-style: normal;
|
104
|
-
font-weight: 500;
|
105
|
-
font-display: swap;
|
106
|
-
src: url(../fonts/Assistant-SemiBold.ttf) format('woff2');
|
107
|
-
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
108
|
-
}
|
109
|
-
/* hebrew */
|
110
|
-
@font-face {
|
111
|
-
font-family: 'Assistant';
|
112
|
-
font-style: normal;
|
113
|
-
font-weight: 600;
|
114
|
-
font-display: swap;
|
115
|
-
src: url(../fonts/Assistant-Bold.ttf) format('woff2');
|
116
|
-
unicode-range: U+0590-05FF, U+20AA, U+25CC, U+FB1D-FB4F;
|
117
|
-
}
|
118
|
-
/* latin-ext */
|
119
|
-
@font-face {
|
120
|
-
font-family: 'Assistant';
|
121
|
-
font-style: normal;
|
122
|
-
font-weight: 600;
|
123
|
-
font-display: swap;
|
124
|
-
src: url(../fonts/Assistant-Bold.ttf) format('woff2');
|
125
|
-
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
126
|
-
}
|
127
|
-
/* latin */
|
128
|
-
@font-face {
|
129
|
-
font-family: 'Assistant';
|
130
|
-
font-style: normal;
|
131
|
-
font-weight: 600;
|
132
|
-
font-display: swap;
|
133
|
-
src: url(../fonts/Assistant-Bold.ttf) format('woff2');
|
134
|
-
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
135
|
-
}
|
136
|
-
/* hebrew */
|
137
|
-
@font-face {
|
138
|
-
font-family: 'Assistant';
|
139
|
-
font-style: normal;
|
140
|
-
font-weight: 700;
|
141
|
-
font-display: swap;
|
142
|
-
src: url(../fonts/Assistant-ExtraBold.ttf) format('woff2');
|
143
|
-
unicode-range: U+0590-05FF, U+20AA, U+25CC, U+FB1D-FB4F;
|
144
|
-
}
|
145
|
-
/* latin-ext */
|
146
|
-
@font-face {
|
147
|
-
font-family: 'Assistant';
|
148
|
-
font-style: normal;
|
149
|
-
font-weight: 700;
|
150
|
-
font-display: swap;
|
151
|
-
src: url(../fonts/Assistant-ExtraBold.ttf) format('woff2');
|
152
|
-
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
153
|
-
}
|
154
|
-
/* latin */
|
155
|
-
@font-face {
|
156
|
-
font-family: 'Assistant';
|
157
|
-
font-style: normal;
|
158
|
-
font-weight: 700;
|
159
|
-
font-display: swap;
|
160
|
-
src: url(../fonts/Assistant-ExtraBold.ttf) format('woff2');
|
161
|
-
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
162
|
-
}
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|