ywana-core8 0.0.484 → 0.0.487
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/db/db.json +5 -56
- package/dist/index.cjs +45 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +4 -2
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +45 -10
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +45 -10
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/ContentEditor.css +4 -2
- package/src/domain/ContentEditor.js +33 -9
- package/src/html/textfield.js +2 -1
- package/src/site/site.test.js +17 -6
package/package.json
CHANGED
@@ -2,11 +2,13 @@
|
|
2
2
|
padding: 0 1rem;
|
3
3
|
}
|
4
4
|
|
5
|
-
.content-editor>section
|
5
|
+
.content-editor>section,
|
6
|
+
.entity-editor>section {
|
6
7
|
margin-bottom: 1rem;
|
7
8
|
}
|
8
9
|
|
9
|
-
.content-editor>section>header
|
10
|
+
.content-editor>section>header,
|
11
|
+
.entity-editor>section>header {
|
10
12
|
padding: .5rem;
|
11
13
|
border-bottom: solid 1px var(--divider-color);
|
12
14
|
margin-bottom: .5rem;
|
@@ -212,19 +212,42 @@ const EntityEditor = ({ field, value = {}, onChange }) => {
|
|
212
212
|
if (onChange) onChange(id, next)
|
213
213
|
}
|
214
214
|
|
215
|
+
/*
|
215
216
|
const form = content.form()
|
216
217
|
const fields = Object.keys(form).map((key) => form[key])
|
217
|
-
|
218
|
+
|
218
219
|
return (
|
219
220
|
<div className='entity-editor'>
|
220
|
-
|
221
|
+
<header>
|
221
222
|
<Text use='caption'>{label}</Text>
|
222
|
-
|
223
|
-
|
223
|
+
</header>
|
224
|
+
<main>
|
224
225
|
{fields.map((field) => (
|
225
226
|
<FieldEditor key={field.id} field={field} onChange={change} />
|
226
|
-
|
227
|
-
|
227
|
+
))}
|
228
|
+
</main>
|
229
|
+
</div>
|
230
|
+
)
|
231
|
+
*/
|
232
|
+
|
233
|
+
const sections = content.sections()
|
234
|
+
return (
|
235
|
+
<div className={`entity-editor`}>
|
236
|
+
<header>
|
237
|
+
<Text use='caption'>{label}</Text>
|
238
|
+
</header>
|
239
|
+
{sections.map((section) => {
|
240
|
+
const { title, fields } = section
|
241
|
+
const filtered = fields.filter(field => field.id !== 'id')
|
242
|
+
return filtered.length > 0 ? (
|
243
|
+
<section key={title}>
|
244
|
+
{title && title.length > 0 ? <header>{title}</header> : null}
|
245
|
+
<main>
|
246
|
+
{filtered.map((field) => <FieldEditor key={field.id} field={field} onChange={change} outlined={true} content={content} />)}
|
247
|
+
</main>
|
248
|
+
</section>
|
249
|
+
) : null
|
250
|
+
})}
|
228
251
|
</div>
|
229
252
|
)
|
230
253
|
}
|
@@ -246,16 +269,17 @@ export const StringEditor = ({ field, value = '', onChange, content, outlined })
|
|
246
269
|
|
247
270
|
function renderFormat(format, options) {
|
248
271
|
switch (format) {
|
249
|
-
case FORMATS.COLOR: return <ColorField id={id} onChange={change} value={value}/>
|
272
|
+
case FORMATS.COLOR: return <ColorField id={id} onChange={change} value={value} />
|
250
273
|
case FORMATS.HTML: return <Editor id={id} value={value} onChange={change} content={content} />
|
251
274
|
case FORMATS.DATE: return <TextField outlined={outlined} id={id} type="date" label={label} value={value} onChange={change} readOnly={!editable} />
|
252
|
-
case FORMATS.
|
275
|
+
case FORMATS.DATERANGE: return <DateRange id={id} label={label} value={value} onChange={change} readOnly={!editable}/>
|
276
|
+
case FORMATS.TOKENS:
|
253
277
|
return <TokenField id={id} label={label} onChange={change} options={buildOptions()} tokens={value} />
|
254
278
|
default:
|
255
279
|
return options ? (
|
256
280
|
<DropDown outlined={outlined} id={id} label={label} value={value} onChange={change} options={buildOptions()} readOnly={!editable} predictive={predictive} />
|
257
281
|
) : multivalue ? (
|
258
|
-
<TokenField id={id} label={label} onChange={change} readOnly={!editable}/>
|
282
|
+
<TokenField id={id} label={label} onChange={change} readOnly={!editable} />
|
259
283
|
) : (
|
260
284
|
<TextField outlined={outlined} id={id} label={label} value={value} onChange={change} readOnly={!editable} />
|
261
285
|
)
|
package/src/html/textfield.js
CHANGED
@@ -187,7 +187,7 @@ export const DropDown = (props) => {
|
|
187
187
|
|
188
188
|
export const DateRange = (props) => {
|
189
189
|
|
190
|
-
const { id, onChange } = props
|
190
|
+
const { id, label, value, onChange } = props
|
191
191
|
const [form, setForm] = useState({})
|
192
192
|
|
193
193
|
useEffect(() => {
|
@@ -201,6 +201,7 @@ export const DateRange = (props) => {
|
|
201
201
|
|
202
202
|
return (
|
203
203
|
<div className="date-range">
|
204
|
+
{ label ? <label>{label}</label> : null }
|
204
205
|
<TextField id="from" type="date" label="From" value={form.from} onChange={change} />
|
205
206
|
<TextField id="to" type="date" label="To" value={form.to} onChange={change} />
|
206
207
|
</div>
|
package/src/site/site.test.js
CHANGED
@@ -115,20 +115,31 @@ const Page2 = (props) => {
|
|
115
115
|
|
116
116
|
const Page3 = (props) => {
|
117
117
|
|
118
|
+
const ENTITYTYPE = {
|
119
|
+
name : { id: "name" , section: "", type: TYPES.STRING, format: FORMATS.NONE , required: true, tab: false, grouper: true , column: true , filter: true , like: true, label: "Name" },
|
120
|
+
field1: { id: "field1", section: "E-INFO1", type: TYPES.STRING, format: FORMATS.NONE , required: true, tab: false, grouper: true , column: true , filter: true , label: "E field1" },
|
121
|
+
field2: { id: "field2", section: "E-INFO2", type: TYPES.STRING, format: FORMATS.NONE , required: true, tab: false, grouper: true , column: true , filter: true , label: "E field2" },
|
122
|
+
field3: { id: "field3", section: "E-INFO2", type: TYPES.STRING, format: FORMATS.NONE , required: true, tab: false, grouper: true , column: true , filter: true , label: "E field3" },
|
123
|
+
|
124
|
+
}
|
125
|
+
|
126
|
+
|
118
127
|
const schema = {
|
119
|
-
name : { id: "name" , type: TYPES.STRING, format: FORMATS.NONE , required: true, tab: false, grouper: true , column: true , filter: true , like: true, label: "Name" },
|
120
|
-
state : { id: "state" , type: TYPES.STRING, format: FORMATS.NONE , required: true, tab: true , grouper: true , column: true , filter: false , label: "State" , options: [
|
128
|
+
name : { id: "name" , section: "A", type: TYPES.STRING, format: FORMATS.NONE , required: true, tab: false, grouper: true , column: true , filter: true , like: true, label: "Name" },
|
129
|
+
state : { id: "state" , section: "A", type: TYPES.STRING, format: FORMATS.NONE , required: true, tab: true , grouper: true , column: true , filter: false , label: "State" , options: [
|
121
130
|
{ label: "Pendiente", value: "NOT_CLASSIFIED" },
|
122
131
|
{ label: "Clasificada", value: "CLASSIFIED"},
|
123
132
|
]},
|
124
|
-
field1: { id: "field1", type: TYPES.STRING, format: FORMATS.NONE , required: true, tab: false, grouper: true , column: true , filter: true , label: "field1" },
|
125
|
-
field2: { id: "field2", type: TYPES.STRING, format: FORMATS.NONE , required: true, tab: false, grouper: true , column: true , filter: true , label: "field2" },
|
126
|
-
field4: { id: "field4", type: TYPES.STRING, format: FORMATS.COLOR, required: true, tab: false, grouper: true , column: true , filter: true , label: "Color" },
|
133
|
+
field1: { id: "field1", section: "A", type: TYPES.STRING , format: FORMATS.NONE , required: true, tab: false, grouper: true , column: true , filter: true , label: "field1" },
|
134
|
+
field2: { id: "field2", section: "B", type: TYPES.STRING , format: FORMATS.NONE , required: true, tab: false, grouper: true , column: true , filter: true , label: "field2" },
|
135
|
+
field4: { id: "field4", section: "B", type: TYPES.STRING , format: FORMATS.COLOR, required: true, tab: false, grouper: true , column: true , filter: true , label: "Color" },
|
136
|
+
field5: { id: "field5", section: "B", type: TYPES.ENTITY, item: ENTITYTYPE, format: FORMATS.NONE , editable: true, tab: false, grouper: false, column: true , filter: true , like: false, label: "Entity5"},
|
137
|
+
|
127
138
|
}
|
128
139
|
|
129
140
|
return (
|
130
141
|
<Fragment>
|
131
|
-
<
|
142
|
+
<TablePage title="Referencias" schema={schema} host="http://localhost:3000" url="/references" canFilter={true} tableClassName="condensed"/>
|
132
143
|
</Fragment>
|
133
144
|
)
|
134
145
|
}
|