@arco-design/mobile-react 2.35.2 → 2.36.1

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 (81) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.en-US.md +2 -2
  3. package/README.md +2 -2
  4. package/cjs/_helpers/hooks.d.ts +10 -2
  5. package/cjs/_helpers/hooks.js +12 -5
  6. package/cjs/date-picker/index.js +218 -18
  7. package/cjs/date-picker/style/css/index.css +42 -0
  8. package/cjs/date-picker/style/index.less +38 -1
  9. package/cjs/date-picker/type.d.ts +22 -6
  10. package/cjs/ellipsis/components/js-ellipsis.js +3 -1
  11. package/cjs/form/linked-container.d.ts +2 -2
  12. package/cjs/form/linked-container.js +5 -1
  13. package/cjs/picker/index.js +3 -2
  14. package/cjs/picker/type.d.ts +5 -0
  15. package/cjs/popover/hooks/usePosition.js +26 -8
  16. package/cjs/search-bar/association.js +2 -2
  17. package/cjs/search-bar/type.d.ts +1 -1
  18. package/cjs/stepper/hooks/useValue.js +3 -1
  19. package/cjs/tabs/index.js +1 -1
  20. package/cjs/tabs/type.d.ts +2 -2
  21. package/dist/index.js +301 -47
  22. package/dist/index.min.js +4 -4
  23. package/dist/style.css +23 -0
  24. package/dist/style.min.css +1 -1
  25. package/esm/_helpers/hooks.d.ts +10 -2
  26. package/esm/_helpers/hooks.js +12 -5
  27. package/esm/date-picker/index.js +218 -18
  28. package/esm/date-picker/style/css/index.css +42 -0
  29. package/esm/date-picker/style/index.less +38 -1
  30. package/esm/date-picker/type.d.ts +22 -6
  31. package/esm/ellipsis/components/js-ellipsis.js +3 -1
  32. package/esm/form/linked-container.d.ts +2 -2
  33. package/esm/form/linked-container.js +5 -1
  34. package/esm/picker/index.js +3 -2
  35. package/esm/picker/type.d.ts +5 -0
  36. package/esm/popover/hooks/usePosition.js +26 -8
  37. package/esm/search-bar/association.js +2 -2
  38. package/esm/search-bar/type.d.ts +1 -1
  39. package/esm/stepper/hooks/useValue.js +1 -0
  40. package/esm/tabs/index.js +1 -1
  41. package/esm/tabs/type.d.ts +2 -2
  42. package/esnext/_helpers/hooks.d.ts +10 -2
  43. package/esnext/_helpers/hooks.js +12 -5
  44. package/esnext/date-picker/index.js +167 -10
  45. package/esnext/date-picker/style/css/index.css +42 -0
  46. package/esnext/date-picker/style/index.less +38 -1
  47. package/esnext/date-picker/type.d.ts +22 -6
  48. package/esnext/ellipsis/components/js-ellipsis.js +2 -0
  49. package/esnext/form/linked-container.d.ts +2 -2
  50. package/esnext/form/linked-container.js +7 -2
  51. package/esnext/picker/index.js +2 -1
  52. package/esnext/picker/type.d.ts +5 -0
  53. package/esnext/popover/hooks/usePosition.js +32 -12
  54. package/esnext/search-bar/association.js +1 -1
  55. package/esnext/search-bar/type.d.ts +1 -1
  56. package/esnext/stepper/hooks/useValue.js +1 -0
  57. package/esnext/tabs/index.js +1 -1
  58. package/esnext/tabs/type.d.ts +2 -2
  59. package/package.json +3 -3
  60. package/tokens/app/arcodesign/default/css-variables.less +10 -0
  61. package/tokens/app/arcodesign/default/index.d.ts +10 -0
  62. package/tokens/app/arcodesign/default/index.js +11 -1
  63. package/tokens/app/arcodesign/default/index.json +108 -0
  64. package/tokens/app/arcodesign/default/index.less +10 -0
  65. package/umd/_helpers/hooks.d.ts +10 -2
  66. package/umd/_helpers/hooks.js +12 -5
  67. package/umd/date-picker/index.js +218 -18
  68. package/umd/date-picker/style/css/index.css +42 -0
  69. package/umd/date-picker/style/index.less +38 -1
  70. package/umd/date-picker/type.d.ts +22 -6
  71. package/umd/ellipsis/components/js-ellipsis.js +3 -1
  72. package/umd/form/linked-container.d.ts +2 -2
  73. package/umd/form/linked-container.js +5 -1
  74. package/umd/picker/index.js +3 -2
  75. package/umd/picker/type.d.ts +5 -0
  76. package/umd/popover/hooks/usePosition.js +26 -8
  77. package/umd/search-bar/association.js +2 -2
  78. package/umd/search-bar/type.d.ts +1 -1
  79. package/umd/stepper/hooks/useValue.js +5 -5
  80. package/umd/tabs/index.js +1 -1
  81. package/umd/tabs/type.d.ts +2 -2
