ywana-core8 0.0.578 → 0.0.581

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.578",
3
+ "version": "0.0.581",
4
4
  "description": "ywana-core8",
5
5
  "homepage": "https://ywana.github.io/workspace",
6
6
  "author": "Ernesto Roldan Garcia",
@@ -38,13 +38,14 @@ export const TabbedTablePage = (props) => {
38
38
  const [tabs, setTabs] = useState([])
39
39
 
40
40
  useEffect(async () => {
41
+ if (canQuery) await context.loadQueries(user)
41
42
  const field = Object.values(schema).find(field => field.tab && field.tab === true)
42
43
  const tabs = field.options.map(option => Object.assign({}, option, { field: field.id }))
43
44
  setTabs(tabs)
44
45
  context.changeTab(tabs[0])
45
46
  setPageContext(context)
46
47
  }, [])
47
-
48
+
48
49
  useEffect(async () => {
49
50
  if (tab) {
50
51
  const filter = { [tab.field]: tab.value }
@@ -333,20 +334,22 @@ const TableFilters = (props) => {
333
334
  }, [schema])
334
335
 
335
336
  useEffect(() => {
336
- if (filters && !equal(filters, form)) setForm(filters)
337
+ if (filters) setForm(filters)
337
338
  }, [filters])
338
339
 
339
340
  useEffect(() => {
340
- if (pageContext.changeFilters && !equal(filters,form)) {
341
- pageContext.changeFilters(form)
342
- setPageContext(Object.assign({}, pageContext))
343
- }
341
+ reload()
344
342
  }, [form])
345
343
 
346
344
  async function change(next) {
347
345
  setForm(next)
348
346
  }
349
347
 
348
+ async function reload() {
349
+ await pageContext.load(form, likes)
350
+ setPageContext(Object.assign({}, pageContext))
351
+ }
352
+
350
353
  function clear() {
351
354
  change({})
352
355
  }
@@ -382,13 +385,6 @@ export const TableEditor = (props) => {
382
385
  const { icon, title, schema, editable, canDelete, filter, actions, tabs, className } = props
383
386
  const [groupBy, setGroupBy] = useState(props.groupBy)
384
387
 
385
- useEffect(async () => {
386
- if (filters) {
387
- await pageContext.load(filters)
388
- setPageContext(Object.assign({}, pageContext))
389
- }
390
- }, [filters])
391
-
392
388
  function changeGroup(id, value) {
393
389
  setGroupBy(value)
394
390
  }
@@ -1,4 +1,4 @@
1
- import React, {useState} from 'react'
1
+ import React, {useState, useEffect} from 'react'
2
2
  import { Icon } from './icon'
3
3
  import './accordion.css'
4
4
 
@@ -6,8 +6,15 @@ export const Accordion = (props) => {
6
6
 
7
7
  const { className, sections = [], onCheck } = props
8
8
 
9
- const [openSections, setOpenSections] = useState(sections.map(section => section.open))
10
- const [checkedSections, setCheckedSections] = useState(sections.map(section => section.checked))
9
+ const [openSections, setOpenSections] = useState([])
10
+ const [checkedSections, setCheckedSections] = useState([])
11
+
12
+ useEffect(() => {
13
+ const openSections = sections.map(section => section.open)
14
+ const checkedSections = sections.map(section => section.checked)
15
+ setOpenSections(openSections)
16
+ setCheckedSections(checkedSections)
17
+ }, [sections])
11
18
 
12
19
  function toggle(index) {
13
20
  const next = openSections.map((open, i) => i === index ? !open : open)