ywana-core8 0.0.952 → 0.0.954
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 +254 -228
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +80 -80
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +253 -227
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +257 -231
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/html/table.js +17 -0
package/package.json
CHANGED
package/src/html/table.js
CHANGED
@@ -5,6 +5,7 @@ import { CheckBox } from './checkbox'
|
|
5
5
|
import { Icon } from './icon'
|
6
6
|
import { Text } from './text'
|
7
7
|
import './table.css'
|
8
|
+
import { Uploader } from '../widgets/upload/Uploader'
|
8
9
|
|
9
10
|
const isFunction = value => value && (Object.prototype.toString.call(value) === "[object Function]" || "function" === typeof value || value instanceof Function);
|
10
11
|
|
@@ -235,6 +236,7 @@ const DataTableCell = ({ index, row, column, cell, editable }) => {
|
|
235
236
|
case "TEXTFIELD": return <TextField id={id} value={cell} onChange={(id, value) => onChange(row.id, id, value)} />
|
236
237
|
case "String": return <StringCellEditor id={id} value={cell} options={options} onChange={(id, value) => onChange(row.id, id, value)} />
|
237
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} />
|
238
240
|
default: return cell
|
239
241
|
}
|
240
242
|
} else {
|
@@ -244,6 +246,7 @@ const DataTableCell = ({ index, row, column, cell, editable }) => {
|
|
244
246
|
case "Boolean": return <BooleanCellViewer id={id} value={cell} />
|
245
247
|
case "String": return <StringCellViewer id={id} value={cell} format={format} options={options} action={action} />
|
246
248
|
case "Number": return <NumberCellViewer id={id} value={cell} format={format} maxDecimals={maxDecimals} />
|
249
|
+
case "Image": return <img src={cell} />
|
247
250
|
default: return cell
|
248
251
|
}
|
249
252
|
}
|
@@ -254,6 +257,20 @@ const DataTableCell = ({ index, row, column, cell, editable }) => {
|
|
254
257
|
)
|
255
258
|
}
|
256
259
|
|
260
|
+
/**
|
261
|
+
* Image Cell Viewer
|
262
|
+
*/
|
263
|
+
const ImageCellViewer = ({ id, value, uploadURL }) => {
|
264
|
+
|
265
|
+
const canUpload = uploadURL ? true : false
|
266
|
+
|
267
|
+
return canUpload ? (
|
268
|
+
<Uploader view="icon" icon="cloud_upload" target={uploadURL} />
|
269
|
+
) : (
|
270
|
+
<img src={value} />
|
271
|
+
)
|
272
|
+
}
|
273
|
+
|
257
274
|
/**
|
258
275
|
* Entity Cell Viewer
|
259
276
|
* @param {*} param0
|