ywana-core8 0.0.155 → 0.0.159
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 +66 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +66 -52
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +66 -52
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/ContentEditor.js +22 -18
- package/src/domain/TablePage.js +12 -9
- package/src/html/textfield.js +1 -1
package/package.json
CHANGED
@@ -28,7 +28,7 @@ export const ContentEditor = ({ content, filter, onChange }) => {
|
|
28
28
|
|
29
29
|
return filtered.length > 0 ? (
|
30
30
|
<section key={title}>
|
31
|
-
{
|
31
|
+
{title && title.length > 0 ? <header>{title}</header> : null}
|
32
32
|
<main>
|
33
33
|
{filtered.map((field) => <FieldEditor key={field.id} field={field} onChange={change} outlined={true} />)}
|
34
34
|
</main>
|
@@ -168,7 +168,7 @@ export const TreededContentEditor = ({ content, filter, onChange }) => {
|
|
168
168
|
* FieldEditor
|
169
169
|
*/
|
170
170
|
export const FieldEditor = ({ field, onChange, content, outlined = false }) => {
|
171
|
-
const { id, type, item, label, editable, options } = field
|
171
|
+
const { id, type, item, label, editable, options, hidden } = field
|
172
172
|
|
173
173
|
function change(id, value) {
|
174
174
|
if (onChange) onChange(id, value)
|
@@ -176,21 +176,25 @@ export const FieldEditor = ({ field, onChange, content, outlined = false }) => {
|
|
176
176
|
|
177
177
|
function renderField() {
|
178
178
|
const value1 = field.value ? field.value : field.default
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
179
|
+
if (hidden(field, value1)) {
|
180
|
+
return null
|
181
|
+
} else {
|
182
|
+
switch (type) {
|
183
|
+
case TYPES.ENTITY:
|
184
|
+
return <EntityEditor field={field} value={value1} onChange={change} />
|
185
|
+
case TYPES.STRING:
|
186
|
+
return <StringEditor outlined={outlined} field={field} value={value1} onChange={change} content={content} />
|
187
|
+
case TYPES.BOOLEAN:
|
188
|
+
return <CheckBox outlined id={id} label={label} value={value1} onChange={change} />
|
189
|
+
case TYPES.NUMBER:
|
190
|
+
return <NumberEditor outlined={outlined} field={field} value={value1} onChange={change} />
|
191
|
+
case TYPES.ARRAY:
|
192
|
+
return item === TYPES.STRING ?
|
193
|
+
options ? <MultiSelectionEditor content={content} field={field} value={value1} onChange={change} /> : <ListEditor field={field} value={value1} onChange={change} />
|
194
|
+
: <CollectionEditor field={field} value={value1} onChange={change} />
|
195
|
+
default:
|
196
|
+
return <div>{label}</div>
|
197
|
+
}
|
194
198
|
}
|
195
199
|
}
|
196
200
|
return renderField()
|
@@ -244,7 +248,7 @@ export const StringEditor = ({ field, value = '', onChange, content, outlined })
|
|
244
248
|
<div className='field-editor string-editor'>
|
245
249
|
{
|
246
250
|
format === FORMATS.DATE ? <TextField outlined={outlined} id={id} type="date" label={label} value={value} onChange={change} readOnly={!editable} /> :
|
247
|
-
options ? <DropDown outlined={outlined} id={id} label={label} value={value} onChange={change} options={buildOptions()} readOnly={!editable} canFilter={false}/> :
|
251
|
+
options ? <DropDown outlined={outlined} id={id} label={label} value={value} onChange={change} options={buildOptions()} readOnly={!editable} canFilter={false} /> :
|
248
252
|
<TextField outlined={outlined} id={id} label={label} value={value} onChange={change} readOnly={!editable} />
|
249
253
|
}
|
250
254
|
</div>
|
package/src/domain/TablePage.js
CHANGED
@@ -92,11 +92,11 @@ export const TablePage = (props) => {
|
|
92
92
|
function renderAside() {
|
93
93
|
const rowSelected = selected && form
|
94
94
|
const rowChecked = pageContext.checked && pageContext.checked.size > 0
|
95
|
-
if (rowSelected ||
|
95
|
+
if (rowSelected || rowChecked) {
|
96
96
|
return (
|
97
97
|
<aside className="table-page">
|
98
|
-
{
|
99
|
-
{
|
98
|
+
{rowSelected ? <TableRowEditor content={new Content(schema, form)} filter={editorFilter} onChange={change} onClose={closeAside} /> : null}
|
99
|
+
{rowChecked ? <TableSelector schema={schema} actions={selectionActions} /> : null}
|
100
100
|
</aside>
|
101
101
|
)
|
102
102
|
}
|
@@ -148,20 +148,23 @@ const TableRowEditor = (props) => {
|
|
148
148
|
*/
|
149
149
|
const TableSelector = (props) => {
|
150
150
|
|
151
|
-
const {
|
151
|
+
const { schema, actions = [] } = props
|
152
152
|
const [pageContext, setPageContext] = useContext(PageContext)
|
153
|
-
const { all, checked} = pageContext
|
153
|
+
const { all, checked } = pageContext
|
154
154
|
|
155
155
|
const count = `${checked.size}/${all.length}`
|
156
156
|
const rows = all.filter(item => checked.has(item.id))
|
157
157
|
const table = {
|
158
158
|
columns: [
|
159
|
-
{ id:"idMatricula", label: "ID Matricula" }
|
159
|
+
{ id: "idMatricula", label: "ID Matricula" }
|
160
160
|
],
|
161
161
|
rows: rows || []
|
162
162
|
}
|
163
|
-
const buttons = actions.map(({label, action }) => {
|
164
|
-
return <Button label={label} raised action={() => action(
|
163
|
+
const buttons = actions.map(({ label, action }) => {
|
164
|
+
return <Button label={label} raised action={() => action(checked, pageContext, async () => {
|
165
|
+
await pageContext.load()
|
166
|
+
setPageContext(Object.assign({}, pageContext))
|
167
|
+
})} />
|
165
168
|
})
|
166
169
|
|
167
170
|
return (
|
@@ -173,7 +176,7 @@ const TableSelector = (props) => {
|
|
173
176
|
<DataTable {...table} />
|
174
177
|
</main>
|
175
178
|
<footer>
|
176
|
-
{
|
179
|
+
{buttons}
|
177
180
|
</footer>
|
178
181
|
</div>
|
179
182
|
)
|
package/src/html/textfield.js
CHANGED
@@ -111,7 +111,7 @@ export const DropDown = (props) => {
|
|
111
111
|
return (
|
112
112
|
<div className="dropdown">
|
113
113
|
<TextField {...props} onClick={toggle} value={label} onChange={change} />
|
114
|
-
<Icon icon="expand_more" clickable size="small" action={toggle} />
|
114
|
+
{!readOnly ? <Icon icon="expand_more" clickable size="small" action={toggle} /> : null }
|
115
115
|
{renderOptions()}
|
116
116
|
</div>
|
117
117
|
)
|