ywana-core8 0.0.93 → 0.0.97

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.93",
3
+ "version": "0.0.97",
4
4
  "description": "ywana-core8",
5
5
  "author": "Ernesto Roldan Garcia",
6
6
  "license": "MIT",
@@ -16,7 +16,16 @@ const http = HTTPClient(window.API || process.env.REACT_APP_API, Session);
16
16
  export const TablePage = (props) => {
17
17
 
18
18
  const site = useContext(SiteContext)
19
- const { id = "table", icon, title, name = "table 1", schema, url, field, delay = 1000, actions, editable, canFilter=false, canAdd = true, canDelete = true, dev = false, autosave = true, groupBy, validator, scenario, formFilter, tableFilter, tableActions } = props
19
+ const { id = "table",
20
+ icon, title, name,
21
+ schema, url, field,
22
+ actions, dev = false, tableActions,
23
+ editable, canFilter = false, canQuery = false, canAdd = true, canDelete = true,
24
+ autosave = true, delay = 1000,
25
+ groupBy, validator, scenario,
26
+ formFilter, tableFilter,
27
+ } = props
28
+
20
29
  const [pageContext, setPageContext] = useContext(PageContext)
21
30
  const { selected } = pageContext
22
31
  const timer = useRef(null)
@@ -106,7 +115,10 @@ export const TablePage = (props) => {
106
115
  ) : null}
107
116
  {actions}
108
117
  </Header>
109
- {canFilter ? <menu className="table-page"><TableFilters schema={schema} /></menu> : null}
118
+ <menu className="table-page">
119
+ {canQuery ? <TableQueries schema={schema} /> : null}
120
+ {canFilter ? <TableFilters schema={schema} /> : null}
121
+ </menu>
110
122
  <main key={id} className="table-page">
111
123
  <TableEditor icon={icon} title={name} schema={schema} delay={delay} editable={editable} groupBy={groupBy} filter={tableFilter} actions={tableActions} canDelete={canDelete} />
112
124
  </main>
@@ -115,6 +127,20 @@ export const TablePage = (props) => {
115
127
  )
116
128
  }
117
129
 
130
+ /**
131
+ * Table Queries
132
+ */
133
+ const TableQueries = (props) => {
134
+ return (
135
+ <Fragment>
136
+ <Header className="table-queries" title={<Text>Queries</Text>} />
137
+ <main className="table-queries">
138
+ ...
139
+ </main>
140
+ </Fragment>
141
+ )
142
+ }
143
+
118
144
  /**
119
145
  * Table Filters
120
146
  */
@@ -132,8 +158,6 @@ const TableFilters = (props) => {
132
158
  }
133
159
 
134
160
  Object.values(filterSchema).forEach(field => field.section = null)
135
-
136
- Object.keys
137
161
  delete filterSchema.flows
138
162
  return filterSchema
139
163
  }, [schema])
@@ -145,16 +169,16 @@ const TableFilters = (props) => {
145
169
  }
146
170
 
147
171
  function clear() {
148
- setForm({})
172
+ change({})
149
173
  }
150
174
 
151
175
  const content = new Content(filterSchema, form)
152
176
  return (
153
177
  <Fragment>
154
- <Header title={<Text>Filtros</Text>} >
155
- <Button icon="filter_list_off" label="Limpiar" action={clear} />
178
+ <Header className="table-filters" title={<Text>Filters</Text>} >
179
+ <Button icon="filter_list_off" label="Clean" action={clear} />
156
180
  </Header>
157
- <main>
181
+ <main className="table-filters">
158
182
  <ContentEditor content={content} onChange={change} />
159
183
  </main>
160
184
  </Fragment>
@@ -1,5 +1,4 @@
1
1
  .datatable8 {
2
- max-height: 40rem;
3
2
  overflow: hidden;
4
3
  border: solid 0px var(--divider-color);
5
4
  background-color: var(--paper-color);
package/src/html/table.js CHANGED
@@ -80,7 +80,7 @@ export const DataTable = (props) => {
80
80
  <tbody>
81
81
  {
82
82
  multiSort(rows, sortDir).map(row => (
83
- <DataTableRow key={row.id} row={row} columns={columns} onSelect={select} onDrop={sort} editable={editable}/>
83
+ <DataTableRow key={row.id} row={row} columns={columns} onSelect={select} onDrop={sort} editable={editable} />
84
84
  ))
85
85
  }
86
86
  </tbody>
@@ -102,7 +102,7 @@ const DataTableRow = (props) => {
102
102
  return (
103
103
  <Fragment>
104
104
  <tr onClick={ev => onSelect(row, ev)}>
105
- {columns.map(column => <DataTableCell row={row} column={column} cell={row[column.id]} editable={editable}/>)}
105
+ {columns.map(column => <DataTableCell row={row} column={column} cell={row[column.id]} editable={editable} />)}
106
106
  {row.info ? <Icon icon={infoIcon} clickable action={() => toggleInfo(!isInfoOpen)} /> : null}
107
107
  </tr>
108
108
  {row.info && isInfoOpen ? (
@@ -121,7 +121,9 @@ const DataTableCell = ({ row, column, cell, editable }) => {
121
121
 
122
122
  const render = (type) => {
123
123
  const { id, disabled = false, min, max, onChange, options } = column
124
- if (editable && onChange) {
124
+ if (id === "checked") {
125
+ return <CheckBox id={id} value={cell} onChange={(id, value) => onChange(row.id, id, value)} />
126
+ } else if (editable && onChange) {
125
127
  switch (type) {
126
128
  case "ICON": return <Icon icon={cell} />
127
129
  case "BOOLEAN": return <CheckBox id={id} value={cell} onChange={(id, value) => onChange(row.id, id, value)} disabled={disabled} />
@@ -153,7 +155,7 @@ const DataTableCell = ({ row, column, cell, editable }) => {
153
155
  * Boolean Cell Viewer
154
156
  */
155
157
  const BooleanCellViewer = ({ id, value = false }) => {
156
- const icon = value === true ? "check_box" : "check_box_outline_blank"
158
+ const icon = value === true ? "check_box" : "check_box_outline_blank"
157
159
  return <Icon icon={icon} />
158
160
  }
159
161
 
@@ -161,7 +163,7 @@ const BooleanCellViewer = ({ id, value = false }) => {
161
163
  * String Cell Viewer
162
164
  */
163
165
  const StringCellViewer = ({ id, value, options }) => {
164
- const option = options ? options.find( o => o.value === value) : null
166
+ const option = options ? options.find(o => o.value === value) : null
165
167
  const text = option ? option.label : value
166
168
  return (<div className="field-editor string-editor">{text}</div>)
167
169
  }