funda-ui 4.7.163 → 4.7.175
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/MultipleCheckboxes/index.d.ts +24 -0
- package/MultipleCheckboxes/index.js +105 -14
- package/Select/index.css +32 -4
- package/Select/index.d.ts +6 -12
- package/Select/index.js +147 -277
- package/Utils/useHistoryTracker.d.ts +155 -15
- package/Utils/useHistoryTracker.js +262 -88
- package/lib/cjs/MultipleCheckboxes/index.d.ts +24 -0
- package/lib/cjs/MultipleCheckboxes/index.js +105 -14
- package/lib/cjs/Select/index.d.ts +6 -12
- package/lib/cjs/Select/index.js +147 -277
- package/lib/cjs/Utils/useHistoryTracker.d.ts +155 -15
- package/lib/cjs/Utils/useHistoryTracker.js +262 -88
- package/lib/css/Select/index.css +32 -4
- package/lib/esm/MultipleCheckboxes/index.tsx +350 -215
- package/lib/esm/Select/index.scss +41 -4
- package/lib/esm/Select/index.tsx +145 -112
- package/lib/esm/Utils/hooks/useHistoryTracker.tsx +266 -115
- package/package.json +1 -1
|
@@ -22,6 +22,36 @@ export interface OptionConfig {
|
|
|
22
22
|
[propName: string]: string | number | boolean;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
export interface CustomOptionsItemsListParams {
|
|
26
|
+
name?: string;
|
|
27
|
+
groupLabelClassName?: string;
|
|
28
|
+
groupWrapperClassName?: string;
|
|
29
|
+
tableLayoutCellClassName?: string;
|
|
30
|
+
tableLayout?: boolean;
|
|
31
|
+
dataInit: OptionConfig[];
|
|
32
|
+
required?: boolean;
|
|
33
|
+
inline?: boolean;
|
|
34
|
+
selectedItems: Set<any>;
|
|
35
|
+
uniqueID: string;
|
|
36
|
+
valueBrackets?: boolean;
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
labelRes: (label: any, id: any) => React.ReactNode;
|
|
39
|
+
valRes: (setData: any) => any[];
|
|
40
|
+
handleCheckboxChange: (itemKey: string) => Set<any>;
|
|
41
|
+
convertArrToValByBrackets: (arr: string[]) => string;
|
|
42
|
+
isAllSelected: boolean;
|
|
43
|
+
handleSelectAll: () => void;
|
|
44
|
+
onChange?: (
|
|
45
|
+
e: any,
|
|
46
|
+
value: any,
|
|
47
|
+
valueStr: any,
|
|
48
|
+
label: any,
|
|
49
|
+
labelStr: any,
|
|
50
|
+
currentData: any,
|
|
51
|
+
dataCollection: any
|
|
52
|
+
) => void;
|
|
53
|
+
attributes: React.HTMLAttributes<HTMLInputElement>;
|
|
54
|
+
}
|
|
25
55
|
|
|
26
56
|
export type MultipleCheckboxesProps = {
|
|
27
57
|
contentRef?: React.ForwardedRef<any>; // could use "Array" on contentRef.current, such as contentRef.current[0], contentRef.current[1]
|
|
@@ -40,6 +70,8 @@ export type MultipleCheckboxesProps = {
|
|
|
40
70
|
options?: OptionConfig[] | string | unknown;
|
|
41
71
|
disabled?: any;
|
|
42
72
|
required?: any;
|
|
73
|
+
showSelectAll?: boolean;
|
|
74
|
+
selectAllLabel?: string;
|
|
43
75
|
/** Whether to use square brackets to save result and initialize default value */
|
|
44
76
|
extractValueByBrackets?: boolean;
|
|
45
77
|
/** -- */
|
|
@@ -80,6 +112,8 @@ const MultipleCheckboxes = forwardRef((props: MultipleCheckboxesProps, externalR
|
|
|
80
112
|
label,
|
|
81
113
|
name,
|
|
82
114
|
id,
|
|
115
|
+
showSelectAll = false,
|
|
116
|
+
selectAllLabel = 'Select all',
|
|
83
117
|
extractValueByBrackets,
|
|
84
118
|
style,
|
|
85
119
|
fetchFuncAsync,
|
|
@@ -106,7 +140,7 @@ const MultipleCheckboxes = forwardRef((props: MultipleCheckboxesProps, externalR
|
|
|
106
140
|
|
|
107
141
|
|
|
108
142
|
//
|
|
109
|
-
const [selectedItems, setSelectedItems] = useState<any
|
|
143
|
+
const [selectedItems, setSelectedItems] = useState<Set<any>>(new Set());
|
|
110
144
|
const [dataInit, setDataInit] = useState<OptionConfig[]>(optionsDataInit);
|
|
111
145
|
|
|
112
146
|
|
|
@@ -143,6 +177,41 @@ const MultipleCheckboxes = forwardRef((props: MultipleCheckboxesProps, externalR
|
|
|
143
177
|
return [].slice.call(rootRef.current.querySelectorAll(`[type="checkbox"]`));
|
|
144
178
|
};
|
|
145
179
|
|
|
180
|
+
|
|
181
|
+
const isAllSelected = () => {
|
|
182
|
+
const allOptions = optionsFlat(dataInit);
|
|
183
|
+
const enabledOptions = allOptions.filter(option =>
|
|
184
|
+
!(disabled || (typeof option.disabled !== 'undefined' ? option.disabled : false))
|
|
185
|
+
);
|
|
186
|
+
return enabledOptions.length > 0 && enabledOptions.every(option => selectedItems.has(option.value));
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
const handleSelectAll = () => {
|
|
190
|
+
const allOptions = optionsFlat(dataInit);
|
|
191
|
+
const enabledOptions = allOptions.filter(option =>
|
|
192
|
+
!(disabled || (typeof option.disabled !== 'undefined' ? option.disabled : false))
|
|
193
|
+
);
|
|
194
|
+
const newSelectedItems = new Set(selectedItems);
|
|
195
|
+
|
|
196
|
+
if (isAllSelected()) {
|
|
197
|
+
enabledOptions.forEach(option => newSelectedItems.delete(option.value));
|
|
198
|
+
} else {
|
|
199
|
+
enabledOptions.forEach(option => newSelectedItems.add(option.value));
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
setSelectedItems(newSelectedItems);
|
|
203
|
+
|
|
204
|
+
//
|
|
205
|
+
const _res = valRes(newSelectedItems);
|
|
206
|
+
const _resLabel = allOptions.filter((v: any) => _res.includes(v.value)).map((k: any) => k.label);
|
|
207
|
+
const _resDataCollection = allOptions.filter((v: any) => _res.includes(v.value)).map((k: any) => k);
|
|
208
|
+
|
|
209
|
+
onChange?.(null, _res, VALUE_BY_BRACKETS ? convertArrToValByBrackets(_res) : _res.join(','),
|
|
210
|
+
_resLabel, VALUE_BY_BRACKETS ? convertArrToValByBrackets(_resLabel) : _resLabel.join(','),
|
|
211
|
+
null, _resDataCollection);
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
|
|
146
215
|
// exposes the following methods
|
|
147
216
|
useImperativeHandle(
|
|
148
217
|
contentRef,
|
|
@@ -175,7 +244,34 @@ const MultipleCheckboxes = forwardRef((props: MultipleCheckboxesProps, externalR
|
|
|
175
244
|
onChange?.(null, null, value, null, null, null, null);
|
|
176
245
|
}
|
|
177
246
|
|
|
178
|
-
}
|
|
247
|
+
},
|
|
248
|
+
selectAll: () => {
|
|
249
|
+
const allOptions = optionsFlat(dataInit);
|
|
250
|
+
const enabledOptions = allOptions.filter(option =>
|
|
251
|
+
!(disabled || (typeof option.disabled !== 'undefined' ? option.disabled : false))
|
|
252
|
+
);
|
|
253
|
+
const newSelectedItems = new Set([
|
|
254
|
+
...Array.from(selectedItems),
|
|
255
|
+
...enabledOptions.map(option => option.value)
|
|
256
|
+
]);
|
|
257
|
+
setSelectedItems(newSelectedItems);
|
|
258
|
+
|
|
259
|
+
//
|
|
260
|
+
const _res = valRes(newSelectedItems);
|
|
261
|
+
const _resLabel = allOptions.filter((v: any) => _res.includes(v.value)).map((k: any) => k.label);
|
|
262
|
+
const _resDataCollection = allOptions.filter((v: any) => _res.includes(v.value)).map((k: any) => k);
|
|
263
|
+
|
|
264
|
+
onChange?.(null, _res, VALUE_BY_BRACKETS ? convertArrToValByBrackets(_res) : _res.join(','),
|
|
265
|
+
_resLabel, VALUE_BY_BRACKETS ? convertArrToValByBrackets(_resLabel) : _resLabel.join(','),
|
|
266
|
+
null, _resDataCollection);
|
|
267
|
+
|
|
268
|
+
},
|
|
269
|
+
deselectAll: () => {
|
|
270
|
+
setSelectedItems(new Set());
|
|
271
|
+
onChange?.(null, [], '', [], '', null, []);
|
|
272
|
+
|
|
273
|
+
},
|
|
274
|
+
isAllSelected: () => isAllSelected(),
|
|
179
275
|
}),
|
|
180
276
|
[dataInit, contentRef, selectedItems],
|
|
181
277
|
);
|
|
@@ -321,264 +417,303 @@ const MultipleCheckboxes = forwardRef((props: MultipleCheckboxesProps, externalR
|
|
|
321
417
|
return res;
|
|
322
418
|
}
|
|
323
419
|
|
|
324
|
-
// Generate list of options
|
|
420
|
+
// Generate custom list of options
|
|
325
421
|
const itemsList = (fn: any) => {
|
|
326
422
|
|
|
327
423
|
if (typeof fn === 'function') {
|
|
328
|
-
|
|
424
|
+
const params: CustomOptionsItemsListParams = {
|
|
329
425
|
name,
|
|
330
426
|
groupLabelClassName,
|
|
331
427
|
groupWrapperClassName,
|
|
332
428
|
tableLayoutCellClassName,
|
|
333
429
|
tableLayout,
|
|
334
430
|
dataInit,
|
|
335
|
-
valueBrackets: VALUE_BY_BRACKETS,
|
|
336
431
|
inline: _inline,
|
|
337
432
|
selectedItems,
|
|
338
|
-
uniqueID
|
|
433
|
+
uniqueID,
|
|
434
|
+
valueBrackets: VALUE_BY_BRACKETS,
|
|
339
435
|
disabled,
|
|
340
436
|
labelRes,
|
|
341
437
|
valRes,
|
|
342
438
|
handleCheckboxChange,
|
|
343
|
-
onChange,
|
|
344
439
|
convertArrToValByBrackets,
|
|
345
|
-
|
|
346
|
-
|
|
440
|
+
isAllSelected: isAllSelected(),
|
|
441
|
+
handleSelectAll,
|
|
442
|
+
onChange,
|
|
443
|
+
attributes,
|
|
444
|
+
};
|
|
445
|
+
return fn?.(params);
|
|
347
446
|
}
|
|
447
|
+
|
|
348
448
|
|
|
349
|
-
|
|
350
|
-
|
|
449
|
+
|
|
450
|
+
const allOptions = optionsFlat(dataInit);
|
|
351
451
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
if (key !== 'extends') {
|
|
355
|
-
_optiondata[key] = value;
|
|
356
|
-
}
|
|
357
|
-
});
|
|
452
|
+
return (
|
|
453
|
+
<>
|
|
358
454
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
{item.optgroup.map((opt: any, optIndex: number) => {
|
|
367
|
-
|
|
368
|
-
const _optiondata2: any = {};
|
|
369
|
-
Object.entries(item).forEach(([key, value]) => {
|
|
370
|
-
if (key !== 'extends') {
|
|
371
|
-
_optiondata2[key] = value;
|
|
455
|
+
{/* SELECT ALL */}
|
|
456
|
+
{showSelectAll && allOptions.length > 0 && (
|
|
457
|
+
<div
|
|
458
|
+
className={combinedCls(
|
|
459
|
+
'multiple-checkboxes__control form-check pe-3',
|
|
460
|
+
{
|
|
461
|
+
'd-inline-block': _inline
|
|
372
462
|
}
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
className={
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
463
|
+
)}
|
|
464
|
+
>
|
|
465
|
+
<input
|
|
466
|
+
type="checkbox"
|
|
467
|
+
className={clsWrite(controlClassName, 'form-check-input')}
|
|
468
|
+
name={`${name}-select-all`}
|
|
469
|
+
id={`multiple-checkboxes__select-all-${idRes}`}
|
|
470
|
+
checked={isAllSelected()}
|
|
471
|
+
onChange={handleSelectAll}
|
|
472
|
+
disabled={disabled}
|
|
473
|
+
/>
|
|
474
|
+
{labelRes(selectAllLabel, `multiple-checkboxes__select-all-${idRes}`)}
|
|
475
|
+
</div>
|
|
476
|
+
)}
|
|
477
|
+
|
|
478
|
+
{/* LIST */}
|
|
479
|
+
{Array.isArray(dataInit) ? dataInit.map((item: OptionConfig, index: number) => {
|
|
480
|
+
|
|
481
|
+
const _optiondata: any = {};
|
|
482
|
+
Object.entries(item).forEach(([key, value]) => {
|
|
483
|
+
if (key !== 'extends') {
|
|
484
|
+
_optiondata[key] = value;
|
|
485
|
+
}
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
const _groupEl = () => {
|
|
489
|
+
return <>
|
|
490
|
+
|
|
491
|
+
{/* GROUP LABEL */}
|
|
492
|
+
<div className={`rmultiple-checkboxes-group__label ${groupLabelClassName || ''}`}>{item.label}</div>
|
|
493
|
+
{/* /GROUP LABEL */}
|
|
494
|
+
|
|
495
|
+
{Array.isArray(item.optgroup) && item.optgroup.map((opt: OptionConfig, optIndex: number) => {
|
|
496
|
+
|
|
497
|
+
const _optiondata2: any = {};
|
|
498
|
+
Object.entries(item).forEach(([key, value]) => {
|
|
499
|
+
if (key !== 'extends') {
|
|
500
|
+
_optiondata2[key] = value;
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
|
|
504
|
+
return <div
|
|
505
|
+
key={'checkbox' + optIndex}
|
|
506
|
+
className={combinedCls(
|
|
507
|
+
'multiple-checkboxes__control form-check pe-3',
|
|
508
|
+
{
|
|
509
|
+
'd-inline-block': _inline
|
|
510
|
+
}
|
|
511
|
+
)}
|
|
512
|
+
data-index={`${index}-${optIndex}`}
|
|
513
|
+
data-label={opt.label}
|
|
514
|
+
data-list-item-label={`${typeof opt.listItemLabel === 'undefined' ? '' : opt.listItemLabel}`}
|
|
515
|
+
data-value={opt.value}
|
|
516
|
+
data-disabled={disabled || (typeof opt.disabled !== 'undefined' ? `${opt.disabled}` : 'false')}
|
|
517
|
+
>
|
|
518
|
+
<input
|
|
519
|
+
ref={(node: any) => {
|
|
520
|
+
if (externalRef) externalRef.current = getAllControls();
|
|
521
|
+
}}
|
|
522
|
+
type="checkbox"
|
|
523
|
+
className={clsWrite(controlClassName, 'form-check-input')}
|
|
524
|
+
name={`${name}-checkbox-item`}
|
|
525
|
+
id={`multiple-checkboxes__control-label-${index}-${optIndex}-${idRes}`}
|
|
526
|
+
data-index={`${index}-${optIndex}`}
|
|
527
|
+
data-label={opt.label}
|
|
528
|
+
data-list-item-label={`${typeof opt.listItemLabel === 'undefined' ? '' : opt.listItemLabel}`}
|
|
529
|
+
data-value={opt.value}
|
|
530
|
+
data-disabled={disabled || (typeof opt.disabled !== 'undefined' ? `${opt.disabled}` : 'false')}
|
|
531
|
+
data-optiondata={JSON.stringify(_optiondata2)}
|
|
532
|
+
value={opt.value as string}
|
|
533
|
+
disabled={disabled || (typeof opt.disabled !== 'undefined' ? opt.disabled : null)}
|
|
534
|
+
checked={selectedItems.has(opt.value)}
|
|
535
|
+
onChange={(e: any) => {
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
const _newSelectedItems = handleCheckboxChange(opt.value as string);
|
|
539
|
+
|
|
540
|
+
//
|
|
541
|
+
const _res = valRes(_newSelectedItems);
|
|
542
|
+
const _resLabel = optionsFlat(dataInit).filter((v: any) => _res.includes(v.value)).map((k: any) => k.label);
|
|
543
|
+
const _resDataCollection = optionsFlat(dataInit).filter((v: any) => _res.includes(v.value)).map((k: any) => k);
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
//
|
|
547
|
+
let curData: any;
|
|
548
|
+
|
|
549
|
+
// if group
|
|
550
|
+
if (typeof item.optgroup !== 'undefined') {
|
|
551
|
+
const groupItemIndex = optIndex;
|
|
552
|
+
const groupOpts: any = item.optgroup;
|
|
553
|
+
|
|
554
|
+
curData = groupOpts[groupItemIndex];
|
|
555
|
+
} else {
|
|
556
|
+
curData = item;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
onChange?.(e.target, _res, VALUE_BY_BRACKETS ? convertArrToValByBrackets(_res) : _res.join(','), _resLabel, VALUE_BY_BRACKETS ? convertArrToValByBrackets(_resLabel) : _resLabel.join(','), curData, _resDataCollection);
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
}}
|
|
563
|
+
{...attributes}
|
|
564
|
+
|
|
565
|
+
/>
|
|
566
|
+
|
|
567
|
+
{labelRes(typeof opt.listItemLabel === 'undefined' ? opt.label : opt.listItemLabel, `multiple-checkboxes__control-label-${index}-${optIndex}-${idRes}`)}
|
|
568
|
+
|
|
569
|
+
{/* EXTENDS */}
|
|
570
|
+
{typeof opt.extends !== 'undefined' ? <>
|
|
571
|
+
<div className="d-inline-block">
|
|
572
|
+
<div className="form-control-extends__wrapper">{opt.extends}</div>
|
|
573
|
+
</div>
|
|
574
|
+
</> : null}
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
</div>;
|
|
578
|
+
|
|
579
|
+
})}
|
|
580
|
+
</>;
|
|
581
|
+
};
|
|
582
|
+
|
|
583
|
+
const _normalEl = () => {
|
|
584
|
+
return <>
|
|
585
|
+
|
|
389
586
|
<input
|
|
390
587
|
ref={(node: any) => {
|
|
391
588
|
if (externalRef) externalRef.current = getAllControls();
|
|
589
|
+
|
|
392
590
|
}}
|
|
393
591
|
type="checkbox"
|
|
394
592
|
className={clsWrite(controlClassName, 'form-check-input')}
|
|
395
593
|
name={`${name}-checkbox-item`}
|
|
396
|
-
id={`multiple-checkboxes__control-label-${index}-${
|
|
397
|
-
data-index={
|
|
398
|
-
data-label={
|
|
399
|
-
data-list-item-label={`${typeof
|
|
400
|
-
data-value={
|
|
401
|
-
data-disabled={disabled || (typeof
|
|
402
|
-
data-optiondata={JSON.stringify(
|
|
403
|
-
value={
|
|
404
|
-
disabled={disabled || (typeof
|
|
405
|
-
checked={selectedItems.has(
|
|
594
|
+
id={`multiple-checkboxes__control-label-${index}-${idRes}`}
|
|
595
|
+
data-index={index}
|
|
596
|
+
data-label={item.label}
|
|
597
|
+
data-list-item-label={`${typeof item.listItemLabel === 'undefined' ? '' : item.listItemLabel}`}
|
|
598
|
+
data-value={item.value}
|
|
599
|
+
data-disabled={disabled || (typeof item.disabled !== 'undefined' ? `${item.disabled}` : 'false')}
|
|
600
|
+
data-optiondata={JSON.stringify(_optiondata)}
|
|
601
|
+
value={item.value as string}
|
|
602
|
+
disabled={disabled || (typeof item.disabled !== 'undefined' ? item.disabled : null)}
|
|
603
|
+
checked={selectedItems.has(item.value)}
|
|
406
604
|
onChange={(e: any) => {
|
|
407
|
-
|
|
408
605
|
|
|
409
|
-
const _newSelectedItems = handleCheckboxChange(
|
|
410
|
-
|
|
606
|
+
const _newSelectedItems = handleCheckboxChange(item.value as string);
|
|
607
|
+
|
|
411
608
|
//
|
|
412
609
|
const _res = valRes(_newSelectedItems);
|
|
413
|
-
const _resLabel =
|
|
610
|
+
const _resLabel = dataInit.filter((v: any) => _res.includes(v.value)).map((k: any) => k.label);
|
|
414
611
|
const _resDataCollection = optionsFlat(dataInit).filter((v: any) => _res.includes(v.value)).map((k: any) => k);
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
// if group
|
|
421
|
-
if (typeof item.optgroup !== 'undefined') {
|
|
422
|
-
const groupItemIndex = optIndex;
|
|
423
|
-
const groupOpts: any = item.optgroup;
|
|
424
|
-
|
|
425
|
-
curData = groupOpts[groupItemIndex];
|
|
426
|
-
} else {
|
|
427
|
-
curData = item;
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
onChange?.(e.target, _res, VALUE_BY_BRACKETS ? convertArrToValByBrackets(_res) : _res.join(','), _resLabel, VALUE_BY_BRACKETS ? convertArrToValByBrackets(_resLabel) : _resLabel.join(','), curData, _resDataCollection);
|
|
431
|
-
|
|
432
|
-
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
onChange?.(e.target, _res, VALUE_BY_BRACKETS ? convertArrToValByBrackets(_res) : _res.join(','), _resLabel, VALUE_BY_BRACKETS ? convertArrToValByBrackets(_resLabel) : _resLabel.join(','), item, _resDataCollection);
|
|
615
|
+
|
|
616
|
+
|
|
433
617
|
}}
|
|
434
618
|
{...attributes}
|
|
435
|
-
|
|
619
|
+
|
|
436
620
|
/>
|
|
437
|
-
|
|
438
|
-
{labelRes(typeof
|
|
621
|
+
|
|
622
|
+
{labelRes(typeof item.listItemLabel === 'undefined' ? item.label : item.listItemLabel, `multiple-checkboxes__control-label-${index}-${idRes}`)}
|
|
439
623
|
|
|
440
624
|
{/* EXTENDS */}
|
|
441
|
-
{typeof
|
|
625
|
+
{typeof item.extends !== 'undefined' ? <>
|
|
442
626
|
<div className="d-inline-block">
|
|
443
|
-
<div className="form-control-extends__wrapper">{
|
|
627
|
+
<div className="form-control-extends__wrapper">{item.extends}</div>
|
|
444
628
|
</div>
|
|
445
629
|
</> : null}
|
|
446
630
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
631
|
+
</>;
|
|
632
|
+
};
|
|
633
|
+
|
|
634
|
+
|
|
635
|
+
if (tableLayout) {
|
|
636
|
+
|
|
637
|
+
/* TABLE LAYOUT */
|
|
638
|
+
if (typeof item.optgroup !== 'undefined') {
|
|
639
|
+
return <td
|
|
640
|
+
colSpan={1}
|
|
641
|
+
className={combinedCls(
|
|
642
|
+
'multiple-checkboxes-group__wrapper',
|
|
643
|
+
groupWrapperClassName,
|
|
644
|
+
tableLayoutCellClassName
|
|
645
|
+
)}
|
|
646
|
+
key={'optgroup-' + index}
|
|
647
|
+
>
|
|
648
|
+
{_groupEl()}
|
|
649
|
+
</td>;
|
|
650
|
+
} else {
|
|
651
|
+
|
|
652
|
+
return <td colSpan={1}
|
|
653
|
+
className={combinedCls(
|
|
654
|
+
'multiple-checkboxes__control form-check pe-3',
|
|
655
|
+
tableLayoutCellClassName,
|
|
656
|
+
{
|
|
657
|
+
'd-inline-block': _inline
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
)}
|
|
661
|
+
data-index={index}
|
|
662
|
+
data-label={item.label}
|
|
663
|
+
data-list-item-label={`${typeof item.listItemLabel === 'undefined' ? '' : item.listItemLabel}`}
|
|
664
|
+
data-value={item.value}
|
|
665
|
+
data-disabled={disabled || (typeof item.disabled !== 'undefined' ? `${item.disabled}` : 'false')}
|
|
666
|
+
key={'checkbox' + index}
|
|
667
|
+
data-optiondata={JSON.stringify(_optiondata)}
|
|
668
|
+
>
|
|
669
|
+
{_normalEl()}
|
|
670
|
+
</td>;
|
|
671
|
+
|
|
672
|
+
}
|
|
673
|
+
/* /TABLE LAYOUT */
|
|
674
|
+
} else {
|
|
675
|
+
|
|
676
|
+
if (typeof item.optgroup !== 'undefined') {
|
|
677
|
+
return <div
|
|
678
|
+
className={combinedCls(
|
|
679
|
+
'multiple-checkboxes-group__wrapper',
|
|
680
|
+
groupWrapperClassName
|
|
681
|
+
)}
|
|
682
|
+
key={'optgroup-' + index}
|
|
683
|
+
>
|
|
684
|
+
{_groupEl()}
|
|
685
|
+
</div>;
|
|
686
|
+
} else {
|
|
687
|
+
|
|
688
|
+
return <div
|
|
689
|
+
className={combinedCls(
|
|
690
|
+
'multiple-checkboxes__control form-check pe-3',
|
|
691
|
+
{
|
|
692
|
+
'd-inline-block': _inline
|
|
693
|
+
}
|
|
694
|
+
)}
|
|
695
|
+
data-index={index}
|
|
696
|
+
data-label={item.label}
|
|
697
|
+
data-list-item-label={`${typeof item.listItemLabel === 'undefined' ? '' : item.listItemLabel}`}
|
|
698
|
+
data-value={item.value}
|
|
699
|
+
data-disabled={disabled || (typeof item.disabled !== 'undefined' ? `${item.disabled}` : 'false')}
|
|
700
|
+
key={'checkbox' + index}
|
|
701
|
+
data-optiondata={JSON.stringify(_optiondata)}
|
|
702
|
+
>
|
|
703
|
+
{_normalEl()}
|
|
704
|
+
</div>;
|
|
705
|
+
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
}) : null}
|
|
711
|
+
</>
|
|
712
|
+
);
|
|
713
|
+
|
|
494
714
|
|
|
495
|
-
{/* EXTENDS */}
|
|
496
|
-
{typeof item.extends !== 'undefined' ? <>
|
|
497
|
-
<div className="d-inline-block">
|
|
498
|
-
<div className="form-control-extends__wrapper">{item.extends}</div>
|
|
499
|
-
</div>
|
|
500
|
-
</> : null}
|
|
501
715
|
|
|
502
|
-
</>;
|
|
503
|
-
};
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
if (tableLayout) {
|
|
507
|
-
|
|
508
|
-
/* TABLE LAYOUT */
|
|
509
|
-
if (typeof item.optgroup !== 'undefined') {
|
|
510
|
-
return <td
|
|
511
|
-
colSpan={1}
|
|
512
|
-
className={combinedCls(
|
|
513
|
-
'multiple-checkboxes-group__wrapper',
|
|
514
|
-
groupWrapperClassName,
|
|
515
|
-
tableLayoutCellClassName
|
|
516
|
-
)}
|
|
517
|
-
key={'optgroup-' + index}
|
|
518
|
-
>
|
|
519
|
-
{_groupEl()}
|
|
520
|
-
</td>;
|
|
521
|
-
} else {
|
|
522
|
-
|
|
523
|
-
return <td colSpan={1}
|
|
524
|
-
className={combinedCls(
|
|
525
|
-
'multiple-checkboxes__control form-check pe-3',
|
|
526
|
-
tableLayoutCellClassName,
|
|
527
|
-
{
|
|
528
|
-
'd-inline-block': _inline
|
|
529
|
-
}
|
|
530
716
|
|
|
531
|
-
)}
|
|
532
|
-
data-index={index}
|
|
533
|
-
data-label={item.label}
|
|
534
|
-
data-list-item-label={`${typeof item.listItemLabel === 'undefined' ? '' : item.listItemLabel}`}
|
|
535
|
-
data-value={item.value}
|
|
536
|
-
data-disabled={disabled || (typeof item.disabled !== 'undefined' ? `${item.disabled}` : 'false')}
|
|
537
|
-
key={'checkbox' + index}
|
|
538
|
-
data-optiondata={JSON.stringify(_optiondata)}
|
|
539
|
-
>
|
|
540
|
-
{_normalEl()}
|
|
541
|
-
</td>;
|
|
542
|
-
|
|
543
|
-
}
|
|
544
|
-
/* /TABLE LAYOUT */
|
|
545
|
-
} else {
|
|
546
|
-
|
|
547
|
-
if (typeof item.optgroup !== 'undefined') {
|
|
548
|
-
return <div
|
|
549
|
-
className={combinedCls(
|
|
550
|
-
'multiple-checkboxes-group__wrapper',
|
|
551
|
-
groupWrapperClassName
|
|
552
|
-
)}
|
|
553
|
-
key={'optgroup-' + index}
|
|
554
|
-
>
|
|
555
|
-
{_groupEl()}
|
|
556
|
-
</div>;
|
|
557
|
-
} else {
|
|
558
|
-
|
|
559
|
-
return <div
|
|
560
|
-
className={combinedCls(
|
|
561
|
-
'multiple-checkboxes__control form-check pe-3',
|
|
562
|
-
{
|
|
563
|
-
'd-inline-block': _inline
|
|
564
|
-
}
|
|
565
|
-
)}
|
|
566
|
-
data-index={index}
|
|
567
|
-
data-label={item.label}
|
|
568
|
-
data-list-item-label={`${typeof item.listItemLabel === 'undefined' ? '' : item.listItemLabel}`}
|
|
569
|
-
data-value={item.value}
|
|
570
|
-
data-disabled={disabled || (typeof item.disabled !== 'undefined' ? `${item.disabled}` : 'false')}
|
|
571
|
-
key={'checkbox' + index}
|
|
572
|
-
data-optiondata={JSON.stringify(_optiondata)}
|
|
573
|
-
>
|
|
574
|
-
{_normalEl()}
|
|
575
|
-
</div>;
|
|
576
|
-
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
}) : null
|
|
582
717
|
};
|
|
583
718
|
|
|
584
719
|
|