funda-ui 1.0.520 → 1.0.525

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.
@@ -770,10 +770,16 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
770
770
  handleFetch(val).then(function (response) {
771
771
  _orginalData = response;
772
772
  update(_orginalData);
773
+
774
+ // Adjust the overall height to fit the wrapper
775
+ fixContentHeight();
773
776
  });
774
777
  } else {
775
778
  _orginalData = orginalData;
776
779
  update(_orginalData);
780
+
781
+ // Adjust the overall height to fit the wrapper
782
+ fixContentHeight();
777
783
  }
778
784
  }, 350, [optionsData]);
779
785
 
@@ -860,6 +866,14 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
860
866
  }
861
867
 
862
868
  //
869
+ function fixContentHeight() {
870
+ if (listContentRef.current === null) return;
871
+ setTimeout(function () {
872
+ var _displayedItems = listContentRef.current.querySelectorAll('.list-group-item');
873
+ var _displayedHeight = _displayedItems[0].clientHeight * _displayedItems.length;
874
+ listContentRef.current.style.height = _displayedHeight + 'px';
875
+ }, 0);
876
+ }
863
877
  function getPlacement(el) {
864
878
  var restorePos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
865
879
  if (el === null) return;
package/Radio/index.d.ts CHANGED
@@ -7,7 +7,7 @@ declare module 'react' {
7
7
  interface OptionConfig {
8
8
  [propName: string]: string | number;
9
9
  }
10
- declare type RadioOptionChangeFnType = (arg1: any, arg2: any) => void;
10
+ declare type RadioOptionChangeFnType = (arg1: any, arg2: any, arg3?: any) => void;
11
11
  declare type RadioProps = {
12
12
  wrapperClassName?: string;
13
13
  value?: string;
package/Radio/index.js CHANGED
@@ -257,6 +257,7 @@ var Radio = function Radio(props) {
257
257
  }
258
258
  function handleChange(event) {
259
259
  var val = event.target.value;
260
+ var currentIndex = event.target.dataset.index;
260
261
 
261
262
  //----
262
263
  // update value
@@ -268,8 +269,10 @@ var Radio = function Radio(props) {
268
269
 
269
270
  //
270
271
  if (typeof onChange === 'function') {
271
- onChange(event, dataInit[event.target.selectedIndex]);
272
- event.target.blur();
272
+ onChange(event, val, dataInit[currentIndex]);
273
+ }
274
+ if (typeof onClick === 'function') {
275
+ onClick(event, val, dataInit[currentIndex]);
273
276
  }
274
277
  }
275
278
  function handleBlur(event) {
@@ -293,6 +296,7 @@ var Radio = function Radio(props) {
293
296
  className: "form-check-input",
294
297
  id: "field-".concat(uniqueID, "-").concat(index),
295
298
  name: name,
299
+ "data-index": index,
296
300
  value: "".concat(item.value),
297
301
  required: requiredVal,
298
302
  disabled: disabled || null,
@@ -770,10 +770,16 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
770
770
  handleFetch(val).then(function (response) {
771
771
  _orginalData = response;
772
772
  update(_orginalData);
773
+
774
+ // Adjust the overall height to fit the wrapper
775
+ fixContentHeight();
773
776
  });
774
777
  } else {
775
778
  _orginalData = orginalData;
776
779
  update(_orginalData);
780
+
781
+ // Adjust the overall height to fit the wrapper
782
+ fixContentHeight();
777
783
  }
778
784
  }, 350, [optionsData]);
779
785
 
@@ -860,6 +866,14 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
860
866
  }
861
867
 
862
868
  //
869
+ function fixContentHeight() {
870
+ if (listContentRef.current === null) return;
871
+ setTimeout(function () {
872
+ var _displayedItems = listContentRef.current.querySelectorAll('.list-group-item');
873
+ var _displayedHeight = _displayedItems[0].clientHeight * _displayedItems.length;
874
+ listContentRef.current.style.height = _displayedHeight + 'px';
875
+ }, 0);
876
+ }
863
877
  function getPlacement(el) {
864
878
  var restorePos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
865
879
  if (el === null) return;
@@ -7,7 +7,7 @@ declare module 'react' {
7
7
  interface OptionConfig {
8
8
  [propName: string]: string | number;
9
9
  }
10
- declare type RadioOptionChangeFnType = (arg1: any, arg2: any) => void;
10
+ declare type RadioOptionChangeFnType = (arg1: any, arg2: any, arg3?: any) => void;
11
11
  declare type RadioProps = {
12
12
  wrapperClassName?: string;
13
13
  value?: string;
@@ -257,6 +257,7 @@ var Radio = function Radio(props) {
257
257
  }
258
258
  function handleChange(event) {
259
259
  var val = event.target.value;
260
+ var currentIndex = event.target.dataset.index;
260
261
 
261
262
  //----
262
263
  // update value
@@ -268,8 +269,10 @@ var Radio = function Radio(props) {
268
269
 
269
270
  //
270
271
  if (typeof onChange === 'function') {
271
- onChange(event, dataInit[event.target.selectedIndex]);
272
- event.target.blur();
272
+ onChange(event, val, dataInit[currentIndex]);
273
+ }
274
+ if (typeof onClick === 'function') {
275
+ onClick(event, val, dataInit[currentIndex]);
273
276
  }
274
277
  }
275
278
  function handleBlur(event) {
@@ -293,6 +296,7 @@ var Radio = function Radio(props) {
293
296
  className: "form-check-input",
294
297
  id: "field-".concat(uniqueID, "-").concat(index),
295
298
  name: name,
299
+ "data-index": index,
296
300
  value: "".concat(item.value),
297
301
  required: requiredVal,
298
302
  disabled: disabled || null,
@@ -11,7 +11,6 @@ import {
11
11
  addTreeDepth,
12
12
  addTreeIndent
13
13
  } from './utils/tree';
14
- import { type } from 'os';
15
14
 
16
15
 
17
16
  declare module 'react' {
@@ -171,6 +170,7 @@ const MultiFuncSelect = forwardRef((props: MultiFuncSelectProps, ref: any) => {
171
170
  const multiSelControlOptionExist = (arr: any[], val: any) => arr.map((v: any) => v.toString()).includes(val.toString());
172
171
 
173
172
 
173
+
174
174
  //performance
175
175
  const handleChangeFetchSafe = useDebounce((val: any) => {
176
176
 
@@ -199,20 +199,29 @@ const MultiFuncSelect = forwardRef((props: MultiFuncSelectProps, ref: any) => {
199
199
  }
200
200
  });
201
201
 
202
+
202
203
  }
203
204
 
204
205
  setOptionsData(filterRes);
205
206
  };
206
207
 
207
- if ( fetchUpdate ) {
208
+ if (fetchUpdate) {
208
209
 
209
210
  handleFetch(val).then((response: any) => {
210
211
  _orginalData = response;
211
212
  update(_orginalData);
213
+
214
+
215
+ // Adjust the overall height to fit the wrapper
216
+ fixContentHeight();
212
217
  });
213
218
  } else {
214
219
  _orginalData = orginalData;
215
220
  update(_orginalData);
221
+
222
+
223
+ // Adjust the overall height to fit the wrapper
224
+ fixContentHeight();
216
225
  }
217
226
 
218
227
 
@@ -308,6 +317,20 @@ const MultiFuncSelect = forwardRef((props: MultiFuncSelectProps, ref: any) => {
308
317
 
309
318
 
310
319
  //
320
+ function fixContentHeight() {
321
+ if (listContentRef.current === null) return;
322
+
323
+ setTimeout(() => {
324
+
325
+ const _displayedItems = listContentRef.current.querySelectorAll('.list-group-item');
326
+ const _displayedHeight = _displayedItems[0].clientHeight * _displayedItems.length;
327
+
328
+ listContentRef.current.style.height = _displayedHeight + 'px';
329
+
330
+ }, 0);
331
+
332
+ }
333
+
311
334
  function getPlacement(el: HTMLElement, restorePos: boolean = false) {
312
335
 
313
336
  if ( el === null ) return;
@@ -370,7 +393,6 @@ const MultiFuncSelect = forwardRef((props: MultiFuncSelectProps, ref: any) => {
370
393
  listContentRef.current.style.height = _displayedHeight + 'px';
371
394
  }
372
395
 
373
-
374
396
  //
375
397
  listContentRef.current.style.overflowY = 'auto';
376
398
 
@@ -11,7 +11,7 @@ interface OptionConfig {
11
11
  }
12
12
 
13
13
 
14
- type RadioOptionChangeFnType = (arg1: any, arg2: any) => void;
14
+ type RadioOptionChangeFnType = (arg1: any, arg2: any, arg3?: any) => void;
15
15
 
16
16
 
17
17
  type RadioProps = {
@@ -192,6 +192,7 @@ const Radio = (props: RadioProps) => {
192
192
 
193
193
  function handleChange(event: any) {
194
194
  const val = event.target.value;
195
+ const currentIndex = event.target.dataset.index;
195
196
 
196
197
 
197
198
  //----
@@ -205,11 +206,11 @@ const Radio = (props: RadioProps) => {
205
206
 
206
207
  //
207
208
  if (typeof (onChange) === 'function') {
208
- onChange(event, dataInit[event.target.selectedIndex]);
209
-
210
- event.target.blur();
209
+ onChange(event, val, dataInit[currentIndex]);
210
+ }
211
+ if (typeof (onClick) === 'function') {
212
+ onClick(event, val, dataInit[currentIndex]);
211
213
  }
212
-
213
214
  }
214
215
 
215
216
  function handleBlur(event: any) {
@@ -234,6 +235,7 @@ const Radio = (props: RadioProps) => {
234
235
  className="form-check-input"
235
236
  id={`field-${uniqueID}-${index}`}
236
237
  name={name}
238
+ data-index={index}
237
239
  value={`${item.value}`}
238
240
  required={requiredVal}
239
241
  disabled={disabled || null}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "author": "UIUX Lab",
3
3
  "email": "uiuxlab@gmail.com",
4
4
  "name": "funda-ui",
5
- "version": "1.0.520",
5
+ "version": "1.0.525",
6
6
  "description": "React components using pure Bootstrap 5+ which does not contain any external style and script libraries.",
7
7
  "repository": {
8
8
  "type": "git",