@tarojs/components-react 4.2.1-beta.1 → 4.2.1-beta.3

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 (77) hide show
  1. package/dist/components/image/index.js +3 -5
  2. package/dist/components/image/index.js.map +1 -1
  3. package/dist/components/picker/index.js +35 -76
  4. package/dist/components/picker/index.js.map +1 -1
  5. package/dist/components/picker/picker-group.js +127 -477
  6. package/dist/components/picker/picker-group.js.map +1 -1
  7. package/dist/components/refresher/index.js +5 -5
  8. package/dist/components/refresher/index.js.map +1 -1
  9. package/dist/components/scroll-view/index.js +36 -80
  10. package/dist/components/scroll-view/index.js.map +1 -1
  11. package/dist/index.css +1 -1
  12. package/dist/index.js +2 -6
  13. package/dist/index.js.map +1 -1
  14. package/dist/original/components/image/index.js +3 -5
  15. package/dist/original/components/image/index.js.map +1 -1
  16. package/dist/original/components/image/style/index.scss +1 -5
  17. package/dist/original/components/picker/index.js +35 -76
  18. package/dist/original/components/picker/index.js.map +1 -1
  19. package/dist/original/components/picker/picker-group.js +127 -477
  20. package/dist/original/components/picker/picker-group.js.map +1 -1
  21. package/dist/original/components/picker/style/index.scss +8 -9
  22. package/dist/original/components/refresher/index.js +5 -5
  23. package/dist/original/components/refresher/index.js.map +1 -1
  24. package/dist/original/components/scroll-view/index.js +36 -80
  25. package/dist/original/components/scroll-view/index.js.map +1 -1
  26. package/dist/original/index.js +2 -6
  27. package/dist/original/index.js.map +1 -1
  28. package/dist/solid/components/image/index.js +3 -5
  29. package/dist/solid/components/image/index.js.map +1 -1
  30. package/dist/solid/components/picker/index.js +39 -82
  31. package/dist/solid/components/picker/index.js.map +1 -1
  32. package/dist/solid/components/picker/picker-group.js +151 -500
  33. package/dist/solid/components/picker/picker-group.js.map +1 -1
  34. package/dist/solid/components/refresher/index.js +5 -5
  35. package/dist/solid/components/refresher/index.js.map +1 -1
  36. package/dist/solid/components/scroll-view/index.js +40 -84
  37. package/dist/solid/components/scroll-view/index.js.map +1 -1
  38. package/dist/solid/index.css +1 -1
  39. package/dist/solid/index.js +1 -1
  40. package/package.json +6 -8
  41. package/dist/components/map/MapContext.js +0 -628
  42. package/dist/components/map/MapContext.js.map +0 -1
  43. package/dist/components/map/MapCustomCallout.js +0 -91
  44. package/dist/components/map/MapCustomCallout.js.map +0 -1
  45. package/dist/components/map/common.js +0 -4
  46. package/dist/components/map/common.js.map +0 -1
  47. package/dist/components/map/createMapContext.js +0 -34
  48. package/dist/components/map/createMapContext.js.map +0 -1
  49. package/dist/components/map/handler.js +0 -50
  50. package/dist/components/map/handler.js.map +0 -1
  51. package/dist/components/map/index.js +0 -329
  52. package/dist/components/map/index.js.map +0 -1
  53. package/dist/components/switch/index.js +0 -125
  54. package/dist/components/switch/index.js.map +0 -1
  55. package/dist/components/switch/style/index.scss.js +0 -4
  56. package/dist/components/switch/style/index.scss.js.map +0 -1
  57. package/dist/contexts/ScrollElementContext.js +0 -6
  58. package/dist/contexts/ScrollElementContext.js.map +0 -1
  59. package/dist/original/components/map/MapContext.js +0 -628
  60. package/dist/original/components/map/MapContext.js.map +0 -1
  61. package/dist/original/components/map/MapCustomCallout.js +0 -91
  62. package/dist/original/components/map/MapCustomCallout.js.map +0 -1
  63. package/dist/original/components/map/common.js +0 -4
  64. package/dist/original/components/map/common.js.map +0 -1
  65. package/dist/original/components/map/createMapContext.js +0 -34
  66. package/dist/original/components/map/createMapContext.js.map +0 -1
  67. package/dist/original/components/map/handler.js +0 -50
  68. package/dist/original/components/map/handler.js.map +0 -1
  69. package/dist/original/components/map/index.js +0 -329
  70. package/dist/original/components/map/index.js.map +0 -1
  71. package/dist/original/components/switch/index.js +0 -125
  72. package/dist/original/components/switch/index.js.map +0 -1
  73. package/dist/original/components/switch/style/index.scss +0 -35
  74. package/dist/original/contexts/ScrollElementContext.js +0 -6
  75. package/dist/original/contexts/ScrollElementContext.js.map +0 -1
  76. package/dist/solid/contexts/ScrollElementContext.js +0 -6
  77. package/dist/solid/contexts/ScrollElementContext.js.map +0 -1
