ywana-core8 0.0.231 → 0.0.235
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 +62 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +62 -34
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +62 -34
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/ContentEditor.js +16 -10
- package/src/domain/TablePage.js +17 -4
package/package.json
CHANGED
@@ -248,16 +248,22 @@ export const StringEditor = ({ field, value = '', onChange, content, outlined })
|
|
248
248
|
return opts
|
249
249
|
}
|
250
250
|
|
251
|
+
function renderFormat(format, options) {
|
252
|
+
switch (format) {
|
253
|
+
case FORMATS.HTML: return <Editor id={id} value={value} onChange={change} content={content} />
|
254
|
+
case FORMATS.DATE: return <TextField outlined={outlined} id={id} type="date" label={label} value={value} onChange={change} readOnly={!editable} />
|
255
|
+
default:
|
256
|
+
return options ? (
|
257
|
+
<DropDown outlined={outlined} id={id} label={label} value={value} onChange={change} options={buildOptions()} readOnly={!editable} canFilter={predictive} />
|
258
|
+
) : (
|
259
|
+
<TextField outlined={outlined} id={id} label={label} value={value} onChange={change} readOnly={!editable} />
|
260
|
+
)
|
261
|
+
}
|
262
|
+
}
|
263
|
+
|
251
264
|
return (
|
252
265
|
<div className='field-editor string-editor'>
|
253
|
-
|
254
|
-
{ format === FORMATS.HTML ? <Editor id={id} value={value} onChange={change} content={content}/> : null }
|
255
|
-
|
256
|
-
{
|
257
|
-
format === FORMATS.DATE ? <TextField outlined={outlined} id={id} type="date" label={label} value={value} onChange={change} readOnly={!editable} /> :
|
258
|
-
options ? <DropDown outlined={outlined} id={id} label={label} value={value} onChange={change} options={buildOptions()} readOnly={!editable} canFilter={predictive} /> :
|
259
|
-
<TextField outlined={outlined} id={id} label={label} value={value} onChange={change} readOnly={!editable} />
|
260
|
-
}
|
266
|
+
{renderFormat(format, options)}
|
261
267
|
</div>
|
262
268
|
)
|
263
269
|
}
|
@@ -272,12 +278,12 @@ const NumberEditor = ({ field, value, onChange, outlined = false }) => {
|
|
272
278
|
if (onChange) onChange(id, value)
|
273
279
|
}
|
274
280
|
|
275
|
-
const val = value ||
|
281
|
+
const val = value || value === "" ? value : field.default
|
276
282
|
const min = field.min
|
277
283
|
const max = field.max
|
278
284
|
const disabled = !editable
|
279
285
|
|
280
|
-
console.log('NumberEditor: ', label, val, value
|
286
|
+
console.log('NumberEditor: ', label, val, value)
|
281
287
|
|
282
288
|
return (
|
283
289
|
<div className='field-editor number-editor'>
|
package/src/domain/TablePage.js
CHANGED
@@ -4,7 +4,7 @@ import { Button, DataTable, DropDown, Header, Icon, MenuIcon, MenuItem, Text } f
|
|
4
4
|
import { HTTPClient, Session } from '../http'
|
5
5
|
import { PageContext, SiteContext } from '../site'
|
6
6
|
import { ContentEditor } from './ContentEditor'
|
7
|
-
import { Content } from './ContentType'
|
7
|
+
import { CHECK, Content } from './ContentType'
|
8
8
|
import { ContentViewer } from './ContentViewer'
|
9
9
|
import { CreateContentDialog } from './CreateContentDialog'
|
10
10
|
import "./TablePage.css"
|
@@ -310,15 +310,27 @@ const TableEditor = (props) => {
|
|
310
310
|
})
|
311
311
|
}
|
312
312
|
|
313
|
+
function renderGroupLabel(groupName) {
|
314
|
+
const grouper = schema[groupBy]
|
315
|
+
if (grouper.options) {
|
316
|
+
const options = CHECK['isFunction'](grouper.options) ? grouper.options() : grouper.options
|
317
|
+
const option = options.find(option => option.value === groupName)
|
318
|
+
console.log(grouperName, options, option )
|
319
|
+
return option.label ? option.label : groupName+"LABEL NOT FOUND "
|
320
|
+
} else {
|
321
|
+
return groupName
|
322
|
+
}
|
323
|
+
}
|
324
|
+
|
313
325
|
function renderGroups() {
|
314
326
|
|
315
327
|
const items = filter ? filter(all) : all
|
316
328
|
|
317
|
-
const groups = items.reduce((groups,
|
318
|
-
const groupName =
|
329
|
+
const groups = items.reduce((groups, item) => {
|
330
|
+
const groupName = item[groupBy]
|
319
331
|
const group = groups[groupName]
|
320
332
|
if (!group) groups[groupName] = []
|
321
|
-
groups[groupName].push(
|
333
|
+
groups[groupName].push(item)
|
322
334
|
return groups
|
323
335
|
}, {})
|
324
336
|
|
@@ -361,6 +373,7 @@ const TableEditor = (props) => {
|
|
361
373
|
return (
|
362
374
|
<Fragment key={groupName}>
|
363
375
|
<Header title={groupName} >
|
376
|
+
{renderGroupLabel(groupName)}
|
364
377
|
<span className="size">{groupSize}</span>
|
365
378
|
</Header>
|
366
379
|
<DataTable {...table} onRowSelection={select} editable={editable} onCheckAll={check} />
|