ywana-core8 0.0.756 → 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/dist/index.cjs +18 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +18 -7
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +18 -7
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/html/table.js +10 -6
package/package.json
CHANGED
package/src/html/table.js
CHANGED
@@ -13,7 +13,7 @@ const isFunction = value => value && (Object.prototype.toString.call(value) ===
|
|
13
13
|
*/
|
14
14
|
export const DataTable = (props) => {
|
15
15
|
|
16
|
-
const { columns = [], rows = [], onRowSelection, onSort, onCheckAll, editable, outlined, expanded = false, className } = props
|
16
|
+
const { columns = [], rows = [], onRowSelection, onSort, onCheckAll, editable, outlined, expanded = false, className, emptyMessage = "No Results Found" } = props
|
17
17
|
const [sortDir, setSortDir] = useState({})
|
18
18
|
const [allChecked, setAllChecked] = useState(false)
|
19
19
|
|
@@ -118,7 +118,7 @@ export const DataTable = (props) => {
|
|
118
118
|
<td colSpan={1000}>
|
119
119
|
<div className='empty-message'>
|
120
120
|
<Icon icon="search_off" />
|
121
|
-
<Text>
|
121
|
+
<Text>{emptyMessage}</Text>
|
122
122
|
</div>
|
123
123
|
</td>
|
124
124
|
</tr>
|
@@ -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)
|