@pinnacle0/web-ui 0.4.38 → 0.4.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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import dayjs from "dayjs";
|
|
2
3
|
import type { ControlledFormValue } from "../../internal/type";
|
|
3
4
|
import type { Dayjs } from "dayjs";
|
|
4
5
|
import "./index.less";
|
|
@@ -7,12 +8,18 @@ export interface Props<T extends boolean> extends ControlledFormValue<T extends
|
|
|
7
8
|
disabled?: boolean;
|
|
8
9
|
className?: string;
|
|
9
10
|
disabledRange?: (diffToToday: number, date: Date) => boolean;
|
|
10
|
-
ranges?: {
|
|
11
|
-
[range: string]: [Dayjs, Dayjs];
|
|
11
|
+
ranges?: "presets" | {
|
|
12
|
+
[range: string]: [Dayjs, Dayjs] | (() => [Dayjs, Dayjs]);
|
|
12
13
|
};
|
|
13
14
|
}
|
|
14
15
|
export declare class DateTimeRangePicker<T extends boolean> extends React.PureComponent<Props<T>> {
|
|
15
16
|
static displayName: string;
|
|
17
|
+
static showTime: {
|
|
18
|
+
defaultValue: dayjs.Dayjs[];
|
|
19
|
+
};
|
|
20
|
+
static presets: {
|
|
21
|
+
[range: string]: () => [Dayjs, Dayjs];
|
|
22
|
+
};
|
|
16
23
|
isDateDisabled: (current: Dayjs) => boolean;
|
|
17
24
|
onChange: (dates: [Dayjs | null, Dayjs | null] | null) => void;
|
|
18
25
|
render(): JSX.Element;
|
|
@@ -50,9 +50,19 @@ var DateTimeRangePicker = /** @class */ (function (_super) {
|
|
|
50
50
|
}
|
|
51
51
|
DateTimeRangePicker.prototype.render = function () {
|
|
52
52
|
var _a = this.props, value = _a.value, allowNull = _a.allowNull, disabled = _a.disabled, className = _a.className, ranges = _a.ranges;
|
|
53
|
-
return (React.createElement(AntDatePicker.RangePicker, { className: className, value: value[0] && value[1] ? [dayjs(value[0]), dayjs(value[1])] : [null, null], onChange: this.onChange, disabledDate: this.isDateDisabled, allowClear: allowNull, disabled: disabled, ranges: ranges, showTime:
|
|
53
|
+
return (React.createElement(AntDatePicker.RangePicker, { className: className, value: value[0] && value[1] ? [dayjs(value[0]), dayjs(value[1])] : [null, null], onChange: this.onChange, disabledDate: this.isDateDisabled, allowClear: allowNull, disabled: disabled, ranges: ranges === "presets" ? DateTimeRangePicker.presets : ranges, showTime: DateTimeRangePicker.showTime }));
|
|
54
54
|
};
|
|
55
55
|
DateTimeRangePicker.displayName = "DateTimeRangePicker";
|
|
56
|
+
DateTimeRangePicker.showTime = {
|
|
57
|
+
defaultValue: [dayjs().startOf("day"), dayjs().endOf("day")],
|
|
58
|
+
};
|
|
59
|
+
// Arrow function is used to ensure correct calculation of today when website have opened across days
|
|
60
|
+
DateTimeRangePicker.presets = {
|
|
61
|
+
当天: function () { return [dayjs().startOf("day"), dayjs().endOf("day")]; },
|
|
62
|
+
近7天: function () { return [dayjs().startOf("day").add(-6, "day"), dayjs().endOf("day")]; },
|
|
63
|
+
近30天: function () { return [dayjs().startOf("day").add(-29, "day"), dayjs().endOf("day")]; },
|
|
64
|
+
近90天: function () { return [dayjs().startOf("day").add(-89, "day"), dayjs().endOf("day")]; },
|
|
65
|
+
};
|
|
56
66
|
return DateTimeRangePicker;
|
|
57
67
|
}(React.PureComponent));
|
|
58
68
|
export { DateTimeRangePicker };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/DateTimeRangePicker/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAG/C,OAAO,cAAc,CAAC;AAWtB;IAA4D,uCAA6B;IAAzF;QAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/DateTimeRangePicker/index.tsx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AE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAA7D,CAA6D;QACxE,IAAI,EAAE,cAAM,OAAA,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAA9D,CAA8D;QAC1E,IAAI,EAAE,cAAM,OAAA,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAA9D,CAA8D;KAC7E,CAAC;IA4CN,0BAAC;CAAA,AAvDD,CAA4D,KAAK,CAAC,aAAa,GAuD9E;SAvDY,mBAAmB"}
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
|
|
21
21
|
&.top-right {
|
|
22
22
|
cursor: nesw-resize;
|
|
23
|
-
width: @thickness;
|
|
24
|
-
height: @thickness;
|
|
25
|
-
top: -@
|
|
26
|
-
left: calc(100% - @
|
|
23
|
+
width: 2 * @thickness;
|
|
24
|
+
height: 2 * @thickness;
|
|
25
|
+
top: -@thickness;
|
|
26
|
+
left: calc(100% - @thickness);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
&.right {
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
|
|
37
37
|
&.bottom-right {
|
|
38
38
|
cursor: nwse-resize;
|
|
39
|
-
width: @thickness;
|
|
40
|
-
height: @thickness;
|
|
41
|
-
top: calc(100% - @
|
|
42
|
-
left: calc(100% - @
|
|
39
|
+
width: 2 * @thickness;
|
|
40
|
+
height: 2 * @thickness;
|
|
41
|
+
top: calc(100% - @thickness);
|
|
42
|
+
left: calc(100% - @thickness);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
&.bottom {
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
|
|
53
53
|
&.bottom-left {
|
|
54
54
|
cursor: nesw-resize;
|
|
55
|
-
width: @thickness;
|
|
56
|
-
height: @thickness;
|
|
57
|
-
top: calc(100% - @
|
|
58
|
-
left: -@
|
|
55
|
+
width: 2 * @thickness;
|
|
56
|
+
height: 2 * @thickness;
|
|
57
|
+
top: calc(100% - @thickness);
|
|
58
|
+
left: -@thickness;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
&.left {
|
|
@@ -68,10 +68,10 @@
|
|
|
68
68
|
|
|
69
69
|
&.top-left {
|
|
70
70
|
cursor: nwse-resize;
|
|
71
|
-
width: @thickness;
|
|
72
|
-
height: @thickness;
|
|
73
|
-
top: -@
|
|
74
|
-
left: -@
|
|
71
|
+
width: 2 * @thickness;
|
|
72
|
+
height: 2 * @thickness;
|
|
73
|
+
top: -@thickness;
|
|
74
|
+
left: -@thickness;
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pinnacle0/web-ui",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.39",
|
|
4
4
|
"author": "Pinnacle",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"sideEffects": [
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"react-dom": "18.2.0",
|
|
53
53
|
"react-router-dom": "5.3.0",
|
|
54
54
|
"typescript": "4.9.5",
|
|
55
|
-
"@pinnacle0/
|
|
56
|
-
"@pinnacle0/
|
|
55
|
+
"@pinnacle0/devtool-util": "1.2.2",
|
|
56
|
+
"@pinnacle0/webpack-util": "0.4.47"
|
|
57
57
|
},
|
|
58
58
|
"publishConfig": {
|
|
59
59
|
"directory": "build"
|