package/dist/index.js CHANGED
@@ -1580,12 +1580,17 @@
1580
1580
  /**
1581
1581
  * 获取当前设备的操作系统
1582
1582
  * @desc {en} Get the operating system of the current device
1583
- * @returns {string} 返回当前设备的操作系统,可能的值包括 'android'、'ios' 或 'pc',如果无法获取,则返回空字符串
1584
- * @returns {string} {en} Returns the operating system of the current device, possible values are 'android', 'ios', or 'pc'. Returns an empty string if it cannot be obtained
1583
+ * @param options 配置选项
1584
+ * @param {en} options Configuration options
1585
+ * @param options.detectHarmony 是否识别鸿蒙系统,默认为 false,鸿蒙系统会被识别为 android
1586
+ * @param {en} options.detectHarmony Whether to detect HarmonyOS separately, default is false, HarmonyOS will be recognized as android
1587
+ * @returns 返回当前设备的操作系统,可能的值包括 'android'、'ios'、'harmony' 或 'pc',如果无法获取,则返回空字符串
1588
+ * @returns {en} Returns the operating system of the current device, possible values are 'android', 'ios', 'harmony', or 'pc'. Returns an empty string if it cannot be obtained
1585
1589
  * @example
1586
1590
  * ```
1587
1591
  * import { getSystem } from '@arco-design/mobile-utils';
1588
1592
  *
1593
+ * // Default behavior
1589
1594
  * const systemInfo = getSystem();
1590
1595
  * if (systemInfo === 'android') {
1591
1596
  * console.log('You are using the Android operating system');
@@ -1596,16 +1601,32 @@
1596
1601
  * } else {
1597
1602
  * console.log('Unable to detect your operating system');
1598
1603
  * }
1604
+ *
1605
+ * // With HarmonyOS detection enabled
1606
+ * const systemInfoWithHarmony = getSystem({ detectHarmony: true });
1607
+ * if (systemInfoWithHarmony === 'harmony') {
1608
+ * console.log('You are using HarmonyOS');
1609
+ * }
1599
1610
  * ```
1600
1611
  */
