ywana-core8 0.0.782 → 0.0.784
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 +5012 -4902
- 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 +5011 -4903
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +5012 -4902
- 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/table.js +0 -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/incubator/task.js +28 -20
- 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/table.js
CHANGED
@@ -381,7 +381,6 @@ export const StringCellEditor = ({ id, value = '', options, onChange }) => {
|
|
381
381
|
*/
|
382
382
|
const SortIcon = (props) => {
|
383
383
|
const { sortDir, onChange } = props
|
384
|
-
console.log("sortDir", sortDir)
|
385
384
|
const icon = sortDir ? sortDir > 0 ? "arrow_upward" : "arrow_downward" : "swap_vert"
|
386
385
|
return <Icon icon={icon} size="small" clickable action={onChange} />
|
387
386
|
}
|
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", 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 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" 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/incubator/task.js
CHANGED
@@ -167,7 +167,6 @@ export const TaskMonitor = (props) => {
|
|
167
167
|
}
|
168
168
|
|
169
169
|
async function remove(task) {
|
170
|
-
console.log("remove", task)
|
171
170
|
await context.removeTask(task)
|
172
171
|
refresh()
|
173
172
|
}
|
@@ -175,30 +174,39 @@ export const TaskMonitor = (props) => {
|
|
175
174
|
const table = {
|
176
175
|
columns: [
|
177
176
|
{ id: "state", label: "Estado" },
|
177
|
+
{ id: "init", label: "Inicio", type: TYPES.STRING, format: FORMATS.DATE},
|
178
|
+
{ id: "end", label: "Fin", type: TYPES.STRING, format: FORMATS.DATE },
|
178
179
|
{ id: "description", label: "Descripcion" },
|
179
180
|
{ id: "progress", label: "%" },
|
180
181
|
{ id: "percentage", label: "" },
|
181
|
-
{ id: "
|
182
|
-
{ id: "
|
183
|
-
{ id: "resourceID", label: "Recurso" },
|
184
|
-
{ id: "owner", label: "Propietario" },
|
182
|
+
// { id: "resourceID", label: "Recurso" },
|
183
|
+
// { id: "owner", label: "Propietario" },
|
185
184
|
{ id: "actions", label: "" }
|
186
185
|
],
|
187
|
-
rows: tasks
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
186
|
+
rows: tasks
|
187
|
+
|
188
|
+
// sort by init date from recent to old
|
189
|
+
.sort((a, b) => {
|
190
|
+
if (a.init > b.init) return -1
|
191
|
+
if (a.init < b.init) return 1
|
192
|
+
return 0
|
193
|
+
})
|
194
|
+
|
195
|
+
.map(task => {
|
196
|
+
return {
|
197
|
+
id: task.id,
|
198
|
+
state: task.state,
|
199
|
+
description: task.description,
|
200
|
+
progress: <LinearProgress progress={task.percentage} />,
|
201
|
+
percentage: task.percentage,
|
202
|
+
init: task.init,
|
203
|
+
end: task.end,
|
204
|
+
resourceID: task.resourceID,
|
205
|
+
owner: task.owner,
|
206
|
+
actions: <Icon size="small" icon="cancel" clickable action={() => remove(task)} />,
|
207
|
+
info: editors && task.result ? <TaskInfo task={task} editors={editors} /> : null
|
208
|
+
}
|
209
|
+
})
|
202
210
|
}
|
203
211
|
|
204
212
|
return (
|
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
|