@@ -11,18 +11,16 @@ function Image(props) {
11
11
  const [, setIsLoaded] = useState(false);
12
12
  const {
13
13
  className,
14
- style,
14
+ style = {},
15
15
  src,
16
16
  mode,
17
17
  onError,
18
18
  lazyLoad,
19
19
  imgProps,
20
- forwardedRef,
21
- disableDefaultSize = false
20
+ forwardedRef
22
21
  } = props,
23
- reset = __rest(props, ["className", "style", "src", "mode", "onError", "lazyLoad", "imgProps", "forwardedRef", "disableDefaultSize"]);
22
+ reset = __rest(props, ["className", "style", "src", "mode", "onError", "lazyLoad", "imgProps", "forwardedRef"]);
24
23
  const cls = classNames('taro-img', {
25
- 'taro-img--with-default-host-size': !disableDefaultSize,
26
24
  'taro-img__widthfix': mode === 'widthFix'
27
25
  }, className);
28
26
  const imgCls = classNames('taro-img__mode-' + (mode || 'scaleToFill').toLowerCase().replace(/\s/g, ''));
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/image/index.tsx"],"sourcesContent":["import './style/index.scss'\n\nimport classNames from 'classnames'\n\nimport { createForwardRefComponent } from '../../utils'\nimport { useCallback, useEffect, useRef, useState } from '../../utils/hooks'\n\nimport type React from 'react'\n\ninterface IProps extends React.HTMLAttributes<HTMLDivElement> {\n src: string\n mode: string\n onError: () => void\n onLoad: (e) => void\n lazyLoad?: boolean\n imgProps?: Record<string, any>\n forwardedRef?: React.MutableRefObject<HTMLDivElement>\n /** 为 true 时不挂载默认占位尺寸(320×240),由业务 style/class 决定容器大小 */\n disableDefaultSize?: boolean\n}\n\nfunction Image (props: IProps) {\n const imgRef = useRef<HTMLImageElement | null>(null)\n const observer = useRef<Partial<IntersectionObserver>>({})\n const [, setIsLoaded] = useState(false)\n const {\n className,\n style,\n src,\n mode,\n onError,\n lazyLoad,\n imgProps,\n forwardedRef,\n disableDefaultSize = false,\n ...reset\n } = props\n\n const cls = classNames(\n 'taro-img',\n {\n 'taro-img--with-default-host-size': !disableDefaultSize,\n 'taro-img__widthfix': mode === 'widthFix'\n },\n className\n )\n const imgCls = classNames(\n 'taro-img__mode-' +\n (mode || 'scaleToFill').toLowerCase().replace(/\\s/g, '')\n )\n\n const imageOnLoad = useCallback((e) => {\n const { onLoad } = props\n Object.defineProperty(e, 'detail', {\n enumerable: true,\n writable: true,\n value: {\n width: e.target.width,\n height: e.target.height\n }\n })\n\n onLoad && onLoad(e)\n }, [props])\n\n useEffect(() => {\n if (lazyLoad) {\n observer.current = new IntersectionObserver(\n entries => {\n // 异步 api 关系\n if (entries[entries.length - 1].isIntersecting) {\n setIsLoaded(true)\n // findDOMNode(this).children[0].src = src\n imgRef.current!.src = src\n }\n },\n {\n rootMargin: '300px 0px'\n }\n )\n observer.current.observe?.(imgRef.current!)\n }\n\n return () => {\n observer.current?.disconnect?.()\n }\n }, [lazyLoad, src])\n\n return (\n <div className={cls} style={style} ref={forwardedRef} {...reset}>\n {lazyLoad ? (\n <img\n ref={img => (imgRef.current = img)}\n className={imgCls}\n data-src={src}\n onLoad={imageOnLoad}\n onError={onError}\n {...imgProps}\n />\n ) : (\n <img\n ref={img => (imgRef.current = img)}\n className={imgCls}\n src={src}\n onLoad={imageOnLoad}\n onError={onError}\n {...imgProps}\n />\n )}\n </div>\n )\n}\n\nexport default createForwardRefComponent(Image)\n"],"names":["Image","props","imgRef","useRef","observer","setIsLoaded","useState","className","style","src","mode","onError","lazyLoad","imgProps","forwardedRef","disableDefaultSize","reset","__rest","cls","classNames","imgCls","toLowerCase","replace","imageOnLoad","useCallback","e","onLoad","Object","defineProperty","enumerable","writable","value","width","target","height","useEffect","current","IntersectionObserver","entries","length","isIntersecting","rootMargin","_b","_a","observe","call","disconnect","_jsx","ref","children","img","createForwardRefComponent"],"mappings":";;;;;;;AAqBA,SAASA,KAAKA,CAAEC,KAAa,EAAA;AAC3B,EAAA,MAAMC,MAAM,GAAGC,MAAM,CAA0B,IAAI,CAAC;AACpD,EAAA,MAAMC,QAAQ,GAAGD,MAAM,CAAgC,EAAE,CAAC;AAC1D,EA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OAAO,EAAEA,OAAQ;MAAA,GACbE;KAAS,CACb,gBAEFkC,GAAA,CAAA,KAAA,EAAA;AACEC,MAAAA,GAAG,EAAEE,GAAG,IAAKhD,MAAM,CAACkC,OAAO,GAAGc,GAAK;AACnC3C,MAAAA,SAAS,EAAEa,MAAO;AAClBX,MAAAA,GAAG,EAAEA,GAAI;AACTiB,MAAAA,MAAM,EAAEH,WAAY;AACpBZ,MAAAA,OAAO,EAAEA,OAAQ;MAAA,GACbE;KACJ;AACH,GACE,CAAC;AAEV;AAEA,YAAesC,yBAAyB,CAACnD,KAAK,CAAC;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/image/index.tsx"],"sourcesContent":["import './style/index.scss'\n\nimport classNames from 'classnames'\n\nimport { createForwardRefComponent } from '../../utils'\nimport { useCallback, useEffect, useRef, useState } from '../../utils/hooks'\n\nimport type React from 'react'\n\ninterface IProps extends React.HTMLAttributes<HTMLDivElement> {\n src: string\n mode: string\n onError: () => void\n onLoad: (e) => void\n lazyLoad?: boolean\n imgProps?: Record<string, any>\n forwardedRef?: React.MutableRefObject<HTMLDivElement>\n}\n\nfunction Image (props: IProps) {\n const imgRef = useRef<HTMLImageElement | null>(null)\n const observer = useRef<Partial<IntersectionObserver>>({})\n const [, setIsLoaded] = useState(false)\n const {\n className,\n style = {},\n src,\n mode,\n onError,\n lazyLoad,\n imgProps,\n forwardedRef,\n ...reset\n } = props\n\n const cls = classNames(\n 'taro-img',\n {\n 'taro-img__widthfix': mode === 'widthFix'\n },\n className\n )\n const imgCls = classNames(\n 'taro-img__mode-' +\n (mode || 'scaleToFill').toLowerCase().replace(/\\s/g, '')\n )\n\n const imageOnLoad = useCallback((e) => {\n const { onLoad } = props\n Object.defineProperty(e, 'detail', {\n enumerable: true,\n writable: true,\n value: {\n width: e.target.width,\n height: e.target.height\n }\n })\n\n onLoad && onLoad(e)\n }, [props])\n\n useEffect(() => {\n if (lazyLoad) {\n observer.current = new IntersectionObserver(\n entries => {\n // 异步 api 关系\n if (entries[entries.length - 1].isIntersecting) {\n setIsLoaded(true)\n // findDOMNode(this).children[0].src = src\n imgRef.current!.src = src\n }\n },\n {\n rootMargin: '300px 0px'\n }\n )\n observer.current.observe?.(imgRef.current!)\n }\n\n return () => {\n observer.current?.disconnect?.()\n }\n }, [lazyLoad, src])\n\n return (\n <div className={cls} style={style} ref={forwardedRef} {...reset}>\n {lazyLoad ? (\n <img\n ref={img => (imgRef.current = img)}\n className={imgCls}\n data-src={src}\n onLoad={imageOnLoad}\n onError={onError}\n {...imgProps}\n />\n ) : (\n <img\n ref={img => (imgRef.current = img)}\n className={imgCls}\n src={src}\n onLoad={imageOnLoad}\n onError={onError}\n {...imgProps}\n />\n )}\n </div>\n )\n}\n\nexport default createForwardRefComponent(Image)\n"],"names":["Image","props","imgRef","useRef","observer","setIsLoaded","useState","className","style","src","mode","onError","lazyLoad","imgProps","forwardedRef","reset","__rest","cls","classNames","imgCls","toLowerCase","replace","imageOnLoad","useCallback","e","onLoad","Object","defineProperty","enumerable","writable","value","width","target","height","useEffect","current","IntersectionObserver","entries","length","isIntersecting","rootMargin","_b","_a","observe","call","disconnect","_jsx","ref","children","img","createForwardRefComponent"],"mappings":";;;;;;;AAmBA,SAASA,KAAKA,CAAEC,KAAa,EAAA;AAC3B,EAAA,MAAMC,MAAM,GAAGC,MAAM,CAA0B,IAAI,CAAC;AACpD,EAAA,MAAMC,QAAQ,GAAGD,MAAM,CAAgC,EAAE,CAAC;AAC1D,EAAA,MAAM,GAAGE,WAAW,CAAC,GAAGC,QAAQ,CAAC,KAAK,CAAC;EACvC,MAAM;MACJC,SAAS;MACTC,KAAK,GAAG,EAAE;MACVC,GAAG;MACHC,IAAI;MACJC,OAAO;MACPC,QAAQ;MACRC,QAAQ;AACRC,MAAAA;AAAY,KAAA,GAEVb,KAAK;IADJc,KAAK,GAAAC,MAAA,CACNf,KAAK,EAVH,CAUL,WAAA,EAAA,OAAA,EAAA,KAAA,EAAA,MAAA,EAAA,SAA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 -127,13 +127,12 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
127
127
  children,
128
128
  formType,
129
129
  lang,
130
- theme = 'light',
131
- enableClickItemScroll = true
130
+ theme = 'light'
132
131
  } = props,
133
- restProps = __rest(props, ["mode", "disabled", "range", "rangeKey", "value", "start", "end", "fields", "headerText", "level", "regionData", "textProps", "colors", "onChange", "onColumnChange", "onCancel", "children", "formType", "lang", "theme", "enableClickItemScroll"]);
132
+ restProps = __rest(props, ["mode", "disabled", "range", "rangeKey", "value", "start", "end", "fields", "headerText", "level", "regionData", "textProps", "colors", "onChange", "onColumnChange", "onCancel", "children", "formType", "lang", "theme"]);
134
133
  const indexRef = React__default.useRef([]);
135
134
  const pickerDateRef = React__default.useRef();
136
- // region:首次用户滚动初始化完成前不入库
135
+ // 记录是否是用户滚动
137
136
  const isInitializationCompletedRef = React__default.useRef(false);
138
137
  const [state, setState] = React__default.useState({
139
138
  pickerValue: value || EMPTY_ARRAY,
@@ -142,8 +141,7 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
142
141
  hidden: true,
143
142
  fadeOut: false,
144
143
  isWillLoadCalled: false,
145
- a11yTimeLimitColumnId: null,
146
- a11yTimeLimitNonce: 0
144
+ timestamp: 0 // 用以部分模式下强制刷新组件的的时间戳,多用于反复限位
147
145
  });
148
146
  // 在组件内部
149
147
  const [columnsCount, setColumnsCount] = React__default.useState(() => getRegionColumnsCount(level));
@@ -201,36 +199,25 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
201
199
  const monthRange = getMonthRange(_start, _end, currentYear);
202
200
  const dayRange = getDayRange(_start, _end, currentYear, currentMonth);
203
201
  indexRef.current = [yearRange.indexOf(currentYear), monthRange.indexOf(currentMonth), dayRange.indexOf(currentDay)];
204
- // props 同步时始终刷新 _updateValue,避免取消后再开时日列草稿与索引不一致
205
- pickerDateRef.current = {
206
- _value,
207
- _start,
208
- _end,
209
- _updateValue: [currentYear, currentMonth, currentDay]
210
- };
202
+ if (!pickerDateRef.current || pickerDateRef.current._value.getTime() !== _value.getTime() || pickerDateRef.current._start.getTime() !== _start.getTime() || pickerDateRef.current._end.getTime() !== _end.getTime()) {
203
+ pickerDateRef.current = {
204
+ _value,
205
+ _start,
206
+ _end,
207
+ _updateValue: [currentYear, currentMonth, currentDay]
208
+ };
209
+ }
211
210
  } else if (mode === 'region') {
212
211
  // region 模式处理 - 验证数据
213
212
  if (!regionData) {
214
213
  console.error('Picker: regionData is required for region mode');
215
- indexRef.current = Array.from({
216
- length: columnsCount
217
- }, () => 0);
218
- setState(prev => Object.assign(Object.assign({}, prev), {
219
- selectedIndices: [...indexRef.current],
220
- pickerValue: value || EMPTY_ARRAY
221
- }));
214
+ indexRef.current = [0];
222
215
  return;
223
216
  }
224
217
  const validation = validateRegionData(regionData, 'Picker');
225
218
  if (!validation.valid) {
226
219
  console.error(validation.error);
227
- indexRef.current = Array.from({
228
- length: columnsCount
229
- }, () => 0);
230
- setState(prev => Object.assign(Object.assign({}, prev), {
231
- selectedIndices: [...indexRef.current],
232
- pickerValue: value || EMPTY_ARRAY
233
- }));
220
+ indexRef.current = [0];
234
221
  return;
235
222
  }
236
223
  // 获取列数
@@ -277,16 +264,16 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
277
264
  handleProps();
278
265
  }
279
266
  }, [handleProps, state.isWillLoadCalled, JSON.stringify(value)]);
280
- // 打开时按 props 重算索引,避免未确认的滑动与 indexRef 残留导致再开抖动
267
+ // 显示 Picker
281
268
  const showPicker = React__default.useCallback(() => {
282
269
  if (disabled) return;
283
270
  isInitializationCompletedRef.current = false;
284
- handleProps();
271
+ const newIndices = getIndices();
285
272
  setState(prev => Object.assign(Object.assign({}, prev), {
286
- hidden: false,
287
- a11yTimeLimitColumnId: null
273
+ selectedIndices: newIndices,
274
+ hidden: false
288
275
  }));
289
- }, [disabled, handleProps]);
276
+ }, [disabled, getIndices]);
290
277
  // 隐藏 Picker
291
278
  const hidePicker = React__default.useCallback(() => {
292
279
  isInitializationCompletedRef.current = false;
@@ -361,11 +348,11 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
361
348
  finalIndices = [...newIndices];
362
349
  hasLimited = true;
363
350
  }
351
+ // 触发限位,更新状态,其它状态不用主动触发滚动
364
352
  if (hasLimited) {
365
353
  setState(prev => Object.assign(Object.assign({}, prev), {
366
354
  selectedIndices: finalIndices,
367
- a11yTimeLimitColumnId: columnId,
368
- a11yTimeLimitNonce: prev.a11yTimeLimitNonce + 1
355
+ timestamp: Date.now()
369
356
  }));
370
357
  } else {
371
358
  setState(prev => Object.assign(Object.assign({}, prev), {
@@ -598,17 +585,11 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
598
585
  }
599
586
  });
600
587
  }, [onColumnChange]);
601
- const consumeTimeA11yLimitFocus = React__default.useCallback(() => {
602
- setState(prev => Object.assign(Object.assign({}, prev), {
603
- a11yTimeLimitColumnId: null
604
- }));
605
- }, []);
606
- // 取消时按 props 回同步索引,避免与 value 脱节
588
+ // 处理取消
607
589
  const handleCancel = React__default.useCallback(() => {
608
- handleProps();
609
590
  hidePicker();
610
591
  onCancel === null || onCancel === void 0 ? void 0 : onCancel();
611
- }, [handleProps, hidePicker, onCancel]);
592
+ }, [hidePicker, onCancel]);
612
593
  // 渲染选择器组
