vasuzex 2.3.13 → 2.3.15
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/CHANGELOG.md +129 -0
- package/framework/Database/Model.js +18 -5
- package/framework/Services/Media/MediaManager.js +213 -118
- package/frontend/react-ui/components/BreadCrumb/BreadCrumb.jsx +3 -3
- package/frontend/react-ui/components/DataTable/ActionDefaults.jsx +116 -2
- package/frontend/react-ui/components/DataTable/CellComponents/RowActionsCell.jsx +26 -5
- package/frontend/react-ui/components/DataTable/DataTable.jsx +168 -26
- package/frontend/react-ui/components/DataTable/Filters.jsx +80 -41
- package/frontend/react-ui/components/DataTable/MobileCardList.jsx +226 -0
- package/frontend/react-ui/components/DataTable/Pagination.jsx +120 -57
- package/frontend/react-ui/components/DataTable/TableBody.jsx +85 -24
- package/frontend/react-ui/components/DataTable/TableState.jsx +42 -13
- package/frontend/react-ui/hooks/index.js +1 -0
- package/frontend/react-ui/hooks/useMobileDetect.js +30 -0
- package/package.json +1 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* useMobileDetect
|
|
5
|
+
*
|
|
6
|
+
* Detects whether the viewport is below the given breakpoint using
|
|
7
|
+
* window.matchMedia — no polling, no resize listeners, reacts instantly.
|
|
8
|
+
*
|
|
9
|
+
* @param {number} breakpoint - Max-width in px (default 640 = Tailwind `sm`)
|
|
10
|
+
* @returns {boolean} true when viewport < breakpoint
|
|
11
|
+
*/
|
|
12
|
+
export function useMobileDetect(breakpoint = 640) {
|
|
13
|
+
const getIsMobile = () =>
|
|
14
|
+
typeof window !== 'undefined'
|
|
15
|
+
? window.matchMedia(`(max-width: ${breakpoint - 1}px)`).matches
|
|
16
|
+
: false;
|
|
17
|
+
|
|
18
|
+
const [isMobile, setIsMobile] = useState(getIsMobile);
|
|
19
|
+
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const mq = window.matchMedia(`(max-width: ${breakpoint - 1}px)`);
|
|
22
|
+
const handler = (e) => setIsMobile(e.matches);
|
|
23
|
+
// Set immediately in case of SSR mismatch
|
|
24
|
+
setIsMobile(mq.matches);
|
|
25
|
+
mq.addEventListener('change', handler);
|
|
26
|
+
return () => mq.removeEventListener('change', handler);
|
|
27
|
+
}, [breakpoint]);
|
|
28
|
+
|
|
29
|
+
return isMobile;
|
|
30
|
+
}
|