ywana-core8 0.0.149 → 0.0.153

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.149",
3
+ "version": "0.0.153",
4
4
  "description": "ywana-core8",
5
5
  "author": "Ernesto Roldan Garcia",
6
6
  "license": "MIT",
@@ -242,6 +242,7 @@ const TableFilters = (props) => {
242
242
  */
243
243
  const TableEditor = (props) => {
244
244
 
245
+ const site = useContext(SiteContext)
245
246
  const [pageContext, setPageContext] = useContext(PageContext)
246
247
  const { all = [], filters } = pageContext
247
248
  const { icon, title, schema, editable, canDelete, filter, actions } = props
@@ -252,9 +253,12 @@ const TableEditor = (props) => {
252
253
  }
253
254
 
254
255
  async function remove(id) {
255
- await pageContext.remove(id)
256
- pageContext.clear()
257
- setPageContext(Object.assign({}, pageContext))
256
+ const confirm = await site.confirm("Are you sure ?")
257
+ if (confirm) {
258
+ await pageContext.remove(id)
259
+ pageContext.clear()
260
+ setPageContext(Object.assign({}, pageContext))
261
+ }
258
262
  }
259
263
 
260
264
  function change(rowID, cellID, value) {
package/src/html/table.js CHANGED
@@ -77,7 +77,7 @@ export const DataTable = (props) => {
77
77
  const sort = sortDir[id] ? sortDir[id] : null
78
78
  return (
79
79
  <th>
80
- {id === "checked" ? <CheckBox onChange={checkAll} /> : <Text>{label}</Text>}
80
+ {id === "checked" ? <CheckBox onChange={checkAll} /> : <Text key={`th_${id}`}>{label}</Text>}
81
81
  {sortable ? <Icon icon="arrow_up" size="small" clickable /> : null}
82
82
  </th>
83
83
  )
@@ -98,7 +98,8 @@ export const DropDown = (props) => {
98
98
  function renderOptions() {
99
99
  const canShow = open == true && Array.isArray(options)
100
100
  if (canShow) {
101
- const filterActive = canFilter && label && label.length > 0
101
+ const filterActive = canFilter === true && label && label.length > 0
102
+ console.log('Dropdown filterActive', filterActive, canFilter, label )
102
103
  const items = filterActive ? options.filter(option => option.label.toUpperCase().indexOf(label.toUpperCase()) >= 0) : options
103
104
  const lis = items.map(option => <li key={option.value} value={option.value}>{option.label}</li>)
104
105
  return <menu><ul onClick={select}>{lis}</ul></menu>