ywana-core8 0.0.73 → 0.0.77

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.73",
3
+ "version": "0.0.77",
4
4
  "description": "ywana-core8",
5
5
  "author": "Ernesto Roldan Garcia",
6
6
  "license": "MIT",
@@ -29,6 +29,7 @@
29
29
  "deep-equal": "^2.0.5",
30
30
  "material-design-icons-iconfont": "^6.1.1",
31
31
  "react-datepicker": "^4.6.0",
32
+ "react-notifications": "^1.7.3",
32
33
  "resumablejs": "^1.1.0"
33
34
  }
34
35
  }
package/src/css/html.css CHANGED
@@ -30,4 +30,8 @@ body {
30
30
  .row {
31
31
  display: flex;
32
32
  align-items: center;
33
+ }
34
+
35
+ td.actions {
36
+ display: flex;
33
37
  }
@@ -8,14 +8,11 @@ import { TextField, CheckBox, DropDown, Form } from '../html';
8
8
  export const ContentForm = ({ content, columns = 1, filter, rules, onChange }) => {
9
9
 
10
10
  const form = content.form()
11
- console.log(form)
12
11
 
13
12
  const fields = Object.keys(form)
14
13
  .map(key => form[key])
15
14
  .filter( field => filter ? filter(field) : true)
16
15
 
17
- console.log(fields)
18
-
19
16
  return (
20
17
  <Form className="content-form" columns={columns} outlined={true} onChange={onChange}>
21
18
  { fields.map(field => <ContentFormField key={field.id} {...field} />)}
@@ -16,7 +16,7 @@ const http = HTTPClient(window.API || process.env.REACT_APP_API, Session);
16
16
  export const TablePage = (props) => {
17
17
 
18
18
  const site = useContext(SiteContext)
19
- const { id = "table", icon, title, name = "table 1", schema, url, field, delay = 1000, actions, editable, canAdd = true, canDelete = true, dev = false, autosave = true, groupBy, validator, scenario, formFilter, tableFilter, tableActions } = props
19
+ const { id = "table", icon, title, name = "table 1", schema, url, field, delay = 1000, actions, editable, canFilter=false, canAdd = true, canDelete = true, dev = false, autosave = true, groupBy, validator, scenario, formFilter, tableFilter, tableActions } = props
20
20
  const [pageContext, setPageContext] = useContext(PageContext)
21
21
  const { selected } = pageContext
22
22
  const timer = useRef(null)
@@ -46,7 +46,7 @@ export const TablePage = (props) => {
46
46
  await pageContext.create(form);
47
47
  setPageContext(Object.assign({}, pageContext))
48
48
  }
49
- site.openDialog(<CreateContentDialog label={`Crear ${name}`} type={schema} onOK={onOK} validator={validator} filter={formFilter}/>);
49
+ site.openDialog(<CreateContentDialog label={`Crear ${name}`} type={schema} onOK={onOK} validator={validator} filter={formFilter} />);
50
50
  }
51
51
 
52
52
  function change(next) {
@@ -106,11 +106,9 @@ export const TablePage = (props) => {
106
106
  ) : null}
107
107
  {actions}
108
108
  </Header>
109
- <menu className="table-page">
110
- <TableFilters schema={schema} />
111
- </menu>
109
+ {canFilter ? <menu className="table-page"><TableFilters schema={schema} /></menu> : null}
112
110
  <main key={id} className="table-page">
113
- <TableEditor icon={icon} title={name} schema={schema} delay={delay} editable={editable} groupBy={groupBy} filter={tableFilter} actions={tableActions} canDelete={canDelete}/>
111
+ <TableEditor icon={icon} title={name} schema={schema} delay={delay} editable={editable} groupBy={groupBy} filter={tableFilter} actions={tableActions} canDelete={canDelete} />
114
112
  </main>
115
113
  {renderAside()}
116
114
  </Fragment>
@@ -241,10 +239,10 @@ const TableEditor = (props) => {
241
239
  }),
242
240
  rows: groups[groupName]
243
241
  .map(item => {
244
- item.actions = actions ? actions.map(action => {
245
- return action.filter ?
246
- action.filter(item) ? <Icon icon={action.icon} clickable size="small" action={() => run(action, item) }/> : null
247
- : <Icon icon={action.icon} clickable size="small" action={() => run(action, item) }/>
242
+ item.actions = actions ? actions.map(action => {
243
+ return action.filter ?
244
+ action.filter(item) ? <Icon icon={action.icon} clickable size="small" action={() => run(action, item)} /> : null
245
+ : <Icon icon={action.icon} clickable size="small" action={() => run(action, item)} />
248
246
  }) : []
249
247
  if (canDelete) item.actions.push(<Icon icon="delete" size="small" clickable action={() => remove(item.id)} />)
250
248
  return item
@@ -253,7 +251,7 @@ const TableEditor = (props) => {
253
251
 
254
252
  table.columns.push({ id: "actions" })
255
253
  const groupSize = groups[groupName].length
256
-
254
+
257
255
  return (
258
256
  <Fragment key={groupName}>
259
257
  <Header title={groupName} >
@@ -372,7 +370,7 @@ const TableAPI = (url) => {
372
370
  if (typeof (value) === 'boolean') {
373
371
  return query.concat(`${key}=${value}&`)
374
372
  } else if (Array.isArray(value)) {
375
- const param = value.length === 0 ? '' : value.reduce((param,item) => {
373
+ const param = value.length === 0 ? '' : value.reduce((param, item) => {
376
374
  param = param.concat(`${key}=${item}&`)
377
375
  return param
378
376
  }, "")
@@ -41,7 +41,7 @@ export const TextField = (props) => {
41
41
  const labelTxt = <Text>{label}</Text>
42
42
  return (
43
43
  <div className={`${style}`} onClick={onClick}>
44
- <input id={id} type={type} placeholder={placeholder} value={value} required onChange={change} onKeyDown={onKeyPress} onFocus={focus} readOnly={readOnly}/>
44
+ <input id={id} type={type} placeholder={placeholder} value={value} required onChange={change} onKeyDown={onKeyPress} onFocus={focus} readOnly={readOnly} onfocus="(this.type='date')" onfocusout="(this.type='text')"/>
45
45
  <span className="bar"></span>
46
46
  { label ? <label>{labelTxt}</label> : null }
47
47
  </div>
package/src/site/site.js CHANGED
@@ -3,9 +3,10 @@ import { Icon } from '../html/icon'
3
3
  import { Tabs, Tab } from '../html/tab'
4
4
  import { Header } from '../html/header'
5
5
  import { Page } from './page'
6
- import './site.css'
7
6
  import { SiteContext } from './siteContext'
8
-
7
+ import { NotificationContainer, NotificationManager} from 'react-notifications'
8
+ import './site.css'
9
+ import 'react-notifications/lib/notifications.css';
9
10
 
10
11
 
11
12
  /**
@@ -64,8 +65,13 @@ export const SiteProvider = ({ children, siteLang, siteDictionary, showConsole }
64
65
 
65
66
  preview,
66
67
  openPreview: (preview) => { setPreview(preview) },
67
- closePreview: () => { setPreview(null) }
68
+ closePreview: () => { setPreview(null) },
68
69
 
70
+ confirm: (message) => window.confirm(message),
71
+
72
+ notify: (title, message) => {
73
+ NotificationManager.info(message, title)
74
+ }
69
75
  }
70
76
 
71
77
  return (
@@ -93,11 +99,18 @@ export const Site = ({ icon, logo, title, toolbar, children, init, min, lang, di
93
99
  <SiteConsole />
94
100
  <SiteDialog />
95
101
  <SitePreview />
102
+ <SiteNotifications />
96
103
  </div>
97
104
  </SiteProvider>
98
105
  )
99
106
  }
100
107
 
108
+ const SiteNotifications = () => {
109
+ return (
110
+ <NotificationContainer />
111
+ )
112
+ }
113
+
101
114
  /**
102
115
  * Site Header
103
116
  */