613
594
  const renderPickerGroup = React__default.useMemo(() => {
614
595
  switch (mode) {
@@ -622,16 +603,11 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
622
603
  columnId: String(index),
623
604
  selectedIndex: state.selectedIndices[index] // 传递对应列的selectedIndex
624
605
  ,
625
- colors: colors,
626
- enableClickItemScroll: enableClickItemScroll
606
+ colors: colors
627
607
  }, index));
628
608
  }
629
609
  case 'time':
630
610
  {
631
- const timeA11yLimitFocus = state.a11yTimeLimitColumnId != null ? {
632
- nonce: state.a11yTimeLimitNonce,
633
- columnId: state.a11yTimeLimitColumnId
634
- } : null;
635
611
  return [/*#__PURE__*/jsx(PickerGroup, {
636
612
  mode: "time",
637
613
  range: hoursRange,
@@ -639,24 +615,16 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
639
615
  columnId: "0",
640
616
  selectedIndex: state.selectedIndices[0] // 传递小时列的selectedIndex
641
617
  ,
642
- colors: colors,
643
- timeA11yLimitFocus: timeA11yLimitFocus,
644
- onTimeA11yLimitFocusConsumed: consumeTimeA11yLimitFocus,
645
- timeA11yLimitEventNonce: state.a11yTimeLimitNonce,
646
- enableClickItemScroll: enableClickItemScroll
647
- }, "hour"), /*#__PURE__*/jsx(PickerGroup, {
618
+ colors: colors
619
+ }, `hour-${state.timestamp}`), /*#__PURE__*/jsx(PickerGroup, {
648
620
  mode: "time",
649
621
  range: minutesRange,
650
622
  updateIndex: updateIndex,
651
623
  columnId: "1",
652
624
  selectedIndex: state.selectedIndices[1] // 传递分钟列的selectedIndex
653
625
  ,
654
- colors: colors,
655
- timeA11yLimitFocus: timeA11yLimitFocus,
656
- onTimeA11yLimitFocusConsumed: consumeTimeA11yLimitFocus,
657
- timeA11yLimitEventNonce: state.a11yTimeLimitNonce,
658
- enableClickItemScroll: enableClickItemScroll
659
- }, "minute")];
626
+ colors: colors
627
+ }, `minute-${state.timestamp}`)];
660
628
  }
