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.
Files changed (77) hide show
  1. package/CascadingSelect/index.js +1 -1
  2. package/EventCalendar/index.css +3 -0
  3. package/EventCalendar/index.d.ts +4 -1
  4. package/EventCalendar/index.js +16 -4
  5. package/EventCalendarTimeline/index.css +17 -0
  6. package/EventCalendarTimeline/index.d.ts +9 -2
  7. package/EventCalendarTimeline/index.js +77 -22
  8. package/LiveSearch/index.css +12 -0
  9. package/LiveSearch/index.js +1 -1
  10. package/ModalDialog/index.js +1 -1
  11. package/MultilevelDropdownMenu/index.css +2 -2
  12. package/MultilevelDropdownMenu/index.js +54 -46
  13. package/MultipleSelect/index.css +35 -26
  14. package/MultipleSelect/index.d.ts +3 -0
  15. package/MultipleSelect/index.js +366 -134
  16. package/NativeSelect/index.js +75 -47
  17. package/Pagination/index.d.ts +2 -0
  18. package/Pagination/index.js +25 -21
  19. package/Radio/index.js +14 -6
  20. package/RangeSlider/index.css +1 -0
  21. package/Select/index.css +5 -0
  22. package/Select/index.d.ts +1 -0
  23. package/Select/index.js +31 -11
  24. package/Tabs/index.js +13 -2
  25. package/Tree/index.js +90 -56
  26. package/lib/cjs/CascadingSelect/index.js +1 -1
  27. package/lib/cjs/EventCalendar/index.d.ts +4 -1
  28. package/lib/cjs/EventCalendar/index.js +16 -4
  29. package/lib/cjs/EventCalendarTimeline/index.d.ts +9 -2
  30. package/lib/cjs/EventCalendarTimeline/index.js +77 -22
  31. package/lib/cjs/LiveSearch/index.js +1 -1
  32. package/lib/cjs/ModalDialog/index.js +1 -1
  33. package/lib/cjs/MultilevelDropdownMenu/index.js +54 -46
  34. package/lib/cjs/MultipleSelect/index.d.ts +3 -0
  35. package/lib/cjs/MultipleSelect/index.js +366 -134
  36. package/lib/cjs/NativeSelect/index.js +75 -47
  37. package/lib/cjs/Pagination/index.d.ts +2 -0
  38. package/lib/cjs/Pagination/index.js +25 -21
  39. package/lib/cjs/Radio/index.js +14 -6
  40. package/lib/cjs/Select/index.d.ts +1 -0
  41. package/lib/cjs/Select/index.js +31 -11
  42. package/lib/cjs/Tabs/index.js +13 -2
  43. package/lib/cjs/Tree/index.js +90 -56
  44. package/lib/css/EventCalendar/index.css +3 -0
  45. package/lib/css/EventCalendarTimeline/index.css +17 -0
  46. package/lib/css/LiveSearch/index.css +12 -0
  47. package/lib/css/MultilevelDropdownMenu/index.css +2 -2
  48. package/lib/css/MultipleSelect/index.css +35 -26
  49. package/lib/css/RangeSlider/index.css +1 -0
  50. package/lib/css/Select/index.css +5 -0
  51. package/lib/esm/CascadingSelect/index.tsx +1 -1
  52. package/lib/esm/EventCalendar/index.scss +2 -0
  53. package/lib/esm/EventCalendar/index.tsx +23 -6
  54. package/lib/esm/EventCalendarTimeline/index.scss +24 -1
  55. package/lib/esm/EventCalendarTimeline/index.tsx +195 -118
  56. package/lib/esm/LiveSearch/index.scss +14 -1
  57. package/lib/esm/LiveSearch/index.tsx +1 -1
  58. package/lib/esm/ModalDialog/index.tsx +1 -1
  59. package/lib/esm/MultilevelDropdownMenu/{MenuList.tsx → ItemList.tsx} +52 -45
  60. package/lib/esm/MultilevelDropdownMenu/index.scss +2 -2
  61. package/lib/esm/MultilevelDropdownMenu/index.tsx +12 -4
  62. package/lib/esm/MultipleSelect/ItemList.tsx +300 -0
  63. package/lib/esm/MultipleSelect/index.scss +61 -30
  64. package/lib/esm/MultipleSelect/index.tsx +56 -87
  65. package/lib/esm/MultipleSelect/multiple-select-utils/func.ts +29 -0
  66. package/lib/esm/NativeSelect/index.tsx +4 -18
  67. package/lib/esm/NativeSelect/native-select-utils/func.ts +40 -0
  68. package/lib/esm/Pagination/index.tsx +31 -22
  69. package/lib/esm/Radio/index.tsx +19 -6
  70. package/lib/esm/RangeSlider/index.scss +2 -0
  71. package/lib/esm/Select/index.scss +6 -1
  72. package/lib/esm/Select/index.tsx +70 -54
  73. package/lib/esm/Table/Table.tsx +2 -0
  74. package/lib/esm/Tabs/Tabs.tsx +19 -4
  75. package/lib/esm/Tree/TreeList.tsx +61 -54
  76. package/lib/esm/Tree/index.tsx +4 -0
  77. package/package.json +1 -1
