ywana-core8 0.0.576 → 0.0.577

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.576",
3
+ "version": "0.0.577",
4
4
  "description": "ywana-core8",
5
5
  "homepage": "https://ywana.github.io/workspace",
6
6
  "author": "Ernesto Roldan Garcia",
@@ -333,11 +333,14 @@ const TableFilters = (props) => {
333
333
  }, [schema])
334
334
 
335
335
  useEffect(() => {
336
- if (filters) setForm(filters)
336
+ if (filters && !equal(filters, form)) setForm(filters)
337
337
  }, [filters])
338
338
 
339
339
  useEffect(() => {
340
- reload()
340
+ if (pageContext.changeFilters && !equal(filters,form)) {
341
+ pageContext.changeFilters(form)
342
+ setPageContext(Object.assign({}, pageContext))
343
+ }
341
344
  }, [form])
342
345
 
343
346
  async function change(next) {
@@ -384,6 +387,13 @@ export const TableEditor = (props) => {
384
387
  const { icon, title, schema, editable, canDelete, filter, actions, tabs, className } = props
385
388
  const [groupBy, setGroupBy] = useState(props.groupBy)
386
389
 
390
+ useEffect(async () => {
391
+ if (filters) {
392
+ await pageContext.load(filters)
393
+ setPageContext(Object.assign({}, pageContext))
394
+ }
395
+ }, [filters])
396
+
387
397
  function changeGroup(id, value) {
388
398
  setGroupBy(value)
389
399
  }
@@ -31,7 +31,7 @@ export const TablePage2 = (props) => {
31
31
  children
32
32
  } = props
33
33
 
34
- const [cd, setPageContext] = useContext(PageContext)
34
+ const [pageContext, setPageContext] = useContext(PageContext)
35
35
  const context = TableContext(url, field, host, urlQuery, params)
36
36
  const { selected } = pageContext
37
37
  const timer = useRef(null)
@@ -283,22 +283,20 @@ const TableFilters = (props) => {
283
283
  }, [schema])
284
284
 
285
285
  useEffect(() => {
286
- if (filters) setForm(filters)
286
+ if (filters && !equal(filters, form)) setForm(filters)
287
287
  }, [filters])
288
288
 
289
289
  useEffect(() => {
290
- reload()
290
+ if (pageContext.changeFilters && !equal(filters,form)) {
291
+ pageContext.changeFilters(form)
292
+ setPageContext(Object.assign({}, pageContext))
293
+ }
291
294
  }, [form])
292
295
 
293
296
  async function change(next) {
294
297
  setForm(next)
295
298
  }
296
299
 
297
- async function reload() {
298
- await pageContext.load(form)
299
- setPageContext(Object.assign({}, pageContext))
300
- }
301
-
302
300
  function clear() {
303
301
  change({})
304
302
  }
@@ -331,10 +329,17 @@ export const TableEditor = (props) => {
331
329
  const site = useContext(SiteContext)
332
330
  const [pageContext, setPageContext] = useContext(PageContext)
333
331
  const { all = [], filters } = pageContext
334
- const { icon, title, schema, editable, canDelete, filter, actions, className } = props
332
+ const { icon, title, schema, editable, canDelete, filter, actions, className, tabbedBy } = props
335
333
  const [groupBy, setGroupBy] = useState(props.groupBy)
336
334
  const [tab, setTab] = useState(0)
337
335
 
336
+ useEffect(async () => {
337
+ if (filters) {
338
+ await pageContext.load(filters)
339
+ setPageContext(Object.assign({}, pageContext))
340
+ }
341
+ }, [filters])
342
+
338
343
  useEffect(async () => {
339
344
  if (tab) {
340
345
  const filter = { [tab.field]: tab.value }
@@ -632,7 +637,7 @@ const TableAPI = (url, host, params = "") => {
632
637
  }, "")
633
638
  return query.concat(param)
634
639
  } else {
635
- return query.concat(`${key}=%${filters[key]}%&`)
640
+ return query.concat(`${key}=${filters[key]}&`)
636
641
  }
637
642
  }, "")
638
643
  queryParams = queryParams.concat(filterQuery)