661
629
  case 'date':
662
630
  {
@@ -681,8 +649,7 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
681
649
  columnId: "0",
682
650
  selectedIndex: state.selectedIndices[0] // 传递年份列的selectedIndex
683
651
  ,
684
- colors: colors,
685
- enableClickItemScroll: enableClickItemScroll
652
+ colors: colors
686
653
  }, `year`)];
687
654
  if (fields === 'month' || fields === 'day') {
688
655
  renderView.push(/*#__PURE__*/jsx(PickerGroup, {
@@ -693,8 +660,7 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
693
660
  columnId: "1",
694
661
  selectedIndex: state.selectedIndices[1] // 传递月份列的selectedIndex
695
662
  ,
696
- colors: colors,
697
- enableClickItemScroll: enableClickItemScroll
663
+ colors: colors
698
664
  }, `month`));
699
665
  }
700
666
  if (fields === 'day') {
@@ -706,8 +672,7 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
706
672
  columnId: "2",
707
673
  selectedIndex: state.selectedIndices[2] // 传递日期列的selectedIndex
708
674
  ,
709
- colors: colors,
710
- enableClickItemScroll: enableClickItemScroll
675
+ colors: colors
711
676
  }, `day`));
712
677
  }
713
678
  return renderView;
@@ -742,8 +707,7 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
742
707
  updateIndex: updateIndex,
