bitz-react-admin-ui 1.6.6 → 1.6.8
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/dist/bitz-ui.mjs +126 -120
- package/dist/components/BitzFluentInput/index.mjs +17 -14
- package/dist/components/BitzFluentSelect/index.mjs +17 -15
- package/dist/components/BitzList/List.mjs +14 -0
- package/dist/components/BitzList/LoadMore.mjs +60 -0
- package/dist/components/BitzList/index.less.mjs +4 -0
- package/dist/components/BitzList/index.mjs +6 -0
- package/dist/components/BitzPullRefresh/PullRefresh.mjs +84 -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 +86 -74
- package/dist/components/BitzTable/ActionBar/ActionBar.mjs +36 -0
- package/dist/components/BitzTable/ActionBar/Button.mjs +10 -0
- package/dist/components/BitzTable/ActionBar/index.mjs +6 -34
- package/dist/components/BitzTable/ActionBar/style.mjs +36 -27
- package/dist/components/BitzTable/ActionCol/index.mjs +18 -17
- package/dist/components/BitzTable/Table/index.mjs +154 -92
- package/dist/components/BitzTable/TableSkeleton/index.mjs +36 -32
- package/dist/components/BitzTable/ToolBar/ColConfigIcon/ColumnSettingModal.mjs +88 -99
- package/dist/components/BitzTable/ToolBar/ColConfigIcon/DndItem.mjs +20 -18
- package/dist/components/BitzTable/ToolBar/ColConfigIcon/index.mjs +8 -8
- package/dist/components/BitzTable/ToolBar/DensityIcon/index.mjs +7 -7
- package/dist/components/BitzTable/ToolBar/ExportIcon/index.mjs +13 -13
- package/dist/components/BitzTable/ToolBar/RefreshIcon/index.mjs +5 -5
- package/dist/components/BitzTable/ToolBar/Wrapper/index.mjs +7 -3
- package/dist/components/BitzTable/ToolBar/style.mjs +29 -20
- package/dist/hooks/use-event-listener.mjs +31 -0
- package/dist/hooks/use-lock-fn.mjs +18 -0
- package/dist/hooks/use-scroll-parent.mjs +32 -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 +5 -1
- 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
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
import { j as
|
|
1
|
+
import { j as s } from "../../../../node_modules/.store/react@18.2.0/node_modules/react/jsx-runtime.mjs";
|
|
2
2
|
import c from "react";
|
|
3
|
-
import
|
|
4
|
-
import { useSortable as
|
|
5
|
-
import { CSS as
|
|
6
|
-
import
|
|
3
|
+
import e from "./index.module.less.mjs";
|
|
4
|
+
import { useSortable as b } from "../../../../node_modules/.store/@dnd-kit_sortable@7.0.2/node_modules/@dnd-kit/sortable/dist/sortable.esm.mjs";
|
|
5
|
+
import { CSS as f } from "../../../../node_modules/.store/@dnd-kit_utilities@3.2.2/node_modules/@dnd-kit/utilities/dist/utilities.esm.mjs";
|
|
6
|
+
import o from "../../../../node_modules/.store/classnames@2.5.1/node_modules/classnames/index.mjs";
|
|
7
7
|
import u from "../../../../assets/iconfont/IconTuodong.mjs";
|
|
8
|
-
import
|
|
9
|
-
const
|
|
10
|
-
const { item:
|
|
11
|
-
id:
|
|
12
|
-
disabled:
|
|
13
|
-
}),
|
|
8
|
+
import p from "../../../../node_modules/.store/@ant-design_icons@5.3.1/node_modules/@ant-design/icons/es/icons/LockOutlined.mjs";
|
|
9
|
+
const I = (n) => {
|
|
10
|
+
const { item: t } = n, { attributes: r, isDragging: a, setNodeRef: l, listeners: m, transform: i, transition: d } = b({
|
|
11
|
+
id: t == null ? void 0 : t.key,
|
|
12
|
+
disabled: t == null ? void 0 : t.disabled
|
|
13
|
+
}), g = {
|
|
14
14
|
transition: d,
|
|
15
|
-
transform:
|
|
15
|
+
transform: f.Transform.toString(i)
|
|
16
16
|
};
|
|
17
|
-
return
|
|
18
|
-
[
|
|
19
|
-
[
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
return s.jsxs("li", { ref: l, className: o(e.moveItem, "tableColumnSetting_moveItem", {
|
|
18
|
+
[e.isDragging]: a,
|
|
19
|
+
[e.disabled]: t == null ? void 0 : t.disabled,
|
|
20
|
+
tableColumnSetting_isDragging: a,
|
|
21
|
+
tableColumnSetting_disabled: t == null ? void 0 : t.disabled
|
|
22
|
+
}), style: g, ...m, ...r, children: [t.disabled ? s.jsx(p, { className: o(e.dragIcon, "tableColumnSetting_dragIcon") }) : s.jsx(u, { size: 14, className: o(e.dragIcon, "tableColumnSetting_dragIcon") }), s.jsx("span", { className: o(e["moveItem-text"], "tableColumnSetting_moveItem-text"), children: t.title })] });
|
|
23
|
+
}, y = c.memo(I);
|
|
22
24
|
export {
|
|
23
|
-
|
|
25
|
+
y as default
|
|
24
26
|
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { j as t } from "../../../../node_modules/.store/react@18.2.0/node_modules/react/jsx-runtime.mjs";
|
|
2
|
-
import
|
|
3
|
-
import { Tooltip as
|
|
2
|
+
import u, { useContext as s } from "react";
|
|
3
|
+
import { Tooltip as a } from "antd";
|
|
4
4
|
import { show as c } 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:
|
|
11
|
+
const { icon: i = t.jsx(g, {}) } = o, { toolbarItemClassName: m } = d(), { uuid: n } = s(x), l = () => {
|
|
12
12
|
c(`ColumnSettingModal-${n}`).then((r) => {
|
|
13
13
|
var e;
|
|
14
14
|
(e = o.onChange) == null || e.call(o, r);
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
|
-
return t.jsxs(t.Fragment, { children: [t.jsx(
|
|
18
|
-
},
|
|
17
|
+
return t.jsxs(t.Fragment, { children: [t.jsx(f, { id: `ColumnSettingModal-${n}` }), t.jsx(a, { title: "列设置", open: !1, children: t.jsx(C, { type: "text", className: m, onClick: l, icon: i, children: "列设置" }) })] });
|
|
18
|
+
}, y = u.memo(h);
|
|
19
19
|
export {
|
|
20
|
-
|
|
20
|
+
y as default
|
|
21
21
|
};
|
|
@@ -2,11 +2,11 @@ import { j as o } from "../../../../node_modules/.store/react@18.2.0/node_module
|
|
|
2
2
|
import { memo as r, useContext as u } from "react";
|
|
3
3
|
import { Dropdown as x, Tooltip as d } from "antd";
|
|
4
4
|
import { TableContext as y } from "../../Store/index.mjs";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
5
|
+
import C from "../style.mjs";
|
|
6
|
+
import b from "../../../BitzButton/index.mjs";
|
|
7
|
+
import f from "../../../../node_modules/.store/@ant-design_icons@5.3.1/node_modules/@ant-design/icons/es/icons/ColumnHeightOutlined.mjs";
|
|
8
8
|
const k = (e) => {
|
|
9
|
-
const { icon: m = o.jsx(
|
|
9
|
+
const { icon: m = o.jsx(f, {}) } = e, t = u(y), { toolbarItemClassName: s } = C(), a = {
|
|
10
10
|
selectedKeys: [t.tableSize],
|
|
11
11
|
onClick: ({ key: c }) => {
|
|
12
12
|
var n, i;
|
|
@@ -36,8 +36,8 @@ const k = (e) => {
|
|
|
36
36
|
}
|
|
37
37
|
]
|
|
38
38
|
};
|
|
39
|
-
return o.jsx(x, { menu: a, trigger: ["click"], children: o.jsx(d, { title: "表格密度", children: o.jsx(
|
|
40
|
-
},
|
|
39
|
+
return o.jsx(x, { menu: a, trigger: ["click"], children: o.jsx(d, { title: "表格密度", open: !1, children: o.jsx(b, { type: "text", className: s, icon: m, children: "表格密度" }) }) });
|
|
40
|
+
}, I = r(k);
|
|
41
41
|
export {
|
|
42
|
-
|
|
42
|
+
I as default
|
|
43
43
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { memo as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
const
|
|
8
|
-
const { toolbarItemClassName:
|
|
1
|
+
import { j as e } from "../../../../node_modules/.store/react@18.2.0/node_modules/react/jsx-runtime.mjs";
|
|
2
|
+
import { memo as u, useMemo as a } 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 = ({ show: r = !0, loading: s, onClick: t, icon: m = e.jsx(d, {}), menu: o, tipText: n }) => {
|
|
8
|
+
const { toolbarItemClassName: i } = x(), p = a(() => o || {
|
|
9
9
|
items: [
|
|
10
10
|
{ key: "excel", label: "导出查询结果为Excel" }
|
|
11
11
|
],
|
|
12
|
-
onClick: ({ key:
|
|
13
|
-
}
|
|
14
|
-
return
|
|
15
|
-
},
|
|
12
|
+
onClick: ({ key: l }) => t == null ? void 0 : t(l)
|
|
13
|
+
}, [o, t]);
|
|
14
|
+
return r ? e.jsx(f.DropdownToButton, { menu: p, trigger: ["click"], showTootip: !1, tipText: n || "导出", children: e.jsx(c, { type: "text", className: i, disabled: s, icon: m, children: "下载" }) }) : null;
|
|
15
|
+
}, I = u(j);
|
|
16
16
|
export {
|
|
17
|
-
|
|
17
|
+
I as default
|
|
18
18
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { j as o } from "../../../../node_modules/.store/react@18.2.0/node_modules/react/jsx-runtime.mjs";
|
|
2
|
-
import { memo as
|
|
3
|
-
import { Tooltip as
|
|
2
|
+
import { memo as n } from "react";
|
|
3
|
+
import { Tooltip as m } from "antd";
|
|
4
4
|
import l from "../style.mjs";
|
|
5
5
|
import c from "../../../BitzButton/index.mjs";
|
|
6
6
|
import a 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 = o.jsx(a, {}) } = t, { toolbarItemClassName: i } = l();
|
|
9
|
-
return o.jsx(
|
|
10
|
-
},
|
|
9
|
+
return o.jsx(m, { title: "刷新", open: !1, children: o.jsx(c, { type: "text", className: i, disabled: e, onClick: r, icon: s, children: "刷新" }) });
|
|
10
|
+
}, B = n(p);
|
|
11
11
|
export {
|
|
12
|
-
|
|
12
|
+
B as default
|
|
13
13
|
};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { j as o } from "../../../../node_modules/.store/react@18.2.0/node_modules/react/jsx-runtime.mjs";
|
|
2
|
+
import { useMemo as a } from "react";
|
|
2
3
|
import { Space as l } from "antd";
|
|
3
|
-
import
|
|
4
|
-
const
|
|
4
|
+
import e from "../index.mjs";
|
|
5
|
+
const g = ({ size: j, loading: n, onExport: c, onRefresh: r, onSizeChange: t, onColumnChange: i, children: s }) => {
|
|
6
|
+
const x = a(() => s ? o.jsxs(o.Fragment, { children: [s, o.jsx(e.RefreshIcon, { loading: n, onClick: r }), o.jsx(e.DensityIcon, { onChange: t }), o.jsx(e.ColConfigIcon, { onChange: i })] }) : o.jsxs(o.Fragment, { children: [o.jsx(e.ExportIcon, { loading: n, onClick: c }), o.jsx(e.RefreshIcon, { loading: n, onClick: r }), o.jsx(e.DensityIcon, { onChange: t }), o.jsx(e.ColConfigIcon, { onChange: i })] }), [n, s]);
|
|
7
|
+
return o.jsx(l.Compact, { style: { height: "100%" }, children: x });
|
|
8
|
+
};
|
|
5
9
|
export {
|
|
6
|
-
|
|
10
|
+
g as default
|
|
7
11
|
};
|
|
@@ -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,31 @@
|
|
|
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 { target: n = window, passive: d = !1, capture: r = !1, depends: l = [] } = c;
|
|
18
|
+
let s;
|
|
19
|
+
const p = () => {
|
|
20
|
+
const t = a(n);
|
|
21
|
+
t && !s && (t.addEventListener(e, o, f ? { capture: r, passive: d } : r), s = !0);
|
|
22
|
+
}, u = () => {
|
|
23
|
+
const t = a(n);
|
|
24
|
+
t && s && (t.removeEventListener(e, o, r), s = !1);
|
|
25
|
+
};
|
|
26
|
+
v(() => (p(), () => u()), [n, ...l]);
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
w as default,
|
|
30
|
+
f as supportsPassive
|
|
31
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useRef as u, useCallback as n } from "react";
|
|
2
|
+
function s(t) {
|
|
3
|
+
const r = u(!1);
|
|
4
|
+
return n(async (...c) => {
|
|
5
|
+
if (!r.current) {
|
|
6
|
+
r.current = !0;
|
|
7
|
+
try {
|
|
8
|
+
const e = await t(...c);
|
|
9
|
+
return r.current = !1, e;
|
|
10
|
+
} catch (e) {
|
|
11
|
+
throw r.current = !1, e;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}, [t]);
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
s as default
|
|
18
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
function w(n, t) {
|
|
3
|
+
if (!n)
|
|
4
|
+
return t;
|
|
5
|
+
let e;
|
|
6
|
+
return typeof n == "function" ? e = n() : "current" in n ? e = n.current : e = n, e;
|
|
7
|
+
}
|
|
8
|
+
const l = typeof window < "u", o = /scroll|auto/i, f = l ? window : void 0;
|
|
9
|
+
function u(n) {
|
|
10
|
+
return n.tagName !== "HTML" && n.tagName !== "BODY" && n.nodeType === 1;
|
|
11
|
+
}
|
|
12
|
+
function c(n, t = f) {
|
|
13
|
+
t === void 0 && (t = window);
|
|
14
|
+
let e = n;
|
|
15
|
+
for (; e && e !== t && 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(e.parentNode).overflowY;
|
|
21
|
+
if (o.test(r))
|
|
22
|
+
return e;
|
|
23
|
+
}
|
|
24
|
+
e = e.parentNode;
|
|
25
|
+
}
|
|
26
|
+
return t;
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
c as getScrollParent,
|
|
30
|
+
w as getTargetElement,
|
|
31
|
+
l as inBrowser
|
|
32
|
+
};
|
|
@@ -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
|
+
};
|