ywana-core8 0.0.757 → 0.0.758

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.757",
3
+ "version": "0.0.758",
4
4
  "description": "ywana-core8",
5
5
  "homepage": "https://ywana.github.io/workspace",
6
6
  "author": "Ernesto Roldan Garcia",
package/src/html/table.js CHANGED
@@ -163,7 +163,7 @@ const DataTableRow = (props) => {
163
163
  const DataTableCell = ({ index, row, column, cell, editable }) => {
164
164
 
165
165
  const render = (type) => {
166
- const { id, disabled = false, min, max, onChange, format, options, item } = column
166
+ const { id, disabled = false, min, max, onChange, format, options, item, action } = column
167
167
 
168
168
 
169
169
  if (id === "checked") {
@@ -186,7 +186,7 @@ const DataTableCell = ({ index, row, column, cell, editable }) => {
186
186
  case "INDEX": return <span>{index}</span>
187
187
  case "ICON": return <Icon icon={cell} />
188
188
  case "Boolean": return <BooleanCellViewer id={id} value={cell} />
189
- case "String": return <StringCellViewer id={id} value={cell} format={format} options={options} />
189
+ case "String": return <StringCellViewer id={id} value={cell} format={format} options={options} action={action} />
190
190
  default: return cell
191
191
  }
192
192
  }
@@ -247,13 +247,17 @@ const BooleanCellViewer = ({ id, value = false }) => {
247
247
  /**
248
248
  * String Cell Viewer
249
249
  */
250
- const StringCellViewer = ({ id, value, format, options }) => {
250
+ const StringCellViewer = ({ id, value, format, options, action }) => {
251
251
 
252
252
  function buildOptions() {
253
253
  const opts = typeof options === 'function' ? options() : options
254
254
  return opts
255
255
  }
256
256
 
257
+ function onClick() {
258
+ if (action) action(id, value, format, options)
259
+ }
260
+
257
261
  const option = options ? buildOptions().find(o => o.value === value) : null
258
262
  let text = option ? option.label : value
259
263
  const className = option ? option.className : ''
@@ -265,7 +269,7 @@ const StringCellViewer = ({ id, value, format, options }) => {
265
269
  text = <a href={text} target="download" download >{text}</a>
266
270
  break;
267
271
  case FORMATS.IMG:
268
- text = <img src={text} />
272
+ text = <img src={text} onClick={onClick}/>
269
273
  break;
270
274
  case FORMATS.DATE:
271
275
  let fecha = new Date(text)