shineout 3.7.0-beta.37 → 3.7.0-beta.39
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/cjs/date-picker/date-picker.js +28 -1
- package/cjs/index.js +1 -1
- package/dist/shineout.js +89 -31
- package/dist/shineout.js.map +1 -1
- package/dist/shineout.min.js +1 -1
- package/dist/shineout.min.js.map +1 -1
- package/esm/date-picker/date-picker.js +29 -2
- package/esm/index.js +1 -1
- package/package.json +5 -5
|
@@ -4,8 +4,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
-
import {
|
|
7
|
+
import { useMemo } from 'react';
|
|
8
|
+
import { DatePicker, getLocale, useConfig } from '@sheinx/base';
|
|
8
9
|
import { useButtonStyle, useDatePickerStyle, useInnerTitleStyle, usePopoverStyle, useLinkStyle } from '@sheinx/shineout-style';
|
|
10
|
+
import { convertValueToDateArr, getFormat, getFormatValueArr } from '@sheinx/hooks';
|
|
9
11
|
import useFieldCommon from "../hooks/use-field-common";
|
|
10
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
13
|
var jssStyle = {
|
|
@@ -21,5 +23,30 @@ var BaseDatePicker = function BaseDatePicker(props) {
|
|
|
21
23
|
}, props));
|
|
22
24
|
};
|
|
23
25
|
export default (function (props) {
|
|
24
|
-
|
|
26
|
+
var _useConfig = useConfig(),
|
|
27
|
+
locale = _useConfig.locale;
|
|
28
|
+
|
|
29
|
+
// datepicker 默认值需要提格式化前处理,否则内部会根据 format 进行格式化并再次触发 onChange,参考 v1 v2 的 value hoc 行为
|
|
30
|
+
var defaultValue = useMemo(function () {
|
|
31
|
+
if (props.defaultValue) {
|
|
32
|
+
var options = {
|
|
33
|
+
timeZone: props.timeZone,
|
|
34
|
+
weekStartsOn: Number(getLocale(locale, 'startOfWeek'))
|
|
35
|
+
};
|
|
36
|
+
var type = props.type || 'date';
|
|
37
|
+
var format = getFormat(props.format, type);
|
|
38
|
+
var dateArr = convertValueToDateArr(props.defaultValue, format, options);
|
|
39
|
+
var formattedDefaultValue = getFormatValueArr({
|
|
40
|
+
dateArr: dateArr,
|
|
41
|
+
format: format,
|
|
42
|
+
type: type,
|
|
43
|
+
options: options
|
|
44
|
+
});
|
|
45
|
+
return props.range ? formattedDefaultValue : formattedDefaultValue[0];
|
|
46
|
+
}
|
|
47
|
+
return props.defaultValue;
|
|
48
|
+
}, []);
|
|
49
|
+
return useFieldCommon(_objectSpread(_objectSpread({}, props), {}, {
|
|
50
|
+
defaultValue: defaultValue
|
|
51
|
+
}), BaseDatePicker);
|
|
25
52
|
});
|
package/esm/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shineout",
|
|
3
|
-
"version": "3.7.0-beta.
|
|
3
|
+
"version": "3.7.0-beta.39",
|
|
4
4
|
"description": "A components library for React",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"module": "./esm/index.js",
|
|
17
17
|
"typings": "./cjs/index.d.ts",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@sheinx/base": "3.7.0-beta.
|
|
20
|
-
"@sheinx/hooks": "3.7.0-beta.
|
|
21
|
-
"@sheinx/shineout-style": "3.7.0-beta.
|
|
22
|
-
"@sheinx/theme": "3.7.0-beta.
|
|
19
|
+
"@sheinx/base": "3.7.0-beta.39",
|
|
20
|
+
"@sheinx/hooks": "3.7.0-beta.39",
|
|
21
|
+
"@sheinx/shineout-style": "3.7.0-beta.39",
|
|
22
|
+
"@sheinx/theme": "3.7.0-beta.39",
|
|
23
23
|
"classnames": "^2.0.0",
|
|
24
24
|
"immer": "^10.0.0",
|
|
25
25
|
"deep-eql": "^4.0.0"
|