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.
Files changed (84) hide show
  1. package/README.md +2 -2
  2. package/dist/bitz-ui.mjs +126 -120
  3. package/dist/components/BitzFluentInput/index.mjs +20 -17
  4. package/dist/components/BitzFluentSelect/index.mjs +20 -18
  5. package/dist/components/BitzList/List.mjs +28 -0
  6. package/dist/components/BitzList/LoadMore.mjs +69 -0
  7. package/dist/components/BitzList/index.less.mjs +4 -0
  8. package/dist/components/BitzList/index.mjs +6 -0
  9. package/dist/components/BitzPullRefresh/PullRefresh.mjs +113 -0
  10. package/dist/components/BitzPullRefresh/index.mjs +6 -0
  11. package/dist/components/BitzPullRefresh/style/index.less.mjs +4 -0
  12. package/dist/components/BitzSelect/component/BitzSelectMobile.mjs +133 -94
  13. package/dist/components/BitzTable/ActionBar/ActionBar.mjs +64 -0
  14. package/dist/components/BitzTable/ActionBar/Button.mjs +10 -0
  15. package/dist/components/BitzTable/ActionBar/index.mjs +6 -60
  16. package/dist/components/BitzTable/ActionBar/style.mjs +36 -32
  17. package/dist/components/BitzTable/ActionCol/index.mjs +29 -28
  18. package/dist/components/BitzTable/Table/index.mjs +302 -253
  19. package/dist/components/BitzTable/TableSkeleton/index.mjs +46 -42
  20. package/dist/components/BitzTable/ToolBar/ColConfigIcon/ColumnSettingModal.mjs +179 -173
  21. package/dist/components/BitzTable/ToolBar/ColConfigIcon/DndItem.mjs +28 -26
  22. package/dist/components/BitzTable/ToolBar/ColConfigIcon/index.mjs +10 -9
  23. package/dist/components/BitzTable/ToolBar/DensityIcon/index.mjs +1 -1
  24. package/dist/components/BitzTable/ToolBar/ExportIcon/index.mjs +28 -25
  25. package/dist/components/BitzTable/ToolBar/RefreshIcon/index.mjs +3 -2
  26. package/dist/components/BitzTable/ToolBar/Wrapper/index.mjs +23 -14
  27. package/dist/components/BitzTable/ToolBar/style.mjs +29 -20
  28. package/dist/hooks/use-event-listener.mjs +40 -0
  29. package/dist/hooks/use-lock-fn.mjs +21 -0
  30. package/dist/hooks/use-scroll-parent.mjs +34 -0
  31. package/dist/hooks/use-touch.mjs +33 -0
  32. package/dist/node_modules/.store/@dnd-kit_core@6.1.0/node_modules/@dnd-kit/core/dist/core.esm.mjs +751 -1050
  33. package/dist/node_modules/.store/ahooks@3.7.10/node_modules/ahooks/es/useSetState/index.mjs +16 -0
  34. package/dist/node_modules/.store/ahooks@3.7.10/node_modules/ahooks/es/useThrottleFn/index.mjs +28 -0
  35. package/dist/node_modules/.store/ahooks@3.7.10/node_modules/ahooks/es/useUpdateEffect/index.mjs +6 -0
  36. package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/_Symbol.mjs +5 -0
  37. package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/_baseGetTag.mjs +11 -0
  38. package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/_baseTrim.mjs +9 -0
  39. package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/_freeGlobal.mjs +5 -0
  40. package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/_getRawTag.mjs +16 -0
  41. package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/_objectToString.mjs +8 -0
  42. package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/_root.mjs +5 -0
  43. package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/_trimmedEndIndex.mjs +10 -0
  44. package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/debounce.mjs +55 -0
  45. package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/isObject.mjs +8 -0
  46. package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/isObjectLike.mjs +7 -0
  47. package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/isSymbol.mjs +10 -0
  48. package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/now.mjs +7 -0
  49. package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/throttle.mjs +19 -0
  50. package/dist/node_modules/.store/lodash@4.17.21/node_modules/lodash/toNumber.mjs +23 -0
  51. package/dist/node_modules/.store/tslib@2.6.2/node_modules/tslib/tslib.es6.mjs +48 -37
  52. package/dist/node_modules/_clsx@2.1.0@clsx/dist/clsx.mjs +23 -0
  53. package/dist/style.css +1 -1
  54. package/dist/type/bitz-ui.d.ts +2 -0
  55. package/dist/type/components/BitzList/List.d.ts +4 -0
  56. package/dist/type/components/BitzList/LoadMore.d.ts +4 -0
  57. package/dist/type/components/BitzList/PropsType.d.ts +35 -0
  58. package/dist/type/components/BitzList/index.d.ts +5 -0
  59. package/dist/type/components/BitzPagination/index.d.ts +8 -2
  60. package/dist/type/components/BitzPullRefresh/PropsType.d.ts +43 -0
  61. package/dist/type/components/BitzPullRefresh/PullRefresh.d.ts +4 -0
  62. package/dist/type/components/BitzPullRefresh/index.d.ts +5 -0
  63. package/dist/type/components/BitzSelect/component/BitzSelectMobile.d.ts +1 -0
  64. package/dist/type/components/BitzTable/ActionBar/ActionBar.d.ts +37 -0
  65. package/dist/type/components/BitzTable/ActionBar/Button.d.ts +6 -0
  66. package/dist/type/components/BitzTable/ActionBar/index.d.ts +6 -33
  67. package/dist/type/components/BitzTable/ActionBar/style.d.ts +2 -2
  68. package/dist/type/components/BitzTable/Store/index.d.ts +2 -3
  69. package/dist/type/components/BitzTable/Table/index.d.ts +2 -2
  70. package/dist/type/components/BitzTable/TableSkeleton/index.d.ts +1 -1
  71. package/dist/type/components/BitzTable/ToolBar/ExportIcon/index.d.ts +2 -1
  72. package/dist/type/components/BitzTable/ToolBar/style.d.ts +1 -2
  73. package/dist/type/components/BitzTable/index.d.ts +6 -7
  74. package/dist/type/hooks/use-event-listener.d.ts +11 -0
  75. package/dist/type/hooks/use-lock-fn.d.ts +2 -0
  76. package/dist/type/hooks/use-scroll-parent.d.ts +9 -0
  77. package/dist/type/hooks/use-touch.d.ts +18 -0
  78. package/dist/type/pages/Login2/useRowSelection.d.ts +6 -4
  79. package/dist/type/pages/Test/index.d.ts +3 -0
  80. package/dist/type/utils/get-default-props.d.ts +2 -0
  81. package/dist/type/utils/scroll.d.ts +6 -0
  82. package/dist/utils/get-default-props.mjs +12 -0
  83. package/dist/utils/scroll.mjs +15 -0
  84. 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 d from "./ColumnSettingModal.mjs";
