assui 3.1.37 → 3.1.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.
@@ -0,0 +1,3 @@
1
+ import './index.less';
2
+ import '../../label-condition-input/style';
3
+ import '../../label-select/style';
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ require("./index.less");
7
+ require("../../label-condition-input/style");
8
+ require("../../label-select/style");
@@ -0,0 +1,32 @@
1
+ @import '~antd/lib/style/index.less';
2
+ @import '../../style/themes/default.less';
3
+ @import '../../style/variables.less';
4
+
5
+ .label-condition-select {
6
+ display: flex;
7
+ align-items: center;
8
+ width: 100%;
9
+
10
+ &-selector {
11
+ width: 30%;
12
+ margin-right: 8px;
13
+ }
14
+
15
+ &-second-input {
16
+ width: 70%;
17
+ }
18
+
19
+ &-two-select-selector {
20
+ width: 50%;
21
+ margin-right: 8px;
22
+ }
23
+
24
+ &-only-selector {
25
+ width: 100%;
26
+ margin-right: 0;
27
+ }
28
+
29
+ &-second-select {
30
+ width: 50%;
31
+ }
32
+ }
@@ -98,6 +98,10 @@ var label_range_picker_1 = __importDefault(require("../label-range-picker"));
98
98
  var context_1 = __importDefault(require("../config-provider/context"));
99
99
  var messages_1 = __importDefault(require("../messages"));
100
100
  var utils_1 = require("./utils");
101
+ /** 1整天的毫秒数 */
102
+ var ONE_DAY_MILLISECOND = 1000 * 60 * 60 * 24;
103
+ /** 1分钟的毫秒数 */
104
+ var ONE_MINUTE_MILLISECOND = 1000 * 60;
101
105
  var RangePicker = date_picker_1["default"].RangePicker;
