@tarojs/components-react 4.1.12-beta.63 → 4.1.12-beta.65

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 (33) hide show
  1. package/dist/components/picker/picker-group-legacy.js +12 -4
  2. package/dist/components/picker/picker-group-legacy.js.map +1 -1
  3. package/dist/components/picker/picker-group-slider.js +2 -7
  4. package/dist/components/picker/picker-group-slider.js.map +1 -1
  5. package/dist/components/picker-view/index.js +265 -0
  6. package/dist/components/picker-view/index.js.map +1 -0
  7. package/dist/components/picker-view/style/index.scss.js +4 -0
  8. package/dist/components/picker-view/style/index.scss.js.map +1 -0
  9. package/dist/components/picker-view-column/index.js +517 -0
  10. package/dist/components/picker-view-column/index.js.map +1 -0
  11. package/dist/index.css +1 -1
  12. package/dist/index.js +3 -1
  13. package/dist/index.js.map +1 -1
  14. package/dist/original/components/picker/picker-group-legacy.js +12 -4
  15. package/dist/original/components/picker/picker-group-legacy.js.map +1 -1
  16. package/dist/original/components/picker/picker-group-slider.js +2 -7
  17. package/dist/original/components/picker/picker-group-slider.js.map +1 -1
  18. package/dist/original/components/picker-view/index.js +265 -0
  19. package/dist/original/components/picker-view/index.js.map +1 -0
  20. package/dist/original/components/picker-view/style/index.scss +132 -0
  21. package/dist/original/components/picker-view-column/index.js +517 -0
  22. package/dist/original/components/picker-view-column/index.js.map +1 -0
  23. package/dist/original/index.js +3 -1
  24. package/dist/original/index.js.map +1 -1
  25. package/dist/original/utils/picker-scale.js +25 -0
  26. package/dist/original/utils/picker-scale.js.map +1 -0
  27. package/dist/solid/components/picker/picker-group-legacy.js +16 -8
  28. package/dist/solid/components/picker/picker-group-legacy.js.map +1 -1
  29. package/dist/solid/components/picker/picker-group-slider.js +6 -17
  30. package/dist/solid/components/picker/picker-group-slider.js.map +1 -1
  31. package/dist/utils/picker-scale.js +25 -0
  32. package/dist/utils/picker-scale.js.map +1 -0
  33. package/package.json +6 -6
