@visns-studio/visns-components 3.5.3 → 3.5.4
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/components/crm/Field.jsx +62 -8
- package/package.json +1 -1
package/components/crm/Field.jsx
CHANGED
|
@@ -120,6 +120,7 @@ function Field({
|
|
|
120
120
|
break;
|
|
121
121
|
case 'dropdown-ajax':
|
|
122
122
|
case 'multi-dropdown-ajax':
|
|
123
|
+
case 'radio-ajax':
|
|
123
124
|
fetchOptions();
|
|
124
125
|
break;
|
|
125
126
|
default:
|
|
@@ -230,6 +231,7 @@ function Field({
|
|
|
230
231
|
[
|
|
231
232
|
'address',
|
|
232
233
|
'async-dropdown-ajax',
|
|
234
|
+
'checkbox',
|
|
233
235
|
'colour',
|
|
234
236
|
'copytoclipboard',
|
|
235
237
|
'date',
|
|
@@ -244,6 +246,8 @@ function Field({
|
|
|
244
246
|
'plaindatetime',
|
|
245
247
|
'plainrelation',
|
|
246
248
|
'plainrelationarray',
|
|
249
|
+
'radio',
|
|
250
|
+
'radio-ajax',
|
|
247
251
|
'richeditor',
|
|
248
252
|
'time',
|
|
249
253
|
].includes(settings.type)
|
|
@@ -271,13 +275,6 @@ function Field({
|
|
|
271
275
|
}
|
|
272
276
|
} else if (['plaintextheading'].includes(settings.type)) {
|
|
273
277
|
return <h2>{settings.label ? settings.label : ''}</h2>;
|
|
274
|
-
} else if (['checkbox'].includes(settings.type)) {
|
|
275
|
-
return (
|
|
276
|
-
<span className="fi__spancheckbox">
|
|
277
|
-
{settings.label ? settings.label : ''}{' '}
|
|
278
|
-
{settings.required ? '*' : ''}
|
|
279
|
-
</span>
|
|
280
|
-
);
|
|
281
278
|
}
|
|
282
279
|
};
|
|
283
280
|
|
|
@@ -319,8 +316,62 @@ function Field({
|
|
|
319
316
|
|
|
320
317
|
const renderInput = () => {
|
|
321
318
|
switch (settings.type) {
|
|
319
|
+
case 'radio':
|
|
320
|
+
return settings.options?.length > 0 ? (
|
|
321
|
+
<div className="fi__optionscontainer">
|
|
322
|
+
{settings.options.map((option, index) => (
|
|
323
|
+
<div
|
|
324
|
+
key={`${settings.id}-checkbox-option-${index}`}
|
|
325
|
+
className="fi__checkboxcontainer"
|
|
326
|
+
>
|
|
327
|
+
<input
|
|
328
|
+
name={settings.id}
|
|
329
|
+
data-name={settings.id}
|
|
330
|
+
type="radio"
|
|
331
|
+
className="fi__customcheckbox"
|
|
332
|
+
value={option.id}
|
|
333
|
+
checked={
|
|
334
|
+
parseInt(inputValue) ===
|
|
335
|
+
parseInt(option.id)
|
|
336
|
+
}
|
|
337
|
+
onChange={onChange}
|
|
338
|
+
/>
|
|
339
|
+
<label className="fi__checkboxlabel">
|
|
340
|
+
{option.label}
|
|
341
|
+
</label>{' '}
|
|
342
|
+
</div>
|
|
343
|
+
))}
|
|
344
|
+
</div>
|
|
345
|
+
) : null;
|
|
346
|
+
case 'radio-ajax':
|
|
347
|
+
return options?.length > 0 ? (
|
|
348
|
+
<div className="fi__optionscontainer">
|
|
349
|
+
{options.map((option, index) => (
|
|
350
|
+
<div
|
|
351
|
+
key={`${settings.id}-checkbox-option-${index}`}
|
|
352
|
+
className="fi__checkboxcontainer"
|
|
353
|
+
>
|
|
354
|
+
<input
|
|
355
|
+
name={settings.id}
|
|
356
|
+
data-name={settings.id}
|
|
357
|
+
type="radio"
|
|
358
|
+
className="fi__customcheckbox"
|
|
359
|
+
value={option.id}
|
|
360
|
+
checked={
|
|
361
|
+
parseInt(inputValue) ===
|
|
362
|
+
parseInt(option.id)
|
|
363
|
+
}
|
|
364
|
+
onChange={onChange}
|
|
365
|
+
/>
|
|
366
|
+
<label className="fi__checkboxlabel">
|
|
367
|
+
{option.label}
|
|
368
|
+
</label>{' '}
|
|
369
|
+
</div>
|
|
370
|
+
))}
|
|
371
|
+
</div>
|
|
372
|
+
) : null;
|
|
322
373
|
case 'checkbox':
|
|
323
|
-
return settings.options
|
|
374
|
+
return settings.options?.length > 0 ? (
|
|
324
375
|
<div className="fi__optionscontainer">
|
|
325
376
|
{settings.options.map((option, index) => (
|
|
326
377
|
<div
|
|
@@ -329,6 +380,7 @@ function Field({
|
|
|
329
380
|
>
|
|
330
381
|
<input
|
|
331
382
|
name={settings.id}
|
|
383
|
+
data-name={settings.id}
|
|
332
384
|
type="checkbox"
|
|
333
385
|
className="fi__customcheckbox"
|
|
334
386
|
value={option.label}
|
|
@@ -970,6 +1022,8 @@ function Field({
|
|
|
970
1022
|
'plainrelationarray',
|
|
971
1023
|
'plaintext',
|
|
972
1024
|
'plaintextheading',
|
|
1025
|
+
'radio',
|
|
1026
|
+
'radio-ajax',
|
|
973
1027
|
'richeditor',
|
|
974
1028
|
'time',
|
|
975
1029
|
'toggle',
|
package/package.json
CHANGED