funda-ui 4.7.125 → 4.7.133
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/README.md +1 -2
- package/Refresher/index.d.ts +22 -0
- package/Refresher/index.js +564 -0
- package/SplitterPanel/index.js +66 -2
- package/Utils/useIsMobile.js +66 -2
- package/all.d.ts +1 -0
- package/all.js +1 -0
- package/lib/cjs/Refresher/index.d.ts +22 -0
- package/lib/cjs/Refresher/index.js +564 -0
- package/lib/cjs/SplitterPanel/index.js +66 -2
- package/lib/cjs/Utils/useIsMobile.js +66 -2
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +1 -0
- package/lib/esm/Refresher/index.tsx +121 -0
- package/lib/esm/Utils/hooks/useIsMobile.tsx +90 -4
- package/lib/esm/index.js +1 -0
- package/package.json +1 -1
package/SplitterPanel/index.js
CHANGED
|
@@ -446,7 +446,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
446
446
|
*/
|
|
447
447
|
|
|
448
448
|
var useIsMobile = function useIsMobile() {
|
|
449
|
-
var breakpoint = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] :
|
|
449
|
+
var breakpoint = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 600;
|
|
450
450
|
var _useState = (0, react__WEBPACK_IMPORTED_MODULE_0__.useState)(false),
|
|
451
451
|
_useState2 = _slicedToArray(_useState, 2),
|
|
452
452
|
isMobile = _useState2[0],
|
|
@@ -460,7 +460,71 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
460
460
|
setIsMounted(true);
|
|
461
461
|
var handleResize = function handleResize() {
|
|
462
462
|
if (window) {
|
|
463
|
-
|
|
463
|
+
var detectDeviceType = function detectDeviceType() {
|
|
464
|
+
// 1. First check if window and navigator are available (SSR compatibility)
|
|
465
|
+
if (typeof window === 'undefined' || !navigator) {
|
|
466
|
+
return 'desktop'; // Default to desktop
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
// 2. Get user agent string
|
|
470
|
+
var ua = navigator.userAgent.toLowerCase();
|
|
471
|
+
|
|
472
|
+
// 3. Get platform info
|
|
473
|
+
var platform = navigator.platform.toLowerCase();
|
|
474
|
+
|
|
475
|
+
// 4. Check screen characteristics using window.matchMedia
|
|
476
|
+
var isTouch = 'ontouchstart' in window || navigator.maxTouchPoints > 0;
|
|
477
|
+
var isPortrait = window.matchMedia('(orientation: portrait)').matches;
|
|
478
|
+
var isLandscape = window.matchMedia('(orientation: landscape)').matches;
|
|
479
|
+
|
|
480
|
+
// 5. Get screen dimensions
|
|
481
|
+
var screenWidth = window.screen.width;
|
|
482
|
+
var screenHeight = window.screen.height;
|
|
483
|
+
var minScreenSize = Math.min(screenWidth, screenHeight);
|
|
484
|
+
var maxScreenSize = Math.max(screenWidth, screenHeight);
|
|
485
|
+
|
|
486
|
+
// Define device characteristics
|
|
487
|
+
var isTablet =
|
|
488
|
+
// Traditional UA detection
|
|
489
|
+
/ipad/.test(ua) || /android/.test(ua) && !/mobile/.test(ua) || /tablet/.test(ua) || /playbook/.test(ua) || /nexus (7|9|10)/.test(ua) || /sm-t/.test(ua) || /huawei(.*)mediapad/.test(ua) ||
|
|
490
|
+
// Special detection for iPad Pro and newer iPads
|
|
491
|
+
navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1 ||
|
|
492
|
+
// Screen size characteristics (tablets typically fall within this range)
|
|
493
|
+
minScreenSize >= breakpoint && maxScreenSize <= 1366 && isTouch ||
|
|
494
|
+
// Specific device detection
|
|
495
|
+
/kindle|silk|kftt|kfot|kfjwa|kfjwi|kfsowi|kfthwa|kfthwi|kfapwa|kfapwi/i.test(ua);
|
|
496
|
+
var isMobile = !isTablet && (
|
|
497
|
+
// Prevent tablets from being detected as phones
|
|
498
|
+
// Traditional mobile device detection
|
|
499
|
+
/iphone|ipod|android.*mobile|windows phone|mobi/.test(ua) ||
|
|
500
|
+
// Screen size characteristics (phones typically smaller than 600px)
|
|
501
|
+
minScreenSize < breakpoint && isTouch ||
|
|
502
|
+
// Additional mobile device detection
|
|
503
|
+
/blackberry|\bbb\d+|meego|webos|palm|phone|pocket|mobile|mini|iemobile/i.test(ua));
|
|
504
|
+
|
|
505
|
+
// 6. Comprehensive decision logic
|
|
506
|
+
if (isMobile) {
|
|
507
|
+
// Additional check for small tablets
|
|
508
|
+
if (maxScreenSize >= 1024 && isTouch) {
|
|
509
|
+
return 'tablet';
|
|
510
|
+
}
|
|
511
|
+
return 'mobile';
|
|
512
|
+
}
|
|
513
|
+
if (isTablet) {
|
|
514
|
+
// Additional check for touch-enabled laptops
|
|
515
|
+
if (maxScreenSize > 1366 && /windows/.test(ua)) {
|
|
516
|
+
return 'desktop';
|
|
517
|
+
}
|
|
518
|
+
return 'tablet';
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
// 7. Check for touch-enabled laptops
|
|
522
|
+
if (isTouch && /windows/.test(ua) && maxScreenSize > 1366) {
|
|
523
|
+
return 'desktop';
|
|
524
|
+
}
|
|
525
|
+
return 'desktop';
|
|
526
|
+
};
|
|
527
|
+
setIsMobile(detectDeviceType() === 'mobile');
|
|
464
528
|
}
|
|
465
529
|
};
|
|
466
530
|
|
package/Utils/useIsMobile.js
CHANGED
|
@@ -127,7 +127,7 @@ const App = () => {
|
|
|
127
127
|
*/
|
|
128
128
|
|
|
129
129
|
var useIsMobile = function useIsMobile() {
|
|
130
|
-
var breakpoint = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] :
|
|
130
|
+
var breakpoint = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 600;
|
|
131
131
|
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false),
|
|
132
132
|
_useState2 = _slicedToArray(_useState, 2),
|
|
133
133
|
isMobile = _useState2[0],
|
|
@@ -141,7 +141,71 @@ var useIsMobile = function useIsMobile() {
|
|
|
141
141
|
setIsMounted(true);
|
|
142
142
|
var handleResize = function handleResize() {
|
|
143
143
|
if (window) {
|
|
144
|
-
|
|
144
|
+
var detectDeviceType = function detectDeviceType() {
|
|
145
|
+
// 1. First check if window and navigator are available (SSR compatibility)
|
|
146
|
+
if (typeof window === 'undefined' || !navigator) {
|
|
147
|
+
return 'desktop'; // Default to desktop
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// 2. Get user agent string
|
|
151
|
+
var ua = navigator.userAgent.toLowerCase();
|
|
152
|
+
|
|
153
|
+
// 3. Get platform info
|
|
154
|
+
var platform = navigator.platform.toLowerCase();
|
|
155
|
+
|
|
156
|
+
// 4. Check screen characteristics using window.matchMedia
|
|
157
|
+
var isTouch = 'ontouchstart' in window || navigator.maxTouchPoints > 0;
|
|
158
|
+
var isPortrait = window.matchMedia('(orientation: portrait)').matches;
|
|
159
|
+
var isLandscape = window.matchMedia('(orientation: landscape)').matches;
|
|
160
|
+
|
|
161
|
+
// 5. Get screen dimensions
|
|
162
|
+
var screenWidth = window.screen.width;
|
|
163
|
+
var screenHeight = window.screen.height;
|
|
164
|
+
var minScreenSize = Math.min(screenWidth, screenHeight);
|
|
165
|
+
var maxScreenSize = Math.max(screenWidth, screenHeight);
|
|
166
|
+
|
|
167
|
+
// Define device characteristics
|
|
168
|
+
var isTablet =
|
|
169
|
+
// Traditional UA detection
|
|
170
|
+
/ipad/.test(ua) || /android/.test(ua) && !/mobile/.test(ua) || /tablet/.test(ua) || /playbook/.test(ua) || /nexus (7|9|10)/.test(ua) || /sm-t/.test(ua) || /huawei(.*)mediapad/.test(ua) ||
|
|
171
|
+
// Special detection for iPad Pro and newer iPads
|
|
172
|
+
navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1 ||
|
|
173
|
+
// Screen size characteristics (tablets typically fall within this range)
|
|
174
|
+
minScreenSize >= breakpoint && maxScreenSize <= 1366 && isTouch ||
|
|
175
|
+
// Specific device detection
|
|
176
|
+
/kindle|silk|kftt|kfot|kfjwa|kfjwi|kfsowi|kfthwa|kfthwi|kfapwa|kfapwi/i.test(ua);
|
|
177
|
+
var isMobile = !isTablet && (
|
|
178
|
+
// Prevent tablets from being detected as phones
|
|
179
|
+
// Traditional mobile device detection
|
|
180
|
+
/iphone|ipod|android.*mobile|windows phone|mobi/.test(ua) ||
|
|
181
|
+
// Screen size characteristics (phones typically smaller than 600px)
|
|
182
|
+
minScreenSize < breakpoint && isTouch ||
|
|
183
|
+
// Additional mobile device detection
|
|
184
|
+
/blackberry|\bbb\d+|meego|webos|palm|phone|pocket|mobile|mini|iemobile/i.test(ua));
|
|
185
|
+
|
|
186
|
+
// 6. Comprehensive decision logic
|
|
187
|
+
if (isMobile) {
|
|
188
|
+
// Additional check for small tablets
|
|
189
|
+
if (maxScreenSize >= 1024 && isTouch) {
|
|
190
|
+
return 'tablet';
|
|
191
|
+
}
|
|
192
|
+
return 'mobile';
|
|
193
|
+
}
|
|
194
|
+
if (isTablet) {
|
|
195
|
+
// Additional check for touch-enabled laptops
|
|
196
|
+
if (maxScreenSize > 1366 && /windows/.test(ua)) {
|
|
197
|
+
return 'desktop';
|
|
198
|
+
}
|
|
199
|
+
return 'tablet';
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// 7. Check for touch-enabled laptops
|
|
203
|
+
if (isTouch && /windows/.test(ua) && maxScreenSize > 1366) {
|
|
204
|
+
return 'desktop';
|
|
205
|
+
}
|
|
206
|
+
return 'desktop';
|
|
207
|
+
};
|
|
208
|
+
setIsMobile(detectDeviceType() === 'mobile');
|
|
145
209
|
}
|
|
146
210
|
};
|
|
147
211
|
|
package/all.d.ts
CHANGED
package/all.js
CHANGED
|
@@ -31,6 +31,7 @@ exports.NumberInput = _interopRequireDefault(require("./NumberInput")).default;
|
|
|
31
31
|
exports.Pagination = _interopRequireDefault(require("./Pagination")).default;
|
|
32
32
|
exports.Radio = _interopRequireDefault(require("./Radio")).default;
|
|
33
33
|
exports.RangeSlider = _interopRequireDefault(require("./RangeSlider")).default;
|
|
34
|
+
exports.Refresher = _interopRequireDefault(require("./Refresher")).default;
|
|
34
35
|
exports.RootPortal = _interopRequireDefault(require("./RootPortal")).default;
|
|
35
36
|
exports.ScrollReveal = _interopRequireDefault(require("./ScrollReveal")).default;
|
|
36
37
|
exports.Scrollbar = _interopRequireDefault(require("./Scrollbar")).default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface RefresherProps {
|
|
3
|
+
/** Pulling text */
|
|
4
|
+
pullingText?: React.ReactNode;
|
|
5
|
+
/** Text when reaching the threshold */
|
|
6
|
+
readyToRefreshText?: React.ReactNode;
|
|
7
|
+
/** Refreshing text */
|
|
8
|
+
refreshingText?: React.ReactNode;
|
|
9
|
+
/** The pull distance (px) that triggers the refresh */
|
|
10
|
+
threshold?: number;
|
|
11
|
+
/** The height of the trigger area */
|
|
12
|
+
triggerHeight?: number;
|
|
13
|
+
/** The styles of the trigger area */
|
|
14
|
+
triggerAreaStyle?: React.CSSProperties;
|
|
15
|
+
/** Pull-down is only allowed when the scroll bar of this element is at the top. You can only fire certain actions when the scrollbar is at the top by listening to the scroll event of a given DOM element and determining if its scrollTop is 0. */
|
|
16
|
+
scrollableElementClassName?: string;
|
|
17
|
+
/** Refresh action is async */
|
|
18
|
+
onRefresh: () => Promise<void>;
|
|
19
|
+
children: React.ReactNode;
|
|
20
|
+
}
|
|
21
|
+
declare const Refresher: (prpps: RefresherProps) => JSX.Element;
|
|
22
|
+
export default Refresher;
|