@pisell/common 0.0.1
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/LICENSE +21 -0
- package/README.md +40 -0
- package/es/business-components/colorInput/index.d.ts +21 -0
- package/es/business-components/colorInput/index.js +43 -0
- package/es/business-components/colorInput/index.less +10 -0
- package/es/business-components/index.d.ts +11 -0
- package/es/business-components/index.js +7 -0
- package/es/business-components/rechargeOption/index.d.ts +36 -0
- package/es/business-components/rechargeOption/index.js +136 -0
- package/es/business-components/rechargeOption/index.less +0 -0
- package/es/business-components/selectTag/index.d.ts +25 -0
- package/es/business-components/selectTag/index.js +180 -0
- package/es/business-components/selectTag/index.less +22 -0
- package/es/business-components/sortModal/index.d.ts +30 -0
- package/es/business-components/sortModal/index.js +85 -0
- package/es/business-components/sortModal/index.less +29 -0
- package/es/business-components/statistics/index.d.ts +12 -0
- package/es/business-components/statistics/index.js +38 -0
- package/es/business-components/statistics/index.less +64 -0
- package/es/business-components/tagModal/index.d.ts +17 -0
- package/es/business-components/tagModal/index.js +59 -0
- package/es/business-hooks/index.d.ts +2 -0
- package/es/business-hooks/index.js +2 -0
- package/es/business-hooks/useModal/index.d.ts +31 -0
- package/es/business-hooks/useModal/index.js +91 -0
- package/es/business-hooks/useModal/index.less +0 -0
- package/es/business-hooks/useTagModal/index.d.ts +17 -0
- package/es/business-hooks/useTagModal/index.js +47 -0
- package/es/components/ColorPicker/index.d.ts +22 -0
- package/es/components/ColorPicker/index.js +51 -0
- package/es/components/ColorPicker/index.less +17 -0
- package/es/components/DragSort/index.d.ts +2 -0
- package/es/components/DragSort/index.js +68 -0
- package/es/components/Iconfont/index.d.ts +6 -0
- package/es/components/Iconfont/index.js +28 -0
- package/es/components/Iconfont/index.less +0 -0
- package/es/components/card/index.d.ts +5 -0
- package/es/components/card/index.js +16 -0
- package/es/components/card/index.less +9 -0
- package/es/components/index.d.ts +4 -0
- package/es/components/index.js +4 -0
- package/es/config/index.d.ts +16 -0
- package/es/config/index.js +18 -0
- package/es/config/utils.d.ts +0 -0
- package/es/config/utils.js +0 -0
- package/es/hooks/index.d.ts +8 -0
- package/es/hooks/index.js +8 -0
- package/es/hooks/useCountDown/index.d.ts +10 -0
- package/es/hooks/useCountDown/index.js +48 -0
- package/es/hooks/useDocumentScroll/index.d.ts +8 -0
- package/es/hooks/useDocumentScroll/index.js +41 -0
- package/es/hooks/useDocumentScroll/index.less +0 -0
- package/es/hooks/useMousemove/index.d.ts +8 -0
- package/es/hooks/useMousemove/index.js +61 -0
- package/es/hooks/useResponsive/index.d.ts +2 -0
- package/es/hooks/useResponsive/index.js +29 -0
- package/es/hooks/useResponsive/index.less +0 -0
- package/es/hooks/useSize/index.d.ts +2 -0
- package/es/hooks/useSize/index.js +27 -0
- package/es/hooks/useSize/index.less +0 -0
- package/es/hooks/useStateMulti/index.d.ts +2 -0
- package/es/hooks/useStateMulti/index.js +29 -0
- package/es/hooks/useStateWithCb/index.d.ts +2 -0
- package/es/hooks/useStateWithCb/index.js +42 -0
- package/es/hooks/useTable/index.d.ts +12 -0
- package/es/hooks/useTable/index.js +74 -0
- package/es/hooks/useTable/index.less +0 -0
- package/es/hooks/useTableModal/index.d.ts +12 -0
- package/es/hooks/useTableModal/index.js +25 -0
- package/es/hooks/useTableModal/index.less +0 -0
- package/es/hooks/useUrlState/index.d.ts +2 -0
- package/es/hooks/useUrlState/index.js +56 -0
- package/es/hooks/useWebSocket/index.d.ts +13 -0
- package/es/hooks/useWebSocket/index.js +121 -0
- package/es/index.d.ts +4 -0
- package/es/index.js +4 -0
- package/es/locales/en-US.d.ts +11 -0
- package/es/locales/en-US.js +10 -0
- package/es/locales/index.d.ts +1 -0
- package/es/locales/index.js +23 -0
- package/es/locales/zh-CN.d.ts +11 -0
- package/es/locales/zh-CN.js +10 -0
- package/es/locales/zh-TW.d.ts +11 -0
- package/es/locales/zh-TW.js +10 -0
- package/es/utils/index.d.ts +3 -0
- package/es/utils/index.js +3 -0
- package/es/utils/otherUtils.d.ts +8 -0
- package/es/utils/otherUtils.js +12 -0
- package/es/utils/storage.d.ts +30 -0
- package/es/utils/storage.js +70 -0
- package/es/utils/typeUtils.d.ts +42 -0
- package/es/utils/typeUtils.js +86 -0
- package/lib/business-components/colorInput/index.d.ts +21 -0
- package/lib/business-components/colorInput/index.js +70 -0
- package/lib/business-components/colorInput/index.less +10 -0
- package/lib/business-components/index.d.ts +11 -0
- package/lib/business-components/index.js +54 -0
- package/lib/business-components/rechargeOption/index.d.ts +36 -0
- package/lib/business-components/rechargeOption/index.js +133 -0
- package/lib/business-components/rechargeOption/index.less +0 -0
- package/lib/business-components/selectTag/index.d.ts +25 -0
- package/lib/business-components/selectTag/index.js +181 -0
- package/lib/business-components/selectTag/index.less +22 -0
- package/lib/business-components/sortModal/index.d.ts +30 -0
- package/lib/business-components/sortModal/index.js +100 -0
- package/lib/business-components/sortModal/index.less +29 -0
- package/lib/business-components/statistics/index.d.ts +12 -0
- package/lib/business-components/statistics/index.js +63 -0
- package/lib/business-components/statistics/index.less +64 -0
- package/lib/business-components/tagModal/index.d.ts +17 -0
- package/lib/business-components/tagModal/index.js +66 -0
- package/lib/business-hooks/index.d.ts +2 -0
- package/lib/business-hooks/index.js +42 -0
- package/lib/business-hooks/useModal/index.d.ts +31 -0
- package/lib/business-hooks/useModal/index.js +68 -0
- package/lib/business-hooks/useModal/index.less +0 -0
- package/lib/business-hooks/useTagModal/index.d.ts +17 -0
- package/lib/business-hooks/useTagModal/index.js +61 -0
- package/lib/components/ColorPicker/index.d.ts +22 -0
- package/lib/components/ColorPicker/index.js +80 -0
- package/lib/components/ColorPicker/index.less +17 -0
- package/lib/components/DragSort/index.d.ts +2 -0
- package/lib/components/DragSort/index.js +101 -0
- package/lib/components/Iconfont/index.d.ts +6 -0
- package/lib/components/Iconfont/index.js +47 -0
- package/lib/components/Iconfont/index.less +0 -0
- package/lib/components/card/index.d.ts +5 -0
- package/lib/components/card/index.js +42 -0
- package/lib/components/card/index.less +9 -0
- package/lib/components/index.d.ts +4 -0
- package/lib/components/index.js +48 -0
- package/lib/config/index.d.ts +16 -0
- package/lib/config/index.js +39 -0
- package/lib/config/utils.d.ts +0 -0
- package/lib/config/utils.js +0 -0
- package/lib/hooks/index.d.ts +8 -0
- package/lib/hooks/index.js +57 -0
- package/lib/hooks/useCountDown/index.d.ts +10 -0
- package/lib/hooks/useCountDown/index.js +57 -0
- package/lib/hooks/useDocumentScroll/index.d.ts +8 -0
- package/lib/hooks/useDocumentScroll/index.js +54 -0
- package/lib/hooks/useDocumentScroll/index.less +0 -0
- package/lib/hooks/useMousemove/index.d.ts +8 -0
- package/lib/hooks/useMousemove/index.js +70 -0
- package/lib/hooks/useResponsive/index.d.ts +2 -0
- package/lib/hooks/useResponsive/index.js +47 -0
- package/lib/hooks/useResponsive/index.less +0 -0
- package/lib/hooks/useSize/index.d.ts +2 -0
- package/lib/hooks/useSize/index.js +45 -0
- package/lib/hooks/useSize/index.less +0 -0
- package/lib/hooks/useStateMulti/index.d.ts +2 -0
- package/lib/hooks/useStateMulti/index.js +43 -0
- package/lib/hooks/useStateWithCb/index.d.ts +2 -0
- package/lib/hooks/useStateWithCb/index.js +53 -0
- package/lib/hooks/useTable/index.d.ts +12 -0
- package/lib/hooks/useTable/index.js +75 -0
- package/lib/hooks/useTable/index.less +0 -0
- package/lib/hooks/useTableModal/index.d.ts +12 -0
- package/lib/hooks/useTableModal/index.js +43 -0
- package/lib/hooks/useTableModal/index.less +0 -0
- package/lib/hooks/useUrlState/index.d.ts +2 -0
- package/lib/hooks/useUrlState/index.js +59 -0
- package/lib/hooks/useWebSocket/index.d.ts +13 -0
- package/lib/hooks/useWebSocket/index.js +91 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +22 -0
- package/lib/locales/en-US.d.ts +11 -0
- package/lib/locales/en-US.js +36 -0
- package/lib/locales/index.d.ts +1 -0
- package/lib/locales/index.js +59 -0
- package/lib/locales/zh-CN.d.ts +11 -0
- package/lib/locales/zh-CN.js +36 -0
- package/lib/locales/zh-TW.d.ts +11 -0
- package/lib/locales/zh-TW.js +36 -0
- package/lib/utils/index.d.ts +3 -0
- package/lib/utils/index.js +21 -0
- package/lib/utils/otherUtils.d.ts +8 -0
- package/lib/utils/otherUtils.js +31 -0
- package/lib/utils/storage.d.ts +30 -0
- package/lib/utils/storage.js +63 -0
- package/lib/utils/typeUtils.d.ts +42 -0
- package/lib/utils/typeUtils.js +75 -0
- package/package.json +101 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/hooks/useMousemove/index.ts
|
|
20
|
+
var useMousemove_exports = {};
|
|
21
|
+
__export(useMousemove_exports, {
|
|
22
|
+
default: () => useMousemove_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(useMousemove_exports);
|
|
25
|
+
var import_react = require("react");
|
|
26
|
+
var count = 0;
|
|
27
|
+
var timer = null;
|
|
28
|
+
var useMousemove = ({ time = 60 }) => {
|
|
29
|
+
const [isMove, setIsMove] = (0, import_react.useState)(false);
|
|
30
|
+
const go = () => {
|
|
31
|
+
count++;
|
|
32
|
+
if (count >= time) {
|
|
33
|
+
setIsMove(true);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const init = () => {
|
|
37
|
+
timer = setInterval(go, 1e3);
|
|
38
|
+
let x;
|
|
39
|
+
let y;
|
|
40
|
+
document.onmousemove = (event) => {
|
|
41
|
+
let x1 = event.clientX;
|
|
42
|
+
let y1 = event.clientY;
|
|
43
|
+
if (x != x1 || y != y1) {
|
|
44
|
+
count = 0;
|
|
45
|
+
setIsMove(false);
|
|
46
|
+
}
|
|
47
|
+
x = x1;
|
|
48
|
+
y = y1;
|
|
49
|
+
};
|
|
50
|
+
document.onkeydown = () => {
|
|
51
|
+
count = 0;
|
|
52
|
+
setIsMove(false);
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
(0, import_react.useEffect)(() => {
|
|
56
|
+
init();
|
|
57
|
+
return () => {
|
|
58
|
+
clearInterval(timer);
|
|
59
|
+
setIsMove(false);
|
|
60
|
+
document.onmousemove = null;
|
|
61
|
+
document.onkeydown = null;
|
|
62
|
+
};
|
|
63
|
+
}, []);
|
|
64
|
+
return {
|
|
65
|
+
isMove
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
var useMousemove_default = useMousemove;
|
|
69
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
70
|
+
0 && (module.exports = {});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/hooks/useResponsive/index.tsx
|
|
20
|
+
var useResponsive_exports = {};
|
|
21
|
+
__export(useResponsive_exports, {
|
|
22
|
+
default: () => useResponsive_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(useResponsive_exports);
|
|
25
|
+
var import_react = require("react");
|
|
26
|
+
var import_ahooks = require("ahooks");
|
|
27
|
+
(0, import_ahooks.configResponsive)({
|
|
28
|
+
phone: 0,
|
|
29
|
+
ipad: 700,
|
|
30
|
+
pc: 1080
|
|
31
|
+
});
|
|
32
|
+
var useLmResponsive = () => {
|
|
33
|
+
const responsive = (0, import_ahooks.useResponsive)();
|
|
34
|
+
const current = (0, import_react.useMemo)(() => {
|
|
35
|
+
if (responsive == null ? void 0 : responsive.pc) {
|
|
36
|
+
return "pc";
|
|
37
|
+
}
|
|
38
|
+
if (responsive == null ? void 0 : responsive.ipad) {
|
|
39
|
+
return "ipad";
|
|
40
|
+
}
|
|
41
|
+
return "phone";
|
|
42
|
+
}, [responsive]);
|
|
43
|
+
return current;
|
|
44
|
+
};
|
|
45
|
+
var useResponsive_default = useLmResponsive;
|
|
46
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
47
|
+
0 && (module.exports = {});
|
|
File without changes
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/hooks/useSize/index.tsx
|
|
20
|
+
var useSize_exports = {};
|
|
21
|
+
__export(useSize_exports, {
|
|
22
|
+
default: () => useSize_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(useSize_exports);
|
|
25
|
+
var import_react = require("react");
|
|
26
|
+
var import_ahooks = require("ahooks");
|
|
27
|
+
var useSize_default = (dom) => {
|
|
28
|
+
const [size, setSize] = (0, import_react.useState)({ width: 0, height: 0 });
|
|
29
|
+
const _fn = (0, import_react.useCallback)(() => {
|
|
30
|
+
return document.querySelector(dom || "body");
|
|
31
|
+
}, [dom]);
|
|
32
|
+
const _size = (0, import_ahooks.useSize)(_fn);
|
|
33
|
+
(0, import_ahooks.useDebounceEffect)(
|
|
34
|
+
() => {
|
|
35
|
+
setSize(_size);
|
|
36
|
+
},
|
|
37
|
+
[_size],
|
|
38
|
+
{
|
|
39
|
+
wait: 50
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
return size;
|
|
43
|
+
};
|
|
44
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
+
0 && (module.exports = {});
|
|
File without changes
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/hooks/useStateMulti/index.ts
|
|
20
|
+
var useStateMulti_exports = {};
|
|
21
|
+
__export(useStateMulti_exports, {
|
|
22
|
+
default: () => useStateMulti_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(useStateMulti_exports);
|
|
25
|
+
var import_react = require("react");
|
|
26
|
+
var import_utils = require("../../utils");
|
|
27
|
+
var useStateMulti = (initState) => {
|
|
28
|
+
const [state, _setState] = (0, import_react.useState)(initState);
|
|
29
|
+
const setState = (0, import_react.useCallback)((updatedValues) => {
|
|
30
|
+
if ((0, import_utils.isPlainObject)(updatedValues)) {
|
|
31
|
+
_setState((prevState) => {
|
|
32
|
+
return {
|
|
33
|
+
...prevState,
|
|
34
|
+
...updatedValues
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}, []);
|
|
39
|
+
return [state, setState];
|
|
40
|
+
};
|
|
41
|
+
var useStateMulti_default = useStateMulti;
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/hooks/useStateWithCb/index.ts
|
|
20
|
+
var useStateWithCb_exports = {};
|
|
21
|
+
__export(useStateWithCb_exports, {
|
|
22
|
+
default: () => useStateWithCb_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(useStateWithCb_exports);
|
|
25
|
+
var import_react = require("react");
|
|
26
|
+
var useStateWithCb = (initialVal) => {
|
|
27
|
+
const [state, _setState] = (0, import_react.useState)(() => initialVal);
|
|
28
|
+
const [random, setRandom] = (0, import_react.useState)(() => Math.random());
|
|
29
|
+
const cbs = (0, import_react.useRef)([]);
|
|
30
|
+
const setState = (0, import_react.useCallback)(
|
|
31
|
+
(newState, cb) => {
|
|
32
|
+
if (cb) {
|
|
33
|
+
cbs.current.push(cb);
|
|
34
|
+
}
|
|
35
|
+
if (Object.is(state, newState)) {
|
|
36
|
+
setRandom(Math.random());
|
|
37
|
+
}
|
|
38
|
+
_setState(newState);
|
|
39
|
+
},
|
|
40
|
+
[state]
|
|
41
|
+
);
|
|
42
|
+
(0, import_react.useEffect)(() => {
|
|
43
|
+
if (cbs.current) {
|
|
44
|
+
let _cbs = cbs.current;
|
|
45
|
+
cbs.current = [];
|
|
46
|
+
_cbs.forEach((_cb) => _cb());
|
|
47
|
+
}
|
|
48
|
+
}, [state, random]);
|
|
49
|
+
return [state, setState];
|
|
50
|
+
};
|
|
51
|
+
var useStateWithCb_default = useStateWithCb;
|
|
52
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
+
0 && (module.exports = {});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseOptions, CombineService, PaginatedFormatReturn, PaginatedParams, Result } from 'ahooks/lib/useAntdTable/index';
|
|
2
|
+
/**
|
|
3
|
+
* @Title: 基于ahooks 增加额外参数
|
|
4
|
+
* @Describe:
|
|
5
|
+
* @Author: Wzw
|
|
6
|
+
*/
|
|
7
|
+
interface useTableOptions<T> extends Omit<BaseOptions<T>, 'onSuccess'> {
|
|
8
|
+
isCaChe?: boolean;
|
|
9
|
+
onSuccess?: (data: any, params?: any, urlParams?: any) => void;
|
|
10
|
+
}
|
|
11
|
+
declare const useTable: <R, Item = any, U extends Item = any>(service: CombineService<PaginatedFormatReturn<Item>, PaginatedParams>, options: useTableOptions<U>) => Result<Item>;
|
|
12
|
+
export default useTable;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/hooks/useTable/index.tsx
|
|
30
|
+
var useTable_exports = {};
|
|
31
|
+
__export(useTable_exports, {
|
|
32
|
+
default: () => useTable_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(useTable_exports);
|
|
35
|
+
var import_react = require("react");
|
|
36
|
+
var import_ahooks = require("ahooks");
|
|
37
|
+
var import_useUrlState = __toESM(require("../useUrlState"));
|
|
38
|
+
var useTable = (service, options) => {
|
|
39
|
+
const [urlParams, setUrlParams] = (0, import_useUrlState.default)({});
|
|
40
|
+
const table = (0, import_ahooks.useAntdTable)(service, {
|
|
41
|
+
throwOnError: true,
|
|
42
|
+
...options,
|
|
43
|
+
onSuccess: (data, params) => {
|
|
44
|
+
if (options.isCaChe) {
|
|
45
|
+
setParams(params);
|
|
46
|
+
}
|
|
47
|
+
if (typeof options.onSuccess === "function") {
|
|
48
|
+
options.onSuccess(data, params, urlParams);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
const setParams = (params) => {
|
|
53
|
+
let _pagination = params[0];
|
|
54
|
+
let _formData = params[1];
|
|
55
|
+
let _newParams = {
|
|
56
|
+
skip: (_pagination == null ? void 0 : _pagination.current) || 1,
|
|
57
|
+
num: (_pagination == null ? void 0 : _pagination.pageSize) || 10
|
|
58
|
+
};
|
|
59
|
+
for (let item of Object.entries(_formData)) {
|
|
60
|
+
if (item[1] !== void 0) {
|
|
61
|
+
_newParams[item[0]] = item[1];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
setUrlParams({ ..._newParams });
|
|
65
|
+
};
|
|
66
|
+
(0, import_react.useEffect)(() => {
|
|
67
|
+
return () => {
|
|
68
|
+
table.cancel();
|
|
69
|
+
};
|
|
70
|
+
}, []);
|
|
71
|
+
return table;
|
|
72
|
+
};
|
|
73
|
+
var useTable_default = useTable;
|
|
74
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
75
|
+
0 && (module.exports = {});
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* @Title: 传入参数
|
|
4
|
+
* @Describe: 其余参数与Modal一致
|
|
5
|
+
* @Author: Wzw
|
|
6
|
+
*/
|
|
7
|
+
interface useModalProps {
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
title: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
declare const useTableModal: (props: Partial<useModalProps>) => JSX.Element;
|
|
12
|
+
export default useTableModal;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/hooks/useTableModal/index.tsx
|
|
30
|
+
var useTableModal_exports = {};
|
|
31
|
+
__export(useTableModal_exports, {
|
|
32
|
+
default: () => useTableModal_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(useTableModal_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_useModal = __toESM(require("../../business-hooks/useModal"));
|
|
37
|
+
var useTableModal = (props) => {
|
|
38
|
+
const { content } = (0, import_useModal.default)({});
|
|
39
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, content);
|
|
40
|
+
};
|
|
41
|
+
var useTableModal_default = useTableModal;
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {});
|
|
File without changes
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/hooks/useUrlState/index.ts
|
|
20
|
+
var useUrlState_exports = {};
|
|
21
|
+
__export(useUrlState_exports, {
|
|
22
|
+
default: () => useUrlState_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(useUrlState_exports);
|
|
25
|
+
var import_umi = require("umi");
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_ahooks = require("ahooks");
|
|
28
|
+
var useUrlState = (defaultState) => {
|
|
29
|
+
const mergeQueryAndDefault = (0, import_ahooks.usePersistFn)((query) => {
|
|
30
|
+
const tempState = {};
|
|
31
|
+
Object.keys(defaultState).forEach((k) => {
|
|
32
|
+
if (k in query) {
|
|
33
|
+
tempState[k] = query[k];
|
|
34
|
+
} else {
|
|
35
|
+
tempState[k] = defaultState[k];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
return tempState;
|
|
39
|
+
});
|
|
40
|
+
const [state, setState] = (0, import_react.useState)(() => {
|
|
41
|
+
return mergeQueryAndDefault(import_umi.history.location.query);
|
|
42
|
+
});
|
|
43
|
+
(0, import_react.useEffect)(() => {
|
|
44
|
+
return import_umi.history.listen((location) => {
|
|
45
|
+
setState(mergeQueryAndDefault(location.query));
|
|
46
|
+
});
|
|
47
|
+
}, [mergeQueryAndDefault]);
|
|
48
|
+
const setUrlState = (0, import_react.useCallback)((states) => {
|
|
49
|
+
import_umi.history.replace({
|
|
50
|
+
query: {
|
|
51
|
+
...states
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}, []);
|
|
55
|
+
return [state, setUrlState];
|
|
56
|
+
};
|
|
57
|
+
var useUrlState_default = useUrlState;
|
|
58
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
59
|
+
0 && (module.exports = {});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @Description: WebSocket hooks
|
|
3
|
+
* @Author: wzw
|
|
4
|
+
* @Date: 2020-11-26 14:00:23
|
|
5
|
+
* @param {*}
|
|
6
|
+
* @return {*}
|
|
7
|
+
*/
|
|
8
|
+
declare const useWebSocket: ({ onopen, onerror, onmessage, onclose }: any) => {
|
|
9
|
+
createWebSocket: () => void;
|
|
10
|
+
closeWebSocket: () => void;
|
|
11
|
+
websocket: any;
|
|
12
|
+
};
|
|
13
|
+
export default useWebSocket;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/hooks/useWebSocket/index.tsx
|
|
20
|
+
var useWebSocket_exports = {};
|
|
21
|
+
__export(useWebSocket_exports, {
|
|
22
|
+
default: () => useWebSocket_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(useWebSocket_exports);
|
|
25
|
+
var import_react = require("react");
|
|
26
|
+
var import_config = require("../../config");
|
|
27
|
+
var useWebSocket = ({ onopen, onerror, onmessage, onclose }) => {
|
|
28
|
+
let websocket = (0, import_react.useRef)();
|
|
29
|
+
const time = (0, import_react.useRef)();
|
|
30
|
+
const [reconnectNum, setReconnectNum] = (0, import_react.useState)(3);
|
|
31
|
+
const createWebSocket = () => {
|
|
32
|
+
websocket.current = new WebSocket((0, import_config.getConfig)().ENV.socket);
|
|
33
|
+
websocket.current.onopen = (e) => {
|
|
34
|
+
console.log("open");
|
|
35
|
+
if (typeof onopen === "function") {
|
|
36
|
+
onopen(e);
|
|
37
|
+
}
|
|
38
|
+
socketTimeOut();
|
|
39
|
+
};
|
|
40
|
+
websocket.current.onerror = (e) => {
|
|
41
|
+
console.log("error");
|
|
42
|
+
reconnect();
|
|
43
|
+
if (typeof onerror === "function") {
|
|
44
|
+
onerror(e);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
websocket.current.onmessage = (e) => {
|
|
48
|
+
console.log("message", e);
|
|
49
|
+
if (typeof onmessage === "function") {
|
|
50
|
+
onmessage(e);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
websocket.current.onclose = (e) => {
|
|
54
|
+
console.log("close");
|
|
55
|
+
if (typeof onclose === "function") {
|
|
56
|
+
onclose(e);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
const reconnect = () => {
|
|
61
|
+
if (reconnectNum === 0) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
setReconnectNum(reconnectNum - 1);
|
|
65
|
+
createWebSocket();
|
|
66
|
+
};
|
|
67
|
+
const socketTimeOut = () => {
|
|
68
|
+
clearTimeout(time.current);
|
|
69
|
+
if (websocket.current && websocket.current.readyState === 1) {
|
|
70
|
+
time.current = setTimeout(() => {
|
|
71
|
+
console.log("ping");
|
|
72
|
+
websocket.current.send(JSON.stringify({ type: "ping" }));
|
|
73
|
+
socketTimeOut();
|
|
74
|
+
}, 3e4);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const closeWebSocket = () => {
|
|
78
|
+
_reset();
|
|
79
|
+
};
|
|
80
|
+
const _reset = () => {
|
|
81
|
+
if (websocket.current) {
|
|
82
|
+
websocket.current.close();
|
|
83
|
+
}
|
|
84
|
+
setReconnectNum(3);
|
|
85
|
+
clearTimeout(time.current);
|
|
86
|
+
};
|
|
87
|
+
return { createWebSocket, closeWebSocket, websocket: websocket.current };
|
|
88
|
+
};
|
|
89
|
+
var useWebSocket_default = useWebSocket;
|
|
90
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
91
|
+
0 && (module.exports = {});
|
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/index.ts
|
|
17
|
+
var src_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(src_exports);
|
|
19
|
+
__reExport(src_exports, require("./business-components"), module.exports);
|
|
20
|
+
__reExport(src_exports, require("./business-hooks"), module.exports);
|
|
21
|
+
__reExport(src_exports, require("./components"), module.exports);
|
|
22
|
+
__reExport(src_exports, require("./hooks"), module.exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
'pisell-design.multi-select.apply': string;
|
|
3
|
+
'pisell-design.multi-select.apply.no-data': string;
|
|
4
|
+
'pisell-design.paginator.previous': string;
|
|
5
|
+
'pisell-design.paginator.next': string;
|
|
6
|
+
'pisell-design.search.search': string;
|
|
7
|
+
'pisell-design.recharge.option.button.edit': string;
|
|
8
|
+
'pisell-design.recharge.option.button.add': string;
|
|
9
|
+
'pisell-design.select.tag.modal.title': string;
|
|
10
|
+
};
|
|
11
|
+
export default _default;
|