ywana-core8 0.0.153 → 0.0.157

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ywana-core8",
3
- "version": "0.0.153",
3
+ "version": "0.0.157",
4
4
  "description": "ywana-core8",
5
5
  "author": "Ernesto Roldan Garcia",
6
6
  "license": "MIT",
@@ -229,7 +229,7 @@ const EntityEditor = ({ field, value = {}, onChange }) => {
229
229
  * String Editor
230
230
  */
231
231
  export const StringEditor = ({ field, value = '', onChange, content, outlined }) => {
232
- const { id, format, label, options, editable = true, filter } = field
232
+ const { id, format, label, options, editable = true } = field
233
233
 
234
234
  function change(id, value) {
235
235
  if (onChange) onChange(id, value)
@@ -244,7 +244,7 @@ export const StringEditor = ({ field, value = '', onChange, content, outlined })
244
244
  <div className='field-editor string-editor'>
245
245
  {
246
246
  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={true}/> :
247
+ options ? <DropDown outlined={outlined} id={id} label={label} value={value} onChange={change} options={buildOptions()} readOnly={!editable} canFilter={false}/> :
248
248
  <TextField outlined={outlined} id={id} label={label} value={value} onChange={change} readOnly={!editable} />
249
249
  }
250
250
  </div>
@@ -23,7 +23,7 @@ export const TablePage = (props) => {
23
23
  editable, canFilter = false, canQuery = false, canAdd = true, canDelete = true,
24
24
  autosave = true, delay = 1000,
25
25
  groupBy, validator, scenario,
26
- formFilter, tableFilter, editorFilter
26
+ formFilter, tableFilter, editorFilter = false
27
27
  } = props
28
28
 
29
29
  const [pageContext, setPageContext] = useContext(PageContext)
@@ -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 || rowChecked) {
95
+ if (rowSelected || rowChecked) {
96
96
  return (
97
97
  <aside className="table-page">
98
- { rowSelected ? <TableRowEditor content={new Content(schema, form)} filter={editorFilter} onChange={change} onClose={closeAside} /> : null }
99
- { rowChecked ? <TableSelector schema={schema} actions={selectionActions} /> : null }
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,20 @@ const TableRowEditor = (props) => {
148
148
  */
149
149
  const TableSelector = (props) => {
150
150
 
151
- const { schema, actions = []} = props
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(rows)} />
163
+ const buttons = actions.map(({ label, action }) => {
164
+ return <Button label={label} raised action={() => action(checked)} />
165
165
  })
166
166
 
167
167
  return (
@@ -173,7 +173,7 @@ const TableSelector = (props) => {
173
173
  <DataTable {...table} />
174
174
  </main>
175
175
  <footer>
176
- { buttons }
176
+ {buttons}
177
177
  </footer>
178
178
  </div>
179
179
  )
@@ -56,7 +56,7 @@ export const TextField = (props) => {
56
56
  export const DropDown = (props) => {
57
57
 
58
58
  const site = useContext(SiteContext)
59
- const { id, options = [], value, onChange, canFilter = false } = props
59
+ const { id, options = [], value, onChange, canFilter = false, readOnly = false } = props
60
60
  const [open, setOpen] = useState(false)
61
61
  const [label, setLabel] = useState()
62
62
 
@@ -84,7 +84,7 @@ export const DropDown = (props) => {
84
84
  }
85
85
  })
86
86
  }
87
- setOpen(!open)
87
+ if (!readOnly) setOpen(!open)
88
88
  }
89
89
 
90
90
  function select(event) {
@@ -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
  )