ywana-core8 0.0.954 → 0.0.955
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 +16 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +16 -4
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +16 -4
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/html/table.js +12 -3
package/package.json
CHANGED
package/src/html/table.js
CHANGED
@@ -236,7 +236,7 @@ const DataTableCell = ({ index, row, column, cell, editable }) => {
|
|
236
236
|
case "TEXTFIELD": return <TextField id={id} value={cell} onChange={(id, value) => onChange(row.id, id, value)} />
|
237
237
|
case "String": return <StringCellEditor id={id} value={cell} options={options} onChange={(id, value) => onChange(row.id, id, value)} />
|
238
238
|
case "Number": return <TextField id={id} type="number" value={cell} min={min} max={max} maxDecimals={column.maxDecimals} onChange={(id, value) => onChange(row.id, id, value)} />
|
239
|
-
case "Image": return <ImageCellViewer id={id} value={cell} uploadURL={column.uploadURL} />
|
239
|
+
case "Image": return <ImageCellViewer id={id} value={cell} uploadURL={column.uploadURL} onUpload={column.onUpload} />
|
240
240
|
default: return cell
|
241
241
|
}
|
242
242
|
} else {
|
@@ -260,12 +260,21 @@ const DataTableCell = ({ index, row, column, cell, editable }) => {
|
|
260
260
|
/**
|
261
261
|
* Image Cell Viewer
|
262
262
|
*/
|
263
|
-
const ImageCellViewer = ({ id, value, uploadURL }) => {
|
263
|
+
const ImageCellViewer = ({ id, value, uploadURL, onUpload }) => {
|
264
264
|
|
265
265
|
const canUpload = uploadURL ? true : false
|
266
266
|
|
267
|
+
function success(file, message) {
|
268
|
+
if (onUpload) onUpload(id, file, message)
|
269
|
+
}
|
270
|
+
|
271
|
+
function error(file, message) {
|
272
|
+
if (onUpload) onUpload(id, file, message)
|
273
|
+
console.error(message)
|
274
|
+
}
|
275
|
+
|
267
276
|
return canUpload ? (
|
268
|
-
<Uploader view="icon" icon="cloud_upload" target={uploadURL} />
|
277
|
+
<Uploader view="icon" icon="cloud_upload" target={uploadURL} onSuccess={success} onError={error} />
|
269
278
|
) : (
|
270
279
|
<img src={value} />
|
271
280
|
)
|