6
- import f from "../style.mjs";
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 } = f(), { uuid: n } = a(x), l = () => {
12
- u(`ColumnSettingModal-${n}`).then((r) => {
13
- var e;
14
- (e = o.onChange) == null || e.call(o, r);
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(d, { id: `ColumnSettingModal-${n}` }),
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
- children: m
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, children: m }) }) });
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 o } from "../../../../node_modules/.store/react@18.2.0/node_modules/react/jsx-runtime.mjs";
2
- import { memo as p, useMemo as u } from "react";
3
- import l from "../style.mjs";
4
- import x from "../../../BitzButton/index.mjs";
5
- import a from "../../../BitzConvert/index.mjs";
6
- import c from "../../../../node_modules/.store/@ant-design_icons@5.3.1/node_modules/@ant-design/icons/es/icons/DownloadOutlined.mjs";
7
- const d = ({
8
- show: e = !0,
9
- loading: r,
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__ */ o.jsx(c, {})
11
+ icon: m = /* @__PURE__ */ e.jsx(d, {}),
12
+ menu: o,
13
+ tipText: n
12
14
  }) => {
13
- const { toolbarItemClassName: s } = l(), n = u(() => ({
15
+ const { toolbarItemClassName: i } = x(), p = u(() => o || {
14
16
  items: [
15
17
  { key: "excel", label: "导出查询结果为Excel" }
16
18
  ],
17
- onClick: ({ key: i }) => t == null ? void 0 : t(i)
18
- }), [t]);
19
- return e ? /* @__PURE__ */ o.jsx(
20
- a.DropdownToButton,
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: n,
24
+ menu: p,
23
25
  trigger: ["click"],
24
- showTootip: !0,
25
- tipText: "导出",
26
- children: /* @__PURE__ */ o.jsx(
27
- x,
26
+ showTootip: !1,
27
+ tipText: n || "导出",
28
+ children: /* @__PURE__ */ e.jsx(
29
+ c,
28
30
  {
29
31
  type: "text",
30
- className: s,
31
- disabled: r,
32
- children: m
32
+ className: i,
33
+ disabled: s,
34
+ icon: m,
35
+ children: "下载"
33
36
  }
34
37
  )
35
38
  }
36
39
  ) : null;
37
- }, y = p(d);
40
+ }, T = a(j);
38
41
  export {
39
- y as default
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
- children: s
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 { Space as x } from "antd";
2
+ import { useMemo as j } from "react";
3
+ import { Space as m } from "antd";
3
4
  import e from "../index.mjs";
4
- const p = ({
5
- size: c,
6
- loading: n,
7
- onExport: r,
8
- onRefresh: s,
5
+ const h = ({
6
+ size: a,
7
+ loading: s,
8
+ onExport: i,
9
+ onRefresh: n,
9
10
  onSizeChange: t,
10
- onColumnChange: i,
11
- children: a = /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
12
- /* @__PURE__ */ o.jsx(e.ExportIcon, { loading: n, onClick: r }),
13
- /* @__PURE__ */ o.jsx(e.RefreshIcon, { loading: n, onClick: s }),
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: i })
16
- ] })
17
- }) => /* @__PURE__ */ o.jsx(x, { size: 32, children: a });
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
- p as default
28
+ h as default
20
29
  };
@@ -1,7 +1,8 @@
1
- import { theme as s } from "antd";
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 l from "../../../node_modules/.store/@ant-design_cssinjs@1.18.4/node_modules/@ant-design/cssinjs/es/hooks/useStyleRegister.mjs";
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 n from "../../../node_modules/.store/classnames@2.5.1/node_modules/classnames/index.mjs";
15
- const z = (p) => {
16
- const { theme: i, token: o, hashId: e } = s.useToken(), t = "toolbarItem", m = (a, r) => [
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
- [`.${a}`]: {
19
- fontSize: 16,
20
- background: "inherit !important",
21
- height: "auto",
22
- lineHeight: "inherit",
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: r.colorPrimary
26
+ color: s.colorText
28
27
  },
29
28
  "&:not(&:disabled):focus": {
30
- color: r.colorPrimaryTextActive
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
- return l({ theme: i, token: o, hashId: e, path: [t] }, () => [
36
- m(t, o)
37
- ]), { toolbarItemClassName: n(t, e) };
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
- z as default
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
+ };