ywana-core8 0.0.436 → 0.0.439

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.436",
3
+ "version": "0.0.439",
4
4
  "description": "ywana-core8",
5
5
  "homepage": "https://ywana.github.io/workspace",
6
6
  "author": "Ernesto Roldan Garcia",
@@ -15,9 +15,9 @@ import "./CollectionPage.css"
15
15
  export const CollectionPage = (props) => {
16
16
 
17
17
  const site = useContext(SiteContext)
18
- const { id = "collection", icon, title, name = "Collection 1", schema, url, host, groupBy, editor, field, autosave = false, delay = 1000, actions, levels, onSelect, children } = props
18
+ const { id = "collection", icon, title, name = "Collection 1", schema, url, page, host, groupBy, editor, field, autosave = false, delay = 1000, actions, levels, onSelect, children } = props
19
19
  const [pageContext, setPageContext] = useContext(PageContext)
20
- const context = CollectionContext(url, field, host)
20
+ const context = CollectionContext(url, field, host, page)
21
21
 
22
22
  useEffect(async () => {
23
23
  await context.load()
@@ -237,7 +237,7 @@ const CollectionEditor = (props) => {
237
237
  /**
238
238
  * Collection Context
239
239
  */
240
- export const CollectionContext = (url, field, host) => {
240
+ export const CollectionContext = (url, field, host, page) => {
241
241
 
242
242
  const API = CollectionAPI(url, host)
243
243
 
@@ -248,7 +248,7 @@ export const CollectionContext = (url, field, host) => {
248
248
 
249
249
  async load() {
250
250
  try {
251
- const data = await API.all();
251
+ const data = await API.all(null, page);
252
252
  this.all = field ? data[field] : data;
253
253
  } catch (error) {
254
254
  console.log(error)
@@ -325,8 +325,8 @@ const CollectionAPI = (url, host) => {
325
325
  const http = HTTPClient(host || window.API || process.env.REACT_APP_API, Session);
326
326
 
327
327
  return {
328
- all(filters) {
329
- let queryParams = "?"
328
+ all(filters, page) {
329
+ let queryParams = page ? "?page={page}&" : "?"
330
330
  if (filters) {
331
331
  const filterQuery = Object.keys(filters).reduce((query, key) => {
332
332
  const value = filters[key]
@@ -344,7 +344,7 @@ const CollectionAPI = (url, host) => {
344
344
  }, "")
345
345
  queryParams = queryParams.concat(filterQuery)
346
346
  }
347
- return http.GET(url)
347
+ return http.GET(url + queryParams)
348
348
  },
349
349
 
350
350
  find(id) {
@@ -284,8 +284,6 @@ const NumberEditor = ({ field, value, onChange, outlined = false }) => {
284
284
  const max = field.max
285
285
  const disabled = !editable
286
286
 
287
- console.log('NumberEditor: ', label, val, value)
288
-
289
287
  return (
290
288
  <div className='field-editor number-editor'>
291
289
  <TextField outlined={outlined} id={id} label={label} type='NUMBER' value={val} max={max} min={min} onChange={change} disabled={disabled} />
@@ -89,7 +89,6 @@ const EntityViewer = (props) => {
89
89
  const ArrayViewer = (props) => {
90
90
  const { label, item, value } = props
91
91
  const columns = Object.keys(item).map(key => item[key]["label"])
92
- console.log("ARRAYVIEWER", item, value, columns)
93
92
  return (
94
93
  <div className="array-viewer">
95
94
  <header>
@@ -227,7 +227,6 @@ const TableQueries = (props) => {
227
227
  const [selected, setSelected] = useState()
228
228
 
229
229
  function select(query) {
230
- console.log("TableQueries.select", query)
231
230
  setSelected(query.id)
232
231
  pageContext.changeFilters(query.filters)
233
232
  setPageContext(Object.assign({}, pageContext))
@@ -565,7 +564,6 @@ const TableContext = (url, field, host, urlQuery) => {
565
564
  },
566
565
 
567
566
  changeFilters(filters) {
568
- console.log("TableContext.changeFilters", filters)
569
567
  this.filters = filters
570
568
  },
571
569
 
package/src/html/table.js CHANGED
@@ -5,6 +5,7 @@ import { Icon } from './icon'
5
5
  import { Text } from './text'
6
6
  import './table.css'
7
7
  import { FORMATS, TYPES } from '../domain/ContentType'
8
+ import { ColorField } from './color'
8
9
 
9
10
  const isFunction = value => value && (Object.prototype.toString.call(value) === "[object Function]" || "function" === typeof value || value instanceof Function);
10
11
 
@@ -212,6 +213,8 @@ const StringCellViewer = ({ id, value, format, options }) => {
212
213
  let text = option ? option.label : value
213
214
  const locale = window.navigator.userLanguage || window.navigator.language;
214
215
  switch (format) {
216
+ case FORMATS.COLOR:
217
+ text = <input type="color" value={text} disabled/>
215
218
  case FORMATS.URL:
216
219
  text = <a href={text} target="download" download >{text}</a>
217
220
  break;
@@ -1,4 +1,5 @@
1
1
  import React, { useState } from 'react'
2
+ import { FORMATS } from '../domain/ContentType'
2
3
  import { DataTable } from './table'
3
4
 
4
5
  const TableTest = (prop) => {
@@ -6,7 +7,7 @@ const TableTest = (prop) => {
6
7
  const [rows, setRows] = useState(
7
8
  [
8
9
  { id: 1, checked: false, name: "John Smith", thumb: "https://w7.pngwing.com/pngs/881/826/png-transparent-pikachu-ash-ketchum-pokemon-vrste-pikachu-leaf-flower-meme-thumbnail.png"},
9
- { id: 2, checked: false, name: "Ann Martin" }
10
+ { id: 2, checked: false, name: "Ann Martin", color: "#CCFFFF" }
10
11
  ]
11
12
  )
12
13
 
@@ -32,8 +33,8 @@ const TableTest = (prop) => {
32
33
  columns : [
33
34
  { id: "checked", onChange: check },
34
35
  { id: "name", label: "Name", type: "String", onChange: editCell},
35
- { id: "thumb", label: "Thumb", type: "String", format: "IMG" },
36
-
36
+ { id: "thumb", label: "Thumb", type: "String", format: FORMATS.IMG },
37
+ { id: "color", label: "Color", type: "String", format: FORMATS.COLOR },
37
38
  ],
38
39
  rows
39
40
  }
@@ -25,7 +25,6 @@ const TextFieldTest = (prop) => {
25
25
  { label: "NO", value: "false" },
26
26
  ]
27
27
 
28
- console.log(form)
29
28
  return (
30
29
  <>
31
30
  <DropDown id="b1" label="Boolean1" onChange={change} options={options2} value={form.b1} />
@@ -21,7 +21,7 @@ export const EditorBox = (props) => {
21
21
  }
22
22
 
23
23
  function split() {
24
- console.log('TODO: Split Vertical')
24
+ // console.log('TODO: Split Vertical')
25
25
  }
26
26
 
27
27
  const style = " "
@@ -52,7 +52,7 @@ export const Editor = (props) => {
52
52
  }
53
53
 
54
54
  function split() {
55
- console.log('TODO: Split Vertical')
55
+ // console.log('TODO: Split Vertical')
56
56
  }
57
57
 
58
58
  const style = " "
@@ -49,7 +49,6 @@ export const UploadIcon = ({ icon = "folder_open", resumable }) => {
49
49
  useEffect(() => {
50
50
  if (resumable && iconElement.current) {
51
51
  resumable.assignBrowse(iconElement.current)
52
- console.log('uploadicon')
53
52
  }
54
53
  }, [iconElement])
55
54