ywana-core8 0.0.263 → 0.0.266

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.263",
3
+ "version": "0.0.266",
4
4
  "description": "ywana-core8",
5
5
  "author": "Ernesto Roldan Garcia",
6
6
  "license": "MIT",
@@ -180,9 +180,6 @@ export const FieldEditor = ({ field, onChange, content, outlined = false }) => {
180
180
  if (isHidden) {
181
181
  return null
182
182
  } else {
183
-
184
- console.log("FieldEditor: ", label, value1)
185
-
186
183
  switch (type) {
187
184
  case TYPES.ENTITY:
188
185
  return <EntityEditor field={field} value={value1} onChange={change} />
@@ -21,7 +21,7 @@ export const TablePage = (props) => {
21
21
  icon, title, name,
22
22
  schema, url, field,
23
23
  autosave = true, delay = 1000,
24
- editable,
24
+ editable,
25
25
  actions = [], dev = false, tableActions, selectionActions = [],
26
26
  canFilter = false, canQuery = false, canAdd = true, canDelete = true, canEdit = true,
27
27
  groupBy, validator, scenario,
@@ -97,7 +97,7 @@ export const TablePage = (props) => {
97
97
  if (rowSelected || rowChecked) {
98
98
  return (
99
99
  <aside className="table-page">
100
- {rowSelected ? <TableRowEditor content={new Content(schema, form)} filter={editorFilter} onChange={change} onClose={closeAside} editable={canEdit}/> : null}
100
+ {rowSelected ? <TableRowEditor content={new Content(schema, form)} filter={editorFilter} onChange={change} onClose={closeAside} editable={canEdit} /> : null}
101
101
  {rowChecked ? <TableSelector schema={schema} actions={selectionActions} /> : null}
102
102
  </aside>
103
103
  )
@@ -108,7 +108,7 @@ export const TablePage = (props) => {
108
108
  function renderActions() {
109
109
  return actions.map(element => {
110
110
  const action = () => element.props.action(pageContext)
111
- const clone = React.cloneElement(element, { action })
111
+ const clone = React.cloneElement(element, { action })
112
112
  return clone
113
113
  })
114
114
  }
@@ -124,10 +124,12 @@ export const TablePage = (props) => {
124
124
  ) : null}
125
125
  {renderActions()}
126
126
  </Header>
127
- <menu className="table-page">
128
- {canQuery ? <TableQueries schema={schema} /> : null}
129
- {canFilter ? <TableFilters schema={schema} /> : null}
130
- </menu>
127
+ {canQuery || canFilter ? (
128
+ <menu className="table-page">
129
+ {canQuery ? <TableQueries schema={schema} /> : null}
130
+ {canFilter ? <TableFilters schema={schema} /> : null}
131
+ </menu>
132
+ ) : null)}
131
133
  <main key={id} className="table-page">
132
134
  <TableEditor icon={icon} title={name} schema={schema} delay={delay} editable={editable} groupBy={groupBy} filter={tableFilter} actions={tableActions} canDelete={canDelete} />
133
135
  </main>
@@ -147,7 +149,7 @@ const TableRowEditor = (props) => {
147
149
  <Icon icon="close" clickable action={onClose} />
148
150
  </Header>
149
151
  <main>
150
- { editable ? <ContentEditor content={content} onChange={onChange} filter={filter} /> : <ContentViewer content={content} /> }
152
+ {editable ? <ContentEditor content={content} onChange={onChange} filter={filter} /> : <ContentViewer content={content} />}
151
153
  </main>
152
154
  </div>
153
155
  )
@@ -313,12 +315,12 @@ export const TableEditor = (props) => {
313
315
  function renderGroupLabel(groupName) {
314
316
  const grouper = schema[groupBy]
315
317
 
316
- if (!groupName || !grouper) return ""
318
+ if (!groupName || !grouper) return ""
317
319
 
318
320
  if (grouper.options) {
319
321
  const options = CHECK['isFunction'](grouper.options) ? grouper.options() : grouper.options
320
322
  const option = options.find(option => option.value === groupName)
321
- console.log(groupName, options, option )
323
+ console.log(groupName, options, option)
322
324
  return option ? option.label : groupName
323
325
  } else {
324
326
  return groupName
package/src/site/site.css CHANGED
@@ -15,7 +15,6 @@
15
15
  background-color: var(--site-header-bgcolor);
16
16
  display: flex;
17
17
  align-items: center;
18
- width: var(--site-menu-width);
19
18
  }
20
19
 
21
20
  .site6>nav {
@@ -45,6 +44,21 @@
45
44
  width: var(--site-menu-width);
46
45
  }
47
46
 
47
+ .site6>menu.max {
48
+ width: 20rem;
49
+ }
50
+
51
+ .site6>menu>main>.site-menu-item {
52
+ width: 100%;
53
+ display: flex;
54
+ align-items: center;
55
+ }
56
+
57
+ .site6>menu.max>main>.site-menu-item:hover {
58
+ background-color: rgba(200,200,200,.2);
59
+ cursor: pointer;
60
+ }
61
+
48
62
  .site6>menu>main {
49
63
  flex: 1;
50
64
  overflow-x: hidden;
package/src/site/site.js CHANGED
@@ -4,7 +4,12 @@ import { Tabs, Tab } from '../html/tab'
4
4
  import { Header } from '../html/header'
5
5
  import { Page } from './page'
6
6
  import { SiteContext } from './siteContext'
7
- import { NotificationContainer, NotificationManager} from 'react-notifications'
7
+
8
+ /*
9
+ import { NotificationManager } from 'react-notifications'
10
+ import { NotificationContainer } from 'react-notifications'
11
+ */
12
+
8
13
  import './site.css'
9
14
  import 'react-notifications/lib/notifications.css';
10
15
 
@@ -69,8 +74,8 @@ export const SiteProvider = ({ children, siteLang, siteDictionary, showConsole }
69
74
 
70
75
  confirm: (message) => window.confirm(message),
71
76
 
72
- notify: ({title, body}) => {
73
- NotificationManager.info(body, title)
77
+ notify: ({ title, body }) => {
78
+ //NotificationManager.info(body, title)
74
79
  }
75
80
  }
76
81
 
@@ -106,6 +111,9 @@ export const Site = ({ icon, logo, title, toolbar, children, init, min, lang, di
106
111
  }
107
112
 
108
113
  const SiteNotifications = () => {
114
+ return (
115
+ <div></div>
116
+ )
109
117
  return (
110
118
  <NotificationContainer />
111
119
  )
@@ -151,17 +159,22 @@ const SiteAside = () => {
151
159
  const SiteMenu = ({ logo, title, children, min }) => {
152
160
 
153
161
  const context = useContext(SiteContext)
154
- const { sideNav, showNav } = context
155
- const toggleIcon = sideNav === 'max' ? 'chevron_left' : 'chevron_right'
162
+ const { sideNav, setSideNav, showNav } = context
156
163
 
157
164
  useEffect(() => {
158
165
  if (min) context.setSideNav('min')
159
166
  }, [])
160
167
 
168
+ function toggle() {
169
+ const next = sideNav === 'max' ? 'min' : 'max'
170
+ setSideNav(next)
171
+ }
172
+
161
173
  const goto = (id) => {
162
174
  context.setShowNav(false)
163
175
  context.goto(id)
164
176
  }
177
+
165
178
  const sections = children ?
166
179
  Children.toArray(children).reduce((sections, page) => {
167
180
  const section = page.props ? page.props.section : '...'
@@ -171,18 +184,29 @@ const SiteMenu = ({ logo, title, children, min }) => {
171
184
  return sections
172
185
  }, {}) : {}
173
186
 
187
+
188
+ const style = sideNav === 'max' ? 'max' : 'min'
189
+ const toggleIcon = sideNav === 'max' ? 'chevron_left' : 'chevron_right'
174
190
  return (
175
- <menu className={`min ${showNav ? 'show' : ''}`}>
191
+ <menu className={`${style} ${showNav ? 'show' : ''}`}>
176
192
  <main >
177
193
  {Object.keys(sections).map(title => (
178
194
  <Fragment key={title}>
179
195
  {sections[title].map(({ id, icon = 'info', title }) => {
180
- return (<Icon key={id} icon={icon} clickable checked={id === context.page} action={() => goto(id)} />)
196
+ return (
197
+ <div className="site-menu-item" key={id} onClick={() => goto(id)}>
198
+ <Icon key={id} icon={icon} clickable checked={id === context.page} action={() => goto(id)} />
199
+ { sideNav === 'max' ? <label>{title}</label> : null }
200
+ </div>
201
+ )
181
202
  })}
182
203
  <div className="section-divider" ></div>
183
204
  </Fragment>
184
205
  ))}
185
206
  </main>
207
+ <footer>
208
+ <Icon icon={toggleIcon} clickable action={toggle} />
209
+ </footer>
186
210
  </menu>
187
211
  )
188
212
  }
@@ -0,0 +1,19 @@
1
+ import React, { useState } from 'react'
2
+ import { Site } from './site'
3
+ import { Page } from './page'
4
+ import './site.css'
5
+ import './page.css'
6
+
7
+ const SiteTest = (prop) => {
8
+
9
+ return (
10
+ <Site icon="star" title="Site Test" init={"PAGE1"}>
11
+ <Page id="PAGE1" section="SECTION1" icon="description" title="Page 1">
12
+ 111
13
+ </Page>
14
+ <Page id="PAGE2" section="SECTION1" icon="description" title="Page 2">
15
+ 222
16
+ </Page>
17
+ </Site>
18
+ )
19
+ }
@@ -195,7 +195,7 @@ const PlannerCell = ({ lane, events, date, disabled = false, onAdd, onDelete, on
195
195
  return (
196
196
  <div className={`cell ${weekend}`} onDragOver={onDragOver} onDragLeave={onDragLeave} onDrop={drop} onClick={select}>
197
197
  {events.map(event => {
198
- const { title, color, Renderer = EventCard } = event
198
+ const { Renderer = EventCard } = event
199
199
  return <Renderer event={event} />
200
200
  })}
201
201
  </div>