@arco-design/mobile-react 2.35.2 → 2.36.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 +18 -0
- package/README.en-US.md +2 -2
- package/README.md +2 -2
- package/cjs/_helpers/hooks.d.ts +10 -2
- package/cjs/_helpers/hooks.js +12 -5
- package/cjs/date-picker/index.js +218 -18
- package/cjs/date-picker/style/css/index.css +42 -0
- package/cjs/date-picker/style/index.less +38 -1
- package/cjs/date-picker/type.d.ts +22 -6
- package/cjs/form/linked-container.d.ts +2 -2
- package/cjs/form/linked-container.js +5 -1
- package/cjs/picker/index.js +3 -2
- package/cjs/picker/type.d.ts +5 -0
- package/cjs/search-bar/association.js +2 -2
- package/cjs/search-bar/type.d.ts +1 -1
- package/cjs/stepper/hooks/useValue.js +3 -1
- package/cjs/tabs/index.js +1 -1
- package/cjs/tabs/type.d.ts +2 -2
- package/dist/index.js +272 -38
- package/dist/index.min.js +4 -4
- package/dist/style.css +23 -0
- package/dist/style.min.css +1 -1
- package/esm/_helpers/hooks.d.ts +10 -2
- package/esm/_helpers/hooks.js +12 -5
- package/esm/date-picker/index.js +218 -18
- package/esm/date-picker/style/css/index.css +42 -0
- package/esm/date-picker/style/index.less +38 -1
- package/esm/date-picker/type.d.ts +22 -6
- package/esm/form/linked-container.d.ts +2 -2
- package/esm/form/linked-container.js +5 -1
- package/esm/picker/index.js +3 -2
- package/esm/picker/type.d.ts +5 -0
- package/esm/search-bar/association.js +2 -2
- package/esm/search-bar/type.d.ts +1 -1
- package/esm/stepper/hooks/useValue.js +1 -0
- package/esm/tabs/index.js +1 -1
- package/esm/tabs/type.d.ts +2 -2
- package/esnext/_helpers/hooks.d.ts +10 -2
- package/esnext/_helpers/hooks.js +12 -5
- package/esnext/date-picker/index.js +167 -10
- package/esnext/date-picker/style/css/index.css +42 -0
- package/esnext/date-picker/style/index.less +38 -1
- package/esnext/date-picker/type.d.ts +22 -6
- package/esnext/form/linked-container.d.ts +2 -2
- package/esnext/form/linked-container.js +7 -2
- package/esnext/picker/index.js +2 -1
- package/esnext/picker/type.d.ts +5 -0
- package/esnext/search-bar/association.js +1 -1
- package/esnext/search-bar/type.d.ts +1 -1
- package/esnext/stepper/hooks/useValue.js +1 -0
- package/esnext/tabs/index.js +1 -1
- package/esnext/tabs/type.d.ts +2 -2
- package/package.json +3 -3
- package/tokens/app/arcodesign/default/css-variables.less +10 -0
- package/tokens/app/arcodesign/default/index.d.ts +10 -0
- package/tokens/app/arcodesign/default/index.js +11 -1
- package/tokens/app/arcodesign/default/index.json +108 -0
- package/tokens/app/arcodesign/default/index.less +10 -0
- package/umd/_helpers/hooks.d.ts +10 -2
- package/umd/_helpers/hooks.js +12 -5
- package/umd/date-picker/index.js +218 -18
- package/umd/date-picker/style/css/index.css +42 -0
- package/umd/date-picker/style/index.less +38 -1
- package/umd/date-picker/type.d.ts +22 -6
- package/umd/form/linked-container.d.ts +2 -2
- package/umd/form/linked-container.js +5 -1
- package/umd/picker/index.js +3 -2
- package/umd/picker/type.d.ts +5 -0
- package/umd/search-bar/association.js +2 -2
- package/umd/search-bar/type.d.ts +1 -1
- package/umd/stepper/hooks/useValue.js +5 -5
- package/umd/tabs/index.js +1 -1
- package/umd/tabs/type.d.ts +2 -2
@@ -1103,7 +1103,17 @@ var tokens = {
|
|
1103
1103
|
"dark-uploader-disabled-delete-icon-color": "var(--dark-disabled-color)",
|
1104
1104
|
"uploader-disabled-delete-icon-color": "var(--disabled-color)",
|
1105
1105
|
"dark-uploader-item-text-error-color": "var(--dark-danger-color)",
|
1106
|
-
"uploader-item-text-error-color": "var(--danger-color)"
|
1106
|
+
"uploader-item-text-error-color": "var(--danger-color)",
|
1107
|
+
"date-picker-range-font-size": "0.32rem",
|
1108
|
+
"date-picker-range-background-color": "#FBFCFC",
|
1109
|
+
"dark-date-picker-range-background-color": "#1E1E1E",
|
1110
|
+
"dark-date-picker-range-font-color": "var(--dark-font-color)",
|
1111
|
+
"date-picker-range-font-color": "var(--font-color)",
|
1112
|
+
"dark-date-picker-range-disabled-font-color": "var(--dark-disabled-color)",
|
1113
|
+
"date-picker-range-disabled-font-color": "var(--disabled-color)",
|
1114
|
+
"date-picker-range-show-padding": "0 0.32rem",
|
1115
|
+
"date-picker-range-show-min-height": "0.96rem",
|
1116
|
+
"date-picker-range-separate-min-width": "0.96rem"
|
1107
1117
|
};
|
1108
1118
|
var _default = tokens;
|
1109
1119
|
exports["default"] = _default;
|
@@ -2699,6 +2699,30 @@
|
|
2699
2699
|
"jsValue": "#F76965",
|
2700
2700
|
"staticValue": "#F76965"
|
2701
2701
|
},
|
2702
|
+
"darkDatePickerRangeBackgroundColor": {
|
2703
|
+
"cssKey": "dark-date-picker-range-background-color",
|
2704
|
+
"desc": "",
|
2705
|
+
"override": "",
|
2706
|
+
"value": "#1E1E1E",
|
2707
|
+
"jsValue": "#1E1E1E",
|
2708
|
+
"staticValue": "#1E1E1E"
|
2709
|
+
},
|
2710
|
+
"darkDatePickerRangeDisabledFontColor": {
|
2711
|
+
"cssKey": "dark-date-picker-range-disabled-font-color",
|
2712
|
+
"desc": "",
|
2713
|
+
"override": "",
|
2714
|
+
"value": "@dark-disabled-color",
|
2715
|
+
"jsValue": "@global@darkDisabledColor",
|
2716
|
+
"staticValue": "#5f5f60"
|
2717
|
+
},
|
2718
|
+
"darkDatePickerRangeFontColor": {
|
2719
|
+
"cssKey": "dark-date-picker-range-font-color",
|
2720
|
+
"desc": "",
|
2721
|
+
"override": "",
|
2722
|
+
"value": "@dark-font-color",
|
2723
|
+
"jsValue": "@global@darkFontColor",
|
2724
|
+
"staticValue": "#f6f6f6"
|
2725
|
+
},
|
2702
2726
|
"darkDialogBodyAndroidColor": {
|
2703
2727
|
"cssKey": "dark-dialog-body-android-color",
|
2704
2728
|
"desc": "",
|
@@ -4355,6 +4379,90 @@
|
|
4355
4379
|
"jsValue": "#FF9626",
|
4356
4380
|
"staticValue": "#FF9626"
|
4357
4381
|
},
|
4382
|
+
"datePickerRangeBackgroundColor": {
|
4383
|
+
"cssKey": "date-picker-range-background-color",
|
4384
|
+
"desc": "日期时间范围选择器背景颜色",
|
4385
|
+
"override": "",
|
4386
|
+
"value": "#FBFCFC",
|
4387
|
+
"jsValue": "#FBFCFC",
|
4388
|
+
"staticValue": "#FBFCFC",
|
4389
|
+
"localeDesc": {
|
4390
|
+
"ch": "日期时间范围选择器背景颜色",
|
4391
|
+
"en": "Background color of the date picker range when checked"
|
4392
|
+
}
|
4393
|
+
},
|
4394
|
+
"datePickerRangeDisabledFontColor": {
|
4395
|
+
"cssKey": "date-picker-range-disabled-font-color",
|
4396
|
+
"desc": "日期时间范围选择器未选中时文字颜色",
|
4397
|
+
"override": "",
|
4398
|
+
"value": "@disabled-color",
|
4399
|
+
"jsValue": "@global@disabledColor",
|
4400
|
+
"staticValue": "#c9cdd4",
|
4401
|
+
"localeDesc": {
|
4402
|
+
"ch": "日期时间范围选择器未选中时文字颜色",
|
4403
|
+
"en": "Font color of the date picker range when disabled"
|
4404
|
+
}
|
4405
|
+
},
|
4406
|
+
"datePickerRangeFontColor": {
|
4407
|
+
"cssKey": "date-picker-range-font-color",
|
4408
|
+
"desc": "日期时间范围选择器选中时文字颜色",
|
4409
|
+
"override": "",
|
4410
|
+
"value": "@font-color",
|
4411
|
+
"jsValue": "@global@fontColor",
|
4412
|
+
"staticValue": "#1d2129",
|
4413
|
+
"localeDesc": {
|
4414
|
+
"ch": "日期时间范围选择器选中时文字颜色",
|
4415
|
+
"en": "Font color of the date picker range when checked"
|
4416
|
+
}
|
4417
|
+
},
|
4418
|
+
"datePickerRangeFontSize": {
|
4419
|
+
"cssKey": "date-picker-range-font-size",
|
4420
|
+
"desc": "日期时间范围选择器文字大小",
|
4421
|
+
"override": "",
|
4422
|
+
"value": "~`pxtorem(16)`",
|
4423
|
+
"jsValue": "@getRem@16",
|
4424
|
+
"staticValue": "0.32rem",
|
4425
|
+
"localeDesc": {
|
4426
|
+
"ch": "日期时间范围选择器文字大小",
|
4427
|
+
"en": "Font size of the date picker range"
|
4428
|
+
}
|
4429
|
+
},
|
4430
|
+
"datePickerRangeSeparateMinWidth": {
|
4431
|
+
"cssKey": "date-picker-range-separate-min-width",
|
4432
|
+
"desc": "日期时间范围选择器展示区域分隔符最小宽度",
|
4433
|
+
"override": "",
|
4434
|
+
"value": "~`pxtorem(48)`",
|
4435
|
+
"jsValue": "@getRem@48",
|
4436
|
+
"staticValue": "0.96rem",
|
4437
|
+
"localeDesc": {
|
4438
|
+
"ch": "日期时间范围选择器展示区域分隔符最小宽度",
|
4439
|
+
"en": "Min width of the date picker range separate"
|
4440
|
+
}
|
4441
|
+
},
|
4442
|
+
"datePickerRangeShowMinHeight": {
|
4443
|
+
"cssKey": "date-picker-range-show-min-height",
|
4444
|
+
"desc": "日期时间范围选择器展示区域最小高度",
|
4445
|
+
"override": "",
|
4446
|
+
"value": "~`pxtorem(48)`",
|
4447
|
+
"jsValue": "@getRem@48",
|
4448
|
+
"staticValue": "0.96rem",
|
4449
|
+
"localeDesc": {
|
4450
|
+
"ch": "日期时间范围选择器展示区域最小高度",
|
4451
|
+
"en": "Min height of the date picker range area"
|
4452
|
+
}
|
4453
|
+
},
|
4454
|
+
"datePickerRangeShowPadding": {
|
4455
|
+
"cssKey": "date-picker-range-show-padding",
|
4456
|
+
"desc": "日期时间范围选择器展示区域外边距大小",
|
4457
|
+
"override": "",
|
4458
|
+
"value": "0 ~`pxtorem(16)`",
|
4459
|
+
"jsValue": "0 @getRem@16",
|
4460
|
+
"staticValue": "0 0.32rem",
|
4461
|
+
"localeDesc": {
|
4462
|
+
"ch": "日期时间范围选择器展示区域外边距大小",
|
4463
|
+
"en": "Margin of the date picker range area"
|
4464
|
+
}
|
4465
|
+
},
|
4358
4466
|
"dialogAndroidBodyFooterGutter": {
|
4359
4467
|
"cssKey": "dialog-android-body-footer-gutter",
|
4360
4468
|
"desc": "对话框 body 和 footer 的间距 (android)",
|
@@ -1092,4 +1092,14 @@
|
|
1092
1092
|
@uploader-disabled-delete-icon-color: @disabled-color;
|
1093
1093
|
@dark-uploader-item-text-error-color: @dark-danger-color;
|
1094
1094
|
@uploader-item-text-error-color: @danger-color;
|
1095
|
+
@date-picker-range-font-size: ~`pxtorem(16)`;
|
1096
|
+
@date-picker-range-background-color: #FBFCFC;
|
1097
|
+
@dark-date-picker-range-background-color: #1E1E1E;
|
1098
|
+
@dark-date-picker-range-font-color: @dark-font-color;
|
1099
|
+
@date-picker-range-font-color: @font-color;
|
1100
|
+
@dark-date-picker-range-disabled-font-color: @dark-disabled-color;
|
1101
|
+
@date-picker-range-disabled-font-color: @disabled-color;
|
1102
|
+
@date-picker-range-show-padding: 0 ~`pxtorem(16)`;
|
1103
|
+
@date-picker-range-show-min-height: ~`pxtorem(48)`;
|
1104
|
+
@date-picker-range-separate-min-width: ~`pxtorem(48)`;
|
1095
1105
|
|
package/umd/_helpers/hooks.d.ts
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
* @name_en General Hooks
|
5
5
|
*/
|
6
6
|
import React from 'react';
|
7
|
+
import type { SystemOptions } from '@arco-design/mobile-utils';
|
7
8
|
import { BezierType } from '../progress';
|
8
9
|
/**
|
9
10
|
* 监听页面resize事件的统一封装
|
@@ -130,15 +131,22 @@ export declare function useLatestRef<T>(variable: T): React.MutableRefObject<T>;
|
|
130
131
|
/**
|
131
132
|
* 从navigator.userAgent中获取当前操作系统,如果无法获取ua,则从ContextProvider传入的system中获取值
|
132
133
|
* @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
|
133
|
-
* @
|
134
|
+
* @param options 配置选项
|
135
|
+
* @param {en} options Configuration options
|
136
|
+
* @param options.detectHarmony 是否识别鸿蒙系统,默认为 false,鸿蒙系统会被识别为 android
|
137
|
+
* @param {en} options.detectHarmony Whether to detect HarmonyOS separately, default is false, HarmonyOS will be recognized as android
|
138
|
+
* @returns 返回当前设备的操作系统,可能的值包括 'android'、'ios'、'harmony' 或 'pc',如果无法获取,则返回空字符串
|
139
|
+
* @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
|
134
140
|
* @example
|
135
141
|
* ```
|
136
142
|
* import { useSystem } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
137
143
|
*
|
138
144
|
* const system = useSystem();
|
145
|
+
* // Or with options
|
146
|
+
* const systemWithHarmony = useSystem({ detectHarmony: true });
|
139
147
|
* ```
|
140
148
|
*/
|
141
|
-
export declare function useSystem(): "" | "android" | "ios" | "pc";
|
149
|
+
export declare function useSystem(options?: SystemOptions): "" | "android" | "harmony" | "ios" | "pc";
|
142
150
|
/**
|
143
151
|
* 获取页面视口宽高大小,并在页面有resize时更新大小
|
144
152
|
* @desc {en} Get the width and height of the page viewport, and update the size when the page is resized
|
package/umd/_helpers/hooks.js
CHANGED
@@ -283,29 +283,36 @@
|
|
283
283
|
/**
|
284
284
|
* 从navigator.userAgent中获取当前操作系统,如果无法获取ua,则从ContextProvider传入的system中获取值
|
285
285
|
* @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
|
286
|
-
* @
|
286
|
+
* @param options 配置选项
|
287
|
+
* @param {en} options Configuration options
|
288
|
+
* @param options.detectHarmony 是否识别鸿蒙系统,默认为 false,鸿蒙系统会被识别为 android
|
289
|
+
* @param {en} options.detectHarmony Whether to detect HarmonyOS separately, default is false, HarmonyOS will be recognized as android
|
290
|
+
* @returns 返回当前设备的操作系统,可能的值包括 'android'、'ios'、'harmony' 或 'pc',如果无法获取,则返回空字符串
|
291
|
+
* @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
|
287
292
|
* @example
|
288
293
|
* ```
|
289
294
|
* import { useSystem } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
290
295
|
*
|
291
296
|
* const system = useSystem();
|
297
|
+
* // Or with options
|
298
|
+
* const systemWithHarmony = useSystem({ detectHarmony: true });
|
292
299
|
* ```
|
293
300
|
*/
|
294
301
|
|
295
302
|
|
296
|
-
function useSystem() {
|
303
|
+
function useSystem(options) {
|
297
304
|
var _useContext = (0, _react.useContext)(_contextProvider.GlobalContext),
|
298
305
|
currentSystem = _useContext.system;
|
299
306
|
|
300
307
|
var _useState5 = (0, _react.useState)(function () {
|
301
|
-
return currentSystem || (0, _mobileUtils.getSystem)();
|
308
|
+
return currentSystem || (0, _mobileUtils.getSystem)(options);
|
302
309
|
}),
|
303
310
|
system = _useState5[0],
|
304
311
|
setSystem = _useState5[1];
|
305
312
|
|
306
313
|
(0, _react.useEffect)(function () {
|
307
|
-
setSystem(currentSystem || (0, _mobileUtils.getSystem)());
|
308
|
-
}, [currentSystem]);
|
314
|
+
setSystem(currentSystem || (0, _mobileUtils.getSystem)(options));
|
315
|
+
}, [currentSystem, options]);
|
309
316
|
return system;
|
310
317
|
}
|
311
318
|
/**
|
package/umd/date-picker/index.js
CHANGED
@@ -30,7 +30,7 @@
|
|
30
30
|
if (key in _exports && _exports[key] === _type[key]) return;
|
31
31
|
_exports[key] = _type[key];
|
32
32
|
});
|
33
|
-
var _excluded = ["currentTs", "className", "visible", "onOk", "onChange", "onValueChange", "mode", "typeArr", "minTs", "maxTs", "formatter", "valueFilter", "columnsProcessor", "touchToStop", "useUTC", "renderLinkedContainer"];
|
33
|
+
var _excluded = ["currentTs", "className", "visible", "onOk", "onChange", "onValueChange", "mode", "typeArr", "minTs", "maxTs", "rangeItemFormat", "formatter", "valueFilter", "columnsProcessor", "touchToStop", "useUTC", "renderSeparator", "renderLinkedContainer"];
|
34
34
|
|
35
35
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
36
36
|
|
@@ -58,9 +58,10 @@
|
|
58
58
|
_props$typeArr = props.typeArr,
|
59
59
|
typeArr = _props$typeArr === void 0 ? [] : _props$typeArr,
|
60
60
|
_props$minTs = props.minTs,
|
61
|
-
|
61
|
+
userSetMinTs = _props$minTs === void 0 ? initMinDate : _props$minTs,
|
62
62
|
_props$maxTs = props.maxTs,
|
63
|
-
|
63
|
+
userSetMaxTs = _props$maxTs === void 0 ? initMaxDate : _props$maxTs,
|
64
|
+
rangeItemFormat = props.rangeItemFormat,
|
64
65
|
_props$formatter = props.formatter,
|
65
66
|
formatter = _props$formatter === void 0 ? defaultFormatter : _props$formatter,
|
66
67
|
_props$valueFilter = props.valueFilter,
|
@@ -71,17 +72,40 @@
|
|
71
72
|
touchToStop = props.touchToStop,
|
72
73
|
_props$useUTC = props.useUTC,
|
73
74
|
useUTC = _props$useUTC === void 0 ? false : _props$useUTC,
|
75
|
+
renderSeparator = props.renderSeparator,
|
74
76
|
renderLinkedContainer = props.renderLinkedContainer,
|
75
77
|
otherProps = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
76
|
-
var
|
78
|
+
var isRange = typeof userSetCurrentTs !== 'number';
|
77
79
|
|
78
|
-
var _useState = (0, _react.useState)([
|
79
|
-
|
80
|
-
|
80
|
+
var _useState = (0, _react.useState)(userSetCurrentTs[0]),
|
81
|
+
leftTimeValue = _useState[0],
|
82
|
+
setLeftTimeValue = _useState[1];
|
81
83
|
|
82
|
-
var _useState2 = (0, _react.useState)([]),
|
83
|
-
|
84
|
-
|
84
|
+
var _useState2 = (0, _react.useState)(userSetCurrentTs[1]),
|
85
|
+
rightTimeValue = _useState2[0],
|
86
|
+
setRightTimeValue = _useState2[1];
|
87
|
+
|
88
|
+
var _useState3 = (0, _react.useState)(0),
|
89
|
+
activeTabIndex = _useState3[0],
|
90
|
+
setActiveTabIndex = _useState3[1];
|
91
|
+
|
92
|
+
var _useMemo = (0, _react.useMemo)(function () {
|
93
|
+
return _updateTimeScope();
|
94
|
+
}, [userSetMinTs, userSetMaxTs, activeTabIndex]),
|
95
|
+
minTs = _useMemo[0],
|
96
|
+
maxTs = _useMemo[1];
|
97
|
+
|
98
|
+
var _useState4 = (0, _react.useState)(isRange ? Math.min(maxTs, Math.max(minTs, userSetCurrentTs[0])) : Math.min(maxTs, Math.max(minTs, userSetCurrentTs))),
|
99
|
+
currentTs = _useState4[0],
|
100
|
+
setCurrentTs = _useState4[1];
|
101
|
+
|
102
|
+
var _useState5 = (0, _react.useState)([[]]),
|
103
|
+
data = _useState5[0],
|
104
|
+
setData = _useState5[1];
|
105
|
+
|
106
|
+
var _useState6 = (0, _react.useState)([]),
|
107
|
+
value = _useState6[0],
|
108
|
+
setValue = _useState6[1];
|
85
109
|
|
86
110
|
var currentDateObjRef = (0, _react.useRef)(_convertTsToDateObj(currentTs));
|
87
111
|
var minDateObjRef = (0, _react.useRef)(_convertTsToDateObj(minTs));
|
@@ -89,7 +113,36 @@
|
|
89
113
|
var keyOptions = (0, _react.useMemo)(function () {
|
90
114
|
return _getKeyOptions();
|
91
115
|
}, [mode, typeArr]);
|
116
|
+
var leftTimeString = (0, _react.useMemo)(function () {
|
117
|
+
return _getRangeItemValue(leftTimeValue);
|
118
|
+
}, [leftTimeValue]);
|
119
|
+
var rightTimeString = (0, _react.useMemo)(function () {
|
120
|
+
return _getRangeItemValue(rightTimeValue);
|
121
|
+
}, [rightTimeValue]);
|
92
122
|
var pickerRef = (0, _react.useRef)(null);
|
123
|
+
|
124
|
+
function _updateRangeValue(nowCurrentTs) {
|
125
|
+
var leftMinTs = typeof userSetMinTs !== 'number' ? userSetMinTs.startTs : userSetMinTs;
|
126
|
+
var rightMinTs = typeof userSetMinTs !== 'number' ? userSetMinTs.endTs : userSetMinTs;
|
127
|
+
var leftMaxTs = typeof userSetMaxTs !== 'number' ? userSetMaxTs.startTs : userSetMaxTs;
|
128
|
+
var rightMaxTs = typeof userSetMaxTs !== 'number' ? userSetMaxTs.endTs : userSetMaxTs;
|
129
|
+
|
130
|
+
if (isRange) {
|
131
|
+
var leftTime, rightTime;
|
132
|
+
|
133
|
+
if (activeTabIndex === 0) {
|
134
|
+
leftTime = nowCurrentTs;
|
135
|
+
rightTime = Math.min(rightMaxTs, Math.max(Math.max(leftTime, rightMinTs), rightTimeValue));
|
136
|
+
} else {
|
137
|
+
rightTime = nowCurrentTs;
|
138
|
+
leftTime = Math.min(leftMaxTs, Math.max(leftMinTs, leftTimeValue));
|
139
|
+
}
|
140
|
+
|
141
|
+
setLeftTimeValue(leftTime);
|
142
|
+
setRightTimeValue(rightTime);
|
143
|
+
}
|
144
|
+
}
|
145
|
+
|
93
146
|
(0, _react.useImperativeHandle)(ref, function () {
|
94
147
|
return {
|
95
148
|
dom: pickerRef.current ? pickerRef.current.dom : null
|
@@ -113,6 +166,65 @@
|
|
113
166
|
};
|
114
167
|
}
|
115
168
|
|
169
|
+
function _parseFormat(format, timeValue) {
|
170
|
+
var year = timeValue.year,
|
171
|
+
month = timeValue.month,
|
172
|
+
date = timeValue.date,
|
173
|
+
hour = timeValue.hour,
|
174
|
+
minute = timeValue.minute,
|
175
|
+
second = timeValue.second;
|
176
|
+
|
177
|
+
var padZero = function padZero(num, targetLength) {
|
178
|
+
if (targetLength === void 0) {
|
179
|
+
targetLength = 2;
|
180
|
+
}
|
181
|
+
|
182
|
+
var str = "" + num;
|
183
|
+
|
184
|
+
while (str.length < targetLength) {
|
185
|
+
str = "0" + str;
|
186
|
+
}
|
187
|
+
|
188
|
+
return str;
|
189
|
+
};
|
190
|
+
|
191
|
+
var replace = function replace(formatArg, str, num) {
|
192
|
+
if (formatArg.includes(str)) {
|
193
|
+
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));
|
194
|
+
}
|
195
|
+
|
196
|
+
return formatArg;
|
197
|
+
};
|
198
|
+
|
199
|
+
return [['Y', year], ['M', month], ['D', date], ['H', hour], ['m', minute], ['s', second]].reduce(function (current, item) {
|
200
|
+
return replace(current, item[0], item[1]);
|
201
|
+
}, format);
|
202
|
+
}
|
203
|
+
|
204
|
+
function _getRangeItemValue(time) {
|
205
|
+
var timeValue = _convertTsToDateObj(time);
|
206
|
+
|
207
|
+
if (!isRange) {
|
208
|
+
return;
|
209
|
+
}
|
210
|
+
|
211
|
+
if (rangeItemFormat) {
|
212
|
+
return _parseFormat(rangeItemFormat, timeValue);
|
213
|
+
}
|
214
|
+
|
215
|
+
var format = function format(options, joinString) {
|
216
|
+
return options.filter(function (option) {
|
217
|
+
return keyOptions.includes(option);
|
218
|
+
}).map(function (option) {
|
219
|
+
return timeValue[option] < 10 ? "0" + timeValue[option] : "" + timeValue[option];
|
220
|
+
}).join(joinString);
|
221
|
+
};
|
222
|
+
|
223
|
+
var datePart = format(['year', 'month', 'date'], '/');
|
224
|
+
var timePart = format(['hour', 'minute', 'second'], ':');
|
225
|
+
return datePart + (datePart && timePart && ' ') + timePart;
|
226
|
+
}
|
227
|
+
|
116
228
|
function _getSelectValue(columns) {
|
117
229
|
var val = keyOptions.map(function (opt, index) {
|
118
230
|
var _curCol$Math$max;
|
@@ -245,7 +357,7 @@
|
|
245
357
|
|
246
358
|
function _handlePickerChange(values, index) {
|
247
359
|
var type = keyOptions[index];
|
248
|
-
var nowDateObj =
|
360
|
+
var nowDateObj = currentDateObjRef.current;
|
249
361
|
values.forEach(function (i, keyIndex) {
|
250
362
|
nowDateObj[keyOptions[keyIndex]] = i;
|
251
363
|
});
|
@@ -273,18 +385,35 @@
|
|
273
385
|
setValue(val);
|
274
386
|
}
|
275
387
|
|
388
|
+
setCurrentTs(_convertObjToTs(nowDateObj, currentTs));
|
389
|
+
|
276
390
|
if (onValueChange) {
|
277
391
|
onValueChange(_convertObjToTs(nowDateObj, currentTs), nowDateObj, index);
|
278
392
|
}
|
279
393
|
}
|
280
394
|
|
281
395
|
function _handlePickerConfirm(values) {
|
282
|
-
var nowDateObj
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
396
|
+
var nowDateObj;
|
397
|
+
var newTs;
|
398
|
+
|
399
|
+
if (isRange) {
|
400
|
+
var leftTimeObj = _convertTsToDateObj(leftTimeValue);
|
401
|
+
|
402
|
+
var rightTimeObj = _convertTsToDateObj(rightTimeValue);
|
403
|
+
|
404
|
+
nowDateObj = keyOptions.reduce(function (arr, key) {
|
405
|
+
arr[0][key] = leftTimeObj[key];
|
406
|
+
arr[1][key] = rightTimeObj[key];
|
407
|
+
return arr;
|
408
|
+
}, [{}, {}]);
|
409
|
+
newTs = [_convertObjToTs(nowDateObj[0], currentTs), _convertObjToTs(nowDateObj[1], currentTs)];
|
410
|
+
} else {
|
411
|
+
nowDateObj = {};
|
412
|
+
values.forEach(function (index, keyIndex) {
|
413
|
+
nowDateObj[keyOptions[keyIndex]] = index;
|
414
|
+
});
|
415
|
+
newTs = _convertObjToTs(nowDateObj, currentTs);
|
416
|
+
}
|
288
417
|
|
289
418
|
if (onOk) {
|
290
419
|
onOk(newTs, nowDateObj);
|
@@ -318,6 +447,24 @@
|
|
318
447
|
return options;
|
319
448
|
}
|
320
449
|
|
450
|
+
function _updateTimeScope(isLeft) {
|
451
|
+
var nowMaxTs, nowMinTs;
|
452
|
+
|
453
|
+
if (isLeft || activeTabIndex === 0) {
|
454
|
+
nowMaxTs = typeof userSetMaxTs === 'number' ? userSetMaxTs : userSetMaxTs.startTs;
|
455
|
+
nowMinTs = Math.min(nowMaxTs, typeof userSetMinTs === 'number' ? userSetMinTs : userSetMinTs.startTs);
|
456
|
+
} else {
|
457
|
+
nowMinTs = Math.max(Math.min(typeof userSetMaxTs === 'number' ? userSetMaxTs : userSetMaxTs.startTs, leftTimeValue), typeof userSetMinTs === 'number' ? userSetMinTs : userSetMinTs.endTs);
|
458
|
+
nowMaxTs = Math.max(nowMinTs, typeof userSetMaxTs === 'number' ? userSetMaxTs : userSetMaxTs.endTs);
|
459
|
+
}
|
460
|
+
|
461
|
+
return [nowMinTs, nowMaxTs];
|
462
|
+
}
|
463
|
+
|
464
|
+
function _chooseTimeActive(index) {
|
465
|
+
setActiveTabIndex(index);
|
466
|
+
}
|
467
|
+
|
321
468
|
(0, _react.useEffect)(function () {
|
322
469
|
minDateObjRef.current = _convertTsToDateObj(minTs);
|
323
470
|
currentDateObjRef.current = _convertTsToDateObj(currentTs);
|
@@ -325,9 +472,45 @@
|
|
325
472
|
|
326
473
|
_initData();
|
327
474
|
}, [currentTs, minTs, maxTs, useUTC]);
|
475
|
+
(0, _react.useEffect)(function () {
|
476
|
+
var nowCurrentTs;
|
477
|
+
|
478
|
+
if (isRange) {
|
479
|
+
nowCurrentTs = Math.min(maxTs, Math.max(minTs, activeTabIndex === 0 ? leftTimeValue : rightTimeValue));
|
480
|
+
|
481
|
+
if (currentTs === nowCurrentTs) {
|
482
|
+
_updateRangeValue(currentTs);
|
483
|
+
}
|
484
|
+
} else {
|
485
|
+
nowCurrentTs = Math.min(maxTs, Math.max(minTs, currentTs));
|
486
|
+
}
|
487
|
+
|
488
|
+
setCurrentTs(nowCurrentTs);
|
489
|
+
}, [minTs, maxTs]);
|
490
|
+
(0, _react.useEffect)(function () {
|
491
|
+
_updateRangeValue(currentTs);
|
492
|
+
}, [currentTs]);
|
328
493
|
(0, _react.useEffect)(function () {
|
329
494
|
if (visible) {
|
330
|
-
|
495
|
+
// 初始化当前时间
|
496
|
+
if (isRange) {
|
497
|
+
setActiveTabIndex(0);
|
498
|
+
setLeftTimeValue(userSetCurrentTs[0]);
|
499
|
+
setRightTimeValue(userSetCurrentTs[1]);
|
500
|
+
|
501
|
+
var _updateTimeScope2 = _updateTimeScope(true),
|
502
|
+
nowMinTs = _updateTimeScope2[0],
|
503
|
+
nowMaxTs = _updateTimeScope2[1];
|
504
|
+
|
505
|
+
var nowCurrentTs = Math.min(nowMaxTs, Math.max(nowMinTs, userSetCurrentTs[0]));
|
506
|
+
setCurrentTs(nowCurrentTs);
|
507
|
+
|
508
|
+
if (currentTs === nowCurrentTs) {
|
509
|
+
_updateRangeValue(currentTs);
|
510
|
+
}
|
511
|
+
} else {
|
512
|
+
setCurrentTs(Math.min(maxTs, Math.max(minTs, userSetCurrentTs)));
|
513
|
+
}
|
331
514
|
|
332
515
|
_initData();
|
333
516
|
}
|
@@ -344,6 +527,23 @@
|
|
344
527
|
onPickerChange: _handlePickerChange,
|
345
528
|
onOk: _handlePickerConfirm,
|
346
529
|
touchToStop: touchToStop,
|
530
|
+
renderExtraHeader: isRange ? function () {
|
531
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
532
|
+
className: prefixCls + "-date-picker-show"
|
533
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
534
|
+
className: (0, _mobileUtils.cls)("" + (activeTabIndex === 0 ? prefixCls + "-date-picker-range-item-active" : ''), prefixCls + "-date-picker-range-item"),
|
535
|
+
onClick: function onClick() {
|
536
|
+
return _chooseTimeActive(0);
|
537
|
+
}
|
538
|
+
}, leftTimeString), renderSeparator ? renderSeparator() : /*#__PURE__*/_react.default.createElement("span", {
|
539
|
+
className: prefixCls + "-date-picker-show-separate"
|
540
|
+
}, "~"), /*#__PURE__*/_react.default.createElement("span", {
|
541
|
+
className: (0, _mobileUtils.cls)("" + (activeTabIndex === 1 ? prefixCls + "-date-picker-range-item-active" : ''), prefixCls + "-date-picker-range-item"),
|
542
|
+
onClick: function onClick() {
|
543
|
+
return _chooseTimeActive(1);
|
544
|
+
}
|
545
|
+
}, rightTimeString));
|
546
|
+
} : undefined,
|
347
547
|
renderLinkedContainer: renderLinkedContainer ? function () {
|
348
548
|
return renderLinkedContainer((0, _mobileUtils.isEmptyValue)(props.currentTs) ? undefined : currentTs, keyOptions);
|
349
549
|
} : undefined
|
@@ -510,6 +510,41 @@
|
|
510
510
|
* }
|
511
511
|
* ```
|
512
512
|
*/
|
513
|
+
.arco-date-picker-show {
|
514
|
+
display: -webkit-box;
|
515
|
+
display: -webkit-flex;
|
516
|
+
display: flex;
|
517
|
+
font-size: 0.32rem ;
|
518
|
+
padding: 0 0.32rem ;
|
519
|
+
color: #c9cdd4 ;
|
520
|
+
min-height: 0.96rem ;
|
521
|
+
background-color: #FBFCFC ;
|
522
|
+
}
|
523
|
+
.arco-date-picker-show > span {
|
524
|
+
display: -webkit-box;
|
525
|
+
display: -webkit-flex;
|
526
|
+
display: flex;
|
527
|
+
-webkit-box-align: center;
|
528
|
+
-webkit-align-items: center;
|
529
|
+
align-items: center;
|
530
|
+
-webkit-box-pack: center;
|
531
|
+
-webkit-justify-content: center;
|
532
|
+
justify-content: center;
|
533
|
+
}
|
534
|
+
.arco-date-picker-show-separate {
|
535
|
+
-webkit-box-flex: 0;
|
536
|
+
-webkit-flex: 0 1 auto;
|
537
|
+
flex: 0 1 auto;
|
538
|
+
min-width: 0.96rem ;
|
539
|
+
}
|
540
|
+
.arco-date-picker-range-item {
|
541
|
+
-webkit-box-flex: 1;
|
542
|
+
-webkit-flex: 1 0 auto;
|
543
|
+
flex: 1 0 auto;
|
544
|
+
}
|
545
|
+
.arco-date-picker-range-item-active {
|
546
|
+
color: #1d2129 ;
|
547
|
+
}
|
513
548
|
/***************************************************
|
514
549
|
* *
|
515
550
|
* Arco Theme Style *
|
@@ -523,4 +558,11 @@
|
|
523
558
|
background: #2e2e30 ;
|
524
559
|
color: #929293 ;
|
525
560
|
}
|
561
|
+
.arco-theme-dark .arco-date-picker-show {
|
562
|
+
color: #5f5f60 ;
|
563
|
+
background-color: #1E1E1E ;
|
564
|
+
}
|
565
|
+
.arco-theme-dark .arco-date-picker-range-item-active {
|
566
|
+
color: #f6f6f6 ;
|
567
|
+
}
|
526
568
|
/********************* End *************************/
|
@@ -1,7 +1,29 @@
|
|
1
1
|
@import '../../../style/mixin.less';
|
2
2
|
|
3
3
|
.@{prefix}-date-picker {
|
4
|
-
|
4
|
+
&-show {
|
5
|
+
display: flex;
|
6
|
+
.use-var(font-size, date-picker-range-font-size);
|
7
|
+
.use-var(padding, date-picker-range-show-padding);
|
8
|
+
.use-var(color, date-picker-range-disabled-font-color);
|
9
|
+
.use-var(min-height, date-picker-range-show-min-height);
|
10
|
+
.use-var(background-color, date-picker-range-background-color);
|
11
|
+
& > span {
|
12
|
+
display: flex;
|
13
|
+
align-items: center;
|
14
|
+
justify-content: center;
|
15
|
+
}
|
16
|
+
&-separate {
|
17
|
+
flex: 0 1 auto;
|
18
|
+
.use-var(min-width, date-picker-range-separate-min-width);
|
19
|
+
}
|
20
|
+
}
|
21
|
+
&-range-item {
|
22
|
+
flex: 1 0 auto;
|
23
|
+
&-active {
|
24
|
+
.use-var(color, date-picker-range-font-color);
|
25
|
+
}
|
26
|
+
}
|
5
27
|
}
|
6
28
|
|
7
29
|
/***************************************************
|
@@ -26,5 +48,20 @@
|
|
26
48
|
.use-var(color, dark-sub-info-font-color);
|
27
49
|
}
|
28
50
|
}
|
51
|
+
.@{prefix}-date-picker {
|
52
|
+
&-show {
|
53
|
+
@{arco-dark-mode-selector} & {
|
54
|
+
.use-var(color, dark-date-picker-range-disabled-font-color);
|
55
|
+
.use-var(background-color, dark-date-picker-range-background-color);
|
56
|
+
}
|
57
|
+
}
|
58
|
+
&-range-item {
|
59
|
+
&-active {
|
60
|
+
@{arco-dark-mode-selector} & {
|
61
|
+
.use-var(color, dark-date-picker-range-font-color);
|
62
|
+
}
|
63
|
+
}
|
64
|
+
}
|
65
|
+
}
|
29
66
|
}
|
30
67
|
/********************* End *************************/
|