@seakoi/native-ui 1.1.3 → 1.2.0
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/CHANGELOG.md +17 -0
- package/dist/commonjs/components/base/carousel/carousel-indicator.js +56 -0
- package/dist/commonjs/components/base/carousel/carousel-slides.js +140 -0
- package/dist/commonjs/components/base/carousel/carousel.js +114 -122
- package/dist/commonjs/components/base/carousel/hooks/index.js +0 -14
- package/dist/commonjs/components/base/carousel/hooks/use-carousel-index.js +16 -13
- package/dist/commonjs/components/base/carousel/hooks/use-carousel-lifecycle.js +6 -2
- package/dist/commonjs/components/base/carousel/hooks/use-carousel-pan-responder.js +40 -12
- package/dist/commonjs/components/base/carousel/hooks/use-carousel-position.js +6 -2
- package/dist/commonjs/components/base/carousel/index.js +1 -15
- package/dist/commonjs/components/base/carousel/style/index.js +12 -0
- package/dist/commonjs/components/base/date-picker/date-picker.js +56 -44
- package/dist/commonjs/components/base/date-picker/date-range-picker.js +142 -50
- package/dist/commonjs/components/base/date-picker/style/index.js +15 -0
- package/dist/commonjs/components/base/date-picker-view/date-picker-view.js +19 -53
- package/dist/commonjs/components/base/date-picker-view/index.js +0 -22
- package/dist/commonjs/components/base/index.js +30 -8
- package/dist/commonjs/components/base/picker/index.js +26 -4
- package/dist/commonjs/components/base/picker/picker-content.js +60 -0
- package/dist/commonjs/components/base/picker/picker-context.js +9 -0
- package/dist/commonjs/components/base/picker/picker-field.js +37 -0
- package/dist/commonjs/components/base/picker/picker.js +22 -96
- package/dist/commonjs/components/base/picker/style/index.js +1 -3
- package/dist/commonjs/components/base/picker-backup/base-picker-container.js +50 -0
- package/dist/commonjs/components/base/picker-backup/index.js +27 -0
- package/dist/commonjs/components/base/picker-backup/picker-backup.js +75 -0
- package/dist/commonjs/components/base/picker-backup/picker-copy.js +106 -0
- package/dist/commonjs/components/base/{picker → picker-backup}/picker-trigger.js +5 -5
- package/dist/commonjs/components/base/picker-backup/style/index.js +19 -0
- package/dist/commonjs/components/base/picker-backup/utils.js +53 -0
- package/dist/commonjs/components/base/picker-view/picker-view-column.js +15 -0
- package/dist/commonjs/components/base/picker-view/picker-view.js +4 -4
- package/dist/commonjs/components/base/tag/index.js +20 -0
- package/dist/commonjs/components/base/tag/style/index.js +89 -0
- package/dist/commonjs/components/base/tag/tag-context.js +12 -0
- package/dist/commonjs/components/base/tag/tag-group.js +35 -0
- package/dist/commonjs/components/base/tag/tag.js +47 -0
- package/dist/commonjs/components/base/tag/types.js +5 -0
- package/dist/module/components/base/carousel/carousel-indicator.js +51 -0
- package/dist/module/components/base/carousel/carousel-slides.js +135 -0
- package/dist/module/components/base/carousel/carousel.js +116 -124
- package/dist/module/components/base/carousel/hooks/index.js +0 -2
- package/dist/module/components/base/carousel/hooks/use-carousel-index.js +15 -11
- package/dist/module/components/base/carousel/hooks/use-carousel-lifecycle.js +6 -2
- package/dist/module/components/base/carousel/hooks/use-carousel-pan-responder.js +40 -11
- package/dist/module/components/base/carousel/hooks/use-carousel-position.js +5 -1
- package/dist/module/components/base/carousel/index.js +1 -5
- package/dist/module/components/base/carousel/style/index.js +12 -0
- package/dist/module/components/base/date-picker/date-picker.js +60 -48
- package/dist/module/components/base/date-picker/date-range-picker.js +146 -54
- package/dist/module/components/base/date-picker/style/index.js +11 -0
- package/dist/module/components/base/date-picker-view/date-picker-view.js +23 -57
- package/dist/module/components/base/date-picker-view/index.js +1 -3
- package/dist/module/components/base/index.js +2 -0
- package/dist/module/components/base/picker/index.js +9 -1
- package/dist/module/components/base/picker/picker-content.js +54 -0
- package/dist/module/components/base/picker/picker-context.js +4 -0
- package/dist/module/components/base/picker/picker-field.js +32 -0
- package/dist/module/components/base/picker/picker.js +25 -99
- package/dist/module/components/base/picker/style/index.js +1 -3
- package/dist/module/components/base/picker-backup/base-picker-container.js +44 -0
- package/dist/module/components/base/picker-backup/index.js +4 -0
- package/dist/module/components/base/picker-backup/picker-backup.js +69 -0
- package/dist/module/components/base/picker-backup/picker-copy.js +101 -0
- package/dist/module/components/base/{picker → picker-backup}/picker-trigger.js +2 -2
- package/dist/module/components/base/picker-backup/style/index.js +15 -0
- package/dist/module/components/base/picker-backup/utils.js +48 -0
- package/dist/module/components/base/picker-view/picker-view-column.js +15 -0
- package/dist/module/components/base/picker-view/picker-view.js +4 -4
- package/dist/module/components/base/tag/index.js +5 -0
- package/dist/module/components/base/tag/style/index.js +85 -0
- package/dist/module/components/base/tag/tag-context.js +8 -0
- package/dist/module/components/base/tag/tag-group.js +29 -0
- package/dist/module/components/base/tag/tag.js +41 -0
- package/dist/module/components/base/tag/types.js +3 -0
- package/dist/typescript/components/base/carousel/carousel-indicator.d.ts +42 -0
- package/dist/typescript/components/base/carousel/carousel-indicator.d.ts.map +1 -0
- package/dist/typescript/components/base/carousel/carousel-slides.d.ts +49 -0
- package/dist/typescript/components/base/carousel/carousel-slides.d.ts.map +1 -0
- package/dist/typescript/components/base/carousel/carousel.d.ts +16 -11
- package/dist/typescript/components/base/carousel/carousel.d.ts.map +1 -1
- package/dist/typescript/components/base/carousel/hooks/index.d.ts +0 -2
- package/dist/typescript/components/base/carousel/hooks/index.d.ts.map +1 -1
- package/dist/typescript/components/base/carousel/hooks/use-carousel-index.d.ts.map +1 -1
- package/dist/typescript/components/base/carousel/hooks/use-carousel-lifecycle.d.ts.map +1 -1
- package/dist/typescript/components/base/carousel/hooks/use-carousel-pan-responder.d.ts.map +1 -1
- package/dist/typescript/components/base/carousel/hooks/use-carousel-position.d.ts.map +1 -1
- package/dist/typescript/components/base/carousel/index.d.ts +1 -4
- package/dist/typescript/components/base/carousel/index.d.ts.map +1 -1
- package/dist/typescript/components/base/carousel/style/index.d.ts +12 -0
- package/dist/typescript/components/base/carousel/style/index.d.ts.map +1 -1
- package/dist/typescript/components/base/carousel/types.d.ts +8 -17
- package/dist/typescript/components/base/carousel/types.d.ts.map +1 -1
- package/dist/typescript/components/base/date-picker/date-picker.d.ts +4 -2
- package/dist/typescript/components/base/date-picker/date-picker.d.ts.map +1 -1
- package/dist/typescript/components/base/date-picker/date-range-picker.d.ts +12 -3
- package/dist/typescript/components/base/date-picker/date-range-picker.d.ts.map +1 -1
- package/dist/typescript/components/base/date-picker/style/index.d.ts +9 -0
- package/dist/typescript/components/base/date-picker/style/index.d.ts.map +1 -0
- package/dist/typescript/components/base/date-picker-view/date-picker-view.d.ts +1 -6
- package/dist/typescript/components/base/date-picker-view/date-picker-view.d.ts.map +1 -1
- package/dist/typescript/components/base/date-picker-view/index.d.ts +0 -2
- package/dist/typescript/components/base/date-picker-view/index.d.ts.map +1 -1
- package/dist/typescript/components/base/date-picker-view/types.d.ts +1 -1
- package/dist/typescript/components/base/index.d.ts +2 -0
- package/dist/typescript/components/base/index.d.ts.map +1 -1
- package/dist/typescript/components/base/picker/index.d.ts +7 -1
- package/dist/typescript/components/base/picker/index.d.ts.map +1 -1
- package/dist/typescript/components/base/picker/picker-content.d.ts +15 -0
- package/dist/typescript/components/base/picker/picker-content.d.ts.map +1 -0
- package/dist/typescript/components/base/picker/picker-context.d.ts +18 -0
- package/dist/typescript/components/base/picker/picker-context.d.ts.map +1 -0
- package/dist/typescript/components/base/picker/picker-field.d.ts +10 -0
- package/dist/typescript/components/base/picker/picker-field.d.ts.map +1 -0
- package/dist/typescript/components/base/picker/picker.d.ts +13 -11
- package/dist/typescript/components/base/picker/picker.d.ts.map +1 -1
- package/dist/typescript/components/base/picker/style/index.d.ts +0 -2
- package/dist/typescript/components/base/picker/style/index.d.ts.map +1 -1
- package/dist/typescript/components/base/picker-backup/base-picker-container.d.ts +15 -0
- package/dist/typescript/components/base/picker-backup/base-picker-container.d.ts.map +1 -0
- package/dist/typescript/components/base/picker-backup/index.d.ts +3 -0
- package/dist/typescript/components/base/picker-backup/index.d.ts.map +1 -0
- package/dist/typescript/components/base/picker-backup/picker-backup.d.ts +26 -0
- package/dist/typescript/components/base/picker-backup/picker-backup.d.ts.map +1 -0
- package/dist/typescript/components/base/picker-backup/picker-copy.d.ts +13 -0
- package/dist/typescript/components/base/picker-backup/picker-copy.d.ts.map +1 -0
- package/dist/typescript/components/base/picker-backup/picker-trigger.d.ts.map +1 -0
- package/dist/typescript/components/base/picker-backup/style/index.d.ts +13 -0
- package/dist/typescript/components/base/picker-backup/style/index.d.ts.map +1 -0
- package/dist/typescript/components/base/picker-backup/utils.d.ts +8 -0
- package/dist/typescript/components/base/picker-backup/utils.d.ts.map +1 -0
- package/dist/typescript/components/base/picker-view/picker-view-column.d.ts.map +1 -1
- package/dist/typescript/components/base/picker-view/utils/picker.d.ts +3 -3
- package/dist/typescript/components/base/picker-view/utils/picker.d.ts.map +1 -1
- package/dist/typescript/components/base/tag/index.d.ts +5 -0
- package/dist/typescript/components/base/tag/index.d.ts.map +1 -0
- package/dist/typescript/components/base/tag/style/index.d.ts +61 -0
- package/dist/typescript/components/base/tag/style/index.d.ts.map +1 -0
- package/dist/typescript/components/base/tag/tag-context.d.ts +3 -0
- package/dist/typescript/components/base/tag/tag-context.d.ts.map +1 -0
- package/dist/typescript/components/base/tag/tag-group.d.ts +4 -0
- package/dist/typescript/components/base/tag/tag-group.d.ts.map +1 -0
- package/dist/typescript/components/base/tag/tag.d.ts +4 -0
- package/dist/typescript/components/base/tag/tag.d.ts.map +1 -0
- package/dist/typescript/components/base/tag/types.d.ts +48 -0
- package/dist/typescript/components/base/tag/types.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/components/base/carousel/carousel-indicator.tsx +80 -0
- package/src/components/base/carousel/carousel-slides.tsx +177 -0
- package/src/components/base/carousel/carousel.tsx +108 -118
- package/src/components/base/carousel/hooks/index.ts +0 -2
- package/src/components/base/carousel/hooks/use-carousel-index.ts +13 -9
- package/src/components/base/carousel/hooks/use-carousel-lifecycle.ts +4 -3
- package/src/components/base/carousel/hooks/use-carousel-pan-responder.ts +40 -16
- package/src/components/base/carousel/hooks/use-carousel-position.ts +4 -1
- package/src/components/base/carousel/index.ts +1 -3
- package/src/components/base/carousel/style/index.ts +12 -0
- package/src/components/base/carousel/types.ts +8 -21
- package/src/components/base/date-picker/date-picker.tsx +64 -61
- package/src/components/base/date-picker/date-range-picker.tsx +178 -70
- package/src/components/base/date-picker/style/index.ts +10 -0
- package/src/components/base/date-picker-view/date-picker-view.tsx +21 -68
- package/src/components/base/date-picker-view/index.ts +0 -2
- package/src/components/base/date-picker-view/types.ts +1 -1
- package/src/components/base/index.ts +2 -0
- package/src/components/base/picker/index.ts +11 -1
- package/src/components/base/picker/picker-content.tsx +75 -0
- package/src/components/base/picker/picker-context.ts +19 -0
- package/src/components/base/picker/picker-field.tsx +50 -0
- package/src/components/base/picker/picker.tsx +38 -114
- package/src/components/base/picker/style/index.ts +0 -2
- package/src/components/base/picker-backup/base-picker-container.tsx +55 -0
- package/src/components/base/picker-backup/index.ts +2 -0
- package/src/components/base/picker-backup/picker-backup.tsx +110 -0
- package/src/components/base/picker-backup/picker-copy.tsx +125 -0
- package/src/components/base/{picker → picker-backup}/picker-trigger.tsx +2 -2
- package/src/components/base/picker-backup/style/index.ts +14 -0
- package/src/components/base/picker-backup/utils.ts +62 -0
- package/src/components/base/picker-view/picker-view-column.tsx +20 -0
- package/src/components/base/picker-view/picker-view.tsx +4 -4
- package/src/components/base/picker-view/utils/picker.ts +3 -5
- package/src/components/base/tag/index.ts +5 -0
- package/src/components/base/tag/style/index.tsx +84 -0
- package/src/components/base/tag/tag-context.ts +9 -0
- package/src/components/base/tag/tag-group.tsx +31 -0
- package/src/components/base/tag/tag.tsx +50 -0
- package/src/components/base/tag/types.ts +71 -0
- package/dist/commonjs/components/base/carousel/carousel-item.js +0 -45
- package/dist/commonjs/components/base/carousel/constants.js +0 -25
- package/dist/commonjs/components/base/carousel/hooks/use-carousel-indicator.js +0 -63
- package/dist/commonjs/components/base/carousel/hooks/use-carousel-slides.js +0 -95
- package/dist/commonjs/components/base/carousel/utils.js +0 -63
- package/dist/commonjs/components/base/date-picker-view/date-range-picker-view.js +0 -145
- package/dist/commonjs/components/base/date-picker-view/date-time-picker.js +0 -39
- package/dist/module/components/base/carousel/carousel-item.js +0 -40
- package/dist/module/components/base/carousel/constants.js +0 -21
- package/dist/module/components/base/carousel/hooks/use-carousel-indicator.js +0 -58
- package/dist/module/components/base/carousel/hooks/use-carousel-slides.js +0 -90
- package/dist/module/components/base/carousel/utils.js +0 -55
- package/dist/module/components/base/date-picker-view/date-range-picker-view.js +0 -138
- package/dist/module/components/base/date-picker-view/date-time-picker.js +0 -34
- package/dist/typescript/components/base/carousel/carousel-item.d.ts +0 -26
- package/dist/typescript/components/base/carousel/carousel-item.d.ts.map +0 -1
- package/dist/typescript/components/base/carousel/constants.d.ts +0 -17
- package/dist/typescript/components/base/carousel/constants.d.ts.map +0 -1
- package/dist/typescript/components/base/carousel/hooks/use-carousel-indicator.d.ts +0 -37
- package/dist/typescript/components/base/carousel/hooks/use-carousel-indicator.d.ts.map +0 -1
- package/dist/typescript/components/base/carousel/hooks/use-carousel-slides.d.ts +0 -51
- package/dist/typescript/components/base/carousel/hooks/use-carousel-slides.d.ts.map +0 -1
- package/dist/typescript/components/base/carousel/utils.d.ts +0 -25
- package/dist/typescript/components/base/carousel/utils.d.ts.map +0 -1
- package/dist/typescript/components/base/date-picker-view/date-range-picker-view.d.ts +0 -26
- package/dist/typescript/components/base/date-picker-view/date-range-picker-view.d.ts.map +0 -1
- package/dist/typescript/components/base/date-picker-view/date-time-picker.d.ts +0 -3
- package/dist/typescript/components/base/date-picker-view/date-time-picker.d.ts.map +0 -1
- package/dist/typescript/components/base/picker/picker-trigger.d.ts.map +0 -1
- package/src/components/base/carousel/carousel-item.tsx +0 -35
- package/src/components/base/carousel/constants.ts +0 -19
- package/src/components/base/carousel/hooks/use-carousel-indicator.tsx +0 -84
- package/src/components/base/carousel/hooks/use-carousel-slides.tsx +0 -131
- package/src/components/base/carousel/utils.ts +0 -55
- package/src/components/base/date-picker-view/date-range-picker-view.tsx +0 -191
- package/src/components/base/date-picker-view/date-time-picker.tsx +0 -34
- /package/dist/typescript/components/base/{picker → picker-backup}/picker-trigger.d.ts +0 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useMemoizedFn } from 'ahooks';
|
|
4
|
+
import React, { useCallback, useMemo, useRef, useState } from 'react';
|
|
5
|
+
import { Button } from "../button/index.js";
|
|
6
|
+
import { Picker } from "../picker/index.js";
|
|
7
|
+
import { PickerView } from "../picker-view/index.js";
|
|
8
|
+
import { findOptionsByValue } from "../picker-view/utils/picker.js";
|
|
9
|
+
import { normalizeColumns } from "./utils.js";
|
|
10
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
export const PickerBackup = ({
|
|
12
|
+
placeholder = '请选择',
|
|
13
|
+
headerTitle = '请选择',
|
|
14
|
+
formatter,
|
|
15
|
+
confirmText = '确定',
|
|
16
|
+
columns: rawColumns,
|
|
17
|
+
fieldNames,
|
|
18
|
+
...restProps
|
|
19
|
+
}) => {
|
|
20
|
+
const [draftValue, setDraftValue] = useState();
|
|
21
|
+
const committedValueRef = useRef(restProps.value ?? []);
|
|
22
|
+
const handleOpen = useCallback(() => {
|
|
23
|
+
setDraftValue(committedValueRef.current);
|
|
24
|
+
}, []);
|
|
25
|
+
|
|
26
|
+
/** 标准化列数据:将自定义字段名映射为内部标准格式 */
|
|
27
|
+
const columns = useMemo(() => normalizeColumns(rawColumns, fieldNames), [rawColumns, fieldNames]);
|
|
28
|
+
|
|
29
|
+
/** 格式化显示文案 - 根据 value 从 columns 计算 */
|
|
30
|
+
const _renderValue = useMemoizedFn(value => {
|
|
31
|
+
if (!value?.length) return;
|
|
32
|
+
const options = findOptionsByValue(value, columns);
|
|
33
|
+
if (formatter) {
|
|
34
|
+
return formatter(value, options);
|
|
35
|
+
}
|
|
36
|
+
return options.map(opt => opt?.label).filter(Boolean).join(' / ');
|
|
37
|
+
});
|
|
38
|
+
return /*#__PURE__*/_jsxs(Picker, {
|
|
39
|
+
...restProps,
|
|
40
|
+
children: [/*#__PURE__*/_jsx(Picker.Field, {
|
|
41
|
+
placeholder: placeholder,
|
|
42
|
+
renderValue: _renderValue
|
|
43
|
+
}), /*#__PURE__*/_jsx(Picker.Content, {
|
|
44
|
+
headerTitle: headerTitle,
|
|
45
|
+
onOpen: handleOpen,
|
|
46
|
+
children: ({
|
|
47
|
+
onChange,
|
|
48
|
+
value: contextValue
|
|
49
|
+
}) => {
|
|
50
|
+
// 同步 ref:始终保持最新的已提交值
|
|
51
|
+
committedValueRef.current = contextValue ?? [];
|
|
52
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
53
|
+
children: [/*#__PURE__*/_jsx(PickerView, {
|
|
54
|
+
columns: columns,
|
|
55
|
+
itemHeight: restProps.itemHeight,
|
|
56
|
+
value: draftValue,
|
|
57
|
+
onChange: setDraftValue
|
|
58
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
59
|
+
text: confirmText,
|
|
60
|
+
size: "large",
|
|
61
|
+
onPress: () => {
|
|
62
|
+
onChange?.(draftValue);
|
|
63
|
+
}
|
|
64
|
+
})]
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
})]
|
|
68
|
+
});
|
|
69
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useControllableValue, useMemoizedFn } from 'ahooks';
|
|
4
|
+
import { useMemo, useRef, useState } from 'react';
|
|
5
|
+
import { Button } from "../button/index.js";
|
|
6
|
+
import { Flex } from "../flex/index.js";
|
|
7
|
+
import { Modal, ModalHeader } from "../modal/index.js";
|
|
8
|
+
import { PickerView } from "../picker-view/index.js";
|
|
9
|
+
import { findOptionsByValue, getDefaultValues } from "../picker-view/utils/picker.js";
|
|
10
|
+
import { Portal } from "../portal/index.js";
|
|
11
|
+
import { PickerTrigger } from "./picker-trigger.js";
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
|
+
export const Picker = ({
|
|
14
|
+
placeholder = '请选择',
|
|
15
|
+
disabled = false,
|
|
16
|
+
title = '请选择',
|
|
17
|
+
formatter,
|
|
18
|
+
children,
|
|
19
|
+
style,
|
|
20
|
+
confirmText = '确定',
|
|
21
|
+
...restProps
|
|
22
|
+
}) => {
|
|
23
|
+
const [value, setValue] = useControllableValue(restProps, {
|
|
24
|
+
defaultValue: restProps.defaultValue
|
|
25
|
+
});
|
|
26
|
+
const [visible, setVisible] = useState(false);
|
|
27
|
+
|
|
28
|
+
// 内部状态用于管理滚动时的临时值
|
|
29
|
+
const [localValue, setLocalValue] = useState(restProps.value ?? restProps.defaultValue ?? []);
|
|
30
|
+
|
|
31
|
+
// 滑动时的临时 options(不用于 displayText)
|
|
32
|
+
const localOptionsRef = useRef([]);
|
|
33
|
+
|
|
34
|
+
/** 格式化显示文案 - 根据 value 从 columns 计算 */
|
|
35
|
+
const displayText = useMemo(() => {
|
|
36
|
+
if (!value?.length) return '';
|
|
37
|
+
|
|
38
|
+
// 从 columns 计算对应的 options
|
|
39
|
+
const options = findOptionsByValue(value, restProps.columns);
|
|
40
|
+
if (formatter) {
|
|
41
|
+
return formatter(value, options);
|
|
42
|
+
}
|
|
43
|
+
return options.map(opt => opt?.label).filter(Boolean).join(' / ');
|
|
44
|
+
}, [value, restProps.columns, formatter]);
|
|
45
|
+
const handleOpen = useMemoizedFn(() => {
|
|
46
|
+
// 打开时同步外部 value 到内部
|
|
47
|
+
// 如果 value 为空,使用 columns 的默认值(第一个选项)
|
|
48
|
+
const initialValue = value?.length ? value : getDefaultValues(restProps.columns);
|
|
49
|
+
setLocalValue(initialValue);
|
|
50
|
+
setVisible(true);
|
|
51
|
+
});
|
|
52
|
+
const handleClose = useMemoizedFn(() => {
|
|
53
|
+
setVisible(false);
|
|
54
|
+
});
|
|
55
|
+
const handleChange = useMemoizedFn((v, options) => {
|
|
56
|
+
setLocalValue(v);
|
|
57
|
+
localOptionsRef.current = options;
|
|
58
|
+
});
|
|
59
|
+
const handleConfirm = useMemoizedFn(() => {
|
|
60
|
+
setVisible(false);
|
|
61
|
+
setValue(localValue);
|
|
62
|
+
});
|
|
63
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
64
|
+
children: [/*#__PURE__*/_jsx(PickerTrigger, {
|
|
65
|
+
displayText: displayText,
|
|
66
|
+
placeholder: placeholder,
|
|
67
|
+
disabled: disabled,
|
|
68
|
+
style: style,
|
|
69
|
+
onPress: handleOpen,
|
|
70
|
+
children: children
|
|
71
|
+
}), /*#__PURE__*/_jsx(Portal, {
|
|
72
|
+
children: /*#__PURE__*/_jsx(Modal, {
|
|
73
|
+
visible: visible,
|
|
74
|
+
position: "bottom",
|
|
75
|
+
safeAreaInsetBottom: true,
|
|
76
|
+
contentHeight: '50%',
|
|
77
|
+
children: /*#__PURE__*/_jsxs(Flex, {
|
|
78
|
+
vertical: true,
|
|
79
|
+
align: "stretch",
|
|
80
|
+
gap: 16,
|
|
81
|
+
style: {
|
|
82
|
+
flex: 1,
|
|
83
|
+
padding: 16
|
|
84
|
+
},
|
|
85
|
+
children: [/*#__PURE__*/_jsx(ModalHeader, {
|
|
86
|
+
title: title,
|
|
87
|
+
onClose: handleClose
|
|
88
|
+
}), /*#__PURE__*/_jsx(PickerView, {
|
|
89
|
+
...restProps,
|
|
90
|
+
value: localValue,
|
|
91
|
+
onChange: handleChange
|
|
92
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
93
|
+
text: confirmText,
|
|
94
|
+
size: "large",
|
|
95
|
+
onPress: handleConfirm
|
|
96
|
+
})]
|
|
97
|
+
})
|
|
98
|
+
})
|
|
99
|
+
})]
|
|
100
|
+
});
|
|
101
|
+
};
|
|
@@ -4,8 +4,8 @@ import React, { cloneElement, isValidElement } from 'react';
|
|
|
4
4
|
import { TouchableOpacity } from 'react-native';
|
|
5
5
|
import { useTheme } from "../../../native-provider/index.js";
|
|
6
6
|
import { Flex } from "../flex/index.js";
|
|
7
|
+
import { usePickerFieldStyles } from "../picker/style/index.js";
|
|
7
8
|
import { Text } from "../text/index.js";
|
|
8
|
-
import { usePickerFieldStyles } from "./style/index.js";
|
|
9
9
|
|
|
10
10
|
/** Picker 基础触发器 Props */
|
|
11
11
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -38,7 +38,7 @@ export const PickerTrigger = ({
|
|
|
38
38
|
children: /*#__PURE__*/_jsx(Flex, {
|
|
39
39
|
align: "center",
|
|
40
40
|
gap: theme.spacing.sm,
|
|
41
|
-
style: [
|
|
41
|
+
style: [disabled && styles.disabled, style],
|
|
42
42
|
children: /*#__PURE__*/React.isValidElement(displayText) ? displayText : /*#__PURE__*/_jsx(Text, {
|
|
43
43
|
size: 14,
|
|
44
44
|
color: displayText ? theme.palette.fontGray1 : theme.palette.fontGray3,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createThemedStyles } from "../../../../native-provider/index.js";
|
|
4
|
+
export const usePickerFieldStyles = createThemedStyles(theme => ({
|
|
5
|
+
container: {
|
|
6
|
+
flex: 1,
|
|
7
|
+
alignSelf: 'stretch',
|
|
8
|
+
backgroundColor: theme.palette.white,
|
|
9
|
+
paddingVertical: 12,
|
|
10
|
+
paddingHorizontal: 12
|
|
11
|
+
},
|
|
12
|
+
disabled: {
|
|
13
|
+
backgroundColor: theme.palette.blueGray2
|
|
14
|
+
}
|
|
15
|
+
}));
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/** 默认字段名 */
|
|
4
|
+
const DEFAULT_FIELD_NAMES = {
|
|
5
|
+
label: 'label',
|
|
6
|
+
value: 'value',
|
|
7
|
+
children: 'children'
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 将自定义字段名的数据标准化为内部使用的 { label, value, children } 格式
|
|
12
|
+
* 如果 fieldNames 与默认值相同,则直接返回原始数据(零开销)
|
|
13
|
+
*/
|
|
14
|
+
export const normalizeColumns = (columns, fieldNames) => {
|
|
15
|
+
if (!fieldNames) return columns;
|
|
16
|
+
const merged = {
|
|
17
|
+
...DEFAULT_FIELD_NAMES,
|
|
18
|
+
...fieldNames
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// 如果所有字段名都和默认值一样,无需转换
|
|
22
|
+
if (merged.label === 'label' && merged.value === 'value' && merged.children === 'children') {
|
|
23
|
+
return columns;
|
|
24
|
+
}
|
|
25
|
+
const normalizeOption = item => {
|
|
26
|
+
const normalized = {
|
|
27
|
+
...item
|
|
28
|
+
};
|
|
29
|
+
if (merged.label !== 'label') {
|
|
30
|
+
normalized.label = item[merged.label];
|
|
31
|
+
}
|
|
32
|
+
if (merged.value !== 'value') {
|
|
33
|
+
normalized.value = item[merged.value];
|
|
34
|
+
}
|
|
35
|
+
if (merged.children !== 'children' && item[merged.children]) {
|
|
36
|
+
normalized.children = item[merged.children].map(normalizeOption);
|
|
37
|
+
} else if (item.children) {
|
|
38
|
+
normalized.children = item.children.map(normalizeOption);
|
|
39
|
+
}
|
|
40
|
+
return normalized;
|
|
41
|
+
};
|
|
42
|
+
return columns.map(column => {
|
|
43
|
+
if (Array.isArray(column)) {
|
|
44
|
+
return column.map(normalizeOption);
|
|
45
|
+
}
|
|
46
|
+
return normalizeOption(column);
|
|
47
|
+
});
|
|
48
|
+
};
|
|
@@ -48,6 +48,21 @@ export const PickerViewColumn = /*#__PURE__*/memo(({
|
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
50
|
const selectedIndex = getSelectedIndex(options.findIndex(item => item.value === value));
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* 自初始化:当 value 为空或不在 options 中时,主动上报第一个可用选项
|
|
54
|
+
* 这从根本上解决了「不滚动就拿不到值」的问题
|
|
55
|
+
*/
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (options.length === 0) return;
|
|
58
|
+
const hasValidValue = value !== undefined && value !== null && options.some(item => item.value === value);
|
|
59
|
+
if (!hasValidValue) {
|
|
60
|
+
const defaultIndex = findUsableOptionIndex(options, true, 0, false);
|
|
61
|
+
if (defaultIndex >= 0) {
|
|
62
|
+
onChange?.(options[defaultIndex]);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}, [options, value, onChange]);
|
|
51
66
|
useEffect(() => {
|
|
52
67
|
if (selectedIndex >= 0 && selectedIndex < options.length) {
|
|
53
68
|
flatListRef.current?.scrollToIndex({
|
|
@@ -47,8 +47,8 @@ export const PickerView = ({
|
|
|
47
47
|
}, [dataType, columns, value]);
|
|
48
48
|
|
|
49
49
|
// 保存 columnDefaultValues 到 ref,供 handleChange 使用
|
|
50
|
-
const columnDefaultValuesRef = useRef(columnDefaultValues);
|
|
51
|
-
columnDefaultValuesRef.current = columnDefaultValues;
|
|
50
|
+
// const columnDefaultValuesRef = useRef<PickerValue[]>(columnDefaultValues);
|
|
51
|
+
// columnDefaultValuesRef.current = columnDefaultValues;
|
|
52
52
|
|
|
53
53
|
/** 获取容器实际高度 */
|
|
54
54
|
const handleLayout = useCallback(event => {
|
|
@@ -72,7 +72,7 @@ export const PickerView = ({
|
|
|
72
72
|
case 'multiple':
|
|
73
73
|
{
|
|
74
74
|
const newValues = [...value];
|
|
75
|
-
|
|
75
|
+
columnDefaultValues.forEach((item, i) => {
|
|
76
76
|
if (isNil(newValues[i])) {
|
|
77
77
|
newValues[i] = item;
|
|
78
78
|
}
|
|
@@ -138,7 +138,7 @@ export const PickerView = ({
|
|
|
138
138
|
}
|
|
139
139
|
if (!isControlled && !isNoDefaultValue) {
|
|
140
140
|
if (dataType === 'multiple') {
|
|
141
|
-
return
|
|
141
|
+
return columnDefaultValues[index];
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
// 真的没有就默认第一个选项
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createThemedStyles } from "../../../../native-provider/index.js";
|
|
4
|
+
export const useTagStyles = createThemedStyles((theme, props) => {
|
|
5
|
+
const {
|
|
6
|
+
themeColor = 'primary'
|
|
7
|
+
} = props;
|
|
8
|
+
const BASE_COLOR_MAP = {
|
|
9
|
+
primary: {
|
|
10
|
+
baseColor: theme.palette.brand7,
|
|
11
|
+
lightColor: theme.palette.brand1
|
|
12
|
+
},
|
|
13
|
+
danger: {
|
|
14
|
+
baseColor: theme.palette.error6,
|
|
15
|
+
lightColor: theme.palette.error1
|
|
16
|
+
},
|
|
17
|
+
default: {
|
|
18
|
+
baseColor: theme.palette.gray6,
|
|
19
|
+
lightColor: theme.palette.gray2
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const Color = BASE_COLOR_MAP[themeColor];
|
|
23
|
+
return {
|
|
24
|
+
tag: {},
|
|
25
|
+
large: {
|
|
26
|
+
paddingHorizontal: 8,
|
|
27
|
+
paddingVertical: 4,
|
|
28
|
+
borderRadius: 4
|
|
29
|
+
},
|
|
30
|
+
medium: {
|
|
31
|
+
paddingHorizontal: 6,
|
|
32
|
+
paddingVertical: 2,
|
|
33
|
+
borderRadius: 2
|
|
34
|
+
},
|
|
35
|
+
small: {
|
|
36
|
+
paddingHorizontal: 4,
|
|
37
|
+
paddingVertical: 1.5,
|
|
38
|
+
borderRadius: 1.5
|
|
39
|
+
},
|
|
40
|
+
disabled: {
|
|
41
|
+
opacity: 0.5
|
|
42
|
+
},
|
|
43
|
+
'font-small': {
|
|
44
|
+
fontSize: 10
|
|
45
|
+
},
|
|
46
|
+
'font-medium': {
|
|
47
|
+
fontSize: 12
|
|
48
|
+
},
|
|
49
|
+
'font-large': {
|
|
50
|
+
fontSize: 14
|
|
51
|
+
},
|
|
52
|
+
filled: {
|
|
53
|
+
backgroundColor: Color.lightColor
|
|
54
|
+
},
|
|
55
|
+
'text-filled': {
|
|
56
|
+
color: Color.baseColor
|
|
57
|
+
},
|
|
58
|
+
outlined: {
|
|
59
|
+
borderColor: Color.baseColor,
|
|
60
|
+
borderWidth: 0.5
|
|
61
|
+
},
|
|
62
|
+
'text-outlined': {
|
|
63
|
+
color: Color.baseColor
|
|
64
|
+
},
|
|
65
|
+
solid: {
|
|
66
|
+
backgroundColor: Color.baseColor
|
|
67
|
+
},
|
|
68
|
+
'text-solid': {
|
|
69
|
+
color: '#fff'
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
export const useTagGroupStyles = createThemedStyles(() => {
|
|
74
|
+
return {
|
|
75
|
+
container: {
|
|
76
|
+
flexDirection: 'row',
|
|
77
|
+
alignItems: 'center',
|
|
78
|
+
flexWrap: 'wrap'
|
|
79
|
+
},
|
|
80
|
+
vertical: {
|
|
81
|
+
flexDirection: 'column',
|
|
82
|
+
alignItems: 'stretch'
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { View } from 'react-native';
|
|
5
|
+
import { useTagGroupStyles } from "./style/index.js";
|
|
6
|
+
import { TagContext } from "./tag-context.js";
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
export const TagGroup = ({
|
|
9
|
+
children,
|
|
10
|
+
direction = 'horizontal',
|
|
11
|
+
gap = 16,
|
|
12
|
+
style,
|
|
13
|
+
size,
|
|
14
|
+
disabled
|
|
15
|
+
}) => {
|
|
16
|
+
const groupStyles = useTagGroupStyles();
|
|
17
|
+
return /*#__PURE__*/_jsx(TagContext.Provider, {
|
|
18
|
+
value: {
|
|
19
|
+
size,
|
|
20
|
+
disabled
|
|
21
|
+
},
|
|
22
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
23
|
+
style: [groupStyles.container, direction === 'vertical' && groupStyles.vertical, gap > 0 && {
|
|
24
|
+
gap
|
|
25
|
+
}, style],
|
|
26
|
+
children: children
|
|
27
|
+
})
|
|
28
|
+
});
|
|
29
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { use, useMemo } from 'react';
|
|
4
|
+
import { Pressable } from 'react-native';
|
|
5
|
+
import { Text } from "./../index.js";
|
|
6
|
+
import { useTagStyles } from "./style/index.js";
|
|
7
|
+
import { TagContext } from "./tag-context.js";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
export const Tag = ({
|
|
10
|
+
text,
|
|
11
|
+
variant = 'solid',
|
|
12
|
+
style,
|
|
13
|
+
theme = 'primary',
|
|
14
|
+
disabled: customDisabled,
|
|
15
|
+
size,
|
|
16
|
+
child,
|
|
17
|
+
textStyle,
|
|
18
|
+
onPress
|
|
19
|
+
}) => {
|
|
20
|
+
const context = use(TagContext);
|
|
21
|
+
const mergedDisabled = customDisabled ?? context.disabled ?? false;
|
|
22
|
+
const mergedSize = size ?? context.size ?? 'medium';
|
|
23
|
+
const styles = useTagStyles({
|
|
24
|
+
variant,
|
|
25
|
+
themeColor: theme,
|
|
26
|
+
mergedSize
|
|
27
|
+
});
|
|
28
|
+
const tagStyle = useMemo(() => {
|
|
29
|
+
return [styles.tag, styles[variant], styles[mergedSize], style];
|
|
30
|
+
}, [mergedSize, style, variant, styles]);
|
|
31
|
+
const tagNode = /*#__PURE__*/_jsx(Pressable, {
|
|
32
|
+
style: tagStyle,
|
|
33
|
+
onPress: mergedDisabled ? undefined : onPress,
|
|
34
|
+
disabled: mergedDisabled,
|
|
35
|
+
children: child ? child : /*#__PURE__*/_jsx(Text, {
|
|
36
|
+
style: [styles[`text-${variant}`], styles[`font-${mergedSize}`], textStyle],
|
|
37
|
+
children: text
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
return tagNode;
|
|
41
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type ViewStyle } from 'react-native';
|
|
2
|
+
import type { CarouselProps } from './types';
|
|
3
|
+
interface CarouselIndicatorProps {
|
|
4
|
+
/** 指示器配置(false 表示不显示,函数表示自定义渲染) */
|
|
5
|
+
indicator: CarouselProps['indicator'];
|
|
6
|
+
/** 指示器属性配置(颜色、样式) */
|
|
7
|
+
indicatorProps: CarouselProps['indicatorProps'];
|
|
8
|
+
/** 轮播项总数 */
|
|
9
|
+
total: number;
|
|
10
|
+
/** 当前激活的索引 */
|
|
11
|
+
current: number;
|
|
12
|
+
/** 激活状态的指示器颜色 */
|
|
13
|
+
activeColor: string;
|
|
14
|
+
/** 非激活状态的指示器颜色 */
|
|
15
|
+
inactiveColor: string;
|
|
16
|
+
/** 指示器样式对象 */
|
|
17
|
+
styles: {
|
|
18
|
+
indicatorContainer: ViewStyle;
|
|
19
|
+
indicatorDot: ViewStyle;
|
|
20
|
+
indicatorDotActive: ViewStyle;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 轮播图指示器渲染组件
|
|
25
|
+
*
|
|
26
|
+
* 负责渲染轮播图底部的指示器(小圆点),支持自定义指示器或使用默认样式。
|
|
27
|
+
* 当轮播项总数小于等于 1 时,不显示指示器。
|
|
28
|
+
*
|
|
29
|
+
* @param props - 组件属性配置
|
|
30
|
+
* @param props.indicator - 指示器配置(false 表示不显示,函数表示自定义渲染)
|
|
31
|
+
* @param props.indicatorProps - 指示器属性配置(颜色、样式)
|
|
32
|
+
* @param props.total - 轮播项总数
|
|
33
|
+
* @param props.current - 当前激活的索引
|
|
34
|
+
* @param props.activeColor - 激活状态的指示器颜色
|
|
35
|
+
* @param props.inactiveColor - 非激活状态的指示器颜色
|
|
36
|
+
* @param props.styles - 指示器样式对象
|
|
37
|
+
*
|
|
38
|
+
* @returns 渲染的指示器内容或 null
|
|
39
|
+
*/
|
|
40
|
+
export declare const CarouselIndicator: (props: CarouselIndicatorProps) => string | number | bigint | boolean | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=carousel-indicator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carousel-indicator.d.ts","sourceRoot":"","sources":["../../../../../src/components/base/carousel/carousel-indicator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,UAAU,sBAAsB;IAC9B,mCAAmC;IACnC,SAAS,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IACtC,qBAAqB;IACrB,cAAc,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAChD,YAAY;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,cAAc;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc;IACd,MAAM,EAAE;QACN,kBAAkB,EAAE,SAAS,CAAC;QAC9B,YAAY,EAAE,SAAS,CAAC;QACxB,kBAAkB,EAAE,SAAS,CAAC;KAC/B,CAAC;CACH;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO,sBAAsB,gWAqC9D,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
interface CarouselSlidesProps<Data = unknown> {
|
|
3
|
+
/** 数据源数组 */
|
|
4
|
+
data: Data[];
|
|
5
|
+
/** 渲染每一项的函数 */
|
|
6
|
+
renderItem: (item: Data, index: number) => ReactNode;
|
|
7
|
+
/** 轮播项总数 */
|
|
8
|
+
total: number;
|
|
9
|
+
/** 虚拟渲染范围(start、end、isVirtual) */
|
|
10
|
+
virtualRange: {
|
|
11
|
+
start: number;
|
|
12
|
+
end: number;
|
|
13
|
+
isVirtual: boolean;
|
|
14
|
+
} | null;
|
|
15
|
+
/** 是否启用循环播放 */
|
|
16
|
+
loopEnabled: boolean;
|
|
17
|
+
/** 循环播放时前置克隆节点数量 */
|
|
18
|
+
clonesBefore: number;
|
|
19
|
+
/** 滑动方向 */
|
|
20
|
+
direction: 'horizontal' | 'vertical';
|
|
21
|
+
/** 单个滑块的像素大小 */
|
|
22
|
+
slidePixels: number;
|
|
23
|
+
/** 扩展后的总数(包含克隆节点) */
|
|
24
|
+
extTotal: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* 轮播图滑块渲染组件
|
|
28
|
+
*
|
|
29
|
+
* 负责渲染轮播图的滑块内容,使用 data + renderItem 模式。
|
|
30
|
+
* 实现虚拟渲染优化,仅渲染可见范围内的滑块,并处理循环播放时的克隆逻辑。
|
|
31
|
+
* 为虚拟渲染添加前后占位空间,确保滚动位置正确。
|
|
32
|
+
*
|
|
33
|
+
* @template Data - 数据项类型
|
|
34
|
+
* @param props - 组件属性配置
|
|
35
|
+
* @param props.data - 数据源数组
|
|
36
|
+
* @param props.renderItem - 渲染每一项的函数
|
|
37
|
+
* @param props.total - 轮播项总数
|
|
38
|
+
* @param props.virtualRange - 虚拟渲染范围(start、end、isVirtual)
|
|
39
|
+
* @param props.loopEnabled - 是否启用循环播放
|
|
40
|
+
* @param props.clonesBefore - 循环播放时前置克隆节点数量
|
|
41
|
+
* @param props.direction - 滑动方向
|
|
42
|
+
* @param props.slidePixels - 单个滑块的像素大小
|
|
43
|
+
* @param props.extTotal - 扩展后的总数(包含克隆节点)
|
|
44
|
+
*
|
|
45
|
+
* @returns 渲染的滑块内容或 null
|
|
46
|
+
*/
|
|
47
|
+
export declare const CarouselSlides: <Data = unknown>(props: CarouselSlidesProps<Data>) => import("react").JSX.Element | null;
|
|
48
|
+
export {};
|
|
49
|
+
//# sourceMappingURL=carousel-slides.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carousel-slides.d.ts","sourceRoot":"","sources":["../../../../../src/components/base/carousel/carousel-slides.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAW,MAAM,OAAO,CAAC;AAGhD,UAAU,mBAAmB,CAAC,IAAI,GAAG,OAAO;IAC1C,YAAY;IACZ,IAAI,EAAE,IAAI,EAAE,CAAC;IACb,eAAe;IACf,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,KAAK,SAAS,CAAC;IACrD,YAAY;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,YAAY,EAAE;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,SAAS,EAAE,OAAO,CAAC;KACpB,GAAG,IAAI,CAAC;IACT,eAAe;IACf,WAAW,EAAE,OAAO,CAAC;IACrB,oBAAoB;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW;IACX,SAAS,EAAE,YAAY,GAAG,UAAU,CAAC;IACrC,gBAAgB;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,qBAAqB;IACrB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,cAAc,GAAI,IAAI,GAAG,OAAO,EAC3C,OAAO,mBAAmB,CAAC,IAAI,CAAC,uCA4HjC,CAAC"}
|
|
@@ -8,24 +8,29 @@ import type { CarouselProps } from './types';
|
|
|
8
8
|
* @example
|
|
9
9
|
* ```tsx
|
|
10
10
|
* // 基础用法
|
|
11
|
-
* <Carousel
|
|
12
|
-
*
|
|
13
|
-
* <
|
|
14
|
-
*
|
|
11
|
+
* <Carousel
|
|
12
|
+
* data={[1, 2, 3]}
|
|
13
|
+
* renderItem={(item) => <View><Text>{item}</Text></View>}
|
|
14
|
+
* />
|
|
15
15
|
*
|
|
16
16
|
* // 循环播放和自动轮播
|
|
17
|
-
* <Carousel
|
|
18
|
-
* {items
|
|
19
|
-
* </
|
|
17
|
+
* <Carousel
|
|
18
|
+
* data={items}
|
|
19
|
+
* renderItem={(item) => <View>{item.content}</View>}
|
|
20
|
+
* loop
|
|
21
|
+
* autoplay
|
|
22
|
+
* autoplayInterval={3000}
|
|
23
|
+
* />
|
|
20
24
|
*
|
|
21
25
|
* // 虚拟渲染(大量数据)
|
|
22
|
-
* <Carousel
|
|
23
|
-
* {
|
|
24
|
-
* </
|
|
26
|
+
* <Carousel
|
|
27
|
+
* data={largeDataArray}
|
|
28
|
+
* renderItem={(item, index) => <View><Text>{index}: {item}</Text></View>}
|
|
29
|
+
* />
|
|
25
30
|
* ```
|
|
26
31
|
*
|
|
27
32
|
* @param props - 组件属性
|
|
28
33
|
* @returns 轮播图组件
|
|
29
34
|
*/
|
|
30
|
-
export declare const Carousel: (props: CarouselProps) => React.JSX.Element;
|
|
35
|
+
export declare const Carousel: <Data = unknown>(props: CarouselProps<Data>) => React.JSX.Element | null;
|
|
31
36
|
//# sourceMappingURL=carousel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.d.ts","sourceRoot":"","sources":["../../../../../src/components/base/carousel/carousel.tsx"],"names":[],"mappings":"AACA,OAAO,KAAyC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"carousel.d.ts","sourceRoot":"","sources":["../../../../../src/components/base/carousel/carousel.tsx"],"names":[],"mappings":"AACA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAsB9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAa7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,QAAQ,GAAI,IAAI,GAAG,OAAO,EAAG,OAAO,aAAa,CAAC,IAAI,CAAC,6BA0RnE,CAAC"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
export { useCarouselAutoplay } from './use-carousel-autoplay';
|
|
2
2
|
export { useCarouselIndex } from './use-carousel-index';
|
|
3
|
-
export { useCarouselIndicator } from './use-carousel-indicator';
|
|
4
3
|
export { useCarouselLifecycle } from './use-carousel-lifecycle';
|
|
5
4
|
export { useCarouselPanResponder } from './use-carousel-pan-responder';
|
|
6
5
|
export { useCarouselPosition } from './use-carousel-position';
|
|
7
|
-
export { useCarouselSlides } from './use-carousel-slides';
|
|
8
6
|
export { useCarouselSwipe } from './use-carousel-swipe';
|
|
9
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/base/carousel/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/base/carousel/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-carousel-index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/base/carousel/hooks/use-carousel-index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-carousel-index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/base/carousel/hooks/use-carousel-index.ts"],"names":[],"mappings":"AASA,UAAU,sBAAsB;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,eAAe,EAAE,OAAO,CAAC;IACzB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,gBAAgB,GAAI,QAAQ,sBAAsB;;0BAkBpD,MAAM;;;;kCAeL,MAAM;qCAQH,MAAM;6CAcH,MAAM;;CAuDvB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-carousel-lifecycle.d.ts","sourceRoot":"","sources":["../../../../../../src/components/base/carousel/hooks/use-carousel-lifecycle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,OAAO,CAAC;AAElD,UAAU,0BAA0B;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IAC/B,cAAc,EAAE,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACzC,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAChD,kBAAkB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;IACjD,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,oBAAoB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACjD;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,oBAAoB,GAAI,QAAQ,0BAA0B,
|
|
1
|
+
{"version":3,"file":"use-carousel-lifecycle.d.ts","sourceRoot":"","sources":["../../../../../../src/components/base/carousel/hooks/use-carousel-lifecycle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,OAAO,CAAC;AAElD,UAAU,0BAA0B;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IAC/B,cAAc,EAAE,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACzC,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAChD,kBAAkB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;IACjD,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,oBAAoB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACjD;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,oBAAoB,GAAI,QAAQ,0BAA0B,SAmDtE,CAAC"}
|