bitz-react-admin-ui 1.6.5 → 1.6.7
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 +2 -2
- package/dist/bitz-ui.mjs +126 -120
- package/dist/components/BitzFluentInput/index.mjs +20 -17
- package/dist/components/BitzFluentSelect/index.mjs +20 -18
- package/dist/components/BitzList/List.mjs +28 -0
- package/dist/components/BitzList/LoadMore.mjs +69 -0
- package/dist/components/BitzList/index.less.mjs +4 -0
- package/dist/components/BitzList/index.mjs +6 -0
- package/dist/components/BitzPullRefresh/PullRefresh.mjs +113 -0
- package/dist/components/BitzPullRefresh/index.mjs +6 -0
- package/dist/components/BitzPullRefresh/style/index.less.mjs +4 -0
- package/dist/components/BitzSelect/component/BitzSelectMobile.mjs +133 -94
- package/dist/components/BitzTable/ActionBar/ActionBar.mjs +64 -0
- package/dist/components/BitzTable/ActionBar/Button.mjs +10 -0
- package/dist/components/BitzTable/ActionBar/index.mjs +6 -60
- package/dist/components/BitzTable/ActionBar/style.mjs +36 -32
- package/dist/components/BitzTable/ActionCol/index.mjs +29 -28
- package/dist/components/BitzTable/Table/index.mjs +302 -253
- package/dist/components/BitzTable/TableSkeleton/index.mjs +46 -42
- package/dist/components/BitzTable/ToolBar/ColConfigIcon/ColumnSettingModal.mjs +179 -173
- package/dist/components/BitzTable/ToolBar/ColConfigIcon/DndItem.mjs +28 -26
- package/dist/components/BitzTable/ToolBar/ColConfigIcon/index.mjs +10 -9
- package/dist/components/BitzTable/ToolBar/DensityIcon/index.mjs +1 -1
- package/dist/components/BitzTable/ToolBar/ExportIcon/index.mjs +28 -25
- package/dist/components/BitzTable/ToolBar/RefreshIcon/index.mjs +3 -2
- package/dist/components/BitzTable/ToolBar/Wrapper/index.mjs +23 -14
- package/dist/components/BitzTable/ToolBar/style.mjs +29 -20
- package/dist/hooks/use-event-listener.mjs +40 -0
- package/dist/hooks/use-lock-fn.mjs +21 -0
- package/dist/hooks/use-scroll-parent.mjs +34 -0
- package/dist/hooks/use-touch.mjs +33 -0
- package/dist/node_modules/.store/@dnd-kit_core@6.1.0/node_modules/@dnd-kit/core/dist/core.esm.mjs +751 -1050
- package/dist/node_modules/.store/ahooks@3.7.10/node_modules/ahooks/es/useSetState/index.mjs +16 -0
- package/dist/node_modules/.store/ahooks@3.7.10/node_modules/ahooks/es/useThrottleFn/index.mjs +28 -0
- package/dist/node_modules/.store/ahooks@3.7.10/node_modules/ahooks/es/useUpdateEffect/index.mjs +6 -0
- package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/_Symbol.mjs +5 -0
- package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/_baseGetTag.mjs +11 -0
- package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/_baseTrim.mjs +9 -0
- package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/_freeGlobal.mjs +5 -0
- package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/_getRawTag.mjs +16 -0
- package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/_objectToString.mjs +8 -0
- package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/_root.mjs +5 -0
- package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/_trimmedEndIndex.mjs +10 -0
- package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/debounce.mjs +55 -0
- package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/isObject.mjs +8 -0
- package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/isObjectLike.mjs +7 -0
- package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/isSymbol.mjs +10 -0
- package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/now.mjs +7 -0
- package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/throttle.mjs +19 -0
- package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/toNumber.mjs +23 -0
- package/dist/node_modules/.store/tslib@2.6.2/node_modules/tslib/tslib.es6.mjs +48 -37
- package/dist/node_modules/_clsx@2.1.0@clsx/dist/clsx.mjs +23 -0
- package/dist/style.css +1 -1
- package/dist/type/bitz-ui.d.ts +2 -0
- package/dist/type/components/BitzList/List.d.ts +4 -0
- package/dist/type/components/BitzList/LoadMore.d.ts +4 -0
- package/dist/type/components/BitzList/PropsType.d.ts +35 -0
- package/dist/type/components/BitzList/index.d.ts +5 -0
- package/dist/type/components/BitzPagination/index.d.ts +8 -2
- package/dist/type/components/BitzPullRefresh/PropsType.d.ts +43 -0
- package/dist/type/components/BitzPullRefresh/PullRefresh.d.ts +4 -0
- package/dist/type/components/BitzPullRefresh/index.d.ts +5 -0
- package/dist/type/components/BitzSelect/component/BitzSelectMobile.d.ts +1 -0
- package/dist/type/components/BitzTable/ActionBar/ActionBar.d.ts +37 -0
- package/dist/type/components/BitzTable/ActionBar/Button.d.ts +6 -0
- package/dist/type/components/BitzTable/ActionBar/index.d.ts +6 -33
- package/dist/type/components/BitzTable/ActionBar/style.d.ts +2 -2
- package/dist/type/components/BitzTable/Store/index.d.ts +2 -3
- package/dist/type/components/BitzTable/Table/index.d.ts +2 -2
- package/dist/type/components/BitzTable/TableSkeleton/index.d.ts +1 -1
- package/dist/type/components/BitzTable/ToolBar/ExportIcon/index.d.ts +2 -1
- package/dist/type/components/BitzTable/ToolBar/style.d.ts +1 -2
- package/dist/type/components/BitzTable/index.d.ts +6 -7
- package/dist/type/hooks/use-event-listener.d.ts +11 -0
- package/dist/type/hooks/use-lock-fn.d.ts +2 -0
- package/dist/type/hooks/use-scroll-parent.d.ts +9 -0
- package/dist/type/hooks/use-touch.d.ts +18 -0
- package/dist/type/pages/Login2/useRowSelection.d.ts +6 -4
- package/dist/type/pages/Test/index.d.ts +3 -0
- package/dist/type/utils/get-default-props.d.ts +2 -0
- package/dist/type/utils/scroll.d.ts +6 -0
- package/dist/utils/get-default-props.mjs +12 -0
- package/dist/utils/scroll.mjs +15 -0
- package/package.json +2 -1
|
@@ -2,27 +2,28 @@ import { j as t } from "../../../../node_modules/.store/react@18.2.0/node_module
|
|
|
2
2
|
import s, { useContext as a } from "react";
|
|
3
3
|
import { Tooltip as c } from "antd";
|
|
4
4
|
import { show as u } from "@ebay/nice-modal-react";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import f from "./ColumnSettingModal.mjs";
|
|
6
|
+
import d from "../style.mjs";
|
|
7
7
|
import C from "../../../BitzButton/index.mjs";
|
|
8
8
|
import { TableContext as x } from "../../Store/index.mjs";
|
|
9
9
|
import g from "../../../../node_modules/.store/@ant-design_icons@5.3.1/node_modules/@ant-design/icons/es/icons/SettingOutlined.mjs";
|
|
10
10
|
const h = (o) => {
|
|
11
|
-
const { icon: m = /* @__PURE__ */ t.jsx(g, {}) } = o, { toolbarItemClassName: i } =
|
|
12
|
-
u(`ColumnSettingModal-${
|
|
13
|
-
var
|
|
14
|
-
(
|
|
11
|
+
const { icon: m = /* @__PURE__ */ t.jsx(g, {}) } = o, { toolbarItemClassName: i } = d(), { uuid: e } = a(x), l = () => {
|
|
12
|
+
u(`ColumnSettingModal-${e}`).then((r) => {
|
|
13
|
+
var n;
|
|
14
|
+
(n = o.onChange) == null || n.call(o, r);
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
17
|
return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
18
|
-
/* @__PURE__ */ t.jsx(
|
|
19
|
-
/* @__PURE__ */ t.jsx(c, { title: "列设置", children: /* @__PURE__ */ t.jsx(
|
|
18
|
+
/* @__PURE__ */ t.jsx(f, { id: `ColumnSettingModal-${e}` }),
|
|
19
|
+
/* @__PURE__ */ t.jsx(c, { title: "列设置", open: !1, children: /* @__PURE__ */ t.jsx(
|
|
20
20
|
C,
|
|
21
21
|
{
|
|
22
22
|
type: "text",
|
|
23
23
|
className: i,
|
|
24
24
|
onClick: l,
|
|
25
|
-
|
|
25
|
+
icon: m,
|
|
26
|
+
children: "列设置"
|
|
26
27
|
}
|
|
27
28
|
) })
|
|
28
29
|
] });
|
|
@@ -36,7 +36,7 @@ const j = (e) => {
|
|
|
36
36
|
}
|
|
37
37
|
]
|
|
38
38
|
};
|
|
39
|
-
return /* @__PURE__ */ o.jsx(d, { menu: a, trigger: ["click"], children: /* @__PURE__ */ o.jsx(y, { title: "表格密度", children: /* @__PURE__ */ o.jsx(u, { type: "text", className: s,
|
|
39
|
+
return /* @__PURE__ */ o.jsx(d, { menu: a, trigger: ["click"], children: /* @__PURE__ */ o.jsx(y, { title: "表格密度", open: !1, children: /* @__PURE__ */ o.jsx(u, { type: "text", className: s, icon: m, children: "表格密度" }) }) });
|
|
40
40
|
}, T = r(j);
|
|
41
41
|
export {
|
|
42
42
|
T as default
|
|
@@ -1,40 +1,43 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { memo as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
const
|
|
8
|
-
show:
|
|
9
|
-
loading:
|
|
1
|
+
import { j as e } from "../../../../node_modules/.store/react@18.2.0/node_modules/react/jsx-runtime.mjs";
|
|
2
|
+
import { memo as a, useMemo as u } from "react";
|
|
3
|
+
import x from "../style.mjs";
|
|
4
|
+
import c from "../../../BitzButton/index.mjs";
|
|
5
|
+
import f from "../../../BitzConvert/index.mjs";
|
|
6
|
+
import d from "../../../../node_modules/.store/@ant-design_icons@5.3.1/node_modules/@ant-design/icons/es/icons/DownloadOutlined.mjs";
|
|
7
|
+
const j = ({
|
|
8
|
+
show: r = !0,
|
|
9
|
+
loading: s,
|
|
10
10
|
onClick: t,
|
|
11
|
-
icon: m = /* @__PURE__ */
|
|
11
|
+
icon: m = /* @__PURE__ */ e.jsx(d, {}),
|
|
12
|
+
menu: o,
|
|
13
|
+
tipText: n
|
|
12
14
|
}) => {
|
|
13
|
-
const { toolbarItemClassName:
|
|
15
|
+
const { toolbarItemClassName: i } = x(), p = u(() => o || {
|
|
14
16
|
items: [
|
|
15
17
|
{ key: "excel", label: "导出查询结果为Excel" }
|
|
16
18
|
],
|
|
17
|
-
onClick: ({ key:
|
|
18
|
-
}
|
|
19
|
-
return
|
|
20
|
-
|
|
19
|
+
onClick: ({ key: l }) => t == null ? void 0 : t(l)
|
|
20
|
+
}, [o, t]);
|
|
21
|
+
return r ? /* @__PURE__ */ e.jsx(
|
|
22
|
+
f.DropdownToButton,
|
|
21
23
|
{
|
|
22
|
-
menu:
|
|
24
|
+
menu: p,
|
|
23
25
|
trigger: ["click"],
|
|
24
|
-
showTootip: !
|
|
25
|
-
tipText: "导出",
|
|
26
|
-
children: /* @__PURE__ */
|
|
27
|
-
|
|
26
|
+
showTootip: !1,
|
|
27
|
+
tipText: n || "导出",
|
|
28
|
+
children: /* @__PURE__ */ e.jsx(
|
|
29
|
+
c,
|
|
28
30
|
{
|
|
29
31
|
type: "text",
|
|
30
|
-
className:
|
|
31
|
-
disabled:
|
|
32
|
-
|
|
32
|
+
className: i,
|
|
33
|
+
disabled: s,
|
|
34
|
+
icon: m,
|
|
35
|
+
children: "下载"
|
|
33
36
|
}
|
|
34
37
|
)
|
|
35
38
|
}
|
|
36
39
|
) : null;
|
|
37
|
-
},
|
|
40
|
+
}, T = a(j);
|
|
38
41
|
export {
|
|
39
|
-
|
|
42
|
+
T as default
|
|
40
43
|
};
|
|
@@ -6,14 +6,15 @@ import a from "../../../BitzButton/index.mjs";
|
|
|
6
6
|
import c from "../../../../node_modules/.store/@ant-design_icons@5.3.1/node_modules/@ant-design/icons/es/icons/ReloadOutlined.mjs";
|
|
7
7
|
const p = (t) => {
|
|
8
8
|
const { loading: e, onClick: r, icon: s = /* @__PURE__ */ o.jsx(c, {}) } = t, { toolbarItemClassName: m } = l();
|
|
9
|
-
return /* @__PURE__ */ o.jsx(n, { title: "刷新", children: /* @__PURE__ */ o.jsx(
|
|
9
|
+
return /* @__PURE__ */ o.jsx(n, { title: "刷新", open: !1, children: /* @__PURE__ */ o.jsx(
|
|
10
10
|
a,
|
|
11
11
|
{
|
|
12
12
|
type: "text",
|
|
13
13
|
className: m,
|
|
14
14
|
disabled: e,
|
|
15
15
|
onClick: r,
|
|
16
|
-
|
|
16
|
+
icon: s,
|
|
17
|
+
children: "刷新"
|
|
17
18
|
}
|
|
18
19
|
) });
|
|
19
20
|
}, R = i(p);
|
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
import { j as o } from "../../../../node_modules/.store/react@18.2.0/node_modules/react/jsx-runtime.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { useMemo as j } from "react";
|
|
3
|
+
import { Space as m } from "antd";
|
|
3
4
|
import e from "../index.mjs";
|
|
4
|
-
const
|
|
5
|
-
size:
|
|
6
|
-
loading:
|
|
7
|
-
onExport:
|
|
8
|
-
onRefresh:
|
|
5
|
+
const h = ({
|
|
6
|
+
size: a,
|
|
7
|
+
loading: s,
|
|
8
|
+
onExport: i,
|
|
9
|
+
onRefresh: n,
|
|
9
10
|
onSizeChange: t,
|
|
10
|
-
onColumnChange:
|
|
11
|
-
children:
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
onColumnChange: c,
|
|
12
|
+
children: r
|
|
13
|
+
}) => {
|
|
14
|
+
const x = j(() => r ? /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
|
|
15
|
+
r,
|
|
16
|
+
/* @__PURE__ */ o.jsx(e.RefreshIcon, { loading: s, onClick: n }),
|
|
14
17
|
/* @__PURE__ */ o.jsx(e.DensityIcon, { onChange: t }),
|
|
15
|
-
/* @__PURE__ */ o.jsx(e.ColConfigIcon, { onChange:
|
|
16
|
-
] })
|
|
17
|
-
|
|
18
|
+
/* @__PURE__ */ o.jsx(e.ColConfigIcon, { onChange: c })
|
|
19
|
+
] }) : /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
|
|
20
|
+
/* @__PURE__ */ o.jsx(e.ExportIcon, { loading: s, onClick: i }),
|
|
21
|
+
/* @__PURE__ */ o.jsx(e.RefreshIcon, { loading: s, onClick: n }),
|
|
22
|
+
/* @__PURE__ */ o.jsx(e.DensityIcon, { onChange: t }),
|
|
23
|
+
/* @__PURE__ */ o.jsx(e.ColConfigIcon, { onChange: c })
|
|
24
|
+
] }), [s, r]);
|
|
25
|
+
return /* @__PURE__ */ o.jsx(m.Compact, { style: { height: "100%" }, children: x });
|
|
26
|
+
};
|
|
18
27
|
export {
|
|
19
|
-
|
|
28
|
+
h as default
|
|
20
29
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { theme as
|
|
1
|
+
import { theme as $ } from "antd";
|
|
2
|
+
import { TableContext as d } from "../Store/index.mjs";
|
|
2
3
|
import "../../../node_modules/.store/@ant-design_cssinjs@1.18.4/node_modules/@ant-design/cssinjs/es/extractStyle.mjs";
|
|
3
4
|
import "../../../node_modules/.store/@ant-design_cssinjs@1.18.4/node_modules/@ant-design/cssinjs/es/hooks/useCacheToken.mjs";
|
|
4
|
-
import "react";
|
|
5
|
+
import { useContext as h, useMemo as S } from "react";
|
|
5
6
|
import "../../../node_modules/.store/@ant-design_cssinjs@1.18.4/node_modules/@ant-design/cssinjs/es/StyleContext.mjs";
|
|
6
7
|
import "../../../node_modules/.store/@ant-design_cssinjs@1.18.4/node_modules/@ant-design/cssinjs/es/theme/createTheme.mjs";
|
|
7
8
|
import "../../../node_modules/.store/rc-util@5.39.0/node_modules/rc-util/es/warning.mjs";
|
|
@@ -9,33 +10,41 @@ import "../../../node_modules/.store/@ant-design_cssinjs@1.18.4/node_modules/@an
|
|
|
9
10
|
import "../../../node_modules/.store/@ant-design_cssinjs@1.18.4/node_modules/@ant-design/cssinjs/es/hooks/useCompatibleInsertionEffect.mjs";
|
|
10
11
|
import "../../../node_modules/.store/@ant-design_cssinjs@1.18.4/node_modules/@ant-design/cssinjs/es/hooks/useEffectCleanupRegister.mjs";
|
|
11
12
|
import "../../../node_modules/.store/@ant-design_cssinjs@1.18.4/node_modules/@ant-design/cssinjs/es/hooks/useHMR.mjs";
|
|
12
|
-
import
|
|
13
|
+
import g from "../../../node_modules/.store/@ant-design_cssinjs@1.18.4/node_modules/@ant-design/cssinjs/es/hooks/useStyleRegister.mjs";
|
|
13
14
|
import "../../../node_modules/.store/@ant-design_cssinjs@1.18.4/node_modules/@ant-design/cssinjs/es/transformers/legacyLogicalProperties.mjs";
|
|
14
|
-
import
|
|
15
|
-
const
|
|
16
|
-
const { theme:
|
|
15
|
+
import u from "../../../node_modules/.store/classnames@2.5.1/node_modules/classnames/index.mjs";
|
|
16
|
+
const M = () => {
|
|
17
|
+
const { theme: a, token: r, hashId: n } = $.useToken(), { tableSize: m } = h(d), p = S(() => m ?? "lg", [m]), e = "toolbarItem", i = "ToolbarItemBtn", l = (t, o, s) => [
|
|
17
18
|
{
|
|
18
|
-
[`.${
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
padding: 0,
|
|
24
|
-
border: "none",
|
|
19
|
+
[`.${t}`]: {
|
|
20
|
+
height: "100%",
|
|
21
|
+
lineHeight: "normal",
|
|
22
|
+
paddingBlock: 0,
|
|
23
|
+
borderRadius: 0,
|
|
25
24
|
display: "block",
|
|
26
25
|
"&:not(&:disabled):hover": {
|
|
27
|
-
color:
|
|
26
|
+
color: s.colorText
|
|
28
27
|
},
|
|
29
28
|
"&:not(&:disabled):focus": {
|
|
30
|
-
color:
|
|
29
|
+
color: s.colorText
|
|
30
|
+
},
|
|
31
|
+
".ant-btn-icon": {
|
|
32
|
+
marginInlineEnd: "6px !important"
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
|
-
}
|
|
35
|
+
},
|
|
36
|
+
[{ [`.${t}.xl${o}`]: { fontSize: 14 } }],
|
|
37
|
+
[{ [`.${t}.lg${o}`]: { fontSize: 12 } }],
|
|
38
|
+
[{ [`.${t}.md${o}`]: { fontSize: 12 } }],
|
|
39
|
+
[{ [`.${t}.sm${o}`]: { fontSize: 12 } }],
|
|
40
|
+
[{ [`.${t}.xs${o}`]: { fontSize: 12 } }]
|
|
34
41
|
];
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
])
|
|
42
|
+
g({ theme: a, token: r, hashId: n, path: [e] }, () => [
|
|
43
|
+
l(e, i, r)
|
|
44
|
+
]);
|
|
45
|
+
const c = `${p}${i}`;
|
|
46
|
+
return { toolbarItemClassName: u(e, c, n) };
|
|
38
47
|
};
|
|
39
48
|
export {
|
|
40
|
-
|
|
49
|
+
M as default
|
|
41
50
|
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useEffect as v } from "react";
|
|
2
|
+
import { inBrowser as i, getTargetElement as a } from "./use-scroll-parent.mjs";
|
|
3
|
+
let f = !1;
|
|
4
|
+
if (i)
|
|
5
|
+
try {
|
|
6
|
+
const e = {};
|
|
7
|
+
Object.defineProperty(e, "passive", {
|
|
8
|
+
get() {
|
|
9
|
+
f = !0;
|
|
10
|
+
}
|
|
11
|
+
}), window.addEventListener("test-passive", null, e);
|
|
12
|
+
} catch {
|
|
13
|
+
}
|
|
14
|
+
function w(e, o, c = {}) {
|
|
15
|
+
if (!i)
|
|
16
|
+
return;
|
|
17
|
+
const {
|
|
18
|
+
target: n = window,
|
|
19
|
+
passive: d = !1,
|
|
20
|
+
capture: r = !1,
|
|
21
|
+
depends: l = []
|
|
22
|
+
} = c;
|
|
23
|
+
let s;
|
|
24
|
+
const p = () => {
|
|
25
|
+
const t = a(n);
|
|
26
|
+
t && !s && (t.addEventListener(
|
|
27
|
+
e,
|
|
28
|
+
o,
|
|
29
|
+
f ? { capture: r, passive: d } : r
|
|
30
|
+
), s = !0);
|
|
31
|
+
}, u = () => {
|
|
32
|
+
const t = a(n);
|
|
33
|
+
t && s && (t.removeEventListener(e, o, r), s = !1);
|
|
34
|
+
};
|
|
35
|
+
v(() => (p(), () => u()), [n, ...l]);
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
w as default,
|
|
39
|
+
f as supportsPassive
|
|
40
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useRef as u, useCallback as n } from "react";
|
|
2
|
+
function s(t) {
|
|
3
|
+
const r = u(!1);
|
|
4
|
+
return n(
|
|
5
|
+
async (...c) => {
|
|
6
|
+
if (!r.current) {
|
|
7
|
+
r.current = !0;
|
|
8
|
+
try {
|
|
9
|
+
const e = await t(...c);
|
|
10
|
+
return r.current = !1, e;
|
|
11
|
+
} catch (e) {
|
|
12
|
+
throw r.current = !1, e;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
[t]
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
s as default
|
|
21
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
function c(t, n) {
|
|
3
|
+
if (!t)
|
|
4
|
+
return n;
|
|
5
|
+
let e;
|
|
6
|
+
return typeof t == "function" ? e = t() : "current" in t ? e = t.current : e = t, e;
|
|
7
|
+
}
|
|
8
|
+
const l = typeof window < "u", o = /scroll|auto/i, f = l ? window : void 0;
|
|
9
|
+
function u(t) {
|
|
10
|
+
return t.tagName !== "HTML" && t.tagName !== "BODY" && t.nodeType === 1;
|
|
11
|
+
}
|
|
12
|
+
function d(t, n = f) {
|
|
13
|
+
n === void 0 && (n = window);
|
|
14
|
+
let e = t;
|
|
15
|
+
for (; e && e !== n && u(e); ) {
|
|
16
|
+
const { overflowY: i } = window.getComputedStyle(e);
|
|
17
|
+
if (o.test(i)) {
|
|
18
|
+
if (e.tagName !== "BODY")
|
|
19
|
+
return e;
|
|
20
|
+
const r = window.getComputedStyle(
|
|
21
|
+
e.parentNode
|
|
22
|
+
).overflowY;
|
|
23
|
+
if (o.test(r))
|
|
24
|
+
return e;
|
|
25
|
+
}
|
|
26
|
+
e = e.parentNode;
|
|
27
|
+
}
|
|
28
|
+
return n;
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
d as getScrollParent,
|
|
32
|
+
c as getTargetElement,
|
|
33
|
+
l as inBrowser
|
|
34
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useRef as t } from "react";
|
|
2
|
+
const h = 10;
|
|
3
|
+
function d(r, n) {
|
|
4
|
+
return r > n && r > h ? "horizontal" : n > r && n > h ? "vertical" : "";
|
|
5
|
+
}
|
|
6
|
+
function z() {
|
|
7
|
+
const r = t(0), n = t(0), u = t(0), o = t(0), s = t(0), i = t(0), e = t(""), c = t(null), X = () => e.current === "vertical", Y = () => e.current === "horizontal", f = () => {
|
|
8
|
+
u.current = 0, o.current = 0, s.current = 0, i.current = 0, e.current = "", c.current = null;
|
|
9
|
+
};
|
|
10
|
+
return {
|
|
11
|
+
move: (l) => {
|
|
12
|
+
const a = l.touches[0];
|
|
13
|
+
u.current = a.clientX < 0 ? 0 : a.clientX - r.current, o.current = a.clientY - n.current, s.current = Math.abs(u.current), i.current = Math.abs(o.current), c.current === null ? c.current = !0 : c.current = !1, e.current || (e.current = d(s.current, i.current));
|
|
14
|
+
},
|
|
15
|
+
start: (l) => {
|
|
16
|
+
f(), r.current = l.touches[0].clientX, n.current = l.touches[0].clientY;
|
|
17
|
+
},
|
|
18
|
+
reset: f,
|
|
19
|
+
startX: r,
|
|
20
|
+
startY: n,
|
|
21
|
+
deltaX: u,
|
|
22
|
+
deltaY: o,
|
|
23
|
+
offsetX: s,
|
|
24
|
+
offsetY: i,
|
|
25
|
+
direction: e,
|
|
26
|
+
isVertical: X,
|
|
27
|
+
isHorizontal: Y,
|
|
28
|
+
firstMove: c
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
z as default
|
|
33
|
+
};
|