ywana-core8 0.0.746 → 0.0.748
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 +28 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +28 -11
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +28 -11
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain2/CollectionList.js +2 -2
- package/src/domain2/CollectionPage.js +2 -2
- package/src/html/list.js +13 -10
- package/src/widgets/login/ResetPasswordBox.js +23 -14
package/package.json
CHANGED
@@ -8,7 +8,7 @@ import './CollectionList.css'
|
|
8
8
|
*/
|
9
9
|
export const CollectionList = (props) => {
|
10
10
|
|
11
|
-
const { itemRenderer, groupBy, searchBy = [], sortBy, sortDir } = props
|
11
|
+
const { itemRenderer, groupBy, groupRenderer, searchBy = [], sortBy, sortDir } = props
|
12
12
|
const context = useContext(CollectionContext)
|
13
13
|
const { all = [], selected, filters, customFilters } = context
|
14
14
|
const [search, setSearch] = useState('')
|
@@ -51,7 +51,7 @@ export const CollectionList = (props) => {
|
|
51
51
|
|
52
52
|
return (
|
53
53
|
<div className={`collection-list ${style}`}>
|
54
|
-
<List items={items} onSelect={select} groupBy={groupBy} />
|
54
|
+
<List items={items} onSelect={select} groupBy={groupBy} groupRenderer={groupRenderer} />
|
55
55
|
{searchBy.length > 0 ? (
|
56
56
|
<div className="search-box">
|
57
57
|
<Icon icon="search" size="small" />
|
@@ -17,7 +17,7 @@ export const CollectionPage = (props) => {
|
|
17
17
|
title, actions,
|
18
18
|
canFilter, customFilters, filtersValue,
|
19
19
|
sortBy, sortDir,
|
20
|
-
listGroupBy, listSearchBy, listItemRenderer,
|
20
|
+
listGroupBy, listSearchBy, listItemRenderer, listGroupRenderer,
|
21
21
|
customEditor,
|
22
22
|
} = props
|
23
23
|
|
@@ -28,7 +28,7 @@ export const CollectionPage = (props) => {
|
|
28
28
|
{actions}
|
29
29
|
</Header>
|
30
30
|
{canFilter ? <CollectionFilters schema={schema} >{customFilters}</CollectionFilters> : null}
|
31
|
-
<CollectionList itemRenderer={listItemRenderer} groupBy={listGroupBy} searchBy={listSearchBy} sortBy={sortBy} sortDir={sortDir} />
|
31
|
+
<CollectionList itemRenderer={listItemRenderer} groupBy={listGroupBy} groupRenderer={listGroupRenderer} searchBy={listSearchBy} sortBy={sortBy} sortDir={sortDir} />
|
32
32
|
<CollectionEditor customEditor={customEditor} />
|
33
33
|
</CollectionContextProvider>
|
34
34
|
</div>
|
package/src/html/list.js
CHANGED
@@ -8,7 +8,7 @@ import "./list.css"
|
|
8
8
|
*/
|
9
9
|
export const List = (props) => {
|
10
10
|
|
11
|
-
const { items = [], children, selected, onSelect, groupBy } = props
|
11
|
+
const { items = [], children, selected, onSelect, groupBy, groupRenderer } = props
|
12
12
|
|
13
13
|
function select(id) {
|
14
14
|
if (onSelect) onSelect(id)
|
@@ -28,7 +28,7 @@ export const List = (props) => {
|
|
28
28
|
* Grouped List
|
29
29
|
*/
|
30
30
|
const GroupedList = (props) => {
|
31
|
-
const { items = [], children, selected, onSelect, groupBy } = props
|
31
|
+
const { items = [], children, selected, onSelect, groupBy, groupRenderer } = props
|
32
32
|
|
33
33
|
const groups = items.reduce((groups, item) => {
|
34
34
|
let group = groups.find(g => g.name === item[groupBy])
|
@@ -42,14 +42,17 @@ const GroupedList = (props) => {
|
|
42
42
|
|
43
43
|
return (
|
44
44
|
<div className="list grouped">
|
45
|
-
{groups.map(group =>
|
46
|
-
|
47
|
-
|
48
|
-
<
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
45
|
+
{groups.map(group => {
|
46
|
+
const groupTitle = groupRenderer ? groupRenderer(group) : <Text>{group.name}</Text>
|
47
|
+
return (
|
48
|
+
<Fragment key={group.name}>
|
49
|
+
<header key={`${group.name}-header`}>{groupTitle}</header>
|
50
|
+
<ul key={`${group.name}-ul`}>
|
51
|
+
{group.items.map(item => <ListItem key={item.id} item={item} selected={selected} onSelect={onSelect} />)}
|
52
|
+
</ul>
|
53
|
+
</Fragment>
|
54
|
+
)
|
55
|
+
})}
|
53
56
|
{children}
|
54
57
|
</div>
|
55
58
|
)
|
@@ -1,13 +1,13 @@
|
|
1
|
-
import React, {
|
1
|
+
import React, { useState } from 'react'
|
2
2
|
import { TextField, Text, Button } from '../../html'
|
3
3
|
import './ResetPasswordBox.css'
|
4
4
|
|
5
5
|
/**
|
6
6
|
* Reset Password
|
7
7
|
*/
|
8
|
-
export const ResetPasswordBox = ({ logo, title, children, onOK, onClose }) => {
|
8
|
+
export const ResetPasswordBox = ({ logo, title, userRequired = true, lang = "EN", children, onOK, onClose }) => {
|
9
9
|
|
10
|
-
const [form, setForm
|
10
|
+
const [form, setForm] = useState({})
|
11
11
|
const [error, setError] = useState()
|
12
12
|
|
13
13
|
function canOK() {
|
@@ -15,17 +15,19 @@ export const ResetPasswordBox = ({ logo, title, children, onOK, onClose }) => {
|
|
15
15
|
}
|
16
16
|
|
17
17
|
function changeField(id, value) {
|
18
|
-
const next = Object.assign({}, form, {[id]: value})
|
18
|
+
const next = Object.assign({}, form, { [id]: value })
|
19
19
|
setForm(next)
|
20
20
|
}
|
21
21
|
|
22
22
|
function ok() {
|
23
23
|
if (onOK && canOK()) {
|
24
|
-
if (form.password1 === form.password2
|
24
|
+
if (form.password1 === form.password2) {
|
25
25
|
setError(null)
|
26
26
|
onOK(form)
|
27
27
|
} else {
|
28
|
-
|
28
|
+
|
29
|
+
const errorLabel = lang === "EN" ? "Passwords do not match" : "Las claves no coinciden"
|
30
|
+
setError(errorLabel)
|
29
31
|
}
|
30
32
|
}
|
31
33
|
}
|
@@ -34,23 +36,30 @@ export const ResetPasswordBox = ({ logo, title, children, onOK, onClose }) => {
|
|
34
36
|
if (onClose) onClose()
|
35
37
|
}
|
36
38
|
|
39
|
+
const text = lang === "EN" ? "CHANGE PASSWORD" : "CAMBIO DE CLAVE"
|
40
|
+
const userLabel = lang === "EN" ? "User" : "Usuario"
|
41
|
+
const passwordLabel = lang === "EN" ? "New Password" : "Nueva Clave"
|
42
|
+
const password2Label = lang === "EN" ? "Confirm New Password" : "Confirmar Nueva Clave"
|
43
|
+
const okLabel = lang === "EN" ? "OK" : "Aceptar"
|
44
|
+
const cancelLabel = lang === "EN" ? "Cancel" : "Cancelar"
|
45
|
+
|
37
46
|
return (
|
38
47
|
<div className="reset-password-box">
|
39
48
|
<header>
|
40
49
|
{logo ? <img src={logo} /> : null}
|
41
50
|
{title ? <div className="title"><Text>{title}</Text></div> : null}
|
42
|
-
{
|
51
|
+
{children}
|
43
52
|
</header>
|
44
53
|
<main>
|
45
|
-
<Text use="headline6">
|
46
|
-
<TextField id="user"
|
47
|
-
<TextField id="password1" outlined icon="lock" type="password" label=
|
48
|
-
<TextField id="password2" outlined icon="lock" type="password" label=
|
49
|
-
{
|
54
|
+
<Text use="headline6">{text}</Text>
|
55
|
+
{userRequired ? <TextField id="user" outlined icon="person" label={userLabel} lapse={100} onChange={changeField} onEnter={ok} /> : null}
|
56
|
+
<TextField id="password1" outlined icon="lock" type="password" label={passwordLabel} lapse={100} onChange={changeField} onEnter={ok} />
|
57
|
+
<TextField id="password2" outlined icon="lock" type="password" label={password2Label} lapse={100} onChange={changeField} onEnter={ok} />
|
58
|
+
{error ? <div className="error">{error}</div> : null}
|
50
59
|
</main>
|
51
60
|
<footer>
|
52
|
-
<Button label=
|
53
|
-
<Button label=
|
61
|
+
<Button label={cancelLabel} action={close} />
|
62
|
+
<Button label={okLabel} raised disabled={!canOK()} action={ok} />
|
54
63
|
</footer>
|
55
64
|
</div>
|
56
65
|
)
|