743
708
  columnId: String(i),
744
709
  selectedIndex: state.selectedIndices[i],
745
- colors: colors,
746
- enableClickItemScroll: enableClickItemScroll
710
+ colors: colors
747
711
  }, `region-${i}`));
748
712
  }
749
713
  return columns;
@@ -756,11 +720,10 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
756
720
  columnId: "0",
757
721
  selectedIndex: state.selectedIndices[0] // 传递selector模式的selectedIndex
758
722
  ,
759
- colors: colors,
760
- enableClickItemScroll: enableClickItemScroll
723
+ colors: colors
761
724
  });
762
725
  }
763
- }, [mode, range, rangeKey, fields, updateIndex, updateDay, handleColumnChange, pickerDateRef.current, level, regionData, state.selectedIndices, state.a11yTimeLimitColumnId, state.a11yTimeLimitNonce, consumeTimeA11yLimitFocus, columnsCount, lang, colors, enableClickItemScroll]);
726
+ }, [mode, range, rangeKey, fields, updateIndex, updateDay, handleColumnChange, pickerDateRef.current, level, regionData, state.selectedIndices, columnsCount, lang, colors]);
764
727
  // 动画类名控制逻辑
765
728
  const clsMask = classNames('taro-picker__mask-overlay', 'taro-picker__animate-fade-in', {
766
729
  'taro-picker__animate-fade-out': state.fadeOut
@@ -774,9 +737,6 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
774
737
  const titleStyle = colors.titleColor ? {
775
738
  color: colors.titleColor
776
739
  } : null;
777
- const maskOverlayStyle = colors.maskColor ? {
778
- backgroundColor: colors.maskColor
779
- } : undefined;
780
740
  // 暴露方法给外部
781
741
  React__default.useImperativeHandle(ref, () => ({
782
742
  showPicker,
@@ -795,10 +755,9 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
795
755
  onClick: showPicker,
796
756
  children: children
797
757
  }), !state.hidden && /*#__PURE__*/jsxs(View, {
798
- className: classNames('taro-picker__overlay', `taro-picker__overlay--theme-${theme}`),
758
+ className: "taro-picker__overlay",
799
759
  children: [/*#__PURE__*/jsx(View, {
800
760
  className: clsMask,
801
- style: maskOverlayStyle,
802
761
  onClick: handleCancel
803
762
  }), /*#__PURE__*/jsxs(View, {
804
763
  className: clsSlider,