102
106
  var LabelCustomizeRangePicker = function LabelCustomizeRangePicker(props) {
103
107
  var customizeTimeList = props.customizeTimeList,
@@ -194,29 +198,38 @@ var LabelCustomizeRangePicker = function LabelCustomizeRangePicker(props) {
194
198
  var _c = __read(nextValue || [], 2),
195
199
  start = _c[0],
196
200
  end = _c[1];
197
- var nextStartDate = (_a = showTime ? start === null || start === void 0 ? void 0 : start.clone() : start === null || start === void 0 ? void 0 : start.clone().startOf('day')) !== null && _a !== void 0 ? _a : null;
198
- var nextEndDate = (_b = showTime ? end === null || end === void 0 ? void 0 : end.clone() : end === null || end === void 0 ? void 0 : end.clone().endOf('day')) !== null && _b !== void 0 ? _b : null;
201
+ var nextStartDate = (_a = showTime ? start === null || start === void 0 ? void 0 : start.clone().startOf('minute') : start === null || start === void 0 ? void 0 : start.clone().startOf('day')) !== null && _a !== void 0 ? _a : null;
202
+ var nextEndDate = (_b = showTime ? end === null || end === void 0 ? void 0 : end.clone().endOf('minute') : end === null || end === void 0 ? void 0 : end.clone().endOf('day')) !== null && _b !== void 0 ? _b : null;
199
203
  if (!nextStartDate && !nextEndDate) {
200
204
  return setDate(undefined);
201
205
  }
202
206
  if (!maxScope) {
203
207
  return setDate([nextStartDate, nextEndDate]);
204
208
  }
209
+ var timeDiffOfShowTime = maxScope * ONE_DAY_MILLISECOND - ONE_MINUTE_MILLISECOND;
205
210
  var _d = __read(date || [], 1),
206
211
  startDate = _d[0];
212
+ // 1. start和end都存在时
207
213
  if (nextStartDate && nextEndDate) {
208
- var isChangeStartData = !(startDate === null || startDate === void 0 ? void 0 : startDate.clone().isSame(nextStartDate, 'day'));
214
+ var isChangeStartData = !(startDate === null || startDate === void 0 ? void 0 : startDate.clone().isSame(nextStartDate));
215
+ var momentDiffDay = nextEndDate.diff(nextStartDate) / ONE_DAY_MILLISECOND;
216
+ // 更改start
209
217
  if (isChangeStartData) {
210
- if (nextEndDate.diff(nextStartDate, 'day') > maxScope) {
211
- nextEndDate = nextStartDate.clone().add(maxScope - 1, 'day').endOf('day');
218
+ // 时间差大于maxScope,则将end调整到期望范围
219
+ if (momentDiffDay > maxScope) {
220
+ nextEndDate = showTime ? nextStartDate.clone().add(timeDiffOfShowTime, 'milliseconds').endOf('minute') : nextStartDate.clone().add(maxScope - 1, 'day').endOf('day');
212
221
  }
213
- } else if (nextEndDate.diff(nextStartDate, 'day') > maxScope) {
214
- nextStartDate = nextEndDate.clone().subtract(maxScope - 1, 'day').startOf('day');
222
+ // 更改end
223
+ // 时间差大于maxScope,则将结start调整到期望范围
224
+ } else if (momentDiffDay > maxScope) {
225
+ nextStartDate = showTime ? nextEndDate.clone().subtract(timeDiffOfShowTime, 'milliseconds').startOf('minute') : nextEndDate.clone().subtract(maxScope - 1, 'day').startOf('day');
215
226
  }
227
+ // 2. 仅end存在时,自动填入start
216
228
  } else if (!nextStartDate && nextEndDate) {
217
- nextStartDate = nextEndDate.clone().subtract(maxScope - 1, 'day').startOf('day');
229
+ nextStartDate = showTime ? nextEndDate.clone().subtract(timeDiffOfShowTime, 'milliseconds').startOf('minute') : nextEndDate.clone().subtract(maxScope - 1, 'day').startOf('day');
230
+ // 3. 仅start存在时,自动填入end
218
231
  } else if (nextStartDate && !nextEndDate) {
219
- nextEndDate = nextStartDate.clone().add(maxScope - 1, 'day').endOf('day');
232
+ nextEndDate = showTime ? nextStartDate.clone().add(timeDiffOfShowTime, 'milliseconds').endOf('minute') : nextStartDate.clone().add(maxScope - 1, 'day').endOf('day');
220
233
  }
221
234
  if (nextStartDate && nextEndDate) {
222
235
  return setDate([nextStartDate, nextEndDate]);
@@ -236,7 +249,7 @@ var LabelCustomizeRangePicker = function LabelCustomizeRangePicker(props) {
236
249
  var _a = __read(item.value, 2),
237
250
  startTime = _a[0],
238
251
  entTime = _a[1];
239
- var space = entTime.diff(startTime, 'days');
252
+ var space = entTime.diff(startTime) / ONE_DAY_MILLISECOND;
240
253
  return space <= maxScope;
241
254
  }) : dataSource;
242
255
  var panelRender = function panelRender(panel) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assui",
3
- "version": "3.1.37",
3
+ "version": "3.1.39",
4
4
  "description": "react ui library",
5
5
  "author": "jason <usochen@gmail.com>",
6
6
  "main": "./lib/index.js",
@@ -35,7 +35,7 @@
35
35
  "@types/react-beautiful-dnd": "^13.1.2",
36
36
  "@types/react-color": "^3.0.6",
37
37
  "@types/react-resizable": "^3.0.0",
38
- "a-icons": "^1.1.59",
38
+ "a-icons": "^1.1.60",
39
39
  "aa-utils": "^2.1.20",
40
40
  "ahooks": "^3.0.8",
41
41
  "bignumber.js": "^9.0.1",
@@ -80,5 +80,5 @@
80
80
  "node": ">=10.0.0"
81
81
  },
82
82
  "license": "MIT",
83
- "gitHead": "67cf5a4b6cecda4b1b35735aad2b375da9eaf9c7"
83
+ "gitHead": "4afcd51627b4018b8ce4786236c590e28692f58e"
84
84
  }