funda-ui 4.2.255 → 4.2.445
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/CascadingSelect/index.js +1 -1
- package/EventCalendar/index.css +3 -0
- package/EventCalendar/index.d.ts +4 -1
- package/EventCalendar/index.js +16 -4
- package/EventCalendarTimeline/index.css +17 -0
- package/EventCalendarTimeline/index.d.ts +9 -2
- package/EventCalendarTimeline/index.js +77 -22
- package/LiveSearch/index.css +12 -0
- package/LiveSearch/index.js +1 -1
- package/ModalDialog/index.js +1 -1
- package/MultilevelDropdownMenu/index.css +2 -2
- package/MultilevelDropdownMenu/index.js +54 -46
- package/MultipleSelect/index.css +35 -26
- package/MultipleSelect/index.d.ts +3 -0
- package/MultipleSelect/index.js +366 -134
- package/NativeSelect/index.js +75 -47
- package/Pagination/index.d.ts +2 -0
- package/Pagination/index.js +25 -21
- package/Radio/index.js +14 -6
- package/RangeSlider/index.css +1 -0
- package/Select/index.css +5 -0
- package/Select/index.d.ts +1 -0
- package/Select/index.js +31 -11
- package/Tabs/index.js +13 -2
- package/Tree/index.js +90 -56
- package/lib/cjs/CascadingSelect/index.js +1 -1
- package/lib/cjs/EventCalendar/index.d.ts +4 -1
- package/lib/cjs/EventCalendar/index.js +16 -4
- package/lib/cjs/EventCalendarTimeline/index.d.ts +9 -2
- package/lib/cjs/EventCalendarTimeline/index.js +77 -22
- package/lib/cjs/LiveSearch/index.js +1 -1
- package/lib/cjs/ModalDialog/index.js +1 -1
- package/lib/cjs/MultilevelDropdownMenu/index.js +54 -46
- package/lib/cjs/MultipleSelect/index.d.ts +3 -0
- package/lib/cjs/MultipleSelect/index.js +366 -134
- package/lib/cjs/NativeSelect/index.js +75 -47
- package/lib/cjs/Pagination/index.d.ts +2 -0
- package/lib/cjs/Pagination/index.js +25 -21
- package/lib/cjs/Radio/index.js +14 -6
- package/lib/cjs/Select/index.d.ts +1 -0
- package/lib/cjs/Select/index.js +31 -11
- package/lib/cjs/Tabs/index.js +13 -2
- package/lib/cjs/Tree/index.js +90 -56
- package/lib/css/EventCalendar/index.css +3 -0
- package/lib/css/EventCalendarTimeline/index.css +17 -0
- package/lib/css/LiveSearch/index.css +12 -0
- package/lib/css/MultilevelDropdownMenu/index.css +2 -2
- package/lib/css/MultipleSelect/index.css +35 -26
- package/lib/css/RangeSlider/index.css +1 -0
- package/lib/css/Select/index.css +5 -0
- package/lib/esm/CascadingSelect/index.tsx +1 -1
- package/lib/esm/EventCalendar/index.scss +2 -0
- package/lib/esm/EventCalendar/index.tsx +23 -6
- package/lib/esm/EventCalendarTimeline/index.scss +24 -1
- package/lib/esm/EventCalendarTimeline/index.tsx +195 -118
- package/lib/esm/LiveSearch/index.scss +14 -1
- package/lib/esm/LiveSearch/index.tsx +1 -1
- package/lib/esm/ModalDialog/index.tsx +1 -1
- package/lib/esm/MultilevelDropdownMenu/{MenuList.tsx → ItemList.tsx} +52 -45
- package/lib/esm/MultilevelDropdownMenu/index.scss +2 -2
- package/lib/esm/MultilevelDropdownMenu/index.tsx +12 -4
- package/lib/esm/MultipleSelect/ItemList.tsx +300 -0
- package/lib/esm/MultipleSelect/index.scss +61 -30
- package/lib/esm/MultipleSelect/index.tsx +56 -87
- package/lib/esm/MultipleSelect/multiple-select-utils/func.ts +29 -0
- package/lib/esm/NativeSelect/index.tsx +4 -18
- package/lib/esm/NativeSelect/native-select-utils/func.ts +40 -0
- package/lib/esm/Pagination/index.tsx +31 -22
- package/lib/esm/Radio/index.tsx +19 -6
- package/lib/esm/RangeSlider/index.scss +2 -0
- package/lib/esm/Select/index.scss +6 -1
- package/lib/esm/Select/index.tsx +70 -54
- package/lib/esm/Table/Table.tsx +2 -0
- package/lib/esm/Tabs/Tabs.tsx +19 -4
- package/lib/esm/Tree/TreeList.tsx +61 -54
- package/lib/esm/Tree/index.tsx +4 -0
- package/package.json +1 -1
|
@@ -13,6 +13,10 @@ import {
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
+
import { multiSelControlOptionExist } from './multiple-select-utils/func';
|
|
17
|
+
import ItemList from './ItemList';
|
|
18
|
+
|
|
19
|
+
|
|
16
20
|
export interface OptionConfig {
|
|
17
21
|
[propName: string]: string | number | boolean;
|
|
18
22
|
}
|
|
@@ -20,6 +24,7 @@ export interface OptionConfig {
|
|
|
20
24
|
|
|
21
25
|
type MultipleSelectProps = {
|
|
22
26
|
wrapperClassName?: string;
|
|
27
|
+
childClassName?: string;
|
|
23
28
|
wrapperMinHeight?: string;
|
|
24
29
|
wrapperMinWidth?: string;
|
|
25
30
|
availableHeaderTitle?: string;
|
|
@@ -32,6 +37,8 @@ type MultipleSelectProps = {
|
|
|
32
37
|
hierarchical?: boolean;
|
|
33
38
|
indentation?: string;
|
|
34
39
|
doubleIndent?: boolean;
|
|
40
|
+
alternateCollapse?: boolean;
|
|
41
|
+
arrow?: React.ReactNode;
|
|
35
42
|
value?: string;
|
|
36
43
|
label?: React.ReactNode | string;
|
|
37
44
|
name?: string;
|
|
@@ -59,6 +66,7 @@ type MultipleSelectProps = {
|
|
|
59
66
|
const MultipleSelect = forwardRef((props: MultipleSelectProps, externalRef: any) => {
|
|
60
67
|
const {
|
|
61
68
|
wrapperClassName,
|
|
69
|
+
childClassName,
|
|
62
70
|
wrapperMinHeight,
|
|
63
71
|
wrapperMinWidth,
|
|
64
72
|
availableHeaderTitle,
|
|
@@ -71,6 +79,8 @@ const MultipleSelect = forwardRef((props: MultipleSelectProps, externalRef: any)
|
|
|
71
79
|
hierarchical,
|
|
72
80
|
indentation,
|
|
73
81
|
doubleIndent,
|
|
82
|
+
alternateCollapse,
|
|
83
|
+
arrow,
|
|
74
84
|
options,
|
|
75
85
|
disabled,
|
|
76
86
|
required,
|
|
@@ -117,12 +127,6 @@ const MultipleSelect = forwardRef((props: MultipleSelectProps, externalRef: any)
|
|
|
117
127
|
const [hasErr, setHasErr] = useState<boolean>(false);
|
|
118
128
|
|
|
119
129
|
|
|
120
|
-
const multiSelControlOptionExist = (arr: any[], val: any) => {
|
|
121
|
-
const _data = arr.filter(Boolean);
|
|
122
|
-
return _data.map((v: any) => v.toString()).includes(val.toString());
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
|
|
126
130
|
async function fetchData(params: any) {
|
|
127
131
|
|
|
128
132
|
// set default value
|
|
@@ -170,6 +174,12 @@ const MultipleSelect = forwardRef((props: MultipleSelectProps, externalRef: any)
|
|
|
170
174
|
return _ORGIN_DATA;
|
|
171
175
|
} else {
|
|
172
176
|
|
|
177
|
+
// Set hierarchical categories ( with sub-categories )
|
|
178
|
+
if ( hierarchical ) {
|
|
179
|
+
optionsDataInit = addTreeDepth(optionsDataInit);
|
|
180
|
+
addTreeIndent(optionsDataInit, INDENT_PLACEHOLDER, INDENT_LAST_PLACEHOLDER, 'label');
|
|
181
|
+
}
|
|
182
|
+
|
|
173
183
|
|
|
174
184
|
// remove Duplicate objects from JSON Array
|
|
175
185
|
optionsDataInit = removeArrDuplicateItems(optionsDataInit, 'value');
|
|
@@ -460,49 +470,26 @@ const MultipleSelect = forwardRef((props: MultipleSelectProps, externalRef: any)
|
|
|
460
470
|
|
|
461
471
|
<a href="#" className="m-select__btn--add-all" onClick={handleSelectAll}>{addAllBtnLabel || 'Add all'}</a>
|
|
462
472
|
</div>
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
__html: typeof item.listItemLabel === 'undefined' ? item.label : item.listItemLabel
|
|
484
|
-
}}></strong>
|
|
485
|
-
<a
|
|
486
|
-
href="#"
|
|
487
|
-
className="m-select__item-action"
|
|
488
|
-
></a>
|
|
489
|
-
</span>
|
|
490
|
-
<i
|
|
491
|
-
onClick={(e: React.MouseEvent) => {
|
|
492
|
-
selectItem((e.target as any).closest('li'));
|
|
493
|
-
}}>
|
|
494
|
-
{iconAdd ? <>{iconAdd}</> : <><svg width="15px" height="15px" viewBox="0 0 24 24" fill="none"><path d="M12 2C6.49 2 2 6.49 2 12C2 17.51 6.49 22 12 22C17.51 22 22 17.51 22 12C22 6.49 17.51 2 12 2ZM16 12.75H12.75V16C12.75 16.41 12.41 16.75 12 16.75C11.59 16.75 11.25 16.41 11.25 16V12.75H8C7.59 12.75 7.25 12.41 7.25 12C7.25 11.59 7.59 11.25 8 11.25H11.25V8C11.25 7.59 11.59 7.25 12 7.25C12.41 7.25 12.75 7.59 12.75 8V11.25H16C16.41 11.25 16.75 11.59 16.75 12C16.75 12.41 16.41 12.75 16 12.75Z" fill="#000" /></svg></>}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
</i>
|
|
498
|
-
|
|
499
|
-
</li>;
|
|
500
|
-
}) : null}
|
|
501
|
-
|
|
502
|
-
{/* /OPTIONS LIST */}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
</ul>
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
{/* OPTIONS LIST */}
|
|
477
|
+
<ItemList
|
|
478
|
+
root={rootRef.current}
|
|
479
|
+
listContainerClassName="m-select__available m-select__options-contentlist"
|
|
480
|
+
ref={availableListRef}
|
|
481
|
+
indentStr={INDENT_LAST_PLACEHOLDER}
|
|
482
|
+
valSelected={valSelected}
|
|
483
|
+
iconAdd={iconAdd}
|
|
484
|
+
onSelect={selectItem}
|
|
485
|
+
alternateCollapse={alternateCollapse}
|
|
486
|
+
first={true}
|
|
487
|
+
arrow={arrow}
|
|
488
|
+
data={dataInit}
|
|
489
|
+
childClassName={childClassName || 'm-select__options-contentlist-custom'}
|
|
490
|
+
/>
|
|
491
|
+
{/* /OPTIONS LIST */}
|
|
492
|
+
|
|
506
493
|
</div>
|
|
507
494
|
|
|
508
495
|
|
|
@@ -517,44 +504,26 @@ const MultipleSelect = forwardRef((props: MultipleSelectProps, externalRef: any)
|
|
|
517
504
|
<span className="m-select__title" dangerouslySetInnerHTML={{__html: `${selectedHeaderTitle || ''}`}}></span>
|
|
518
505
|
<a href="#" className="m-select__btn--remove-all" onClick={handleRemoveAll}>{removeAllBtnLabel || 'Remove all'}</a>
|
|
519
506
|
</div>
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
<a
|
|
541
|
-
href="#"
|
|
542
|
-
className="m-select__item-action"
|
|
543
|
-
></a>
|
|
544
|
-
</span>
|
|
545
|
-
<i
|
|
546
|
-
onClick={(e: React.MouseEvent) => {
|
|
547
|
-
removeItem((e.target as any).closest('li'));
|
|
548
|
-
}}>
|
|
549
|
-
{iconRemove ? <>{iconRemove}</> : <><svg width="15px" height="15px" viewBox="0 0 24 24" fill="none"><path fillRule="evenodd" clipRule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10ZM8 11a1 1 0 1 0 0 2h8a1 1 0 1 0 0-2H8Z" fill="#000" /></svg></>}
|
|
550
|
-
|
|
551
|
-
</i>
|
|
552
|
-
|
|
553
|
-
</li>;
|
|
554
|
-
}) : null}
|
|
555
|
-
{/* /OPTIONS LIST */}
|
|
556
|
-
|
|
557
|
-
</ul>
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
{/* OPTIONS LIST */}
|
|
510
|
+
<ItemList
|
|
511
|
+
root={rootRef.current}
|
|
512
|
+
listContainerClassName="m-select__selected m-select__options-contentlist--sortable m-select__options-contentlist"
|
|
513
|
+
ref={selectedListRef}
|
|
514
|
+
indentStr={INDENT_LAST_PLACEHOLDER}
|
|
515
|
+
valSelected={valSelected}
|
|
516
|
+
iconRemove={iconRemove}
|
|
517
|
+
onSelect={removeItem}
|
|
518
|
+
alternateCollapse={alternateCollapse}
|
|
519
|
+
first={true}
|
|
520
|
+
arrow={arrow}
|
|
521
|
+
data={valSelectedData}
|
|
522
|
+
childClassName={childClassName || 'm-select__options-contentlist--custom'}
|
|
523
|
+
selected
|
|
524
|
+
/>
|
|
525
|
+
{/* /OPTIONS LIST */}
|
|
526
|
+
|
|
558
527
|
</div>
|
|
559
528
|
|
|
560
529
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* Format indent value
|
|
4
|
+
* @param {String|Array} inputData
|
|
5
|
+
* @param {String} placeholder
|
|
6
|
+
* @returns {String|Array}
|
|
7
|
+
*/
|
|
8
|
+
export function formatIndentVal(inputData: any, placeholder: string) {
|
|
9
|
+
const reVar = new RegExp(placeholder, 'g');
|
|
10
|
+
if (Array.isArray(inputData)) {
|
|
11
|
+
return inputData.map((s: any) => String(s).replace(reVar, '').replace(/\ /ig, ''));
|
|
12
|
+
} else {
|
|
13
|
+
const _txt: any = typeof inputData === 'string' ? inputData : inputData.toString();
|
|
14
|
+
return _txt.replace(reVar, '').replace(/\ /ig, '');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Determine whether the option exists
|
|
22
|
+
* @param val
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
export function multiSelControlOptionExist(arr: any[], val: any) {
|
|
26
|
+
const _data = arr.filter(Boolean);
|
|
27
|
+
return _data.map((v: any) => v.toString()).includes(val.toString());
|
|
28
|
+
|
|
29
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useState, useRef, forwardRef } from 'react';
|
|
2
2
|
|
|
3
|
+
import { optionsFlat } from './native-select-utils/func';
|
|
4
|
+
|
|
3
5
|
import {
|
|
4
6
|
useComId,
|
|
5
7
|
isJSON,
|
|
@@ -157,23 +159,6 @@ const NativeSelect = forwardRef((props: NativeSelectProps, externalRef: any) =>
|
|
|
157
159
|
|
|
158
160
|
}
|
|
159
161
|
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Format indent value
|
|
163
|
-
* @param {String|Array} str
|
|
164
|
-
* @returns {String|Array}
|
|
165
|
-
*/
|
|
166
|
-
function formatIndentVal(str: any) {
|
|
167
|
-
const reVar = new RegExp(INDENT_LAST_PLACEHOLDER, 'g');
|
|
168
|
-
if (Array.isArray(str)) {
|
|
169
|
-
return str.map((s: string) => s.replace(reVar,'').replace(/\ /ig,''));
|
|
170
|
-
} else {
|
|
171
|
-
return str.replace(reVar,'').replace(/\ /ig,'');
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
|
|
177
162
|
//
|
|
178
163
|
function handleFocus(event: any) {
|
|
179
164
|
rootRef.current?.classList.add('focus');
|
|
@@ -197,7 +182,8 @@ const NativeSelect = forwardRef((props: NativeSelectProps, externalRef: any) =>
|
|
|
197
182
|
|
|
198
183
|
//
|
|
199
184
|
if ( typeof(onChange) === 'function' ) {
|
|
200
|
-
|
|
185
|
+
console.log('---', event.target.selectedIndex)
|
|
186
|
+
onChange(event, optionsFlat(dataInit)[event.target.selectedIndex].value, optionsFlat(dataInit)[event.target.selectedIndex], event.target.selectedIndex);
|
|
201
187
|
|
|
202
188
|
event.target.blur();
|
|
203
189
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* Format indent value
|
|
4
|
+
* @param {String|Array} inputData
|
|
5
|
+
* @param {String} placeholder
|
|
6
|
+
* @returns {String|Array}
|
|
7
|
+
*/
|
|
8
|
+
export function formatIndentVal(inputData: any, placeholder: string) {
|
|
9
|
+
const reVar = new RegExp(placeholder, 'g');
|
|
10
|
+
if (Array.isArray(inputData)) {
|
|
11
|
+
return inputData.map((s: any) => String(s).replace(reVar, '').replace(/\ /ig, ''));
|
|
12
|
+
} else {
|
|
13
|
+
const _txt: any = typeof inputData === 'string' ? inputData : inputData.toString();
|
|
14
|
+
return _txt.replace(reVar, '').replace(/\ /ig, '');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Flat options
|
|
21
|
+
* @param {Array}allData
|
|
22
|
+
* @returns {Array}
|
|
23
|
+
*/
|
|
24
|
+
export function optionsFlat(allData: any[]) {
|
|
25
|
+
|
|
26
|
+
const flatItems: any[] = [];
|
|
27
|
+
|
|
28
|
+
allData.forEach((item: any) => {
|
|
29
|
+
if (typeof item.optgroup !== 'undefined') {
|
|
30
|
+
item.optgroup.forEach((opt: any) => {
|
|
31
|
+
flatItems.push(opt);
|
|
32
|
+
});
|
|
33
|
+
} else {
|
|
34
|
+
flatItems.push(item);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
return flatItems;
|
|
39
|
+
}
|
|
40
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { forwardRef, useImperativeHandle } from 'react';
|
|
1
|
+
import React, { useRef, forwardRef, useImperativeHandle } from 'react';
|
|
2
2
|
import { paginationNavigators } from './pagination-navigators';
|
|
3
3
|
|
|
4
4
|
|
|
@@ -7,6 +7,8 @@ type PaginationProps = {
|
|
|
7
7
|
wrapperClassName?: string;
|
|
8
8
|
/** The class name of the navigation */
|
|
9
9
|
navClassName?: string;
|
|
10
|
+
/** The class name of each item */
|
|
11
|
+
navItemClassName?: string;
|
|
10
12
|
/** An API URL Path. Use `{page}` characters to place a placeholder. such as `/mypage/{page}` */
|
|
11
13
|
apiUrl: string;
|
|
12
14
|
/** The range of pages displayed */
|
|
@@ -56,6 +58,7 @@ const Pagination = forwardRef((props: PaginationProps, externalRef: any) => {
|
|
|
56
58
|
const {
|
|
57
59
|
wrapperClassName,
|
|
58
60
|
navClassName,
|
|
61
|
+
navItemClassName,
|
|
59
62
|
apiUrl,
|
|
60
63
|
pageRangeDisplayed,
|
|
61
64
|
activePage,
|
|
@@ -79,6 +82,11 @@ const Pagination = forwardRef((props: PaginationProps, externalRef: any) => {
|
|
|
79
82
|
} = props;
|
|
80
83
|
|
|
81
84
|
|
|
85
|
+
const rootRef = useRef<any>(null);
|
|
86
|
+
const visibleNavigators = pageRangeDisplayed ? pageRangeDisplayed : 3;
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
82
90
|
|
|
83
91
|
// exposes the following methods
|
|
84
92
|
useImperativeHandle(
|
|
@@ -105,11 +113,10 @@ const Pagination = forwardRef((props: PaginationProps, externalRef: any) => {
|
|
|
105
113
|
});
|
|
106
114
|
}
|
|
107
115
|
}),
|
|
108
|
-
[externalRef, activePage],
|
|
116
|
+
[externalRef, totalPages, activePage],
|
|
109
117
|
);
|
|
110
118
|
|
|
111
119
|
|
|
112
|
-
const visibleNavigators = pageRangeDisplayed ? pageRangeDisplayed : 3;
|
|
113
120
|
|
|
114
121
|
let alignClassName = '';
|
|
115
122
|
switch (align) {
|
|
@@ -124,12 +131,13 @@ const Pagination = forwardRef((props: PaginationProps, externalRef: any) => {
|
|
|
124
131
|
break;
|
|
125
132
|
}
|
|
126
133
|
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
134
|
+
const _activeClassName = activeClassName || 'active',
|
|
135
|
+
_previousClassName = previousClassName || 'prev',
|
|
136
|
+
_nextClassName = nextClassName || 'next',
|
|
137
|
+
_firstClassName = firstClassName || 'first',
|
|
138
|
+
_lastClassName = lastClassName || 'last',
|
|
139
|
+
_disabledClassName = disabledClassName || 'disabled',
|
|
140
|
+
_itemClassName = navItemClassName || 'page-item',
|
|
133
141
|
_onlyPrevNextButtons = typeof (onlyPrevNext) === 'undefined' ? false : onlyPrevNext,
|
|
134
142
|
_symmetry = typeof (symmetry) === 'undefined' ? false : symmetry;
|
|
135
143
|
|
|
@@ -158,8 +166,8 @@ const Pagination = forwardRef((props: PaginationProps, externalRef: any) => {
|
|
|
158
166
|
_ellipsisEnabled = true;
|
|
159
167
|
|
|
160
168
|
return (
|
|
161
|
-
<li key={i} className={activePage === item ?
|
|
162
|
-
<a className="page-link" data-page={item} href={apiUrl
|
|
169
|
+
<li key={i} className={activePage === item ? `${_itemClassName} ${_activeClassName}` : `${_itemClassName}`}>
|
|
170
|
+
<a className="page-link" data-page={item} href={apiUrl?.replace('{page}', item)} onClick={(e) => {
|
|
163
171
|
e.preventDefault();
|
|
164
172
|
onChange?.(Number(item), Number(totalPages));
|
|
165
173
|
}}>{item}</a>
|
|
@@ -203,21 +211,22 @@ const Pagination = forwardRef((props: PaginationProps, externalRef: any) => {
|
|
|
203
211
|
<>
|
|
204
212
|
|
|
205
213
|
<nav
|
|
214
|
+
ref={rootRef}
|
|
206
215
|
className={wrapperClassName || wrapperClassName === '' ? wrapperClassName : "mb-3 position-relative"}
|
|
207
216
|
style={style}
|
|
208
217
|
>
|
|
209
218
|
<ul className={navClassName || navClassName === '' ? `${navClassName} ${alignClassName}` : `pagination ${alignClassName}`}>
|
|
210
219
|
{firstLabel ? (
|
|
211
|
-
<li className={activePage > 1 ?
|
|
212
|
-
<a tabIndex={activePage > 1 ? 0 : -1} aria-disabled={activePage > 1 ? 'false' : 'true'} className="page-link" data-page={1} href={apiUrl
|
|
220
|
+
<li className={activePage > 1 ? `${_itemClassName} ${_firstClassName}` : `${_itemClassName} ${_firstClassName} ${_disabledClassName}`}>
|
|
221
|
+
<a tabIndex={activePage > 1 ? 0 : -1} aria-disabled={activePage > 1 ? 'false' : 'true'} className="page-link" data-page={1} href={apiUrl?.replace('{page}', '1')} onClick={(e) => { e.preventDefault(); handleClick('first'); }}>
|
|
213
222
|
{firstLabel || null}
|
|
214
223
|
</a>
|
|
215
224
|
</li>
|
|
216
225
|
) : ''}
|
|
217
226
|
|
|
218
227
|
{previousLabel ? (
|
|
219
|
-
<li className={activePage > 1 ?
|
|
220
|
-
<a tabIndex={activePage > 1 ? 0 : -1} aria-disabled={activePage > 1 ? 'false' : 'true'} className="page-link" data-page={activePage - 1} href={apiUrl
|
|
228
|
+
<li className={activePage > 1 ? `${_itemClassName} ${_previousClassName}` : `${_itemClassName} ${_previousClassName} ${_disabledClassName}`}>
|
|
229
|
+
<a tabIndex={activePage > 1 ? 0 : -1} aria-disabled={activePage > 1 ? 'false' : 'true'} className="page-link" data-page={activePage - 1} href={apiUrl?.replace('{page}', (activePage - 1) as any)} onClick={(e) => { e.preventDefault(); handleClick('prev'); }}>
|
|
221
230
|
{previousLabel || null}
|
|
222
231
|
</a>
|
|
223
232
|
</li>
|
|
@@ -228,8 +237,8 @@ const Pagination = forwardRef((props: PaginationProps, externalRef: any) => {
|
|
|
228
237
|
navArr.map((item: any, i: number) => {
|
|
229
238
|
if (item > 0 && item <= totalPages && !_onlyPrevNextButtons) {
|
|
230
239
|
return (
|
|
231
|
-
<li key={i} className={activePage === item ?
|
|
232
|
-
<a className="page-link" data-page={item} href={apiUrl
|
|
240
|
+
<li key={i} className={activePage === item ? `${_itemClassName} ${_activeClassName}` : `${_itemClassName}`}>
|
|
241
|
+
<a className="page-link" data-page={item} href={apiUrl?.replace('{page}', item)} onClick={(e) => {
|
|
233
242
|
e.preventDefault();
|
|
234
243
|
onChange?.(Number(item), Number(totalPages));
|
|
235
244
|
}}>{item}</a>
|
|
@@ -241,12 +250,12 @@ const Pagination = forwardRef((props: PaginationProps, externalRef: any) => {
|
|
|
241
250
|
}
|
|
242
251
|
|
|
243
252
|
|
|
244
|
-
{_ellipsis !== '' && _ellipsisEnabled ? <><li className=
|
|
253
|
+
{_ellipsis !== '' && _ellipsisEnabled ? <><li className={_itemClassName}><span className="page-link">{_ellipsis}</span></li></> : ''}
|
|
245
254
|
{_ellipsisElements}
|
|
246
255
|
|
|
247
256
|
{nextLabel ? (
|
|
248
|
-
<li className={activePage < totalPages ?
|
|
249
|
-
<a tabIndex={activePage < totalPages ? 0 : -1} aria-disabled={activePage < totalPages ? 'false' : 'true'} className="page-link" data-page={activePage + 1} href={apiUrl
|
|
257
|
+
<li className={activePage < totalPages ? `${_itemClassName} ${_nextClassName}` : `${_itemClassName} ${_nextClassName} ${_disabledClassName}`}>
|
|
258
|
+
<a tabIndex={activePage < totalPages ? 0 : -1} aria-disabled={activePage < totalPages ? 'false' : 'true'} className="page-link" data-page={activePage + 1} href={apiUrl?.replace('{page}', (activePage + 1) as any)} onClick={(e) => { e.preventDefault(); handleClick('next'); }}>
|
|
250
259
|
{nextLabel || null}
|
|
251
260
|
</a>
|
|
252
261
|
</li>
|
|
@@ -254,8 +263,8 @@ const Pagination = forwardRef((props: PaginationProps, externalRef: any) => {
|
|
|
254
263
|
|
|
255
264
|
|
|
256
265
|
{lastLabel ? (
|
|
257
|
-
<li className={activePage < totalPages ?
|
|
258
|
-
<a tabIndex={activePage < totalPages ? 0 : -1} aria-disabled={activePage < totalPages ? 'false' : 'true'} className="page-link" data-page={totalPages} href={apiUrl
|
|
266
|
+
<li className={activePage < totalPages ? `${_itemClassName} ${_lastClassName}` : `${_itemClassName} ${_lastClassName} ${_disabledClassName}`}>
|
|
267
|
+
<a tabIndex={activePage < totalPages ? 0 : -1} aria-disabled={activePage < totalPages ? 'false' : 'true'} className="page-link" data-page={totalPages} href={apiUrl?.replace('{page}', totalPages as any)} onClick={(e) => { e.preventDefault(); handleClick('last'); }}>
|
|
259
268
|
{lastLabel || null}
|
|
260
269
|
</a>
|
|
261
270
|
</li>
|
package/lib/esm/Radio/index.tsx
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
} from 'funda-utils';
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
|
|
11
12
|
export interface OptionConfig {
|
|
12
13
|
[propName: string]: string | number | React.ReactNode | boolean;
|
|
13
14
|
}
|
|
@@ -358,6 +359,12 @@ const Radio = forwardRef((props: RadioProps, externalRef: any) => {
|
|
|
358
359
|
return Array.isArray(dataInit) ? dataInit.map((item: any, index: number) => {
|
|
359
360
|
const requiredVal = index === 0 ? required || null : null;
|
|
360
361
|
|
|
362
|
+
const _formatItem = {};
|
|
363
|
+
Object.keys(item).forEach((key: string) => {
|
|
364
|
+
if (key !== 'extends') _formatItem[key] = item[key];
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
|
|
361
368
|
const _groupEl = () => {
|
|
362
369
|
return <>
|
|
363
370
|
{/* GROUP LABEL */}
|
|
@@ -366,6 +373,12 @@ const Radio = forwardRef((props: RadioProps, externalRef: any) => {
|
|
|
366
373
|
|
|
367
374
|
{item.optgroup.map((opt: any, optIndex: number) => {
|
|
368
375
|
|
|
376
|
+
const _formatOpt = {};
|
|
377
|
+
Object.keys(item).forEach((key: string) => {
|
|
378
|
+
if (key !== 'extends') _formatOpt[key] = item[key];
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
|
|
369
382
|
return <div key={'option-' + optIndex} className={`${inline ? `form-check form-check-inline` : `form-check`} ${controlValue == opt.value ? (itemSelectedClassName || 'item-selected') : ''}`}>
|
|
370
383
|
<div className="d-inline-block">
|
|
371
384
|
<input
|
|
@@ -382,7 +395,7 @@ const Radio = forwardRef((props: RadioProps, externalRef: any) => {
|
|
|
382
395
|
data-list-item-label={`${typeof opt.listItemLabel === 'undefined' ? '' : opt.listItemLabel}`}
|
|
383
396
|
data-value={opt.value}
|
|
384
397
|
data-disabled={disabled || (typeof opt.disabled !== 'undefined' ? `${opt.disabled}` : 'false')}
|
|
385
|
-
data-optiondata={JSON.stringify(
|
|
398
|
+
data-optiondata={JSON.stringify(_formatOpt)}
|
|
386
399
|
value={`${opt.value}`}
|
|
387
400
|
required={requiredVal}
|
|
388
401
|
disabled={disabled || (typeof opt.disabled !== 'undefined' ? opt.disabled : null)}
|
|
@@ -424,7 +437,7 @@ const Radio = forwardRef((props: RadioProps, externalRef: any) => {
|
|
|
424
437
|
data-list-item-label={`${typeof item.listItemLabel === 'undefined' ? '' : item.listItemLabel}`}
|
|
425
438
|
data-value={item.value}
|
|
426
439
|
data-disabled={disabled || (typeof item.disabled !== 'undefined' ? `${item.disabled}` : 'false')}
|
|
427
|
-
data-optiondata={JSON.stringify(
|
|
440
|
+
data-optiondata={JSON.stringify(_formatItem)}
|
|
428
441
|
value={`${item.value}`}
|
|
429
442
|
required={requiredVal}
|
|
430
443
|
disabled={disabled || (typeof item.disabled !== 'undefined' ? item.disabled : null)}
|
|
@@ -456,7 +469,7 @@ const Radio = forwardRef((props: RadioProps, externalRef: any) => {
|
|
|
456
469
|
colSpan={1}
|
|
457
470
|
className={`radio-group__wrapper ${groupWrapperClassName || ''} ${tableLayoutCellClassName || ''}`}
|
|
458
471
|
key={'optgroup-' + index}
|
|
459
|
-
data-optiondata={JSON.stringify(
|
|
472
|
+
data-optiondata={JSON.stringify(_formatItem)}
|
|
460
473
|
>
|
|
461
474
|
{_groupEl()}
|
|
462
475
|
</td>;
|
|
@@ -466,7 +479,7 @@ const Radio = forwardRef((props: RadioProps, externalRef: any) => {
|
|
|
466
479
|
colSpan={1}
|
|
467
480
|
className={`${inline ? `form-check form-check-inline` : `form-check`} ${controlValue == item.value ? (itemSelectedClassName || 'item-selected') : ''} ${tableLayoutCellClassName || ''}`}
|
|
468
481
|
key={'option-' + index}
|
|
469
|
-
data-optiondata={JSON.stringify(
|
|
482
|
+
data-optiondata={JSON.stringify(_formatItem)}
|
|
470
483
|
>
|
|
471
484
|
{_normalEl()}
|
|
472
485
|
</td>;
|
|
@@ -477,7 +490,7 @@ const Radio = forwardRef((props: RadioProps, externalRef: any) => {
|
|
|
477
490
|
return <div
|
|
478
491
|
className={`radio-group__wrapper ${groupWrapperClassName || ''}`}
|
|
479
492
|
key={'optgroup-' + index}
|
|
480
|
-
data-optiondata={JSON.stringify(
|
|
493
|
+
data-optiondata={JSON.stringify(_formatItem)}
|
|
481
494
|
>
|
|
482
495
|
{_groupEl()}
|
|
483
496
|
</div>;
|
|
@@ -486,7 +499,7 @@ const Radio = forwardRef((props: RadioProps, externalRef: any) => {
|
|
|
486
499
|
return <div
|
|
487
500
|
className={`${inline ? `form-check form-check-inline` : `form-check`} ${controlValue == item.value ? (itemSelectedClassName || 'item-selected') : ''}`}
|
|
488
501
|
key={'option-' + index}
|
|
489
|
-
data-optiondata={JSON.stringify(
|
|
502
|
+
data-optiondata={JSON.stringify(_formatItem)}
|
|
490
503
|
>
|
|
491
504
|
{_normalEl()}
|
|
492
505
|
</div>;
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
.custom-select__wrapper {
|
|
6
6
|
|
|
7
|
-
|
|
8
7
|
--cus-sel-focus-border-color:#86b7fe;
|
|
9
8
|
--cus-sel-focus-box-shadow: 0 0 0 0.25rem rgba(13,110,253,.25);
|
|
10
9
|
--cus-sel-placeholder-color: rgba(33, 37, 41, 0.75);
|
|
@@ -18,6 +17,8 @@
|
|
|
18
17
|
--cus-sel-removebtn-fill: #000;
|
|
19
18
|
--cus-sel-removebtn-hover-fill: #f00;
|
|
20
19
|
|
|
20
|
+
position: relative; /* Required */
|
|
21
|
+
|
|
21
22
|
|
|
22
23
|
|
|
23
24
|
/*------ Placeholder for input ------*/
|
|
@@ -306,6 +307,10 @@
|
|
|
306
307
|
|
|
307
308
|
/*------ Search button ------*/
|
|
308
309
|
.custom-select-multi__control-searchbtn {
|
|
310
|
+
position: absolute;
|
|
311
|
+
right: 0;
|
|
312
|
+
top: 50%;
|
|
313
|
+
transform: translateY(-50%);
|
|
309
314
|
z-index: 5;
|
|
310
315
|
pointer-events: auto;
|
|
311
316
|
|