@pinnacle0/web-ui 0.3.27 → 0.3.30
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/admin/AdminApp/index.less +2 -0
- package/core/Dropdown.d.ts +9 -0
- package/core/Dropdown.js +10 -0
- package/core/Dropdown.js.map +1 -0
- package/hooks/useOrientationMode.d.ts +2 -0
- package/hooks/useOrientationMode.js +30 -0
- package/hooks/useOrientationMode.js.map +1 -0
- package/package.json +1 -1
- package/util/OrientationUtil.d.ts +20 -0
- package/util/OrientationUtil.js +50 -0
- package/util/OrientationUtil.js.map +1 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import AntdDropdown from "antd/lib/dropdown";
|
|
2
|
+
import type { DropdownProps } from "antd/lib/dropdown";
|
|
3
|
+
import "antd/lib/dropdown/style";
|
|
4
|
+
export type { DropdownButtonProps, DropdownButtonType } from "antd/lib/dropdown";
|
|
5
|
+
export interface Props extends DropdownProps {
|
|
6
|
+
}
|
|
7
|
+
export declare class Dropdown {
|
|
8
|
+
static Button: typeof AntdDropdown.Button;
|
|
9
|
+
}
|
package/core/Dropdown.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import AntdDropdown from "antd/lib/dropdown";
|
|
2
|
+
import "antd/lib/dropdown/style";
|
|
3
|
+
var Dropdown = /** @class */ (function () {
|
|
4
|
+
function Dropdown() {
|
|
5
|
+
}
|
|
6
|
+
Dropdown.Button = AntdDropdown.Button;
|
|
7
|
+
return Dropdown;
|
|
8
|
+
}());
|
|
9
|
+
export { Dropdown };
|
|
10
|
+
//# sourceMappingURL=Dropdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dropdown.js","sourceRoot":"","sources":["../../src/core/Dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAE7C,OAAO,yBAAyB,CAAC;AAKjC;IAAA;IAEA,CAAC;IADU,eAAM,GAA+B,YAAY,CAAC,MAAM,CAAC;IACpE,eAAC;CAAA,AAFD,IAEC;SAFY,QAAQ"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
2
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
3
|
+
if (!m) return o;
|
|
4
|
+
var i = m.call(o), r, ar = [], e;
|
|
5
|
+
try {
|
|
6
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
7
|
+
}
|
|
8
|
+
catch (error) { e = { error: error }; }
|
|
9
|
+
finally {
|
|
10
|
+
try {
|
|
11
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
12
|
+
}
|
|
13
|
+
finally { if (e) throw e.error; }
|
|
14
|
+
}
|
|
15
|
+
return ar;
|
|
16
|
+
};
|
|
17
|
+
import React from "react";
|
|
18
|
+
import { OrientationUtil } from "../util/OrientationUtil";
|
|
19
|
+
export function useOrientationMode() {
|
|
20
|
+
var _a = __read(React.useState(OrientationUtil.mode()), 2), mode = _a[0], setMode = _a[1];
|
|
21
|
+
React.useEffect(function () {
|
|
22
|
+
var handler = function () { return setMode(OrientationUtil.mode()); };
|
|
23
|
+
OrientationUtil.onOrientationChange(handler);
|
|
24
|
+
return function () {
|
|
25
|
+
OrientationUtil.removeOnChange(handler);
|
|
26
|
+
};
|
|
27
|
+
}, []);
|
|
28
|
+
return mode;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=useOrientationMode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOrientationMode.js","sourceRoot":"","sources":["../../src/hooks/useOrientationMode.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AAGxD,MAAM,UAAU,kBAAkB;IACxB,IAAA,KAAA,OAAkB,KAAK,CAAC,QAAQ,CAAkB,eAAe,CAAC,IAAI,EAAE,CAAC,IAAA,EAAxE,IAAI,QAAA,EAAE,OAAO,QAA2D,CAAC;IAEhF,KAAK,CAAC,SAAS,CAAC;QACZ,IAAM,OAAO,GAAG,cAAM,OAAA,OAAO,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC,EAA/B,CAA+B,CAAC;QACtD,eAAe,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;QAE7C,OAAO;YACH,eAAe,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QAC5C,CAAC,CAAC;IACN,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,IAAI,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 1)
|
|
3
|
+
* This util only works on mobile devices.
|
|
4
|
+
* 2)
|
|
5
|
+
* For Safari Mobile & Iphone Mobile,
|
|
6
|
+
* ScreenOrientation API is not supported, and screen.availHeight & screen.availWidth will not produce a good result.
|
|
7
|
+
* So use old APIs: window.eventListener, 'orientationchange'.
|
|
8
|
+
*
|
|
9
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/orientationchange_event
|
|
10
|
+
*/
|
|
11
|
+
export declare type OrientationType = "portrait" | "landscape";
|
|
12
|
+
declare function mode(): OrientationType;
|
|
13
|
+
declare function onOrientationChange(callback: () => void): void;
|
|
14
|
+
declare function removeOnChange(callback: () => void): void;
|
|
15
|
+
export declare const OrientationUtil: Readonly<{
|
|
16
|
+
mode: typeof mode;
|
|
17
|
+
onOrientationChange: typeof onOrientationChange;
|
|
18
|
+
removeOnChange: typeof removeOnChange;
|
|
19
|
+
}>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 1)
|
|
3
|
+
* This util only works on mobile devices.
|
|
4
|
+
* 2)
|
|
5
|
+
* For Safari Mobile & Iphone Mobile,
|
|
6
|
+
* ScreenOrientation API is not supported, and screen.availHeight & screen.availWidth will not produce a good result.
|
|
7
|
+
* So use old APIs: window.eventListener, 'orientationchange'.
|
|
8
|
+
*
|
|
9
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/orientationchange_event
|
|
10
|
+
*/
|
|
11
|
+
function mode() {
|
|
12
|
+
try {
|
|
13
|
+
if (!window.screen.orientation && typeof window.orientation !== undefined) {
|
|
14
|
+
return window.orientation === 0 ? "portrait" : "landscape";
|
|
15
|
+
}
|
|
16
|
+
if (window.screen.availHeight > window.screen.availWidth) {
|
|
17
|
+
return "portrait";
|
|
18
|
+
}
|
|
19
|
+
return "landscape";
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
return "landscape";
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function onOrientationChange(callback) {
|
|
26
|
+
var _a;
|
|
27
|
+
if ((_a = window.screen.orientation) === null || _a === void 0 ? void 0 : _a.addEventListener) {
|
|
28
|
+
// some Android browser may not support this method
|
|
29
|
+
window.screen.orientation.addEventListener("change", callback);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
window.addEventListener("orientationchange", callback);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function removeOnChange(callback) {
|
|
36
|
+
var _a;
|
|
37
|
+
if ((_a = window.screen.orientation) === null || _a === void 0 ? void 0 : _a.removeEventListener) {
|
|
38
|
+
// some Android browser may not support this method
|
|
39
|
+
window.screen.orientation.removeEventListener("change", callback);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
window.removeEventListener("orientationchange", callback);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export var OrientationUtil = Object.freeze({
|
|
46
|
+
mode: mode,
|
|
47
|
+
onOrientationChange: onOrientationChange,
|
|
48
|
+
removeOnChange: removeOnChange,
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=OrientationUtil.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
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