@@ -0,0 +1,265 @@
1
+ import './style/index.scss';
2
+ import { View } from '@tarojs/components';
3
+ import * as React from 'react';
4
+ import { PickerViewColumn } from '../picker-view-column/index.js';
5
+ import { jsx, jsxs } from 'react/jsx-runtime';
6
+
7
+ const DEFAULT_ITEM_HEIGHT = 34;
8
+ // harmony 无 style height / visibleItems 可倒推时的兜底可见行数(= SCSS 默认高 5 行)
9
+ const HARMONY_FALLBACK_ROWS = 5;
10
+ // harmony 端:ArkUI 不解析 calc、且多级 height:100% 百分比链不成立,
11
+ // 又不能测量 DOM(见组件说明),故容器高只能由可静态读出的确定值决定。
12
+ const IS_HARMONY = process.env.TARO_PLATFORM === 'harmony';
13
+ // 同页多 PickerView 时为选项 id 提供实例前缀,避免 scrollIntoView 串到其它实例
14
+ let _pickerViewInstanceSeq = 0;
15
+ // 解析 indicatorStyle 字符串中的 height(纯 px 时优先用它,避免测量 DOM)
16
+ const parseHeightFromStyle = styleStr => {
17
+ if (!styleStr) return null;
18
+ const match = styleStr.match(/height\s*:\s*(\d+(?:\.\d+)?)px/i);
19
+ return match ? parseFloat(match[1]) : null;
20
+ };
21
+ // 从对象 style 的 height 取纯数值:number 直接用,字符串取纯 px("300px"→300)
22
+ const parseNumericHeight = h => {
23
+ if (typeof h === 'number' && Number.isFinite(h)) return h;
24
+ if (typeof h === 'string') {
25
+ const m = h.match(/^(\d+(?:\.\d+)?)px$/i);
26
+ return m ? parseFloat(m[1]) : null;
27
+ }
28
+ return null;
29
+ };
30
+ // 将 CSS 字符串(如 "height: 50px; color: red")解析为 React 样式对象
31
+ // H5 下 React DOM 的 style 只接受对象,不接受字符串,故需转换
32
+ const parseStyleString = styleStr => {
33
+ if (!styleStr) return {};
34
+ const result = {};
35
+ styleStr.split(';').forEach(decl => {
36
+ const idx = decl.indexOf(':');
37
+ if (idx === -1) return;
38
+ const key = decl.slice(0, idx).trim();
39
+ const val = decl.slice(idx + 1).trim();
40
+ if (!key || !val) return;
41
+ // 转驼峰:background-color → backgroundColor
42
+ const camelKey = key.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
43
+ result[camelKey] = val;
44
+ });
45
+ return result;
46
+ };
47
+ // 归一化 style:字符串解析为对象,对象原样返回
48
+ const normalizeStyle = style => {
49
+ if (!style) return {};
50
+ return typeof style === 'string' ? parseStyleString(style) : style;
51
+ };
52
+ function PickerView(props) {
53
+ const {
54
+ value,
55
+ defaultValue,
56
+ indicatorStyle,
57
+ indicatorClass,
58
+ maskStyle,
59
+ maskClass,
60
+ // immediateChange:规范定义为「松手即报(依赖原生惯性预测落点)」。H5/dynamic 无法获取
61
+ // 惯性预测终点,若在 touchend 报当前项会与最终停留项不一致,故统一在归中后上报最终项,
62
+ // 该 prop 保留于接口(超集对齐小程序)但当前不产生行为差异。
63
+ // title(swan)/ariaLabel(qq) 为端专属,第一版保留接口但不透传 DOM
64
+ onChange,
65
+ onPickStart,
66
+ onPickEnd,
67
+ itemHeight,
68
+ visibleItems,
69
+ enableClickItemScroll = true,
70
+ id,
71
+ className,
72
+ style,
73
+ children
74
+ } = props;
75
+ const isControlled = value !== undefined;
76
+ const indicatorRef = React.useRef(null);
77
+ const instanceIdRef = React.useRef(`pv${++_pickerViewInstanceSeq}`);
78
+ // 过滤出有效的 PickerViewColumn 子节点
79
+ const columns = React.Children.toArray(children).filter(child => {
80
+ if (! /*#__PURE__*/React.isValidElement(child)) return false;
81
+ if (child.type !== PickerViewColumn) {
82
+ if (process.env.NODE_ENV !== 'production') {
83
+ console.warn('PickerView 的直接子节点只能是 PickerViewColumn,其它节点将被忽略');
84
+ }
85
+ return false;
86
+ }
87
+ return true;
88
+ });
89
+ // 每列子项数量
90
+ const columnItemCounts = columns.map(col => React.Children.toArray(col.props.children).filter(React.isValidElement).length);
91
+ // 越界 clamp:>=count→末项,<0→0
92
+ const clampValue = (val, count) => {
93
+ if (count === 0) return 0;
94
+ if (val >= count) return count - 1;
95
+ if (val < 0) return 0;
96
+ return Math.floor(val);
97
+ };
98
+ // 归一化 value 数组:补齐列数、各列 clamp
99
+ const normalizeValue = raw => {
100
+ return columnItemCounts.map((count, i) => {
101
+ var _a;
102
+ return clampValue((_a = raw === null || raw === void 0 ? void 0 : raw[i]) !== null && _a !== void 0 ? _a : 0, count);
103
+ });
104
+ };
105
+ // 内部状态(非受控 / 滚动中暂存)
106
+ const [innerValue, setInnerValue] = React.useState(() => normalizeValue(isControlled ? value : defaultValue));
107
+ // 最新 innerValue 的引用,供异步回调读取,避免 stale 闭包
108
+ const innerValueRef = React.useRef(innerValue);
109
+ innerValueRef.current = innerValue;
110
+ // itemHeight 确定:优先 prop → 解析 indicatorStyle 的 px 高 → 量 indicator offsetHeight → 兜底 34
111
+ const [measuredItemHeight, setMeasuredItemHeight] = React.useState(() => {
112
+ var _a;
113
+ if (itemHeight != null) return itemHeight;
114
+ return (_a = parseHeightFromStyle(indicatorStyle)) !== null && _a !== void 0 ? _a : DEFAULT_ITEM_HEIGHT;
115
+ });
116
+ React.useLayoutEffect(() => {
117
+ if (itemHeight != null) {
118
+ setMeasuredItemHeight(itemHeight);
119
+ return;
120
+ }
121
+ // indicatorStyle 是纯 px 高度时直接解析,无需测量 DOM
122
+ const parsed = parseHeightFromStyle(indicatorStyle);
123
+ if (parsed != null) {
124
+ setMeasuredItemHeight(parsed);
125
+ return;
126
+ }
127
+ // 仅当 indicatorStyle 用了 calc/rem 等非 px 单位时才回退到测量
128
+ const el = indicatorRef.current;
129
+ if (el && el.offsetHeight) {
130
+ setMeasuredItemHeight(el.offsetHeight);
131
+ }
132
+ }, [itemHeight, indicatorStyle]);
133
+ const effectiveItemHeight = measuredItemHeight;
134
+ // 容器高度与单项高度相互独立,滚轮始终在容器内垂直居中。
135
+ // - visibleItems 为正整数 → 容器高 = itemHeight × visibleItems(明确「分 N 行」意图)
136
+ // - 否则(未传 / 0 / 负数 / 小数 / NaN 等非法值)→ 容器高由用户 style / className / 继承决定
137
+ // 或走 SCSS 默认高,wrapper height:100% 撑满,无需测量
138
+ // 上下留白交给 CSS:paddingVertical = calc(50% - itemHeight/2),让首尾项能滚到中心
139
+ const useVisibleItems = typeof visibleItems === 'number' && Number.isInteger(visibleItems) && visibleItems > 0;
140
+ const containerHeight = useVisibleItems ? effectiveItemHeight * visibleItems : undefined;
141
+ // harmony 专用:ArkUI 不认 calc、百分比高度链不成立、又不能测量,
142
+ // 故容器高必须解析为确定 px。优先级对齐其它端(style height > visibleItems > 兜底):
143
+ // 内联 style 的 px height → visibleItems×itemHeight → 兜底行数×itemHeight。
144
+ // (className 设的高在 SCSS 里、运行时读不到,故 className 场景只能走兜底——已与用户确认接受)
145
+ const harmonyContainerHeight = React.useMemo(() => {
146
+ var _a;
147
+ if (!IS_HARMONY) return undefined;
148
+ const styleH = (_a = parseHeightFromStyle(typeof style === 'string' ? style : undefined)) !== null && _a !== void 0 ? _a : typeof style === 'object' && style ? parseNumericHeight(style.height) : null;
149
+ if (styleH != null && styleH > 0) return styleH;
150
+ if (useVisibleItems) return effectiveItemHeight * visibleItems;
151
+ return effectiveItemHeight * HARMONY_FALLBACK_ROWS;
152
+ }, [useVisibleItems, visibleItems, effectiveItemHeight, style]);
153
+ // 受控 value 变化 → 同步内部状态(deep 比较)
154
+ // 依赖 valueKey:对 value 做 JSON 深比较,避免引用变化但内容相同的无效同步
155
+ const valueKey = isControlled ? JSON.stringify(value) : null;
156
+ React.useEffect(() => {
157
+ if (isControlled) {
158
+ const normalized = normalizeValue(value);
159
+ innerValueRef.current = normalized;
160
+ setInnerValue(normalized);
161
+ }
162
+ }, [valueKey]);
163
+ // 动态增减 children / 列数 → clamp 越界并补齐,必要时触发 onChange
164
+ const countsKey = JSON.stringify(columnItemCounts);
165
+ const prevCountsKeyRef = React.useRef(countsKey);
166
+ React.useEffect(() => {
167
+ if (prevCountsKeyRef.current !== countsKey) {
168
+ prevCountsKeyRef.current = countsKey;
169
+ const normalized = normalizeValue(innerValueRef.current);
170
+ if (JSON.stringify(normalized) !== JSON.stringify(innerValueRef.current)) {
171
+ innerValueRef.current = normalized;
172
+ setInnerValue(normalized);
173
+ onChange === null || onChange === void 0 ? void 0 : onChange({
174
+ detail: {
175
+ value: normalized
176
+ }
177
+ });
178
+ }
179
+ }
180
+ }, [countsKey]);
181
+ // 某列滚动选中 → 更新对应列索引并上报
182
+ const handleColumnChange = (columnId, index) => {
183
+ const prev = innerValueRef.current;
184
+ const next = columnItemCounts.map((count, i) => {
185
+ var _a;
186
+ return i === columnId ? clampValue(index, count) : clampValue((_a = prev[i]) !== null && _a !== void 0 ? _a : 0, count);
187
+ });
188
+ if (JSON.stringify(next) === JSON.stringify(prev)) return;
189
+ innerValueRef.current = next;
190
+ setInnerValue(next);
191
+ onChange === null || onChange === void 0 ? void 0 : onChange({
192
+ detail: {
193
+ value: next
194
+ }
195
+ });
196
+ };
197
+ // cloneElement 注入内部 props
198
+ const renderedColumns = columns.map((col, columnId) => {
199
+ var _a;
200
+ return /*#__PURE__*/React.cloneElement(col, {
201
+ key: columnId,
202
+ _itemHeight: effectiveItemHeight,
203
+ _selectedIndex: clampValue((_a = innerValue[columnId]) !== null && _a !== void 0 ? _a : 0, columnItemCounts[columnId]),
204
+ _columnId: columnId,
205
+ // harmony:把解析出的确定容器高下发,列内据此用固定 px 算留白(其它端为 undefined,走 calc)
206
+ _containerHeight: harmonyContainerHeight,
207
+ _enableClickItemScroll: enableClickItemScroll,
208
+ _instanceId: instanceIdRef.current,
209
+ _onColumnChange: handleColumnChange,
210
+ _onPickStart: onPickStart,
211
+ _onPickEnd: onPickEnd
212
+ });
213
+ });
214
+ // indicator 的 style:用户传 indicatorStyle 则解析为对象;未指定 height 时用 itemHeight 兜底
215
+ const parsedIndicatorStyle = normalizeStyle(indicatorStyle);
216
+ const indicatorInlineStyle = Object.assign({
217
+ height: effectiveItemHeight
218
+ }, parsedIndicatorStyle);
219
+ const normalizedRootStyle = normalizeStyle(style);
220
+ // visibleItems 模式撑出容器高度;但用户 style 已显式设 height 时以用户为准,不注入。
221
+ // 注入时同时解除 SCSS 的 min-height 兜底——visibleItems 是用户明确的项数意图,
222
+ // 不应被最小高度抬高(如 visibleItems=2 不该被 min-height 撑成 3 项)。
223
+ const rootStyle = useVisibleItems && normalizedRootStyle.height == null ? Object.assign({
224
+ height: containerHeight,
225
+ minHeight: 0
226
+ }, normalizedRootStyle) : normalizedRootStyle;
227
+ // harmony:百分比高度链不成立,需在根/wrapper/columns 逐级写死确定 px。
228
+ // 用解析出的 harmonyContainerHeight 覆盖,并清掉 min-height(px 已确定,无需兜底抬高)。
229
+ const rootStyleFinal = IS_HARMONY ? Object.assign(Object.assign({}, rootStyle), {
230
+ height: harmonyContainerHeight,
231
+ minHeight: 0
232
+ }) : rootStyle;
233
+ const chainHeightStyle = IS_HARMONY ? {
234
+ height: harmonyContainerHeight
235
+ } : {
236
+ height: '100%'
237
+ };
238
+ return /*#__PURE__*/jsx(View, {
239
+ id: id,
240
+ className: `taro-picker-view${className ? ` ${className}` : ''}`,
241
+ style: rootStyleFinal,
242
+ children: /*#__PURE__*/jsxs(View, {
243
+ className: "taro-picker-view__wrapper",
244
+ style: chainHeightStyle,
245
+ children: [/*#__PURE__*/jsx(View, {
246
+ className: `taro-picker-view__mask${maskClass ? ` ${maskClass}` : ''}`,
247
+ ariaHidden: true,
248
+ style: IS_HARMONY ? Object.assign(Object.assign({}, chainHeightStyle), normalizeStyle(maskStyle)) : normalizeStyle(maskStyle)
249
+ }), /*#__PURE__*/jsx(View, {
250
+ ref: indicatorRef,
251
+ className: `taro-picker-view__indicator${indicatorClass ? ` ${indicatorClass}` : ''}`,
252
+ ariaHidden: true,
253
+ style: indicatorInlineStyle
254
+ }), /*#__PURE__*/jsx(View, {
255
+ className: "taro-picker-view__columns",
256
+ style: IS_HARMONY ? chainHeightStyle : undefined,
257
+ children: renderedColumns
258
+ })]
259
+ })
260
+ });
261
+ }
262
+ PickerView.displayName = 'PickerView';
263
+
264
+ export { PickerView, PickerView as default };
265
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/picker-view/index.tsx"],"sourcesContent":["import './style/index.scss'\n\nimport { View } from '@tarojs/components'\nimport * as React from 'react'\n\nimport { PickerViewColumn, PickerViewColumnProps } from '../picker-view-column'\n\n// 默认单项高度(兜底值)\nconst DEFAULT_ITEM_HEIGHT = 34\n// harmony 无 style height / visibleItems 可倒推时的兜底可见行数(= SCSS 默认高 5 行)\nconst HARMONY_FALLBACK_ROWS = 5\n// harmony 端:ArkUI 不解析 calc、且多级 height:100% 百分比链不成立,\n// 又不能测量 DOM(见组件说明),故容器高只能由可静态读出的确定值决定。\nconst IS_HARMONY = process.env.TARO_PLATFORM === 'harmony'\n\n// 同页多 PickerView 时为选项 id 提供实例前缀,避免 scrollIntoView 串到其它实例\nlet _pickerViewInstanceSeq = 0\n\nexport interface PickerViewProps {\n value?: number[]\n defaultValue?: number[]\n indicatorStyle?: string\n indicatorClass?: string\n maskStyle?: string\n maskClass?: string\n immediateChange?: boolean\n title?: string\n ariaLabel?: string\n onChange?: (e: { detail: { value: number[] } }) => void\n onPickStart?: (e?: unknown) => void\n onPickEnd?: (e?: unknown) => void\n // 扩展能力(超集)\n itemHeight?: number\n visibleItems?: number\n /** 点击选项是否滚至选中区,默认 true(与 Picker 对齐) */\n enableClickItemScroll?: boolean\n // StandardProps\n id?: string\n className?: string\n style?: string | React.CSSProperties\n children?: React.ReactNode\n}\n\n// 解析 indicatorStyle 字符串中的 height(纯 px 时优先用它,避免测量 DOM)\nconst parseHeightFromStyle = (styleStr?: string): number | null => {\n if (!styleStr) return null\n const match = styleStr.match(/height\\s*:\\s*(\\d+(?:\\.\\d+)?)px/i)\n return match ? parseFloat(match[1]) : null\n}\n\n// 从对象 style 的 height 取纯数值:number 直接用,字符串取纯 px(\"300px\"→300)\nconst parseNumericHeight = (h?: string | number): number | null => {\n if (typeof h === 'number' && Number.isFinite(h)) return h\n if (typeof h === 'string') {\n const m = h.match(/^(\\d+(?:\\.\\d+)?)px$/i)\n return m ? parseFloat(m[1]) : null\n }\n return null\n}\n\n// 将 CSS 字符串(如 \"height: 50px; color: red\")解析为 React 样式对象\n// H5 下 React DOM 的 style 只接受对象,不接受字符串,故需转换\nconst parseStyleString = (styleStr?: string): React.CSSProperties => {\n if (!styleStr) return {}\n const result: Record<string, string> = {}\n styleStr.split(';').forEach((decl) => {\n const idx = decl.indexOf(':')\n if (idx === -1) return\n const key = decl.slice(0, idx).trim()\n const val = decl.slice(idx + 1).trim()\n if (!key || !val) return\n // 转驼峰:background-color → backgroundColor\n const camelKey = key.replace(/-([a-z])/g, (_, c) => c.toUpperCase())\n result[camelKey] = val\n })\n return result as React.CSSProperties\n}\n\n// 归一化 style:字符串解析为对象,对象原样返回\nconst normalizeStyle = (style?: string | React.CSSProperties): React.CSSProperties => {\n if (!style) return {}\n return typeof style === 'string' ? parseStyleString(style) : style\n}\n\nexport function PickerView(props: PickerViewProps) {\n const {\n value,\n defaultValue,\n indicatorStyle,\n indicatorClass,\n maskStyle,\n maskClass,\n // immediateChange:规范定义为「松手即报(依赖原生惯性预测落点)」。H5/dynamic 无法获取\n // 惯性预测终点,若在 touchend 报当前项会与最终停留项不一致,故统一在归中后上报最终项,\n // 该 prop 保留于接口(超集对齐小程序)但当前不产生行为差异。\n // title(swan)/ariaLabel(qq) 为端专属,第一版保留接口但不透传 DOM\n onChange,\n onPickStart,\n onPickEnd,\n itemHeight,\n visibleItems,\n enableClickItemScroll = true,\n id,\n className,\n style,\n children,\n } = props\n\n const isControlled = value !== undefined\n const indicatorRef = React.useRef<React.ElementRef<typeof View>>(null)\n const instanceIdRef = React.useRef(`pv${++_pickerViewInstanceSeq}`)\n\n // 过滤出有效的 PickerViewColumn 子节点\n const columns = React.Children.toArray(children).filter((child) => {\n if (!React.isValidElement(child)) return false\n if (child.type !== PickerViewColumn) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('PickerView 的直接子节点只能是 PickerViewColumn,其它节点将被忽略')\n }\n return false\n }\n return true\n }) as React.ReactElement<PickerViewColumnProps>[]\n\n // 每列子项数量\n const columnItemCounts = columns.map((col) =>\n React.Children.toArray(col.props.children).filter(React.isValidElement).length\n )\n\n // 越界 clamp:>=count→末项,<0→0\n const clampValue = (val: number, count: number): number => {\n if (count === 0) return 0\n if (val >= count) return count - 1\n if (val < 0) return 0\n return Math.floor(val)\n }\n\n // 归一化 value 数组:补齐列数、各列 clamp\n const normalizeValue = (raw: number[] | undefined): number[] => {\n return columnItemCounts.map((count, i) => clampValue(raw?.[i] ?? 0, count))\n }\n\n // 内部状态(非受控 / 滚动中暂存)\n const [innerValue, setInnerValue] = React.useState<number[]>(() =>\n normalizeValue(isControlled ? value : defaultValue)\n )\n // 最新 innerValue 的引用,供异步回调读取,避免 stale 闭包\n const innerValueRef = React.useRef(innerValue)\n innerValueRef.current = innerValue\n\n // itemHeight 确定:优先 prop → 解析 indicatorStyle 的 px 高 → 量 indicator offsetHeight → 兜底 34\n const [measuredItemHeight, setMeasuredItemHeight] = React.useState<number>(() => {\n if (itemHeight != null) return itemHeight\n return parseHeightFromStyle(indicatorStyle) ?? DEFAULT_ITEM_HEIGHT\n })\n\n React.useLayoutEffect(() => {\n if (itemHeight != null) {\n setMeasuredItemHeight(itemHeight)\n return\n }\n // indicatorStyle 是纯 px 高度时直接解析,无需测量 DOM\n const parsed = parseHeightFromStyle(indicatorStyle)\n if (parsed != null) {\n setMeasuredItemHeight(parsed)\n return\n }\n // 仅当 indicatorStyle 用了 calc/rem 等非 px 单位时才回退到测量\n const el = indicatorRef.current as unknown as HTMLElement | null\n if (el && el.offsetHeight) {\n setMeasuredItemHeight(el.offsetHeight)\n }\n }, [itemHeight, indicatorStyle])\n\n const effectiveItemHeight = measuredItemHeight\n\n // 容器高度与单项高度相互独立,滚轮始终在容器内垂直居中。\n // - visibleItems 为正整数 → 容器高 = itemHeight × visibleItems(明确「分 N 行」意图)\n // - 否则(未传 / 0 / 负数 / 小数 / NaN 等非法值)→ 容器高由用户 style / className / 继承决定\n // 或走 SCSS 默认高,wrapper height:100% 撑满,无需测量\n // 上下留白交给 CSS:paddingVertical = calc(50% - itemHeight/2),让首尾项能滚到中心\n const useVisibleItems = typeof visibleItems === 'number' && Number.isInteger(visibleItems) && visibleItems > 0\n const containerHeight = useVisibleItems\n ? effectiveItemHeight * visibleItems\n : undefined\n\n // harmony 专用:ArkUI 不认 calc、百分比高度链不成立、又不能测量,\n // 故容器高必须解析为确定 px。优先级对齐其它端(style height > visibleItems > 兜底):\n // 内联 style 的 px height → visibleItems×itemHeight → 兜底行数×itemHeight。\n // (className 设的高在 SCSS 里、运行时读不到,故 className 场景只能走兜底——已与用户确认接受)\n const harmonyContainerHeight = React.useMemo(() => {\n if (!IS_HARMONY) return undefined\n const styleH = parseHeightFromStyle(typeof style === 'string' ? style : undefined) ??\n (typeof style === 'object' && style ? parseNumericHeight(style.height) : null)\n if (styleH != null && styleH > 0) return styleH\n if (useVisibleItems) return effectiveItemHeight * (visibleItems as number)\n return effectiveItemHeight * HARMONY_FALLBACK_ROWS\n }, [useVisibleItems, visibleItems, effectiveItemHeight, style])\n\n // 受控 value 变化 → 同步内部状态(deep 比较)\n // 依赖 valueKey:对 value 做 JSON 深比较,避免引用变化但内容相同的无效同步\n const valueKey = isControlled ? JSON.stringify(value) : null\n React.useEffect(() => {\n if (isControlled) {\n const normalized = normalizeValue(value)\n innerValueRef.current = normalized\n setInnerValue(normalized)\n }\n }, [valueKey])\n\n // 动态增减 children / 列数 → clamp 越界并补齐,必要时触发 onChange\n const countsKey = JSON.stringify(columnItemCounts)\n const prevCountsKeyRef = React.useRef(countsKey)\n React.useEffect(() => {\n if (prevCountsKeyRef.current !== countsKey) {\n prevCountsKeyRef.current = countsKey\n const normalized = normalizeValue(innerValueRef.current)\n if (JSON.stringify(normalized) !== JSON.stringify(innerValueRef.current)) {\n innerValueRef.current = normalized\n setInnerValue(normalized)\n onChange?.({ detail: { value: normalized } })\n }\n }\n }, [countsKey])\n\n // 某列滚动选中 → 更新对应列索引并上报\n const handleColumnChange = (columnId: number, index: number) => {\n const prev = innerValueRef.current\n const next = columnItemCounts.map((count, i) =>\n i === columnId ? clampValue(index, count) : clampValue(prev[i] ?? 0, count)\n )\n if (JSON.stringify(next) === JSON.stringify(prev)) return\n innerValueRef.current = next\n setInnerValue(next)\n onChange?.({ detail: { value: next } })\n }\n\n // cloneElement 注入内部 props\n const renderedColumns = columns.map((col, columnId) =>\n React.cloneElement(col, {\n key: columnId,\n _itemHeight: effectiveItemHeight,\n _selectedIndex: clampValue(innerValue[columnId] ?? 0, columnItemCounts[columnId]),\n _columnId: columnId,\n // harmony:把解析出的确定容器高下发,列内据此用固定 px 算留白(其它端为 undefined,走 calc)\n _containerHeight: harmonyContainerHeight,\n _enableClickItemScroll: enableClickItemScroll,\n _instanceId: instanceIdRef.current,\n _onColumnChange: handleColumnChange,\n _onPickStart: onPickStart,\n _onPickEnd: onPickEnd,\n })\n )\n\n // indicator 的 style:用户传 indicatorStyle 则解析为对象;未指定 height 时用 itemHeight 兜底\n const parsedIndicatorStyle = normalizeStyle(indicatorStyle)\n const indicatorInlineStyle: React.CSSProperties = {\n height: effectiveItemHeight,\n ...parsedIndicatorStyle,\n }\n\n const normalizedRootStyle = normalizeStyle(style)\n // visibleItems 模式撑出容器高度;但用户 style 已显式设 height 时以用户为准,不注入。\n // 注入时同时解除 SCSS 的 min-height 兜底——visibleItems 是用户明确的项数意图,\n // 不应被最小高度抬高(如 visibleItems=2 不该被 min-height 撑成 3 项)。\n const rootStyle: React.CSSProperties = (useVisibleItems && normalizedRootStyle.height == null)\n ? { height: containerHeight, minHeight: 0, ...normalizedRootStyle }\n : normalizedRootStyle\n\n // harmony:百分比高度链不成立,需在根/wrapper/columns 逐级写死确定 px。\n // 用解析出的 harmonyContainerHeight 覆盖,并清掉 min-height(px 已确定,无需兜底抬高)。\n const rootStyleFinal: React.CSSProperties = IS_HARMONY\n ? { ...rootStyle, height: harmonyContainerHeight, minHeight: 0 }\n : rootStyle\n const chainHeightStyle: React.CSSProperties = IS_HARMONY\n ? { height: harmonyContainerHeight }\n : { height: '100%' }\n\n return (\n <View\n id={id}\n className={`taro-picker-view${className ? ` ${className}` : ''}`}\n style={rootStyleFinal}\n >\n <View\n className=\"taro-picker-view__wrapper\"\n style={chainHeightStyle}\n >\n <View\n className={`taro-picker-view__mask${maskClass ? ` ${maskClass}` : ''}`}\n ariaHidden\n style={IS_HARMONY ? { ...chainHeightStyle, ...normalizeStyle(maskStyle) } : normalizeStyle(maskStyle)}\n />\n <View\n ref={indicatorRef}\n className={`taro-picker-view__indicator${indicatorClass ? ` ${indicatorClass}` : ''}`}\n ariaHidden\n style={indicatorInlineStyle}\n />\n <View\n className=\"taro-picker-view__columns\"\n style={IS_HARMONY ? chainHeightStyle : undefined}\n >\n {renderedColumns}\n </View>\n </View>\n </View>\n )\n}\n\nPickerView.displayName = 'PickerView'\n\nexport default PickerView\n"],"names":["DEFAULT_ITEM_HEIGHT","HARMONY_FALLBACK_ROWS","IS_HARMONY","process","env","TARO_PLATFORM","_pickerViewInstanceSeq","parseHeightFromStyle","styleStr","match","parseFloat","parseNumericHeight","h","Number","isFinite","m","parseStyleString","result","split","forEach","decl","idx","indexOf","key","slice","trim","val","camelKey","replace","_","c","toUpperCase","normalizeStyle","style","PickerView","props","value","defaultValue","indicatorStyle","indicatorClass","maskStyle","maskClass","onChange","onPickStart","onPickEnd","itemHeight","visibleItems","enableClickItemScroll","id","className","children","isControlled","undefined","indicatorRef","React","useRef","instanceIdRef","columns","Children","toArray","filter","child","isValidElement","type","PickerViewColumn","NODE_ENV","console","warn","columnItemCounts","map","col","length","clampValue","count","Math","floor","normalizeValue","raw","i","_a","innerValue","setInnerValue","useState","innerValueRef","current","measuredItemHeight","setMeasuredItemHeight","useLayoutEffect","parsed","el","offsetHeight","effectiveItemHeight","useVisibleItems","isInteger","containerHeight","harmonyContainerHeight","useMemo","styleH","height","valueKey","JSON","stringify","useEffect","normalized","countsKey","prevCountsKeyRef","detail","handleColumnChange","columnId","index","prev","next","renderedColumns","cloneElement","_itemHeight","_selectedIndex","_columnId","_containerHeight","_enableClickItemScroll","_instanceId","_onColumnChange","_onPickStart","_onPickEnd","parsedIndicatorStyle","indicatorInlineStyle","normalizedRootStyle","rootStyle","Object","assign","minHeight","rootStyleFinal","chainHeightStyle","_jsx","View","_jsxs","ariaHidden","ref","displayName"],"mappings":";;;;;;AAQA,MAAMA,mBAAmB,GAAG,EAAE;AAC9B;AACA,MAAMC,qBAAqB,GAAG,CAAC;AAC/B;AACA;AACA,MAAMC,UAAU,GAAGC,OAAO,CAACC,GAAG,CAACC,aAAa,KAAK,SAAS;AAE1D;AACA,IAAIC,sBAAsB,GAAG,CAAC;AA2B9B;AACA,MAAMC,oBAAoB,GAAIC,QAAiB,IAAmB;AAChE,EAAA,IAAI,CAACA,QAAQ,EAAE,OAAO,IAAI;AAC1B,EAAA,MAAMC,KAAK,GAAGD,QAAQ,CAACC,KAAK,CAAC,iCAAiC,CAAC;EAC/D,OAAOA,KAAK,GAAGC,UAAU,CAACD,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI;AAC5C,CAAC;AAED;AACA,MAAME,kBAAkB,GAAIC,CAAmB,IAAmB;AAChE,EAAA,IAAI,OAAOA,CAAC,KAAK,QAAQ,IAAIC,MAAM,CAACC,QAAQ,CAACF,CAAC,CAAC,EAAE,OAAOA,CAAC;AACzD,EAAA,IAAI,OAAOA,CAAC,KAAK,QAAQ,EAAE;AACzB,IAAA,MAAMG,CAAC,GAAGH,CAAC,CAACH,KAAK,CAAC,sBAAsB,CAAC;IACzC,OAAOM,CAAC,GAAGL,UAAU,CAACK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI;AACpC;AACA,EAAA,OAAO,IAAI;AACb,CAAC;AAED;AACA;AACA,MAAMC,gBAAgB,GAAIR,QAAiB,IAAyB;AAClE,EAAA,IAAI,CAACA,QAAQ,EAAE,OAAO,EAAE;EACxB,MAAMS,MAAM,GAA2B,EAAE;EACzCT,QAAQ,CAACU,KAAK,CAAC,GAAG,CAAC,CAACC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AAA,eAEtBoF,IAAA,CAACD,IAAI,EAAA;AACHpF,MAAAA,SAAS,EAAC,2BAA2B;AACrChB,MAAAA,KAAK,EAAEkG,gBAAiB;MAAAjF,QAAA,EAAA,cAExBkF,GAAA,CAACC,IAAI,EAAA;QACHpF,SAAS,EAAE,yBAAyBR,SAAS,GAAG,IAAIA,SAAS,CAAA,CAAE,GAAG,EAAE,CAAG,CAAA;QACvE8F,UAAU,EAAA,IAAA;QACVtG,KAAK,EAAE/B,UAAU,GAAQ6H,MAAA,CAAAC,MAAA,CAAAD,MAAA,CAAAC,MAAA,CAAA,EAAA,EAAAG,gBAAgB,GAAKnG,cAAc,CAACQ,SAAS,CAAC,CAAA,GAAKR,cAAc,CAACQ,SAAS;AAAE,OAExG,CAAA,eAAA4F,GAAA,CAACC,IAAI,EAAA;AACHG,QAAAA,GAAG,EAAEnF,YAAa;QAClBJ,SAAS,EAAE,8BAA8BV,cAAc,GAAG,IAAIA,cAAc,CAAA,CAAE,GAAG,EAAE,CAAG,CAAA;QACtFgG,UAAU,EAAA,IAAA;AACVtG,QAAAA,KAAK,EAAE2F;AAAqB,OAE9B,CAAA,eAAAQ,GAAA,CAACC,IAAI,EAAA;AACHpF,QAAAA,SAAS,EAAC,2BAA2B;AACrChB,QAAAA,KAAK,EAAE/B,UAAU,GAAGiI,gBAAgB,GAAG/E,SAAU;AAAAF,QAAAA,QAAA,EAEhD8D;AAAe,OACZ,CACR;KAAM;AACR,GAAM,CAAC;AAEX;AAEA9E,UAAU,CAACuG,WAAW,GAAG,YAAY;;;;"}
@@ -0,0 +1,132 @@
1
+ /* Imported from ../../picker/style/variable.scss */
2
+ // Light 模式颜色变量
3
+ $weuiLineColorLight: #e5e5e5;
4
+ $weuiColorPrimary: #FF0F23;
5
+ $weuiTextColorGray: #999;
6
+ $weuiTextColorDesc: #888;
7
+ $weuiTextColorBlack: #000;
8
+ $weuiBackgroundColorLight: #fff;
9
+ $weuiMaskColorLight: rgba(0, 0, 0, 0.6);
10
+
11
+ // Dark 模式颜色变量
12
+ $weuiLineColorDark: rgba(255, 255, 255, 0.06);
13
+ $weuiColorPrimaryDark: #ff0f23;
14
+ $weuiTextColorGrayDark: #999999;
15
+ $weuiTextColorDescDark: #818181;
16
+ $weuiTextColorBlackDark: #e6e6e6;
17
+ $weuiBackgroundColorDark: #1f1f1f;
18
+ $weuiMaskColorDark: rgba(20, 20, 20, 0.7);
19
+
20
+ // Picker 相关变量
21
+ $weuiPickerZIndexContainer: 1000; // picker容器层级
22
+ $weuiPickerZIndexMask: 1001; // 遮罩层级
23
+ $weuiPickerZIndexIndicator: 1002; // 选中指示器层级
24
+
25
+ // Picker 尺寸
26
+ $weuiPickerHeaderHeight: 44px; // 头部高度
27
+ $weuiPickerItemHeight: 34px; // 选项高度
28
+ $weuiPickerContentHeight: 238px; // 内容区高度
29
+ $weuiPickerColumnGap: 8px; // 列间距
30
+
31
+ // 动画
32
+ $weuiPickerTransitionDuration: 0.3s; // 过渡动画时长
33
+
34
+
35
+ .taro-picker-view {
36
+ display: block;
37
+ width: 100%;
38
+
39
+ // 默认高 = 单项高 34 × 5 行,用户 style / className 的 height 会覆盖。
40
+ // 必须用 height 而非 min-height:子级 height:100% 只认父级 height,
41
+ // min-height 撑不起百分比链,会让 calc(50%) 留白失效、居中错位。
42
+ height: $weuiPickerItemHeight * 5;
43
+
44
+ // 最小总高兜底 = 单项高 × 3:保证选中项上下各露 1 项、可正常滚动,
45
+ // 防止 height 过小(如 20px)无法操作。与上面的 height 并存不影响百分比链。
46
+ min-height: $weuiPickerItemHeight * 3;
47
+
48
+ // 滚轮容器:相对定位,承载 indicator / mask / 列
49
+ &__wrapper {
50
+ position: relative;
51
+ width: 100%;
52
+ height: 100%;
53
+ overflow: hidden;
54
+ }
55
+
56
+ // 列容器:横向排列各列,等分宽度
57
+ &__columns {
58
+ display: flex;
59
+ flex-direction: row;
60
+ width: 100%;
61
+ height: 100%;
62
+ }
63
+
64
+ // 单列滚动区
65
+ &__column {
66
+ flex: 1;
67
+ height: 100%;
68
+ box-sizing: border-box;
69
+ }
70
+
71
+ // 列内单项(定高容器)
72
+ &__item {
73
+ display: flex;
74
+ align-items: center;
75
+ justify-content: center;
76
+ box-sizing: border-box;
77
+ text-align: center;
78
+ }
79
+
80
+ // 留白占位
81
+ &__column-blank {
82
+ width: 100%;
83
+ }
84
+
85
+ // 遮罩层 - 上下渐变
86
+ &__mask {
87
+ position: absolute;
88
+ left: 0;
89
+ top: 0;
90
+ z-index: $weuiPickerZIndexMask;
91
+ width: 100%;
92
+ height: 100%;
93
+ pointer-events: none;
94
+ }
95
+
96
+ // 选中行指示器
97
+ &__indicator {
98
+ position: absolute;
99
+ left: 0;
100
+ top: 50%;
101
+ z-index: $weuiPickerZIndexIndicator;
102
+ width: 100%;
103
+ box-sizing: border-box;
104
+ transform: translateY(-50%);
105
+ pointer-events: none;
106
+ }
107
+ }
108
+
109
+ // Light 主题(默认)
110
+ .taro-picker-view {
111
+ .taro-picker-view__indicator {
112
+ border-top: 1px solid $weuiLineColorLight;
113
+ border-bottom: 1px solid $weuiLineColorLight;
114
+ }
115
+
116
+ .taro-picker-view__mask {
117
+ background:
118
+ linear-gradient(
119
+ 180deg,
120
+ rgba(255, 255, 255, 0.95) 0%,
121
+ rgba(255, 255, 255, 0.6) 40%,
122
+ rgba(255, 255, 255, 0) 45%,
123
+ rgba(255, 255, 255, 0) 55%,
124
+ rgba(255, 255, 255, 0.6) 60%,
125
+ rgba(255, 255, 255, 0.95) 100%
126
+ );
127
+ }
128
+
129
+ .taro-picker-view__item {
130
+ color: $weuiTextColorBlack;
131
+ }
132
+ }