ywana-core8 0.0.150 → 0.0.154

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.150",
3
+ "version": "0.0.154",
4
4
  "description": "ywana-core8",
5
5
  "author": "Ernesto Roldan Garcia",
6
6
  "license": "MIT",
@@ -229,7 +229,7 @@ const EntityEditor = ({ field, value = {}, onChange }) => {
229
229
  * String Editor
230
230
  */
231
231
  export const StringEditor = ({ field, value = '', onChange, content, outlined }) => {
232
- const { id, format, label, options, editable = true, filter } = field
232
+ const { id, format, label, options, editable = true, filter=false } = field
233
233
 
234
234
  function change(id, value) {
235
235
  if (onChange) onChange(id, value)
@@ -244,7 +244,7 @@ export const StringEditor = ({ field, value = '', onChange, content, outlined })
244
244
  <div className='field-editor string-editor'>
245
245
  {
246
246
  format === FORMATS.DATE ? <TextField outlined={outlined} id={id} type="date" label={label} value={value} onChange={change} readOnly={!editable} /> :
247
- options ? <DropDown outlined={outlined} id={id} label={label} value={value} onChange={change} options={buildOptions()} readOnly={!editable} canFilter={true}/> :
247
+ options ? <DropDown outlined={outlined} id={id} label={label} value={value} onChange={change} options={buildOptions()} readOnly={!editable} canFilter={filter}/> :
248
248
  <TextField outlined={outlined} id={id} label={label} value={value} onChange={change} readOnly={!editable} />
249
249
  }
250
250
  </div>
@@ -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) {
@@ -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>