ywana-core8 0.0.868 → 0.0.869
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 +34 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +34 -11
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +34 -11
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/ContentEditor.js +14 -2
- package/src/domain/ContentType.js +2 -0
package/package.json
CHANGED
@@ -369,7 +369,7 @@ export const ListEditor = ({ field, value = [], onChange }) => {
|
|
369
369
|
*/
|
370
370
|
export const MultiSelectionEditor = ({ field, value = [], content, onChange }) => {
|
371
371
|
|
372
|
-
const { id, label, options } = field
|
372
|
+
const { id, label, options, format = FORMATS.CHECKBOX } = field
|
373
373
|
|
374
374
|
function change(v) {
|
375
375
|
const index = value.indexOf(v)
|
@@ -386,12 +386,24 @@ export const MultiSelectionEditor = ({ field, value = [], content, onChange }) =
|
|
386
386
|
return opts
|
387
387
|
}
|
388
388
|
|
389
|
+
function renderFormat(format, options) {
|
390
|
+
switch (format) {
|
391
|
+
case FORMATS.CHECKBOX: return <CheckBoxGroup options={options} value={value} onChange={change} />
|
392
|
+
case FORMATS.RADIO: return <RadioGroup options={options} value={value} onChange={change} />
|
393
|
+
default: return <CheckBoxGroup options={options} value={value} onChange={change} />
|
394
|
+
}
|
395
|
+
}
|
396
|
+
|
389
397
|
return (
|
390
398
|
<div className="multiselection-editor">
|
391
399
|
<label>{label}</label>
|
392
400
|
{buildOptions().map(option => {
|
393
401
|
const checked = value.includes(option.value)
|
394
|
-
|
402
|
+
switch (format) {
|
403
|
+
case FORMATS.CHECKBOX: return <CheckBox value={checked} label={option.label} onChange={() => change(option.value)} />
|
404
|
+
case FORMATS.RADIO: return <RadioButton value={checked} label={option.label} onChange={() => change(option.value)} />
|
405
|
+
default: return <CheckBox value={checked} label={option.label} onChange={() => change(option.value)} />
|
406
|
+
}
|
395
407
|
})}
|
396
408
|
</div>
|
397
409
|
)
|