ywana-core8 0.0.92 → 0.0.96
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 +36 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +0 -1
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +36 -16
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +36 -16
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/TablePage.js +32 -8
- package/src/html/table.css +0 -1
- package/src/html/table.js +7 -5
- package/src/upload/uploader.js +1 -1
package/package.json
CHANGED
package/src/domain/TablePage.js
CHANGED
@@ -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",
|
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
|
-
|
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
|
-
|
172
|
+
change({})
|
149
173
|
}
|
150
174
|
|
151
175
|
const content = new Content(filterSchema, form)
|
152
176
|
return (
|
153
177
|
<Fragment>
|
154
|
-
<Header title={<Text>
|
155
|
-
<Button icon="filter_list_off" label="
|
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>
|
package/src/html/table.css
CHANGED
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 (
|
124
|
+
if (id === "checked") {
|
125
|
+
<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 ?
|
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(
|
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
|
}
|
package/src/upload/uploader.js
CHANGED
@@ -11,7 +11,7 @@ const STATES = {
|
|
11
11
|
/**
|
12
12
|
* Uploader
|
13
13
|
*/
|
14
|
-
export const Uploader = ({ label, target, accept, simultaneousUploads = 1, className, onSuccess, onError, onComplete, errors = [] }) => {
|
14
|
+
export const Uploader = ({ label, target, accept, simultaneousUploads = 1, className, onProgress, onSuccess, onError, onComplete, errors = [] }) => {
|
15
15
|
|
16
16
|
|
17
17
|
const resumable = useMemo(() => {
|