ywana-core8 0.0.134 → 0.0.138
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 +46 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +12 -0
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +46 -17
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +46 -17
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/TablePage.js +6 -6
- package/src/html/textfield-outlined.css +6 -0
- package/src/html/textfield.css +6 -0
- package/src/html/textfield.js +31 -13
package/package.json
CHANGED
package/src/domain/TablePage.js
CHANGED
@@ -19,7 +19,7 @@ export const TablePage = (props) => {
|
|
19
19
|
const { id = "table",
|
20
20
|
icon, title, name,
|
21
21
|
schema, url, field,
|
22
|
-
actions, dev = false, tableActions,
|
22
|
+
actions, dev = false, tableActions, selectionActions = [],
|
23
23
|
editable, canFilter = false, canQuery = false, canAdd = true, canDelete = true,
|
24
24
|
autosave = true, delay = 1000,
|
25
25
|
groupBy, validator, scenario,
|
@@ -96,7 +96,7 @@ export const TablePage = (props) => {
|
|
96
96
|
return (
|
97
97
|
<aside className="table-page">
|
98
98
|
{ rowSelected ? <TableRowEditor content={new Content(schema, form)} filter={editorFilter} onChange={change} onClose={closeAside} /> : null }
|
99
|
-
{ rowChecked ? <TableSelector schema={schema}
|
99
|
+
{ rowChecked ? <TableSelector schema={schema} actions={selectionActions} /> : null }
|
100
100
|
</aside>
|
101
101
|
)
|
102
102
|
}
|
@@ -153,16 +153,16 @@ const TableSelector = (props) => {
|
|
153
153
|
const { all, checked} = pageContext
|
154
154
|
|
155
155
|
const count = `${checked.size}/${all.length}`
|
156
|
-
|
157
156
|
const rows = all.filter(item => checked.has(item.id))
|
158
|
-
console.log(count, rows)
|
159
|
-
|
160
157
|
const table = {
|
161
158
|
columns: [
|
162
159
|
{ id:"idMatricula", label: "ID Matricula" }
|
163
160
|
],
|
164
161
|
rows: rows || []
|
165
162
|
}
|
163
|
+
const buttons = actions.map(({label, action }) => {
|
164
|
+
return <Button label={label} raised action={() => action(rows)} />
|
165
|
+
})
|
166
166
|
|
167
167
|
return (
|
168
168
|
<div className="table-selector">
|
@@ -173,7 +173,7 @@ const TableSelector = (props) => {
|
|
173
173
|
<DataTable {...table} />
|
174
174
|
</main>
|
175
175
|
<footer>
|
176
|
-
{
|
176
|
+
{ buttons }
|
177
177
|
</footer>
|
178
178
|
</div>
|
179
179
|
)
|
@@ -39,6 +39,12 @@
|
|
39
39
|
-webkit-transition: 0.2s ease all;
|
40
40
|
}
|
41
41
|
|
42
|
+
.textfield-outlined input[type="date"] ~ label {
|
43
|
+
top: .3rem;
|
44
|
+
font-size: .8rem;
|
45
|
+
color: var(--primary-color);
|
46
|
+
}
|
47
|
+
|
42
48
|
/* active state */
|
43
49
|
.textfield-outlined > input:focus ~ label,
|
44
50
|
.textfield-outlined > input:valid ~ label {
|
package/src/html/textfield.css
CHANGED
@@ -47,6 +47,12 @@ input:read-only {
|
|
47
47
|
border: 0px !important;
|
48
48
|
}
|
49
49
|
|
50
|
+
.textfield input[type="date"] ~ label {
|
51
|
+
top: .3rem;
|
52
|
+
font-size: .8rem;
|
53
|
+
color: var(--primary-color);
|
54
|
+
}
|
55
|
+
|
50
56
|
/* active state */
|
51
57
|
input:read-only ~ label,
|
52
58
|
.textfield > input:focus ~ label,
|
package/src/html/textfield.js
CHANGED
@@ -11,7 +11,7 @@ import './textfield.css'
|
|
11
11
|
export const TextField = (props) => {
|
12
12
|
|
13
13
|
const site = useContext(SiteContext)
|
14
|
-
const { id, type = 'text', label, placeholder, value, outlined, readOnly=false, onChange, onEnter, onClick } = props
|
14
|
+
const { id, type = 'text', label, placeholder, value, outlined, readOnly = false, onChange, onEnter, onClick } = props
|
15
15
|
|
16
16
|
function onKeyPress(event) {
|
17
17
|
var key = event.charCode ? event.charCode : event.keyCode ? event.keyCode : 0;
|
@@ -29,9 +29,11 @@ export const TextField = (props) => {
|
|
29
29
|
|
30
30
|
function focus() {
|
31
31
|
if (site) {
|
32
|
-
site.changeFocus({
|
33
|
-
|
34
|
-
|
32
|
+
site.changeFocus({
|
33
|
+
lose: () => {
|
34
|
+
// DO NOTHING
|
35
|
+
}
|
36
|
+
})
|
35
37
|
}
|
36
38
|
}
|
37
39
|
|
@@ -41,9 +43,9 @@ export const TextField = (props) => {
|
|
41
43
|
const labelTxt = <Text>{label}</Text>
|
42
44
|
return (
|
43
45
|
<div className={`${style}`} onClick={onClick}>
|
44
|
-
<input id={id} type={type} placeholder={placeholder} value={value} required onChange={change} onKeyDown={onKeyPress} onFocus={focus} readOnly={readOnly} onfocus="(this.type='date')" onfocusout="(this.type='text')"/>
|
46
|
+
<input id={id} type={type} placeholder={placeholder} value={value} required onChange={change} onKeyDown={onKeyPress} onFocus={focus} readOnly={readOnly} onfocus="(this.type='date')" onfocusout="(this.type='text')" />
|
45
47
|
<span className="bar"></span>
|
46
|
-
{
|
48
|
+
{label ? <label>{labelTxt}</label> : null}
|
47
49
|
</div>
|
48
50
|
)
|
49
51
|
}
|
@@ -54,9 +56,10 @@ export const TextField = (props) => {
|
|
54
56
|
export const DropDown = (props) => {
|
55
57
|
|
56
58
|
const site = useContext(SiteContext)
|
57
|
-
const { id, options = [], value, onChange } = props
|
59
|
+
const { id, options = [], value, onChange, canFilter = false } = props
|
58
60
|
const [open, setOpen] = useState(false)
|
59
61
|
const [label, setLabel] = useState()
|
62
|
+
const [filter, srtFilter] = useState()
|
60
63
|
|
61
64
|
useEffect(() => {
|
62
65
|
if (Array.isArray(options)) {
|
@@ -65,13 +68,22 @@ export const DropDown = (props) => {
|
|
65
68
|
}
|
66
69
|
}, [value])
|
67
70
|
|
71
|
+
function change(id, value) {
|
72
|
+
if (canFilter) {
|
73
|
+
setFilter(value)
|
74
|
+
} else {
|
75
|
+
if (onChange) onChange(id, value)
|
76
|
+
}
|
77
|
+
}
|
68
78
|
|
69
79
|
function toggle() {
|
70
80
|
if (site) {
|
71
|
-
site.changeFocus({
|
72
|
-
|
73
|
-
|
74
|
-
|
81
|
+
site.changeFocus({
|
82
|
+
lose: () => {
|
83
|
+
setOpen(false)
|
84
|
+
}
|
85
|
+
})
|
86
|
+
}
|
75
87
|
setOpen(!open)
|
76
88
|
}
|
77
89
|
|
@@ -83,14 +95,20 @@ export const DropDown = (props) => {
|
|
83
95
|
setOpen(false)
|
84
96
|
}
|
85
97
|
|
98
|
+
const items = (open == true && Array.isArray(options)) ?
|
99
|
+
options
|
100
|
+
.filter(option => canFilter === false || filter.toUpperCase().indexOf(option.label.toUpperCase()) >= 0 )
|
101
|
+
.map(option => <li key={option.value} value={option.value}>{option.label}</li>)
|
102
|
+
: null
|
103
|
+
|
86
104
|
return (
|
87
105
|
<div className="dropdown">
|
88
|
-
<TextField {...props} onClick={toggle} value={label} />
|
106
|
+
<TextField {...props} onClick={toggle} value={label} onChange={change} />
|
89
107
|
<Icon icon="expand_more" clickable size="small" action={toggle} />
|
90
108
|
{open == true ? (
|
91
109
|
<menu>
|
92
110
|
<ul onClick={select}>
|
93
|
-
{
|
111
|
+
{items}
|
94
112
|
</ul>
|
95
113
|
</menu>
|
96
114
|
) : null}
|