ywana-core8 0.0.288 → 0.0.291

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.288",
3
+ "version": "0.0.291",
4
4
  "description": "ywana-core8",
5
5
  "author": "Ernesto Roldan Garcia",
6
6
  "license": "MIT",
@@ -318,7 +318,6 @@ export const TableEditor = (props) => {
318
318
  if (grouper.options) {
319
319
  const options = CHECK['isFunction'](grouper.options) ? grouper.options() : grouper.options
320
320
  const option = options.find(option => option.value === groupName)
321
- console.log(groupName, options, option)
322
321
  return option ? option.label : groupName
323
322
  } else {
324
323
  return groupName
package/src/html/table.js CHANGED
@@ -78,7 +78,7 @@ export const DataTable = (props) => {
78
78
  const sort = sortDir[id] ? sortDir[id] : null
79
79
  const [rowspan, colspan] = type === TYPES.ENTITY ? [1, Object.values(item).filter(v=>v.column===true).length] : [2, 1]
80
80
  return (
81
- <th rowSpan={rowspan} colSpan={colspan}>
81
+ <th key={id} rowSpan={rowspan} colSpan={colspan}>
82
82
  {id === "checked" ? <CheckBox onChange={checkAll} /> : <Text key={`th_${id}`}>{label}</Text>}
83
83
  {sortable ? <Icon icon="arrow_up" size="small" clickable /> : null}
84
84
  </th>
package/src/site/site.css CHANGED
@@ -48,17 +48,28 @@
48
48
  width: 20rem;
49
49
  }
50
50
 
51
+ .site6>menu>main {
52
+ padding: .1rem;
53
+ }
54
+
51
55
  .site6>menu>main>.site-menu-item {
52
56
  width: 100%;
53
57
  display: flex;
54
58
  align-items: center;
55
59
  }
56
60
 
57
- .site6>menu.max>main>.site-menu-item:hover {
61
+ .site6>menu.max>main>.site-menu-item:not(.selected):hover {
62
+ color: var(--text-color);
58
63
  background-color: rgba(200,200,200,.2);
59
64
  cursor: pointer;
60
65
  }
61
66
 
67
+ .site6>menu>main>.site-menu-item.selected {
68
+ color: rgb(255, 255, 255);
69
+ background-color: rgb(60, 60, 60);
70
+ border-radius: .5rem;
71
+ }
72
+
62
73
  .site6>menu>main {
63
74
  flex: 1;
64
75
  overflow-x: hidden;
package/src/site/site.js CHANGED
@@ -166,7 +166,7 @@ const SiteAside = () => {
166
166
  const SiteMenu = ({ logo, title, children, min }) => {
167
167
 
168
168
  const context = useContext(SiteContext)
169
- const { sideNav, setSideNav, showNav } = context
169
+ const { page, sideNav, setSideNav, showNav } = context
170
170
 
171
171
  useEffect(() => {
172
172
  if (min) context.setSideNav('min')
@@ -191,7 +191,6 @@ const SiteMenu = ({ logo, title, children, min }) => {
191
191
  return sections
192
192
  }, {}) : {}
193
193
 
194
-
195
194
  const style = sideNav === 'max' ? 'max' : 'min'
196
195
  const toggleIcon = sideNav === 'max' ? 'chevron_left' : 'chevron_right'
197
196
  return (
@@ -200,9 +199,10 @@ const SiteMenu = ({ logo, title, children, min }) => {
200
199
  {Object.keys(sections).map(title => (
201
200
  <Fragment key={title}>
202
201
  {sections[title].map(({ id, icon = 'info', title }) => {
202
+ const styleItem = id === page ? 'selected' : ''
203
203
  return (
204
- <div className="site-menu-item" key={id} onClick={() => goto(id)}>
205
- <Icon key={id} icon={icon} clickable checked={id === context.page} action={() => goto(id)} />
204
+ <div className={`site-menu-item ${styleItem}`} key={id} onClick={() => goto(id)}>
205
+ <Icon key={id} icon={icon} clickable action={() => goto(id)} />
206
206
  { sideNav === 'max' ? <label>{title}</label> : null }
207
207
  </div>
208
208
  )
@@ -1,19 +1,18 @@
1
- import React, { useContext, useEffect, useState } from 'react'
1
+ import React, { Fragment, useContext, useEffect, useState } from 'react'
2
+ import { SiteContext } from './siteContext'
2
3
  import { Site } from './site'
3
4
  import { Page } from './page'
4
5
  import './site.css'
5
6
  import './page.css'
6
- import { Fragment } from 'react/cjs/react.production.min'
7
- import { SiteContext } from './siteContext'
8
7
 
9
8
  const SiteTest = (prop) => {
10
9
  return (
11
- <Site icon="star" title="Site Test" init={"PAGE1"}>
10
+ <Site icon="star" title="Site Test" init={"PAGE2"}>
12
11
  <Page id="PAGE1" section="SECTION1" icon="description" title="Page 1" layout="workspace">
13
12
  <Page1 />
14
13
  </Page>
15
14
  <Page id="PAGE2" section="SECTION1" icon="description" title="Page 2" layout="workspace">
16
- 222
15
+ <Page2 />
17
16
  </Page>
18
17
  </Site>
19
18
  )
@@ -23,15 +22,24 @@ const Page1 = (props) => {
23
22
 
24
23
  const site = useContext(SiteContext)
25
24
  useEffect(() => {
26
-
27
25
  site.notify({ title: "Notification 1", body: "Lorem ipsum dolor sit amet"})
28
26
  }, [])
29
27
 
30
28
  return (
31
29
  <Fragment>
32
30
  <header>Page 1</header>
33
- <main>1</main>
31
+ <main></main>
34
32
  <footer>f1</footer>
35
33
  </Fragment>
36
34
  )
35
+ }
36
+
37
+ const Page2 = (props) => {
38
+ return (
39
+ <Fragment>
40
+ <header>Page 2</header>
41
+ <main></main>
42
+ <footer>f2</footer>
43
+ </Fragment>
44
+ )
37
45
  }
@@ -14,12 +14,21 @@ const DATE_RANGE = [
14
14
  /**
15
15
  * Planner
16
16
  */
17
- export const Planner = ({ title, events = [], lanes = [], navigation = true, onSelectCell }) => {
17
+ export const Planner = ({ title, events = [], lanes = [], navigation = true, onSelectCell, focusEvent }) => {
18
18
 
19
19
  const [dateRange, setDateRange] = useState("month");
20
20
  const [from, setFrom] = useState("2021-02-26");
21
21
  const [to, setTo] = useState("2021-04-01");
22
22
 
23
+ useEffect(() => {
24
+ const element = document.getElementById(focusEvent)
25
+ if (element) element.scrollIntoView({
26
+ behavior: 'smooth',
27
+ block: 'start',
28
+ inline: 'center'
29
+ })
30
+ }, [focusEvent])
31
+
23
32
  useEffect(() => {
24
33
  const today = moment();
25
34
  const from_date = today.startOf(dateRange).format("YYYY-MM-DD");
@@ -1,13 +1,13 @@
1
- import React from 'react'
1
+ import React, {useEffect, useState} from 'react'
2
2
  import { Planner } from './Planner'
3
3
 
4
4
  const EventCard = (props) => {
5
- const { event } = props
6
- const { title, color } = event
5
+ const { event={} } = props
6
+ const { id, title, color } = event
7
7
 
8
8
  let style = { backgroundColor : "red", color: "white" }
9
9
  return (
10
- <div className={`event-card`} style={style}>
10
+ <div id={id} className={`event-card`} style={style}>
11
11
  {title}
12
12
  </div>
13
13
  )
@@ -15,6 +15,12 @@ const EventCard = (props) => {
15
15
 
16
16
  const PlannerTest = (prop) => {
17
17
 
18
+ const [event, setEvent] = useState()
19
+
20
+ useEffect(() => {
21
+ setEvent("3")
22
+ }, [])
23
+
18
24
  const lanes = [
19
25
  { id: "lane1", label: "Lane 1" },
20
26
  { id: "lane2", label: "Lane 2" },
@@ -26,12 +32,15 @@ const PlannerTest = (prop) => {
26
32
  ]
27
33
 
28
34
  const events = [
29
- { lane: "lane1", date: "2022-02-01", color: "red", title : "Event One", Renderer: EventCard }
35
+ { id: "1", lane: "lane1", date: "2022-03-01", color: "red", title : "Event One", Renderer: EventCard },
36
+ { id: "2", lane: "lane1", date: "2022-03-22", color: "red", title : "Event One", Renderer: EventCard },
37
+ { id: "3", lane: "lane1", date: "2022-04-03", color: "red", title : "Event One", Renderer: EventCard },
38
+ { id: "4", lane: "lane1", date: "2022-03-04", color: "red", title : "Event One", Renderer: EventCard },
30
39
  ]
31
40
 
41
+
32
42
  return (
33
-
34
- <Planner title="Planner 1" lanes={lanes} events={events} navigation={true} onSelectCell={console.log}>
43
+ <Planner title="Planner 1" lanes={lanes} events={events} navigation={true} onSelectCell={console.log} focusEvent={event}>
35
44
 
36
45
  </Planner>
37
46