@pisell/date-picker 1.0.22 → 1.0.24
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/es/ActionBar/index.d.ts +2 -3
- package/es/ActionBar/index.js +4 -4
- package/es/PisellDateRangePicker/index.d.ts +2 -2
- package/es/PisellDateRangePicker/index.js +8 -5
- package/lib/ActionBar/index.d.ts +2 -3
- package/lib/ActionBar/index.js +2 -2
- package/lib/PisellDateRangePicker/index.d.ts +2 -2
- package/lib/PisellDateRangePicker/index.js +7 -6
- package/package.json +2 -2
package/es/ActionBar/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { Dayjs } from "dayjs";
|
|
3
2
|
import "./index.less";
|
|
4
3
|
interface ActionBarProps {
|
|
@@ -7,9 +6,9 @@ interface ActionBarProps {
|
|
|
7
6
|
onChange: (val: any[], type?: "time") => void;
|
|
8
7
|
onOk: () => void;
|
|
9
8
|
showTime?: boolean | {
|
|
10
|
-
defaultValue:
|
|
9
|
+
defaultValue: Dayjs;
|
|
11
10
|
[key: string]: any;
|
|
12
|
-
};
|
|
11
|
+
}[];
|
|
13
12
|
}
|
|
14
13
|
declare const ActionBar: (props: ActionBarProps) => JSX.Element;
|
|
15
14
|
export default ActionBar;
|
package/es/ActionBar/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
1
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
3
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
4
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
5
|
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
6
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
7
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
8
8
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
9
9
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
10
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -14,7 +14,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
14
14
|
import React, { useMemo } from "react";
|
|
15
15
|
import classNames from "classnames";
|
|
16
16
|
import { Button, Space, TimePicker } from "antd";
|
|
17
|
-
import { isMobile } from "@pisell/utils";
|
|
17
|
+
import { isArr, isMobile } from "@pisell/utils";
|
|
18
18
|
import dayjs from "dayjs";
|
|
19
19
|
import { getText } from "../locales";
|
|
20
20
|
import "./index.less";
|
|
@@ -53,13 +53,13 @@ var ActionBar = function ActionBar(props) {
|
|
|
53
53
|
};
|
|
54
54
|
}, []);
|
|
55
55
|
var startTimeProps = useMemo(function () {
|
|
56
|
-
if (
|
|
56
|
+
if (isArr(showTime) && showTime[0]) {
|
|
57
57
|
return showTime[0];
|
|
58
58
|
}
|
|
59
59
|
return {};
|
|
60
60
|
}, [showTime]);
|
|
61
61
|
var endTimeProps = useMemo(function () {
|
|
62
|
-
if (
|
|
62
|
+
if (isArr(showTime) && showTime[1]) {
|
|
63
63
|
return showTime[1];
|
|
64
64
|
}
|
|
65
65
|
return {};
|
|
@@ -9,9 +9,9 @@ export interface PisellDateRangePickerProps {
|
|
|
9
9
|
presets?: PresetType[];
|
|
10
10
|
className?: string;
|
|
11
11
|
showTime?: boolean | {
|
|
12
|
-
defaultValue:
|
|
12
|
+
defaultValue: Dayjs;
|
|
13
13
|
[key: string]: any;
|
|
14
|
-
};
|
|
14
|
+
}[];
|
|
15
15
|
placeholder?: string;
|
|
16
16
|
disabledDate?: (day: Dayjs, position: "start" | "end", value: Dayjs[]) => boolean;
|
|
17
17
|
format?: string;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
2
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
3
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -11,7 +10,7 @@ import ActionBar from "../ActionBar";
|
|
|
11
10
|
import Shortcuts from "../Shortcuts";
|
|
12
11
|
import { SingleInputDateRangeField } from "../SingleInputDateRangeField";
|
|
13
12
|
import classNames from "classnames";
|
|
14
|
-
import { isBoolean } from "@pisell/utils";
|
|
13
|
+
import { isArr, isBoolean } from "@pisell/utils";
|
|
15
14
|
import "./index.less";
|
|
16
15
|
import useCssVariables from "./useCssVariables";
|
|
17
16
|
var transDayjsArr = function transDayjsArr(dayjsArr, defaultValue) {
|
|
@@ -89,10 +88,14 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
|
|
|
89
88
|
}, [presets]);
|
|
90
89
|
var handleChange = function handleChange(val, type) {
|
|
91
90
|
var newVal = val;
|
|
92
|
-
if (
|
|
91
|
+
if (isArr(showTime) && type !== "time") {
|
|
93
92
|
newVal = newVal.map(function (item, index) {
|
|
94
|
-
var _showTime$
|
|
95
|
-
|
|
93
|
+
var _showTime$index;
|
|
94
|
+
if (showTime !== null && showTime !== void 0 && (_showTime$index = showTime[index]) !== null && _showTime$index !== void 0 && _showTime$index.defaultValue) {
|
|
95
|
+
var _showTime$index2, _showTime$index2$defa, _showTime$index3, _showTime$index3$defa, _showTime$index4, _showTime$index4$defa;
|
|
96
|
+
return item === null || item === void 0 ? void 0 : item.set("hour", (_showTime$index2 = showTime[index]) === null || _showTime$index2 === void 0 ? void 0 : (_showTime$index2$defa = _showTime$index2.defaultValue) === null || _showTime$index2$defa === void 0 ? void 0 : _showTime$index2$defa.get("hour")).set("minute", (_showTime$index3 = showTime[index]) === null || _showTime$index3 === void 0 ? void 0 : (_showTime$index3$defa = _showTime$index3.defaultValue) === null || _showTime$index3$defa === void 0 ? void 0 : _showTime$index3$defa.get("minute")).set("second", (_showTime$index4 = showTime[index]) === null || _showTime$index4 === void 0 ? void 0 : (_showTime$index4$defa = _showTime$index4.defaultValue) === null || _showTime$index4$defa === void 0 ? void 0 : _showTime$index4$defa.get("second"));
|
|
97
|
+
}
|
|
98
|
+
return item;
|
|
96
99
|
});
|
|
97
100
|
}
|
|
98
101
|
setValue(newVal);
|
package/lib/ActionBar/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { Dayjs } from "dayjs";
|
|
3
2
|
import "./index.less";
|
|
4
3
|
interface ActionBarProps {
|
|
@@ -7,9 +6,9 @@ interface ActionBarProps {
|
|
|
7
6
|
onChange: (val: any[], type?: "time") => void;
|
|
8
7
|
onOk: () => void;
|
|
9
8
|
showTime?: boolean | {
|
|
10
|
-
defaultValue:
|
|
9
|
+
defaultValue: Dayjs;
|
|
11
10
|
[key: string]: any;
|
|
12
|
-
};
|
|
11
|
+
}[];
|
|
13
12
|
}
|
|
14
13
|
declare const ActionBar: (props: ActionBarProps) => JSX.Element;
|
|
15
14
|
export default ActionBar;
|
package/lib/ActionBar/index.js
CHANGED
|
@@ -68,13 +68,13 @@ var ActionBar = (props) => {
|
|
|
68
68
|
};
|
|
69
69
|
}, []);
|
|
70
70
|
const startTimeProps = (0, import_react.useMemo)(() => {
|
|
71
|
-
if (
|
|
71
|
+
if ((0, import_utils.isArr)(showTime) && showTime[0]) {
|
|
72
72
|
return showTime[0];
|
|
73
73
|
}
|
|
74
74
|
return {};
|
|
75
75
|
}, [showTime]);
|
|
76
76
|
const endTimeProps = (0, import_react.useMemo)(() => {
|
|
77
|
-
if (
|
|
77
|
+
if ((0, import_utils.isArr)(showTime) && showTime[1]) {
|
|
78
78
|
return showTime[1];
|
|
79
79
|
}
|
|
80
80
|
return {};
|
|
@@ -9,9 +9,9 @@ export interface PisellDateRangePickerProps {
|
|
|
9
9
|
presets?: PresetType[];
|
|
10
10
|
className?: string;
|
|
11
11
|
showTime?: boolean | {
|
|
12
|
-
defaultValue:
|
|
12
|
+
defaultValue: Dayjs;
|
|
13
13
|
[key: string]: any;
|
|
14
|
-
};
|
|
14
|
+
}[];
|
|
15
15
|
placeholder?: string;
|
|
16
16
|
disabledDate?: (day: Dayjs, position: "start" | "end", value: Dayjs[]) => boolean;
|
|
17
17
|
format?: string;
|
|
@@ -106,13 +106,14 @@ var PisellDateRangePicker = (props) => {
|
|
|
106
106
|
}, [presets]);
|
|
107
107
|
const handleChange = (val, type) => {
|
|
108
108
|
let newVal = val;
|
|
109
|
-
if (
|
|
110
|
-
newVal = newVal.map(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
return
|
|
109
|
+
if ((0, import_utils.isArr)(showTime) && type !== "time") {
|
|
110
|
+
newVal = newVal.map((item, index) => {
|
|
111
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
112
|
+
if ((_a = showTime == null ? void 0 : showTime[index]) == null ? void 0 : _a.defaultValue) {
|
|
113
|
+
return item == null ? void 0 : item.set("hour", (_c = (_b = showTime[index]) == null ? void 0 : _b.defaultValue) == null ? void 0 : _c.get("hour")).set("minute", (_e = (_d = showTime[index]) == null ? void 0 : _d.defaultValue) == null ? void 0 : _e.get("minute")).set("second", (_g = (_f = showTime[index]) == null ? void 0 : _f.defaultValue) == null ? void 0 : _g.get("second"));
|
|
114
114
|
}
|
|
115
|
-
|
|
115
|
+
return item;
|
|
116
|
+
});
|
|
116
117
|
}
|
|
117
118
|
setValue(newVal);
|
|
118
119
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/date-picker",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.24",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"*.less"
|
|
6
6
|
],
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"antd": "^5.5.0",
|
|
27
27
|
"react": "^18.0.0",
|
|
28
28
|
"react-dom": "^18.0.0",
|
|
29
|
-
"@pisell/utils": "1.0.
|
|
29
|
+
"@pisell/utils": "1.0.4"
|
|
30
30
|
},
|
|
31
31
|
"files": [
|
|
32
32
|
"es",
|