ywana-core8 0.0.17 → 0.0.21
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/dist/index.cjs +689 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +29 -0
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +688 -20
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +689 -20
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/CollectionPage.js +2 -2
- package/src/domain/TablePage.js +14 -7
- package/src/domain/index.js +1 -0
package/package.json
CHANGED
@@ -5,7 +5,7 @@ import { PageContext } from '../site'
|
|
5
5
|
import { Button, Header, Icon, List, Menu, MenuIcon, MenuItem, Text, Tree, TreeItem, TreeNode } from '../html'
|
6
6
|
import { Content } from './ContentType'
|
7
7
|
import { ContentEditor, TabbedContentEditor, TreededContentEditor } from './ContentEditor'
|
8
|
-
import {
|
8
|
+
import { CreateContentDialog } from './CreateContentDialog_old'
|
9
9
|
import { SiteContext } from '../site/siteContext'
|
10
10
|
import "./CollectionPage.css"
|
11
11
|
|
@@ -37,7 +37,7 @@ export const CollectionPage = (props) => {
|
|
37
37
|
await pageContext.create(form);
|
38
38
|
setPageContext(Object.assign({}, pageContext))
|
39
39
|
}
|
40
|
-
site.openDialog(<
|
40
|
+
site.openDialog(<CreateContentDialog label={`${name}`} type={schema} onOK={onOK} />);
|
41
41
|
}
|
42
42
|
|
43
43
|
return (
|
package/src/domain/TablePage.js
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
import equal from 'deep-equal'
|
2
2
|
import React, { Fragment, useContext, useEffect, useMemo, useRef, useState } from 'react'
|
3
|
-
import { EditContentDialog } from '
|
4
|
-
import { Content
|
5
|
-
import {
|
6
|
-
import {
|
3
|
+
import { EditContentDialog } from './EditContentDialog'
|
4
|
+
import { Content } from './ContentType'
|
5
|
+
import { ContentEditor } from './ContentEditor'
|
6
|
+
import { HTTPClient, Session } from '../http'
|
7
|
+
import { SiteContext, PageContext } from '../site'
|
7
8
|
import { Button, DataTable, DropDown, Header, Icon, MenuIcon, MenuItem, Text } from '../html'
|
8
9
|
import "./TablePage.css"
|
9
10
|
|
@@ -15,7 +16,7 @@ const http = HTTPClient(window.API || process.env.REACT_APP_API, Session);
|
|
15
16
|
export const TablePage = (props) => {
|
16
17
|
|
17
18
|
const site = useContext(SiteContext)
|
18
|
-
const { id = "table", icon, title, name = "table 1", schema, url, field, delay = 1000, actions, editable, canAdd = true, dev =
|
19
|
+
const { id = "table", icon, title, name = "table 1", schema, url, field, delay = 1000, actions, editable, canAdd = true, dev = false, autosave = true, groupBy, validator, scenario } = props
|
19
20
|
const [pageContext, setPageContext] = useContext(PageContext)
|
20
21
|
const { selected } = pageContext
|
21
22
|
const timer = useRef(null)
|
@@ -66,7 +67,7 @@ export const TablePage = (props) => {
|
|
66
67
|
async function playScenario() {
|
67
68
|
const promises1 = pageContext.all.map(async item => await pageContext.remove(item.id))
|
68
69
|
Promise.all(promises1).then(async () => {
|
69
|
-
const promises2 =
|
70
|
+
const promises2 = scenario.map(async (item) => await pageContext.create(item))
|
70
71
|
Promise.all(promises2).then(async () => {
|
71
72
|
await pageContext.load()
|
72
73
|
setPageContext(Object.assign({}, pageContext))
|
@@ -266,10 +267,16 @@ const TableEditor = (props) => {
|
|
266
267
|
|
267
268
|
table.columns.push({ id: "actions" })
|
268
269
|
|
270
|
+
function buildGroupOptions(schema) {
|
271
|
+
return Object.values(schema)
|
272
|
+
.filter(field => field.grouper === true)
|
273
|
+
.map(field => ({ label: field.label, value: field.id }))
|
274
|
+
}
|
275
|
+
|
269
276
|
return (
|
270
277
|
<Fragment>
|
271
278
|
<Header icon={icon} title={<Text>{title}</Text>}>
|
272
|
-
<DropDown id="groupBy" label="Agrupar Por" value={groupBy} options={
|
279
|
+
<DropDown id="groupBy" label="Agrupar Por" value={groupBy} options={buildGroupOptions(schema)} onChange={changeGroup} />
|
273
280
|
</Header>
|
274
281
|
<main className="table-editor">
|
275
282
|
{renderGroups()}
|
package/src/domain/index.js
CHANGED
@@ -4,3 +4,4 @@ export { ContentEditor, TabbedContentEditor, CollectionEditor, TreededContentEdi
|
|
4
4
|
export { CreateContentDialog } from './CreateContentDialog'
|
5
5
|
export { EditContentDialog } from './EditContentDialog'
|
6
6
|
export { CollectionPage, CollectionContext } from './CollectionPage'
|
7
|
+
export { TablePage } from './TablePage'
|