funda-ui 4.5.512 → 4.5.575

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.
@@ -23,7 +23,7 @@
23
23
  --livesearch-listgroup-item-hover-focus-bg: rgba(0,0,0,.1);
24
24
  --livesearch-listgroup-content-scrollbar-color: rgba(0, 0, 0, 0.2);
25
25
  --livesearch-listgroup-content-scrollbar-track: rgba(0, 0, 0, 0);
26
- --livesearch-listgroup-content-scrollbar-w: 3px;
26
+ --livesearch-listgroup-content-scrollbar-w: 10px;
27
27
 
28
28
 
29
29
  display: none;
@@ -8,9 +8,9 @@ import {
8
8
 
9
9
 
10
10
  export type MasonryLayoutProps = {
11
- columns?: number,
12
- gap?: number,
13
- breakPoints?: Record<number, number>
11
+ columns?: number;
12
+ gap?: number;
13
+ breakPoints?: Record<number, number>;
14
14
  /** -- */
15
15
  id?: string;
16
16
  tabIndex?: number;
@@ -75,8 +75,21 @@ const MasonryLayout = (props: MasonryLayoutProps) => {
75
75
  columnWrapper[`${itemWrapperKey}${i}`] = [];
76
76
  }
77
77
 
78
+
78
79
  // STEP 3:
79
80
  //=================
81
+ // Calculate the wrapper width based on the gap
82
+ let wrapperTotalGap: number = 0;
83
+ for (let i = 0; i < colCount; i++) {
84
+ if (i > 0) {
85
+ wrapperTotalGap += GAP;
86
+ }
87
+ }
88
+ if (rootRef.current) rootRef.current.style.width = `calc(100% - ${wrapperTotalGap}px)`;
89
+
90
+
91
+ // STEP 4:
92
+ //=================
80
93
  // Divide the children into columns
81
94
  let items: React.ReactNode[] = [];
82
95
 
@@ -94,21 +107,21 @@ const MasonryLayout = (props: MasonryLayoutProps) => {
94
107
 
95
108
  items.forEach((el: React.ReactNode, i: number) => {
96
109
  const columnIndex = i % colCount;
110
+
97
111
  columnWrapper[`${itemWrapperKey}${columnIndex}`].push(
98
112
  <div
99
113
  key={i}
100
- className="masonry-item"
101
114
  style={{
102
115
  marginBottom: `${GAP}px`
103
116
  }}
104
117
  >
105
- <div style={perBrickWidth > 0 ? {maxWidth: perBrickWidth + 'px'} : undefined}>{el}</div>
118
+ <div style={perBrickWidth > 0 ? {width: perBrickWidth + 'px'} : undefined}>{el}</div>
106
119
  </div>
107
120
  );
108
121
  });
109
122
 
110
123
 
111
- // STEP 4:
124
+ // STEP 5:
112
125
  //=================
113
126
  // Wrapping the items in each column with a div and pushing it into the result array
114
127
  for (let i = 0; i < colCount; i++) {
@@ -118,14 +131,14 @@ const MasonryLayout = (props: MasonryLayoutProps) => {
118
131
  className="masonry-item"
119
132
  style={{
120
133
  marginLeft: `${i > 0 ? GAP : 0}px`,
121
- flex: 1
134
+ flex: '0 1 auto'
122
135
  }}>
123
136
  {columnWrapper[`${itemWrapperKey}${i}`]}
124
137
  </div>
125
138
  );
126
139
  }
127
140
 
128
- // STEP 5:
141
+ // STEP 6:
129
142
  //=================
130
143
  setItems(result);
131
144
 
@@ -10,7 +10,7 @@
10
10
  --m-select-body-font-size: 0.75rem;
11
11
  --m-select-scrollbar-color: rgba(0, 0, 0, 0.2);
12
12
  --m-select-scrollbar-track: rgba(0, 0, 0, 0);
13
- --m-select-scrollbar-w: 3px;
13
+ --m-select-scrollbar-w: 10px;
14
14
  --m-select-search-icon-color: #333;
15
15
  --m-select-body-bg: #fff;
16
16
  --m-select-header-bg: #dee2e6;
@@ -380,7 +380,7 @@
380
380
  --cus-sel-listgroup-item-hover-focus-bg: rgba(0,0,0,.1);
381
381
  --cus-sel-listgroup-content-scrollbar-color: rgba(0, 0, 0, 0.2);
382
382
  --cus-sel-listgroup-content-scrollbar-track: rgba(0, 0, 0, 0);
383
- --cus-sel-listgroup-content-scrollbar-w: 3px;
383
+ --cus-sel-listgroup-content-scrollbar-w: 10px;
384
384
  --cus-sel-listgroup-grouptitle-color: #a2a2a2;
385
385
  --cus-sel-listgroup-groupborder-color: #d8d8d8;
386
386
 
@@ -50,6 +50,7 @@ import { clsWrite, combinedCls } from 'funda-utils/dist/cjs/cls';
50
50
 
51
51
 
52
52
 
53
+
53
54
  export type SelectOptionChangeFnType = (arg1: any, arg2: any, arg3: any) => void;
54
55
 
55
56
  export interface MultiSelectDataConfig {
@@ -240,6 +241,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
240
241
  const listRef = useRef<any>(null);
241
242
  const listContentRef = useRef<any>(null);
242
243
  const optionsRes = options ? (isJSON(options) ? JSON.parse(options as string) : options) : [];
244
+ const LIST_CONTAINER_MAX_HEIGHT = 350;
243
245
 
244
246
  const keyboardSelectedItem = useRef<any>(null);
245
247
 
@@ -284,6 +286,16 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
284
286
  });
285
287
 
286
288
 
289
+ const listContainerHeightLimit = (num: number) => {
290
+ let res = num;
291
+ if (res > LIST_CONTAINER_MAX_HEIGHT) res = LIST_CONTAINER_MAX_HEIGHT;
292
+
293
+ // Avoid the height of the child div containing decimal points and scrollbars
294
+ res = res + 1;
295
+
296
+ return res;
297
+ };
298
+
287
299
  const multiSelControlOptionExist = (arr: any[], val: any) => {
288
300
  const _data = arr.filter(Boolean);
289
301
  return _data.map((v: any) => v.toString()).includes(val.toString());
@@ -864,10 +876,20 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
864
876
  _modalRef.classList.add('active');
865
877
 
866
878
 
879
+
880
+
867
881
  // STEP 2:
868
882
  //-----------
869
- // Detect position
870
- if (window.innerHeight - _triggerBox.top > 100) {
883
+ // Detect content MAX HEIGHT and ACTUAL HEIGHT
884
+ const _contentBox = listContentRef.current.getBoundingClientRect();
885
+ let _contentOldHeight = listContentRef.current.clientHeight;
886
+
887
+ // height restrictions
888
+ _contentOldHeight = listContainerHeightLimit(_contentOldHeight);
889
+
890
+ // You need to wait for the height of the pop-up container to be set
891
+ // Detect position、
892
+ if (window.innerHeight - _triggerBox.top > _contentOldHeight) {
871
893
  targetPos = 'bottom';
872
894
  } else {
873
895
  targetPos = 'top';
@@ -879,13 +901,14 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
879
901
 
880
902
  // STEP 3:
881
903
  //-----------
882
- // Detect content height
883
- const _contentBox = listContentRef.current.getBoundingClientRect();
884
- const _contentOldHeight = listContentRef.current.clientHeight;
885
-
904
+ // Set the pop-up height
886
905
  if (targetPos === 'top') {
887
906
  contentMaxHeight = _triggerBox.top;
888
907
 
908
+ // height restrictions
909
+ contentMaxHeight = listContainerHeightLimit(contentMaxHeight);
910
+
911
+
889
912
  if (_contentBox.height > contentMaxHeight) {
890
913
  listContentRef.current.style.height = contentMaxHeight - contentHeightOffset + 'px';
891
914
  if (typeof listContentRef.current.dataset.height === 'undefined') listContentRef.current.dataset.height = contentMaxHeight - contentHeightOffset;
@@ -908,6 +931,11 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
908
931
  if (targetPos === 'bottom') {
909
932
  contentMaxHeight = window.innerHeight - _triggerBox.bottom;
910
933
 
934
+
935
+ // height restrictions
936
+ contentMaxHeight = listContainerHeightLimit(contentMaxHeight);
937
+
938
+
911
939
  if (_contentBox.height > contentMaxHeight) {
912
940
  listContentRef.current.style.height = contentMaxHeight - 10 + 'px';
913
941
  if (typeof listContentRef.current.dataset.height === 'undefined') listContentRef.current.dataset.height = contentMaxHeight - 10;
@@ -988,6 +1016,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
988
1016
  // no data label
989
1017
  popwinNoMatchInit();
990
1018
 
1019
+
991
1020
  }
992
1021
 
993
1022
 
@@ -1077,9 +1106,14 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1077
1106
  function popwinContainerHeightAdjust() {
1078
1107
  if (listContentRef.current === null) return;
1079
1108
 
1080
- const oldHeight = listContentRef.current.dataset.height;
1109
+ let oldHeight = listContentRef.current.dataset.height;
1081
1110
  const pos = listContentRef.current.dataset.pos;
1082
- const filteredHeight = listContentRef.current.firstChild.clientHeight;
1111
+ let filteredHeight = listContentRef.current.firstChild.clientHeight;
1112
+
1113
+ // height restrictions
1114
+ oldHeight = listContainerHeightLimit(oldHeight);
1115
+ filteredHeight = listContainerHeightLimit(filteredHeight);
1116
+
1083
1117
 
1084
1118
  if (parseFloat(oldHeight) > filteredHeight) {
1085
1119
  listContentRef.current.style.height = filteredHeight + 'px';
@@ -8,7 +8,7 @@
8
8
  --syntable-scrollbar-color: rgba(0, 0, 0, 0.2);
9
9
  --syntable-scrollbar-track: rgba(0, 0, 0, 0);
10
10
  --syntable-scrollbar-h: 3px;
11
- --syntable-scrollbar-w: 3px;
11
+ --syntable-scrollbar-w: 10px;
12
12
  --syntable-padding-x: 1rem;
13
13
  --syntable-padding-y: 0.5rem;
14
14
  --syntable-cell-focus-shadow: inset 0px 0px 2px 0px rgba(13, 110, 253, 2.25);
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": "4.5.512",
5
+ "version": "4.5.575",
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",
@@ -1,6 +0,0 @@
1
- /* ======================================================
2
- <!-- Masonry Layout -->
3
- /* ====================================================== */
4
- .masonry__wrapper .masonry-item > * {
5
- width: 100%;
6
- }
@@ -1,6 +0,0 @@
1
- /* ======================================================
2
- <!-- Masonry Layout -->
3
- /* ====================================================== */
4
- .masonry__wrapper .masonry-item > * {
5
- width: 100%;
6
- }
@@ -1,13 +0,0 @@
1
- /* ======================================================
2
- <!-- Masonry Layout -->
3
- /* ====================================================== */
4
-
5
- .masonry__wrapper {
6
-
7
- .masonry-item {
8
- > * {
9
- width: 100%;
10
- }
11
- }
12
-
13
- }