ywana-core8 0.0.783 → 0.0.785
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 +4767 -4652
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +68 -61
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +4766 -4653
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +4767 -4652
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/ContentEditor.js +4 -1
- package/src/domain/ContentEditor.test.js +1 -0
- package/src/domain/ContentType.js +2 -1
- package/src/html/index.js +1 -1
- package/src/html/textfield.js +22 -2
- package/src/incubator/index.js +2 -1
- package/src/incubator/password.css +7 -0
- package/src/incubator/password.js +48 -0
- package/src/site/site.test.js +2 -0
package/package.json
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
import React, { Fragment, useState } from 'react';
|
2
|
-
import { Button, CheckBox, DataTable, DropDown, Icon, Stack, Tab, Tabs, Text, TextField, Tree, TreeNode, TreeItem, TokenField, Header, Accordion } from '../html';
|
2
|
+
import { Button, CheckBox, DataTable, DropDown, Icon, Stack, Tab, Tabs, Text, TextField, PasswordField, Tree, TreeNode, TreeItem, TokenField, Header, Accordion } from '../html';
|
3
3
|
import { CHECK, Content, TYPES, FORMATS } from './ContentType';
|
4
4
|
import { DateRange } from '../html/textfield';
|
5
5
|
import { ColorField } from '../html/color';
|
6
6
|
import './ContentEditor.css';
|
7
|
+
import { PasswordEditor } from '../incubator';
|
7
8
|
|
8
9
|
/**
|
9
10
|
* Content Editor
|
@@ -286,6 +287,8 @@ export const StringEditor = ({ field, value = '', onChange, content, outlined })
|
|
286
287
|
const label = required ? `${field.label} *` : field.label
|
287
288
|
|
288
289
|
switch (format) {
|
290
|
+
case FORMATS.PASSWORD:
|
291
|
+
return <PasswordEditor outlined={outlined} id={id} type="password" label={label} value={value} onChange={change} readOnly={!editable} />
|
289
292
|
case FORMATS.IMG:
|
290
293
|
return (
|
291
294
|
<div className='img-field'>
|
@@ -18,6 +18,7 @@ const schema = {
|
|
18
18
|
field3: { id: "field3", type: TYPES.STRING, format: FORMATS.TOKENS, required: true, editable: true , label: "field3" , options: buildTokenOptions },
|
19
19
|
field4: { id: "field4", type: TYPES.STRING, format: FORMATS.COLOR , required: true, editable: true , label: "Color" },
|
20
20
|
field5: { id: "field5", type: TYPES.STRING, format: FORMATS.TOKENS, required: true, editable: true , label: "field5" , multivalue: true },
|
21
|
+
field6: { id: "field6", type: TYPES.STRING, format: FORMATS.PASSWORD, required: true, editable: true , label: "Password" },
|
21
22
|
|
22
23
|
}
|
23
24
|
|
package/src/html/index.js
CHANGED
@@ -14,7 +14,7 @@ export { Section } from './section'
|
|
14
14
|
export { Tabs, Tab, Stack } from './tab'
|
15
15
|
export { DataTable } from './table'
|
16
16
|
export { Text, TEXTFORMATS } from './text'
|
17
|
-
export { TextField, DropDown, TextArea, DateRange } from './textfield'
|
17
|
+
export { TextField, DropDown, TextArea, DateRange, PasswordField } from './textfield'
|
18
18
|
export { TokenField } from './tokenfield'
|
19
19
|
export { Tree, TreeNode, TreeItem } from './tree'
|
20
20
|
export { Switch } from './switch'
|
package/src/html/textfield.js
CHANGED
@@ -203,7 +203,9 @@ export const DropDown = (props) => {
|
|
203
203
|
)
|
204
204
|
}
|
205
205
|
|
206
|
-
|
206
|
+
/**
|
207
|
+
* Date Range
|
208
|
+
*/
|
207
209
|
export const DateRange = (props) => {
|
208
210
|
|
209
211
|
const { id, label, value, onChange } = props
|
@@ -228,4 +230,22 @@ export const DateRange = (props) => {
|
|
228
230
|
<TextField id="to" type="date" label="To" value={form.to} onChange={change} />
|
229
231
|
</div>
|
230
232
|
)
|
231
|
-
}
|
233
|
+
}
|
234
|
+
|
235
|
+
export const PasswordField = (props) => {
|
236
|
+
|
237
|
+
const { id, label, value, onChange } = props
|
238
|
+
const [show, setShow] = useState(false)
|
239
|
+
|
240
|
+
function toggle() {
|
241
|
+
setShow(!show)
|
242
|
+
}
|
243
|
+
|
244
|
+
return (
|
245
|
+
<div className="password-field">
|
246
|
+
<TextField id={id} type={show ? "text" : "password"} label={label} value={value} onChange={onChange} />
|
247
|
+
<Icon icon={show ? "visibility" : "visibility_off"} clickable size="small" action={toggle} />
|
248
|
+
</div>
|
249
|
+
)
|
250
|
+
}
|
251
|
+
|
package/src/incubator/index.js
CHANGED
@@ -0,0 +1,48 @@
|
|
1
|
+
import React, { useContext } from 'react'
|
2
|
+
import { Icon, TextField } from '../html'
|
3
|
+
import { Dialog, SiteContext } from '../site'
|
4
|
+
import { ResetPasswordBox } from '../widgets'
|
5
|
+
import './password.css'
|
6
|
+
|
7
|
+
/**
|
8
|
+
* Password Editor
|
9
|
+
*/
|
10
|
+
export const PasswordEditor = (props) => {
|
11
|
+
|
12
|
+
const site = useContext(SiteContext)
|
13
|
+
const { id, label = "Change Password", lang="ES", labelPosition = "left", className, value, onChange } = props
|
14
|
+
|
15
|
+
function onOK(form) {
|
16
|
+
if (onChange) onChange(id, form.password1)
|
17
|
+
site.closeDialog()
|
18
|
+
}
|
19
|
+
|
20
|
+
function onClose() {
|
21
|
+
site.closeDialog()
|
22
|
+
}
|
23
|
+
|
24
|
+
const openDialog = () => {
|
25
|
+
site.openDialog(<ChangePasswordDialog lang={lang} label={label} onOK={onOK} onClose={onClose} />)
|
26
|
+
}
|
27
|
+
|
28
|
+
return (
|
29
|
+
<div className={`password-editor ${className}`}>
|
30
|
+
<TextField label={label} labelPosition={labelPosition} type="password" value={value} readOnly={true} />
|
31
|
+
<Icon icon="edit" clickable action={openDialog} size="small"/>
|
32
|
+
</div>
|
33
|
+
)
|
34
|
+
}
|
35
|
+
|
36
|
+
const ChangePasswordDialog = (props) => {
|
37
|
+
|
38
|
+
const site = useContext(SiteContext)
|
39
|
+
const { id, label, lang, onChange, content, onOK, onClose } = props
|
40
|
+
|
41
|
+
return (
|
42
|
+
<Dialog title={label} onClose={onClose}>
|
43
|
+
<ResetPasswordBox lang={lang} onOK={onOK} onClose={onClose} userRequired={false} />
|
44
|
+
</Dialog>
|
45
|
+
)
|
46
|
+
}
|
47
|
+
|
48
|
+
|
package/src/site/site.test.js
CHANGED
@@ -14,6 +14,7 @@ import { TablePage2 } from '../domain/TablePage2'
|
|
14
14
|
import { CollectionPage } from '../domain/CollectionPage'
|
15
15
|
import { FORMATS, TYPES } from '../domain/ContentType'
|
16
16
|
import { TableTest } from '../html/table.test'
|
17
|
+
import { PasswordEditor } from '../incubator/password'
|
17
18
|
|
18
19
|
const SiteTest = (prop) => {
|
19
20
|
|
@@ -214,6 +215,7 @@ const Page5 = (props) => {
|
|
214
215
|
|
215
216
|
return (
|
216
217
|
<Fragment>
|
218
|
+
<PasswordEditor id="password" label="Password" value="12345678" onChange={(id, value) => console.log(id, value)} />
|
217
219
|
<CollectionPage
|
218
220
|
title="Referencias"
|
219
221
|
schema={schema} host="http://localhost:3000" url="/references" fetching={true} // resource
|