1601
- function getSystem() {
1612
+ function getSystem(options) {
1602
1613
  try {
1603
- var u = navigator.userAgent;
1604
- var android = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1;
1605
- var ios = u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
1606
- var pc = !android && !ios;
1607
- var system = android ? 'android' : 'ios';
1608
- return pc ? 'pc' : system;
1614
+ var u = navigator.userAgent; // Do not modify the Harmony OS ua judgment rule, please refer to the official documentation: https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/web-default-useragent
1615
+
1616
+ if (/OpenHarmony/i.test(u)) {
1617
+ return (options === null || options === void 0 ? void 0 : options.detectHarmony) ? 'harmony' : 'android';
1618
+ } // Do not ignore the case of the first letter
1619
+
1620
+
1621
+ if (/Android|Linux/.test(u)) {
1622
+ return 'android';
1623
+ }
1624
+
1625
+ if (/\(i[^;]+;( U;)? CPU.+Mac OS X/.test(u)) {
1626
+ return 'ios';
1627
+ }
1628
+
1629
+ return 'pc';
1609
1630
  } catch (e) {
1610
1631
  return '';
1611
1632
  }
@@ -4124,27 +4145,34 @@
4124
4145
  /**
4125
4146
  * 从navigator.userAgent中获取当前操作系统,如果无法获取ua,则从ContextProvider传入的system中获取值
4126
4147
  * @desc {en} Get the current operating system from navigator.userAgent, if ua cannot be obtained, get the value from the system passed in by ContextProvider
4127
- * @returns system 操作系统,"" | "pc" | "android" | "ios"
4148
+ * @param options 配置选项
4149
+ * @param {en} options Configuration options
4150
+ * @param options.detectHarmony 是否识别鸿蒙系统,默认为 false,鸿蒙系统会被识别为 android
4151
+ * @param {en} options.detectHarmony Whether to detect HarmonyOS separately, default is false, HarmonyOS will be recognized as android
4152
+ * @returns 返回当前设备的操作系统,可能的值包括 'android'、'ios'、'harmony' 或 'pc',如果无法获取,则返回空字符串
4153
+ * @returns {en} Returns the operating system of the current device, possible values are 'android', 'ios', 'harmony', or 'pc'. Returns an empty string if it cannot be obtained
4128
4154
  * @example
4129
4155
  * ```
4130
4156
  * import { useSystem } from '@arco-design/mobile-react/esm/_helpers/hooks';
4131
4157
  *
4132
4158
  * const system = useSystem();
4159
+ * // Or with options
4160
+ * const systemWithHarmony = useSystem({ detectHarmony: true });
4133
4161
  * ```
4134
4162
  */
4135
4163
 
4136
- function useSystem() {
4164
+ function useSystem(options) {
4137
4165
  var currentSystem = React.useContext(GlobalContext).system;
4138
4166
 
4139
4167
  var _a = React.useState(function () {
4140
- return currentSystem || getSystem();
4168
+ return currentSystem || getSystem(options);
4141
4169
  }),
4142
4170
  system = _a[0],
4143
4171
  setSystem = _a[1];
4144
4172
 
4145
4173
  React.useEffect(function () {
4146
- setSystem(currentSystem || getSystem());
4147
- }, [currentSystem]);
4174
+ setSystem(currentSystem || getSystem(options));
4175
+ }, [currentSystem, options]);
4148
4176
  return system;
4149
4177
  }
4150
4178
  /**
@@ -6707,7 +6735,7 @@
6707
6735
  width = _c.width,
6708
6736
  height = _c.height;
6709
6737
 
6710
- cellRef.current && cellRef.current.resetUnderlineStyle();
6738
+ cellRef.current && cellRef.current.updateLayout();
6711
6739
  setWrapWidth(width || ((_a = domRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 0);
6712
6740
  setWrapHeight(height || ((_b = domRef.current) === null || _b === void 0 ? void 0 : _b.offsetHeight) || 0);
6713
6741
  paneRef.current && paneRef.current.setCurrentHeight();
@@ -13485,7 +13513,8 @@
13485
13513
  _k = props.gestureOutOfControl,
13486
13514
  gestureOutOfControl = _k === void 0 ? true : _k,
13487
13515
  renderLinkedContainer = props.renderLinkedContainer,
13488
- otherProps = __rest$1(props, ["className", "itemStyle", "cascade", "cols", "rows", "data", "okText", "dismissText", "disabled", "clickable", "hideEmptyCols", "title", "visible", "value", "needBottomOffset", "onDismiss", "onOk", "onChange", "maskClosable", "onHide", "onPickerChange", "touchToStop", "gestureOutOfControl", "renderLinkedContainer"]);
13516
+ renderExtraHeader = props.renderExtraHeader,
13517
+ otherProps = __rest$1(props, ["className", "itemStyle", "cascade", "cols", "rows", "data", "okText", "dismissText", "disabled", "clickable", "hideEmptyCols", "title", "visible", "value", "needBottomOffset", "onDismiss", "onOk", "onChange", "maskClosable", "onHide", "onPickerChange", "touchToStop", "gestureOutOfControl", "renderLinkedContainer", "renderExtraHeader"]);
13489
13518
 
13490
13519
  var scrollValueRef = useLatestRef(value);
13491
13520
  var domRef = React.useRef(null);
@@ -13632,7 +13661,7 @@
13632
13661
  }, title), /*#__PURE__*/React__default["default"].createElement("div", {
13633
13662
  className: prefixCls + "-picker-header-btn right",
13634
13663
  onClick: handleConfirm
13635
- }, okText || (locale === null || locale === void 0 ? void 0 : locale.Picker.okText))), /*#__PURE__*/React__default["default"].createElement(PickerView$1, {
13664
+ }, okText || (locale === null || locale === void 0 ? void 0 : locale.Picker.okText))), renderExtraHeader && renderExtraHeader(), /*#__PURE__*/React__default["default"].createElement(PickerView$1, {
13636
13665
  ref: pickerViewRef,
13637
13666
  data: data,
13638
13667
  cascade: cascade,
@@ -13730,9 +13759,10 @@
13730
13759
  _e = props.typeArr,
13731
13760
  typeArr = _e === void 0 ? [] : _e,
13732
13761
  _f = props.minTs,
13733
- minTs = _f === void 0 ? initMinDate : _f,
13762
+ userSetMinTs = _f === void 0 ? initMinDate : _f,
13734
13763
  _g = props.maxTs,
13735
- maxTs = _g === void 0 ? initMaxDate : _g,
13764
+ userSetMaxTs = _g === void 0 ? initMaxDate : _g,
13765
+ rangeItemFormat = props.rangeItemFormat,
13736
13766
  _h = props.formatter,
13737
13767
  formatter = _h === void 0 ? defaultFormatter : _h,
13738
13768
  _j = props.valueFilter,
@@ -13743,18 +13773,41 @@
13743
13773
  touchToStop = props.touchToStop,
13744
13774
  _k = props.useUTC,
13745
13775
  useUTC = _k === void 0 ? false : _k,
13776
+ renderSeparator = props.renderSeparator,
13746
13777
  renderLinkedContainer = props.renderLinkedContainer,
13747
- otherProps = __rest$1(props, ["currentTs", "className", "visible", "onOk", "onChange", "onValueChange", "mode", "typeArr", "minTs", "maxTs", "formatter", "valueFilter", "columnsProcessor", "touchToStop", "useUTC", "renderLinkedContainer"]);
13778
+ otherProps = __rest$1(props, ["currentTs", "className", "visible", "onOk", "onChange", "onValueChange", "mode", "typeArr", "minTs", "maxTs", "rangeItemFormat", "formatter", "valueFilter", "columnsProcessor", "touchToStop", "useUTC", "renderSeparator", "renderLinkedContainer"]);
13779
+
13780
+ var isRange = typeof userSetCurrentTs !== 'number';
13781
+
13782
+ var _l = React.useState(userSetCurrentTs[0]),
13783
+ leftTimeValue = _l[0],
13784
+ setLeftTimeValue = _l[1];
13785
+
13786
+ var _m = React.useState(userSetCurrentTs[1]),
13787
+ rightTimeValue = _m[0],
13788
+ setRightTimeValue = _m[1];
13789
+
13790
+ var _o = React.useState(0),
13791
+ activeTabIndex = _o[0],
13792
+ setActiveTabIndex = _o[1];
13748
13793
 
13749
- var currentTs = Math.min(maxTs, Math.max(minTs, userSetCurrentTs));
13794
+ var _p = React.useMemo(function () {
13795
+ return _updateTimeScope();
13796
+ }, [userSetMinTs, userSetMaxTs, activeTabIndex]),
13797
+ minTs = _p[0],
13798
+ maxTs = _p[1];
13750
13799
 
13751
- var _l = React.useState([[]]),
13752
- data = _l[0],
13753
- setData = _l[1];
13800
+ var _q = React.useState(isRange ? Math.min(maxTs, Math.max(minTs, userSetCurrentTs[0])) : Math.min(maxTs, Math.max(minTs, userSetCurrentTs))),
13801
+ currentTs = _q[0],
13802
+ setCurrentTs = _q[1];
13754
13803
 
13755
- var _m = React.useState([]),
13756
- value = _m[0],
13757
- setValue = _m[1];
13804
+ var _r = React.useState([[]]),
13805
+ data = _r[0],
13806
+ setData = _r[1];
13807
+
13808
+ var _s = React.useState([]),
13809
+ value = _s[0],
13810
+ setValue = _s[1];
13758
13811
 
13759
13812
  var currentDateObjRef = React.useRef(_convertTsToDateObj(currentTs));
13760
13813
  var minDateObjRef = React.useRef(_convertTsToDateObj(minTs));
@@ -13762,7 +13815,37 @@
13762
13815
  var keyOptions = React.useMemo(function () {
13763
13816
  return _getKeyOptions();
13764
13817
  }, [mode, typeArr]);
13818
+ var leftTimeString = React.useMemo(function () {
13819
+ return _getRangeItemValue(leftTimeValue);
13820
+ }, [leftTimeValue]);
13821
+ var rightTimeString = React.useMemo(function () {
13822
+ return _getRangeItemValue(rightTimeValue);
13823
+ }, [rightTimeValue]);
13765
13824
  var pickerRef = React.useRef(null);
13825
+
13826
+ function _updateRangeValue(nowCurrentTs) {
13827
+ var leftMinTs = typeof userSetMinTs !== 'number' ? userSetMinTs.startTs : userSetMinTs;
13828
+ var rightMinTs = typeof userSetMinTs !== 'number' ? userSetMinTs.endTs : userSetMinTs;
13829
+ var leftMaxTs = typeof userSetMaxTs !== 'number' ? userSetMaxTs.startTs : userSetMaxTs;
13830
+ var rightMaxTs = typeof userSetMaxTs !== 'number' ? userSetMaxTs.endTs : userSetMaxTs;
13831
+
13832
+ if (isRange) {
13833
+ var leftTime = void 0,
13834
+ rightTime = void 0;
13835
+
13836
+ if (activeTabIndex === 0) {
13837
+ leftTime = nowCurrentTs;
13838
+ rightTime = Math.min(rightMaxTs, Math.max(Math.max(leftTime, rightMinTs), rightTimeValue));
13839
+ } else {
13840
+ rightTime = nowCurrentTs;
13841
+ leftTime = Math.min(leftMaxTs, Math.max(leftMinTs, leftTimeValue));
13842
+ }
13843
+
13844
+ setLeftTimeValue(leftTime);
13845
+ setRightTimeValue(rightTime);
13846
+ }
13847
+ }
13848
+
13766
13849
  React.useImperativeHandle(ref, function () {
13767
13850
  return {
13768
13851
  dom: pickerRef.current ? pickerRef.current.dom : null
@@ -13786,6 +13869,65 @@
13786
13869
  };
13787
13870
  }
13788
13871
 
13872
+ function _parseFormat(format, timeValue) {
13873
+ var year = timeValue.year,
13874
+ month = timeValue.month,
13875
+ date = timeValue.date,
13876
+ hour = timeValue.hour,
13877
+ minute = timeValue.minute,
13878
+ second = timeValue.second;
13879
+
13880
+ var padZero = function padZero(num, targetLength) {
13881
+ if (targetLength === void 0) {
13882
+ targetLength = 2;
13883
+ }
13884
+
13885
+ var str = "" + num;
13886
+
13887
+ while (str.length < targetLength) {
13888
+ str = "0" + str;
13889
+ }
13890
+
13891
+ return str;
13892
+ };
13893
+
13894
+ var replace = function replace(formatArg, str, num) {
13895
+ if (formatArg.includes(str)) {
13896
+ return str !== 'Y' ? formatArg.replace(str.repeat(2), padZero(num)).replace(str, padZero(num)) : formatArg.replace(str.repeat(4), padZero(num)).replace(str.repeat(2), padZero(num)).replace(str, padZero(num));
13897
+ }
13898
+
13899
+ return formatArg;
13900
+ };
13901
+
13902
+ return [['Y', year], ['M', month], ['D', date], ['H', hour], ['m', minute], ['s', second]].reduce(function (current, item) {
13903
+ return replace(current, item[0], item[1]);
13904
+ }, format);
13905
+ }
13906
+
13907
+ function _getRangeItemValue(time) {
13908
+ var timeValue = _convertTsToDateObj(time);
13909
+
13910
+ if (!isRange) {
13911
+ return;
13912
+ }
13913
+
13914
+ if (rangeItemFormat) {
13915
+ return _parseFormat(rangeItemFormat, timeValue);
13916
+ }
13917
+
13918
+ var format = function format(options, joinString) {
13919
+ return options.filter(function (option) {
13920
+ return keyOptions.includes(option);
13921
+ }).map(function (option) {
13922
+ return timeValue[option] < 10 ? "0" + timeValue[option] : "" + timeValue[option];
13923
+ }).join(joinString);
13924
+ };
13925
+
13926
+ var datePart = format(['year', 'month', 'date'], '/');
13927
+ var timePart = format(['hour', 'minute', 'second'], ':');
13928
+ return datePart + (datePart && timePart && ' ') + timePart;
13929
+ }
13930
+
13789
13931
  function _getSelectValue(columns) {
13790
13932
  var val = keyOptions.map(function (opt, index) {
13791
13933
  var _a;
@@ -13916,7 +14058,7 @@
13916
14058
 
13917
14059
  function _handlePickerChange(values, index) {
13918
14060
  var type = keyOptions[index];
13919
- var nowDateObj = {};
14061
+ var nowDateObj = currentDateObjRef.current;
13920
14062
  values.forEach(function (i, keyIndex) {
13921
14063
  nowDateObj[keyOptions[keyIndex]] = i;
13922
14064
  });
@@ -13944,18 +14086,35 @@
13944
14086
  setValue(val);
13945
14087
  }
13946
14088
 
14089
+ setCurrentTs(_convertObjToTs(nowDateObj, currentTs));
14090
+
13947
14091
  if (onValueChange) {
13948
14092
  onValueChange(_convertObjToTs(nowDateObj, currentTs), nowDateObj, index);
13949
14093
  }
13950
14094
  }
13951
14095
 
13952
14096
  function _handlePickerConfirm(values) {
13953
- var nowDateObj = {};
13954
- values.forEach(function (index, keyIndex) {
13955
- nowDateObj[keyOptions[keyIndex]] = index;
13956
- });
14097
+ var nowDateObj;
14098
+ var newTs;
13957
14099
 
13958
- var newTs = _convertObjToTs(nowDateObj, currentTs);
14100
+ if (isRange) {
14101
+ var leftTimeObj_1 = _convertTsToDateObj(leftTimeValue);
14102
+
14103
+ var rightTimeObj_1 = _convertTsToDateObj(rightTimeValue);
14104
+
14105
+ nowDateObj = keyOptions.reduce(function (arr, key) {
14106
+ arr[0][key] = leftTimeObj_1[key];
14107
+ arr[1][key] = rightTimeObj_1[key];
14108
+ return arr;
14109
+ }, [{}, {}]);
14110
+ newTs = [_convertObjToTs(nowDateObj[0], currentTs), _convertObjToTs(nowDateObj[1], currentTs)];
14111
+ } else {
14112
+ nowDateObj = {};
14113
+ values.forEach(function (index, keyIndex) {
14114
+ nowDateObj[keyOptions[keyIndex]] = index;
14115
+ });
14116
+ newTs = _convertObjToTs(nowDateObj, currentTs);
14117
+ }
13959
14118
 
13960
14119
  if (onOk) {
13961
14120
  onOk(newTs, nowDateObj);
@@ -13989,6 +14148,24 @@
13989
14148
  return options;
13990
14149
  }
13991
14150
 
14151
+ function _updateTimeScope(isLeft) {
14152
+ var nowMaxTs, nowMinTs;
14153
+
14154
+ if (isLeft || activeTabIndex === 0) {
14155
+ nowMaxTs = typeof userSetMaxTs === 'number' ? userSetMaxTs : userSetMaxTs.startTs;
14156
+ nowMinTs = Math.min(nowMaxTs, typeof userSetMinTs === 'number' ? userSetMinTs : userSetMinTs.startTs);
14157
+ } else {
14158
+ nowMinTs = Math.max(Math.min(typeof userSetMaxTs === 'number' ? userSetMaxTs : userSetMaxTs.startTs, leftTimeValue), typeof userSetMinTs === 'number' ? userSetMinTs : userSetMinTs.endTs);
14159
+ nowMaxTs = Math.max(nowMinTs, typeof userSetMaxTs === 'number' ? userSetMaxTs : userSetMaxTs.endTs);
14160
+ }
14161
+
14162
+ return [nowMinTs, nowMaxTs];
14163
+ }
14164
+
14165
+ function _chooseTimeActive(index) {
14166
+ setActiveTabIndex(index);
14167
+ }
14168
+
13992
14169
  React.useEffect(function () {
13993
14170
  minDateObjRef.current = _convertTsToDateObj(minTs);
13994
14171
  currentDateObjRef.current = _convertTsToDateObj(currentTs);
@@ -13996,9 +14173,45 @@
13996
14173
 
13997
14174
  _initData();
13998
14175
  }, [currentTs, minTs, maxTs, useUTC]);
14176
+ React.useEffect(function () {
14177
+ var nowCurrentTs;
14178
+
14179
+ if (isRange) {
14180
+ nowCurrentTs = Math.min(maxTs, Math.max(minTs, activeTabIndex === 0 ? leftTimeValue : rightTimeValue));
14181
+
14182
+ if (currentTs === nowCurrentTs) {
14183
+ _updateRangeValue(currentTs);
14184
+ }
14185
+ } else {
14186
+ nowCurrentTs = Math.min(maxTs, Math.max(minTs, currentTs));
14187
+ }
14188
+
14189
+ setCurrentTs(nowCurrentTs);
14190
+ }, [minTs, maxTs]);
14191
+ React.useEffect(function () {
14192
+ _updateRangeValue(currentTs);
14193
+ }, [currentTs]);
13999
14194
  React.useEffect(function () {
14000
14195
  if (visible) {
14001
- currentDateObjRef.current = _convertTsToDateObj(currentTs);
14196
+ // 初始化当前时间
14197
+ if (isRange) {
14198
+ setActiveTabIndex(0);
14199
+ setLeftTimeValue(userSetCurrentTs[0]);
14200
+ setRightTimeValue(userSetCurrentTs[1]);
14201
+
14202
+ var _a = _updateTimeScope(true),
14203
+ nowMinTs = _a[0],
14204
+ nowMaxTs = _a[1];
14205
+
14206
+ var nowCurrentTs = Math.min(nowMaxTs, Math.max(nowMinTs, userSetCurrentTs[0]));
14207
+ setCurrentTs(nowCurrentTs);
14208
+
14209
+ if (currentTs === nowCurrentTs) {
14210
+ _updateRangeValue(currentTs);
14211
+ }
14212
+ } else {
14213
+ setCurrentTs(Math.min(maxTs, Math.max(minTs, userSetCurrentTs)));
14214
+ }
14002
14215
 
14003
14216
  _initData();
14004
14217
  }
@@ -14015,6 +14228,23 @@
14015
14228
  onPickerChange: _handlePickerChange,
14016
14229
  onOk: _handlePickerConfirm,
14017
14230
  touchToStop: touchToStop,
14231
+ renderExtraHeader: isRange ? function () {
14232
+ return /*#__PURE__*/React__default["default"].createElement("div", {
14233
+ className: prefixCls + "-date-picker-show"
14234
+ }, /*#__PURE__*/React__default["default"].createElement("span", {
14235
+ className: cls("" + (activeTabIndex === 0 ? prefixCls + "-date-picker-range-item-active" : ''), prefixCls + "-date-picker-range-item"),
14236
+ onClick: function onClick() {
14237
+ return _chooseTimeActive(0);
14238
+ }
14239
+ }, leftTimeString), renderSeparator ? renderSeparator() : /*#__PURE__*/React__default["default"].createElement("span", {
14240
+ className: prefixCls + "-date-picker-show-separate"
14241
+ }, "~"), /*#__PURE__*/React__default["default"].createElement("span", {
14242
+ className: cls("" + (activeTabIndex === 1 ? prefixCls + "-date-picker-range-item-active" : ''), prefixCls + "-date-picker-range-item"),
14243
+ onClick: function onClick() {
14244
+ return _chooseTimeActive(1);
14245
+ }
14246
+ }, rightTimeString));
14247
+ } : undefined,
14018
14248
  renderLinkedContainer: renderLinkedContainer ? function () {
14019
14249
  return renderLinkedContainer(isEmptyValue(props.currentTs) ? undefined : currentTs, keyOptions);
14020
14250
  } : undefined
@@ -16111,8 +16341,10 @@
16111
16341
  currentText += temp;
16112
16342
  l = m;
16113
16343
  }
16114
- } // Remove the exclude char at the end of the content.
16344
+ } // Remove the last character if it is orphaned high-surrogate characters (indicative of incomplete emoji).
16345
+
16115
16346
 
16347
+ currentText = currentText.replace(/[\uD800-\uDBFF]+$/, ''); // Remove the exclude char at the end of the content.
16116
16348
 
16117
16349
  while (endExcludes && endExcludes.includes(currentText[currentText.length - 1])) {
16118
16350
  currentText = currentText.slice(0, -1);
@@ -17920,7 +18152,11 @@
17920
18152
 
17921
18153
  var className = prefixCls + "-form-picker-link-container";
17922
18154
  var dateTimeStr = React.useMemo(function () {
17923
- return formatDateTimeStr(ts, types);
18155
+ if (typeof ts === 'number') {
18156
+ return formatDateTimeStr(ts, types);
18157
+ }
18158
+
18159
+ return formatDateTimeStr(ts[0], types) + " ~ " + formatDateTimeStr(ts[1], types);
17924
18160
  }, [ts, types]);
17925
18161
 
17926
18162
  function formatDateTimeStr(timestamp, itemTypes) {
@@ -24617,20 +24853,38 @@
24617
24853
 
24618
24854
 
24619
24855
  if (verticalAuto) {
24620
- var popoverTop = childRect.bottom - (newConfig.bottom && newConfig.height ? newConfig.bottom + newConfig.height : 0);
24621
- var popoverBottom = childRect.top + (newConfig.top && newConfig.height ? newConfig.top + newConfig.height : 0); // 顶部安全距离不够,调整到底部
24622
- // @en The top safety distance is not enough, adjust to the bottom
24623
-
24624
- if (directionState.indexOf('top') !== -1 && popoverTop < topOffset) {
24856
+ var setToBottom = function setToBottom() {
24625
24857
  newConfig.top = verticalOffset + childRect.height;
24626
24858
  newConfig.bottom = null;
24627
24859
  onAdjustDirection('bottom');
24628
- } else if (directionState.indexOf('bottom') !== -1 && popoverBottom + bottomOffset > window.innerHeight) {
24629
- // 底部安全距离不够,调整到顶部
24630
- // @en The bottom safety distance is not enough, adjust to the top
24860
+ };
24861
+
24862
+ var setToTop = function setToTop() {
24631
24863
  newConfig.top = null;
24632
24864
  newConfig.bottom = verticalOffset + childRect.height;
24633
24865
  onAdjustDirection('top');
24866
+ }; // 判断上下空间是否都不足以展示气泡内容
24867
+ // @en Determine whether there is insufficient space both above and below to display content
24868
+
24869
+
24870
+ var isPopoverTooTall = window.innerHeight - topOffset - bottomOffset < 2 * (newConfig.height || 0) + 2 * verticalOffset + childRect.height;
24871
+
24872
+ if (isPopoverTooTall) {
24873
+ var spaceAbove = childRect.top;
24874
+ var spaceBelow = window.innerHeight - childRect.bottom;
24875
+ spaceAbove > spaceBelow ? setToTop() : setToBottom();
24876
+ } else {
24877
+ var popoverTop = childRect.bottom - (newConfig.bottom && newConfig.height ? newConfig.bottom + newConfig.height : 0);
24878
+ var popoverBottom = childRect.top + (newConfig.top && newConfig.height ? newConfig.top + newConfig.height : 0); // 顶部安全距离不够,调整到底部
24879
+ // @en The top safety distance is not enough, adjust to the bottom
24880
+
24881
+ if (directionState.indexOf('top') !== -1 && popoverTop < topOffset) {
24882
+ setToBottom();
24883
+ } else if ( // 底部安全距离不够,调整到顶部
24884
+ // @en The bottom safety distance is not enough, adjust to the top
24885
+ directionState.indexOf('bottom') !== -1 && popoverBottom + bottomOffset > window.innerHeight) {
24886
+ setToTop();
24887
+ }
24634
24888
  }
24635
24889
  } // 挂载在全局的气泡需要计算相对屏幕的位置
24636
24890
  // @en Bubble mounted in the global needs to calculate the position relative to the screen
@@ -26762,8 +27016,8 @@
26762
27016
  return /*#__PURE__*/React__default["default"].createElement("div", {
26763
27017
  key: index,
26764
27018
  className: searchBarAssociationPrefixCls + "-item",
26765
- onClick: function onClick() {
26766
- return onAssociationItemClick === null || onAssociationItemClick === void 0 ? void 0 : onAssociationItemClick(item, index);
27019
+ onClick: function onClick(e) {
27020
+ return onAssociationItemClick === null || onAssociationItemClick === void 0 ? void 0 : onAssociationItemClick(item, index, e);
26767
27021
  }
26768
27022
  }, node);
26769
27023
  };
@@ -28802,7 +29056,7 @@
28802
29056
  var tempValue = typeof updater === 'function' ? updater(innerValue) : updater;
28803
29057
 
28804
29058
  if (formatter) {
28805
- new Promise(function (resolve) {
29059
+ new es6Promise.Promise(function (resolve) {
28806
29060
  resolve(formatter(Number(tempValue)));
28807
29061
  }).then(function (result) {
28808
29062
  var res = Math.max(min, Math.min(max, result));