@@ -2,6 +2,20 @@
2
2
  <!-- Live Search -->
3
3
  /* ====================================================== */
4
4
 
5
+ .livesearch__wrapper {
6
+
7
+ /*------ Search button ------*/
8
+ .livesearch__wrapper-searchbtn {
9
+ position: absolute;
10
+ right: 0;
11
+ top: 50%;
12
+ transform: translateY(-50%);
13
+ z-index: 5;
14
+ pointer-events: auto;
15
+ }
16
+
17
+ }
18
+
5
19
 
6
20
  /*------ List ------*/
7
21
  .livesearch__options-wrapper {
@@ -21,7 +35,6 @@
21
35
  display: block !important;
22
36
  }
23
37
 
24
-
25
38
  .livesearch__options-contentlist {
26
39
  overflow: hidden;
27
40
  overflow-y: auto;
@@ -905,7 +905,7 @@ const LiveSearch = forwardRef((props: LiveSearchProps, externalRef: any) => {
905
905
 
906
906
  {hideIcon ? null : <>
907
907
  {!fetchTrigger ? <>
908
- <span className="livesearch__wrapper-searchbtn position-absolute top-0 end-0">
908
+ <span className="livesearch__wrapper-searchbtn">
909
909
  <button tabIndex={-1} type="button" className="btn border-end-0 rounded-pill" style={{ pointerEvents: 'none' }}>
910
910
  <svg width="1em" height="1em" fill="#a5a5a5" viewBox="0 0 16 16">
911
911
  <path d="M12.027 9.92L16 13.95 14 16l-4.075-3.976A6.465 6.465 0 0 1 6.5 13C2.91 13 0 10.083 0 6.5 0 2.91 2.917 0 6.5 0 10.09 0 13 2.917 13 6.5a6.463 6.463 0 0 1-.973 3.42zM1.997 6.452c0 2.48 2.014 4.5 4.5 4.5 2.48 0 4.5-2.015 4.5-4.5 0-2.48-2.015-4.5-4.5-4.5-2.48 0-4.5 2.014-4.5 4.5z" fillRule="evenodd" />
@@ -145,7 +145,7 @@ const ModalDialog = forwardRef((props: ModalDialogProps, externalRef: React.Forw
145
145
  const DEPTH = depth || 1055; // the default value same as bootstrap
146
146
  const M_WIDTH = fullscreen ? undefined : (typeof maxWidth === 'function' ? maxWidth() : maxWidth ? maxWidth : undefined);
147
147
  const M_HEIGHT = typeof minHeight === 'function' ? minHeight() : minHeight ? minHeight : undefined;
148
- const LOCK_BODY_SCROLL = typeof lockBodyScroll === 'undefined' ? true : lockBodyScroll;
148
+ const LOCK_BODY_SCROLL = typeof lockBodyScroll === 'undefined' ? false : lockBodyScroll;
149
149
 
150
150
  const uniqueID = useComId();
151
151
  const modalRef = useRef<any>(null);
@@ -8,7 +8,8 @@ import {
8
8
 
9
9
  /* Recursively nested components to traverse nodes
10
10
  -------------------------------------------------*/
11
- type MenuListProps = {
11
+ type ItemListProps = {
12
+ root: any;
12
13
  alternateCollapse?: boolean;
13
14
  first?: boolean;
14
15
  arrow?: React.ReactNode;
@@ -18,9 +19,10 @@ type MenuListProps = {
18
19
  onSelect?: (e: any, val: any) => void;
19
20
  };
20
21
 
21
- export default function MenuList(props: MenuListProps) {
22
+ export default function ItemList(props: ItemListProps) {
22
23
 
23
24
  const {
25
+ root,
24
26
  alternateCollapse,
25
27
  first,
26
28
  arrow,
@@ -89,6 +91,7 @@ export default function MenuList(props: MenuListProps) {
89
91
 
90
92
  function handleClick(e: any) {
91
93
  e.preventDefault();
94
+ e.stopPropagation();
92
95
  const hyperlink = e.currentTarget;
93
96
  const url = hyperlink.getAttribute('href');
94
97
  const subElement = getNextSiblings(hyperlink, 'ul');
@@ -153,60 +156,63 @@ export default function MenuList(props: MenuListProps) {
153
156
 
154
157
  useEffect(() => {
155
158
 
159
+ if (root !== null && data.length > 0) {
160
+ // Activate current item
161
+ //=====================
162
+ const allItems = rootRef.current ? [].slice.call(root.querySelectorAll(`.${childClassName} a`)).map( (item: any) => {
163
+ return {
164
+ href: item.getAttribute('href'),
165
+ el: item,
166
+ actived: item.parentNode.classList?.contains('active') ? true : false,
167
+ expandedLink: document.body.contains(item.parentNode.parentNode.previousSibling) ? item.parentNode.parentNode.previousSibling : false
168
+ }
169
+ } ) : [];
156
170
 
157
- // Activate current item
158
- //=====================
159
- const allItems = rootRef.current ? [].slice.call(document.querySelectorAll(`.${childClassName} a`)).map( (item: any) => {
160
- return {
161
- href: item.getAttribute('href'),
162
- el: item,
163
- actived: item.parentNode.classList?.contains('active') ? true : false,
164
- expandedLink: document.body.contains(item.parentNode.parentNode.previousSibling) ? item.parentNode.parentNode.previousSibling : false
165
- }
166
- } ) : [];
167
-
168
-
169
- allItems.forEach( (hyperlink: any) => {
171
+
172
+ allItems.forEach( (hyperlink: any) => {
170
173
 
171
- // Expand the currently active item by default
172
- if ( hyperlink.actived ) {
174
+ // Expand the currently active item by default
175
+ if ( hyperlink.actived ) {
173
176
 
174
- hyperlink.el.setAttribute('aria-expanded', 'true');
177
+ hyperlink.el.setAttribute('aria-expanded', 'true');
175
178
 
176
- if ( hyperlink.expandedLink ) {
177
- const expandedLink: any = hyperlink.expandedLink; // <a>
178
- activeClass(expandedLink.parentNode, 'add');
179
- expandedLink.setAttribute('aria-expanded', true);
180
- }
179
+ if ( hyperlink.expandedLink ) {
180
+ const expandedLink: any = hyperlink.expandedLink; // <a>
181
+ activeClass(expandedLink.parentNode, 'add');
182
+ expandedLink.setAttribute('aria-expanded', true);
183
+ }
181
184
 
182
185
 
183
- // init <ul> height
184
- const ul = getNextSiblings(hyperlink.el, 'ul');
185
-
186
- [].slice.call(ul).forEach(function (_curUl: any) {
186
+ // init <ul> height
187
+ const ul = getNextSiblings(hyperlink.el, 'ul');
188
+
189
+ [].slice.call(ul).forEach(function (_curUl: any) {
187
190
 
188
- const allHeight = [].slice.call(_curUl.querySelectorAll('li')).map((_curLi: any) => _curLi.scrollHeight);
191
+ const allHeight = [].slice.call(_curUl.querySelectorAll('li')).map((_curLi: any) => _curLi.scrollHeight);
189
192
 
190
- // Prevent missing height, causing the last element to be clipped
191
- const maxHeight = Math.max(...allHeight);
192
- allHeight.push(maxHeight * 3);
193
+ // Prevent missing height, causing the last element to be clipped
194
+ const maxHeight = Math.max(...allHeight);
195
+ allHeight.push(maxHeight * 3);
193
196
 
194
197
 
195
- //
196
- const totalHeight = allHeight.reduce(
197
- (accumulator: number, currentValue: number) => accumulator + currentValue,
198
- 0,
199
- );
200
-
201
- // Prevent the use of iframe or other situations where the height is 0
202
- _curUl.style.maxHeight = `${totalHeight == 0 ? 999 : totalHeight}px`;
198
+ //
199
+ const totalHeight = allHeight.reduce(
200
+ (accumulator: number, currentValue: number) => accumulator + currentValue,
201
+ 0,
202
+ );
203
+
204
+ // Prevent the use of iframe or other situations where the height is 0
205
+ _curUl.style.maxHeight = `${totalHeight == 0 ? 999 : totalHeight}px`;
206
+
207
+ });
203
208
 
204
- });
205
-
206
- }
209
+ }
207
210
 
208
- });
211
+ });
212
+
213
+ }
209
214
 
215
+
210
216
  }, [data]);
211
217
 
212
218
 
@@ -232,9 +238,10 @@ export default function MenuList(props: MenuListProps) {
232
238
  <li key={i} className={item.active ? `nav-item active` : (_matchPath ? `nav-item active` : 'nav-item')}>
233
239
  <a tabIndex={-1} title={item.title} className={item.active ? `nav-link active` : (_matchPath ? `nav-link active` : 'nav-link')} href={item.link === '#' ? `${item.link}-${i}` : item.link} onClick={handleClick} data-router={item.link.indexOf('#') >= 0 || item.link.indexOf('http') >= 0 ? 'false' : 'true'} data-link={item.link} data-slug={item.slug}>
234
240
  {item.icon ? item.icon.indexOf('</svg>') < 0 ? <><i className={item.icon}></i> </> : <var dangerouslySetInnerHTML={{ __html: `${item.icon}` }} /> : null}<i dangerouslySetInnerHTML={{ __html: `${item.title}` }}></i>
235
- {item.children ? <span className="arrow">{arrowGenerator()}</span> : ''}
241
+ {item.children && item.children.length > 0 ? <span className="arrow">{arrowGenerator()}</span> : ''}
236
242
  </a>
237
- {item.children && <MenuList
243
+ {item.children && <ItemList
244
+ root={root}
238
245
  data={item.children}
239
246
  first={false}
240
247
  arrow={arrow}
@@ -17,8 +17,8 @@
17
17
  display: inline-block;
18
18
  text-align: center;
19
19
  position: absolute;
20
- right: 0.5em;
21
- top: 1.5em;
20
+ right: -1em;
21
+ top: 50%;
22
22
  transform: translateY(-50%) rotate(0deg);
23
23
  }
24
24
 
@@ -1,10 +1,12 @@
1
- import React, { useState, useEffect, memo } from 'react';
1
+ import React, { useRef, useState, useEffect, memo } from 'react';
2
2
 
3
3
  import {
4
4
  useComId
5
5
  } from 'funda-utils';
6
6
 
7
- import MenuList from './MenuList';
7
+
8
+
9
+ import ItemList from './ItemList';
8
10
 
9
11
 
10
12
  type MultilevelDropdownMenuProps = {
@@ -38,6 +40,7 @@ const MultilevelDropdownMenu = (props: MultilevelDropdownMenuProps) => {
38
40
  onSelect
39
41
  } = props;
40
42
 
43
+ const rootRef = useRef<any>(null);
41
44
  const uniqueID = useComId();
42
45
  const idRes = id || uniqueID;
43
46
  const [val, setVal] = useState<any>(null);
@@ -50,8 +53,13 @@ const MultilevelDropdownMenu = (props: MultilevelDropdownMenuProps) => {
50
53
  return (
51
54
  <>
52
55
 
53
- <nav id={idRes} className={navbarClassName ? navbarClassName : "navbar"}>
54
- <MenuList
56
+ <nav
57
+ id={idRes}
58
+ className={navbarClassName ? navbarClassName : "navbar"}
59
+ ref={rootRef}
60
+ >
61
+ <ItemList
62
+ root={rootRef.current}
55
63
  alternateCollapse={alternateCollapse}
56
64
  first={true}
57
65
  arrow={arrow}
@@ -0,0 +1,300 @@
1
+ import React, { forwardRef, useEffect, useRef } from 'react';
2
+
3
+ import {
4
+ getNextSiblings
5
+ } from 'funda-utils';
6
+
7
+
8
+ import { formatIndentVal, multiSelControlOptionExist } from './multiple-select-utils/func';
9
+
10
+ /* Recursively nested components to traverse nodes
11
+ -------------------------------------------------*/
12
+ type ItemListProps = {
13
+ root: any;
14
+ listContainerClassName: string;
15
+ valSelected: any[];
16
+ indentStr: string;
17
+ iconAdd?: React.ReactNode | string;
18
+ iconRemove?: React.ReactNode | string;
19
+ selected?: boolean;
20
+ onSelect: (any) => void;
21
+ alternateCollapse?: boolean;
22
+ first?: boolean;
23
+ arrow?: React.ReactNode;
24
+ childClassName: string;
25
+ data: any[any];
26
+ };
27
+
28
+ const ItemList = forwardRef((props: ItemListProps, externalRef: any) => {
29
+
30
+ const {
31
+ root,
32
+ listContainerClassName,
33
+ valSelected,
34
+ indentStr,
35
+ iconAdd,
36
+ iconRemove,
37
+ selected,
38
+ onSelect,
39
+ alternateCollapse,
40
+ first,
41
+ arrow,
42
+ childClassName,
43
+ data,
44
+ } = props;
45
+
46
+ const listContainerRef = useRef<any>(null);
47
+
48
+ const activeClass = (el: any, mode: string, classname: string = 'active') => {
49
+ if ( mode === 'add' ) {
50
+ el.classList.add(classname);
51
+ } else {
52
+ el.classList.remove(classname);
53
+ }
54
+ };
55
+
56
+ const closeChild = (hyperlink: HTMLElement, ul: HTMLAllCollection) => {
57
+ if ( ul.length === 0 ) return;
58
+
59
+ activeClass(hyperlink, 'remove');
60
+ hyperlink.setAttribute('aria-expanded', 'false');
61
+ activeClass(hyperlink.parentNode, 'remove');
62
+
63
+ //to close
64
+ [].slice.call(ul).forEach(function(element: any){
65
+ element.style.maxHeight = 0;
66
+ });
67
+ };
68
+
69
+ const openChild = (hyperlink: HTMLElement, ul: HTMLAllCollection) => {
70
+ if ( ul.length === 0 ) return;
71
+
72
+ activeClass(hyperlink, 'add');
73
+ hyperlink.setAttribute('aria-expanded', 'true');
74
+ activeClass(hyperlink.parentNode, 'add');
75
+
76
+ // init <ul> height
77
+ [].slice.call(ul).forEach(function (_curUl: any) {
78
+
79
+ const allHeight = [].slice.call(_curUl.querySelectorAll('li')).map((_curLi: any) => _curLi.scrollHeight);
80
+
81
+ // Prevent missing height, causing the last element to be clipped
82
+ const maxHeight = Math.max(...allHeight);
83
+ allHeight.push(maxHeight*3);
84
+
85
+ //
86
+ const totalHeight = allHeight.reduce(
87
+ (accumulator: number, currentValue: number) => accumulator + currentValue,
88
+ 0,
89
+ );
90
+
91
+ // Prevent the use of iframe or other situations where the height is 0
92
+ _curUl.style.maxHeight = `${totalHeight == 0 ? 999 : totalHeight}px`;
93
+
94
+ });
95
+
96
+ };
97
+
98
+
99
+
100
+ function handleClick(e: any) {
101
+ e.preventDefault();
102
+ e.stopPropagation();
103
+ const hyperlink = e.currentTarget.querySelector('div');
104
+ const subElement = getNextSiblings(hyperlink, 'ul');
105
+
106
+
107
+
108
+ // hide child if expandedLink doesn't exist, on the contrary
109
+ //=====================
110
+ if ( hyperlink.getAttribute('aria-expanded') === 'false' || hyperlink.getAttribute('aria-expanded') === null ) {
111
+
112
+
113
+ //Hide all other siblings of the selected <ul>
114
+ if ( alternateCollapse ) {
115
+ [].slice.call(listContainerRef.current.children).forEach(function(li: any){
116
+
117
+ activeClass(li, 'remove');
118
+
119
+ const _li = li.firstChild;
120
+ activeClass(_li, 'remove');
121
+ _li.setAttribute('aria-expanded', false);
122
+
123
+ [].slice.call(getNextSiblings(_li, 'ul')).forEach(function(element: any){
124
+ element.style.maxHeight = 0;
125
+ });
126
+ });
127
+ }
128
+
129
+
130
+ //open current
131
+ openChild(hyperlink, subElement as never);
132
+
133
+ } else {
134
+
135
+ //close current
136
+ closeChild(hyperlink, subElement as never);
137
+ }
138
+
139
+
140
+
141
+ }
142
+
143
+
144
+ function arrowGenerator() {
145
+ return arrow ? arrow : <svg viewBox="0 0 22 22" width="8px"><path d="m345.44 248.29l-194.29 194.28c-12.359 12.365-32.397 12.365-44.75 0-12.354-12.354-12.354-32.391 0-44.744l171.91-171.91-171.91-171.9c-12.354-12.359-12.354-32.394 0-44.748 12.354-12.359 32.391-12.359 44.75 0l194.29 194.28c6.177 6.18 9.262 14.271 9.262 22.366 0 8.099-3.091 16.196-9.267 22.373" transform="matrix(.03541-.00013.00013.03541 2.98 3.02)" fill="#a5a5a5" /></svg>;
146
+ }
147
+
148
+ useEffect(() => {
149
+
150
+ if (root !== null && data.length > 0) {
151
+ // Activate current item
152
+ //=====================
153
+ const allItems = listContainerRef.current ? [].slice.call(root.querySelectorAll(`.${childClassName} div`)).map( (item: any) => {
154
+ return {
155
+ el: item,
156
+ actived: item.parentNode.classList?.contains('active') ? true : false,
157
+ expandedLink: document.body.contains(item.parentNode.parentNode.previousSibling) ? item.parentNode.parentNode.previousSibling : false
158
+ }
159
+ } ) : [];
160
+
161
+
162
+ allItems.forEach( (hyperlink: any) => {
163
+
164
+ // Expand the currently active item by default
165
+ if ( hyperlink.actived ) {
166
+
167
+ hyperlink.el.setAttribute('aria-expanded', 'true');
168
+
169
+ if ( hyperlink.expandedLink ) {
170
+ const expandedLink: any = hyperlink.expandedLink; // <a>
171
+ activeClass(expandedLink.parentNode, 'add');
172
+ expandedLink.setAttribute('aria-expanded', true);
173
+ }
174
+
175
+
176
+ // init <ul> height
177
+ const ul = getNextSiblings(hyperlink.el, 'ul');
178
+
179
+ [].slice.call(ul).forEach(function (_curUl: any) {
180
+
181
+ const allHeight = [].slice.call(_curUl.querySelectorAll('li')).map((_curLi: any) => _curLi.scrollHeight);
182
+
183
+ // Prevent missing height, causing the last element to be clipped
184
+ const maxHeight = Math.max(...allHeight);
185
+ allHeight.push(maxHeight * 3);
186
+
187
+
188
+ //
189
+ const totalHeight = allHeight.reduce(
190
+ (accumulator: number, currentValue: number) => accumulator + currentValue,
191
+ 0,
192
+ );
193
+
194
+ // Prevent the use of iframe or other situations where the height is 0
195
+ _curUl.style.maxHeight = `${totalHeight == 0 ? 999 : totalHeight}px`;
196
+
197
+ });
198
+
199
+ }
200
+
201
+ });
202
+
203
+ }
204
+
205
+
206
+
207
+ }, [data]);
208
+
209
+
210
+ if (data) {
211
+
212
+ return (
213
+ <>
214
+ <ul
215
+ className={`${listContainerClassName || ''} ${childClassName}`}
216
+ style={!first ? { maxHeight: '0px' } : {}}
217
+ ref={(node) => {
218
+ listContainerRef.current = node;
219
+ if (typeof externalRef === 'function') {
220
+ externalRef(node);
221
+ } else if (externalRef) {
222
+ externalRef.current = node;
223
+ }
224
+ }}
225
+ >
226
+
227
+
228
+ {data ? data.map((item: any, i: number) => {
229
+
230
+ return <li
231
+ key={selected ? 'item-selected' + i : 'item' + i}
232
+ className={selected ? 'selected' : `${item.disabled ? 'disabled' : ''} ${multiSelControlOptionExist(valSelected, item.value) ? 'hide' : ''}`}
233
+ data-index={i}
234
+ data-value={`${item.value}`}
235
+ data-label={`${item.label}`}
236
+ data-list-item-label={`${typeof item.listItemLabel === 'undefined' ? '' : item.listItemLabel}`}
237
+ data-disabled={item.disabled || 'false'}
238
+ data-querystring={`${typeof item.queryString === 'undefined' ? '' : item.queryString}`}
239
+ data-itemdata={JSON.stringify(item)}
240
+ onClick={selected ? () => void(0) : handleClick}
241
+ >
242
+
243
+
244
+ <div>
245
+ <strong>
246
+ <span dangerouslySetInnerHTML={{
247
+ __html: selected ? (typeof item.listItemLabel === 'undefined' ? formatIndentVal(item.label, indentStr) : formatIndentVal(item.listItemLabel, indentStr)) : (typeof item.listItemLabel === 'undefined' ? item.label : item.listItemLabel)
248
+ }}></span>
249
+ {item.children && item.children.length > 0 && !selected ? <span className="arrow">{arrowGenerator()}</span> : ''}
250
+ </strong>
251
+
252
+ <i
253
+ onClick={(e: React.MouseEvent) => {
254
+ e.stopPropagation();
255
+ onSelect((e.target as any).closest('li'));
256
+ }}>
257
+
258
+ {selected ? <>
259
+ {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></>}
260
+ </> : <>
261
+ {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></>}
262
+ </>}
263
+ </i>
264
+
265
+
266
+ </div>
267
+
268
+ {item.children && <ItemList
269
+ root={root}
270
+ listContainerClassName={listContainerClassName}
271
+ ref={externalRef}
272
+ indentStr={indentStr}
273
+ valSelected={valSelected}
274
+ iconAdd={iconAdd}
275
+ iconRemove={iconRemove}
276
+ onSelect={onSelect}
277
+ first={false}
278
+ arrow={arrow}
279
+ data={item.children}
280
+ childClassName={childClassName}
281
+ />}
282
+
283
+ </li>;
284
+ }) : null}
285
+
286
+ </ul>
287
+
288
+
289
+ </>
290
+ )
291
+ } else {
292
+ return (
293
+ <></>
294
+ )
295
+ }
296
+
297
+
298
+ });
299
+
300
+ export default ItemList;
@@ -87,8 +87,7 @@
87
87
  cursor: default;
88
88
  position: relative;
89
89
  font-size: var(--m-select-body-font-size);
90
- display: flex;
91
- justify-content: space-between;
90
+ display: block;
92
91
  background: var(--m-select-options-item-bg);
93
92
  border-bottom: 1px solid var(--m-select-options-item-dividingline-color);
94
93
 
@@ -119,47 +118,51 @@
119
118
  &:last-child {
120
119
  border-bottom: none;
121
120
  }
122
- > span {
121
+ > div {
123
122
  padding: .35rem .75rem;
124
- display: inline-block;
125
- max-width: 100%;
123
+ display: flex;
124
+ justify-content: space-between;
125
+ width: 100%;
126
126
  overflow: hidden;
127
127
  text-overflow: ellipsis;
128
128
  word-wrap: break-word;
129
129
  word-break: break-word;
130
- }
131
130
 
132
- > strong {
133
- font-weight: normal;
134
- }
135
-
136
- > i {
137
- display: inline-block;
138
- padding: .35rem .75rem;
139
- cursor: pointer;
140
131
 
141
- svg {
142
- path {
143
- fill: var(--m-select-options-item-icon-color);
132
+ > strong {
133
+ font-weight: normal;
134
+ display: flex;
135
+ align-items: center;
136
+
137
+ .arrow {
138
+ display: inline-block;
139
+ margin-left: .2rem;
140
+ }
141
+
142
+ }
143
+
144
+ &.active {
145
+ .arrow {
146
+ transform: rotate(90deg);
144
147
  }
145
148
  }
146
- }
147
149
 
148
150
 
151
+ > i {
152
+ display: inline-block;
153
+ cursor: pointer;
149
154
 
150
- a {
151
- color: #999;
152
- text-decoration: none;
153
- padding: 0;
154
- display: block;
155
- cursor: pointer;
156
- &.m-select__item-action {
157
- position: absolute;
158
- right: 0.5rem;
159
- top: 0.5rem;
155
+ svg {
156
+ path {
157
+ fill: var(--m-select-options-item-icon-color);
158
+ }
159
+ }
160
160
  }
161
+
161
162
  }
163
+
162
164
  }
165
+
163
166
  div {
164
167
  &.m-select__selected__container {
165
168
  .m-select__header {
@@ -232,8 +235,36 @@
232
235
  }
233
236
 
234
237
 
238
+ /*-------- Multilevel --------*/
239
+ ul.m-select__options-contentlist {
240
+
241
+ > li {
242
+
243
+ ul {
244
+ transition: max-height 0.25s ease;
245
+ overflow: hidden;
246
+ position: relative;
247
+ padding-left: 1rem;
248
+ }
249
+ }
250
+
251
+ > li:not(.active) {
252
+
253
+ ul {
254
+ max-height: 0;
255
+ }
256
+ }
257
+
258
+
259
+ > li ul ul {
260
+ margin-top: auto;
261
+ }
262
+
263
+ }
264
+
265
+
235
266
  /*-------- List --------*/
236
- .m-select__options-contentlist {
267
+ ul.m-select__options-contentlist {
237
268
  position: relative;
238
269
  width: 100%;
239
270
  overflow: hidden;
@@ -252,7 +283,7 @@
252
283
  cursor: grab;
253
284
  }
254
285
  }
255
- .m-select__options-contentlist--hide {
286
+ ul.m-select__options-contentlist--hide {
256
287
  overflow: hidden;
257
288
  height: auto;
258
289
  }