@zgfe/business-lib 1.2.33-hrFix.1 → 1.2.33-hrFix.5

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.
@@ -92,7 +92,8 @@ var ValuesList = function ValuesList(props) {
92
92
  return value === '1' ? 3600 : value === '2' ? 60 : 1;
93
93
  };
94
94
  var disabledDate = function disabledDate(current) {
95
- return current && current > moment().endOf('day');
95
+ if (!current) return false;
96
+ return current.isAfter(moment().endOf('day')) || current.isBefore(moment().subtract(2, 'years').startOf('day'));
96
97
  };
97
98
  if (!attr || !operate || isFirst) {
98
99
  return /*#__PURE__*/React.createElement("div", {
@@ -33,7 +33,7 @@ var BizDate = function BizDate(_ref) {
33
33
  function disabledDate(current) {
34
34
  var step = includeToday ? 0 : 1;
35
35
  var max = moment().subtract(step, 'days');
36
- var _timeRangeOpen = timeRangeOpen || 12;
36
+ var _timeRangeOpen = timeRangeOpen || 24;
37
37
  if (envs === null || envs === void 0 ? void 0 : envs.timeRangeOpen) {
38
38
  _timeRangeOpen = typeof (envs === null || envs === void 0 ? void 0 : envs.timeRangeOpen) === 'boolean' ? (envs === null || envs === void 0 ? void 0 : envs.timeRangeOpen) ? 200 : 12 : envs === null || envs === void 0 ? void 0 : envs.timeRangeOpen;
39
39
  }
@@ -106,7 +106,7 @@ var BizDate = function BizDate(_ref) {
106
106
  disabledDate: disabledDate,
107
107
  onOpenChange: function onOpenChange(open) {
108
108
  if (BizDateBeyondRange) {
109
- message.error("\u65F6\u95F4\u6BB5\u6700\u5927\u652F\u6301".concat(selectRange ? selectRange : 12).concat(selectRangeUnitText));
109
+ message.error("\u65F6\u95F4\u6BB5\u6700\u5927\u652F\u6301".concat(selectRange ? selectRange : 24).concat(selectRangeUnitText));
110
110
  BizDateBeyondRange = false;
111
111
  }
112
112
  _onOpenChange && _onOpenChange(open);
@@ -116,7 +116,7 @@ var BizDate = function BizDate(_ref) {
116
116
  if (includeToday && value && value.length === 2 && isTodayInRange(value[0], value[1])) {
117
117
  subtractDays = 1;
118
118
  }
119
- if (value && value.length === 2 && moment(_.cloneDeep(value[1]).subtract(subtractDays, 'days').format('YYYY-MM-DD')).diff(moment(value[0].format('YYYY-MM-DD')), selectRangeUnit || 'months') >= (selectRange ? selectRange : 12)) {
119
+ if (value && value.length === 2 && moment(_.cloneDeep(value[1]).subtract(subtractDays, 'days').format('YYYY-MM-DD')).diff(moment(value[0].format('YYYY-MM-DD')), selectRangeUnit || 'months') >= (selectRange ? selectRange : 24)) {
120
120
  BizDateBeyondRange = true;
121
121
  return;
122
122
  }
@@ -10,6 +10,7 @@ import { classPrefix } from '../..';
10
10
  import moment from 'moment';
11
11
  import { DatePicker, Input } from 'antd';
12
12
  import { PropType } from '../../types';
13
+ import { disabledAbsoluteDate } from '../../util';
13
14
  var RangePicker = DatePicker.RangePicker;
14
15
  var ParamsCondition = function ParamsCondition(props) {
15
16
  var condition = props.condition,
@@ -78,7 +79,8 @@ var ParamsCondition = function ParamsCondition(props) {
78
79
  size: "middle",
79
80
  defaultValue: [moment(condition.attrs[index].params[0]), moment(condition.attrs[index].params[1])],
80
81
  onChange: onDateChange,
81
- allowClear: false
82
+ allowClear: false,
83
+ disabledDate: disabledAbsoluteDate
82
84
  })) : null));
83
85
  };
84
86
  export default ParamsCondition;
@@ -19,6 +19,7 @@ import { dateOperate, numberOperate, stringOperate } from '../../attrConditions/
19
19
  import { DatePicker, Input } from 'antd';
20
20
  import moment from 'moment';
21
21
  import { BizUserConditionContext } from '..';
22
+ import { disabledAbsoluteDate } from '../util';
22
23
  import request from '../../utils/ajax';
23
24
  import Apis from '../../constants/apis';
24
25
  import BizGlobalDataContext from '../../context';
@@ -215,7 +216,8 @@ var CdpConditionItem = function CdpConditionItem(props) {
215
216
  }(),
216
217
  onChange: function onChange() {
217
218
  setFieldValue(arguments.length <= 1 ? undefined : arguments[1]);
218
- }
219
+ },
220
+ disabledDate: disabledAbsoluteDate
219
221
  });
220
222
  if ((operator === null || operator === void 0 ? void 0 : operator.value) === 'relative') return /*#__PURE__*/React.createElement(Input, {
221
223
  key: "relative-date",
@@ -19,6 +19,7 @@ import { dateOperate, numberOperateCsh, numberTypeCsh, stringOperate, numberOper
19
19
  import { DatePicker, Input } from 'antd';
20
20
  import moment from 'moment';
21
21
  import { BizUserConditionContext } from '..';
22
+ import { disabledAbsoluteDate } from '../util';
22
23
  import request from '../../utils/ajax';
23
24
  import Apis from '../../constants/apis';
24
25
  import BizGlobalDataContext from '../../context';
@@ -328,7 +329,8 @@ var CdpConditionItem = function CdpConditionItem(props) {
328
329
  }(),
329
330
  onChange: function onChange() {
330
331
  setFieldValue(arguments.length <= 1 ? undefined : arguments[1]);
331
- }
332
+ },
333
+ disabledDate: disabledAbsoluteDate
332
334
  });
333
335
  if ((operator === null || operator === void 0 ? void 0 : operator.value) === 'relative') return /*#__PURE__*/React.createElement(Input, {
334
336
  key: "relative-date",
@@ -10,6 +10,7 @@ import moment from 'moment';
10
10
  import '../styles/periodCondition.less';
11
11
  import { classPrefix } from '../..';
12
12
  import { operatorMap } from '../constants';
13
+ import { disabledAbsoluteDate } from '../../util';
13
14
  import BizSelect from '../../../select';
14
15
  import RunTimesCondition from './runTimesCondition';
15
16
  var RangePicker = DatePicker.RangePicker;
@@ -102,7 +103,8 @@ var RunPeriodCondition = function RunPeriodCondition(props) {
102
103
  size: "middle",
103
104
  defaultValue: [moment(values[0]), moment(values[1])],
104
105
  onChange: onDateChange,
105
- allowClear: false
106
+ allowClear: false,
107
+ disabledDate: disabledAbsoluteDate
106
108
  });
107
109
  }
108
110
  }
@@ -11,6 +11,7 @@ import moment from 'moment';
11
11
  import './styles/periodCondition.less';
12
12
  import { classPrefix } from '..';
13
13
  import { operatorMap } from './constants';
14
+ import { disabledAbsoluteDate } from '../util';
14
15
  var RangePicker = DatePicker.RangePicker;
15
16
  var PeriodCondition = function PeriodCondition(props) {
16
17
  var dataId = props.dataId,
@@ -105,7 +106,8 @@ var PeriodCondition = function PeriodCondition(props) {
105
106
  size: "middle",
106
107
  defaultValue: [moment(values[0]), moment(values[1])],
107
108
  onChange: onDateChange,
108
- allowClear: false
109
+ allowClear: false,
110
+ disabledDate: disabledAbsoluteDate
109
111
  });
110
112
  }
111
113
  }
@@ -1,5 +1,7 @@
1
+ import moment from 'moment';
1
2
  import type { GlobalContextProps } from '../context';
2
3
  import type { BizUserConditionT, Unpacked } from './types';
4
+ export declare function disabledAbsoluteDate(current: moment.Moment): boolean;
3
5
  export declare function buildCondition(type: BizUserConditionT.ConditionType): BizUserConditionT.BusinessCondition | BizUserConditionT.EventCondition | BizUserConditionT.AddCondition | BizUserConditionT.OrderCondition | BizUserConditionT.ActiveCondition | BizUserConditionT.PropCondition | BizUserConditionT.CdpCondition | BizUserConditionT.CdpCshCondition;
4
6
  export declare function transformNumberOperate(key: string, output?: boolean): string;
5
7
  export declare function findEvent(eventId: number, eventGroupList: Unpacked<GlobalContextProps, 'eventGroupList'>): import("../attributeSelector/types").AnalysisEvent | null;
@@ -4,7 +4,12 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
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(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
6
  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
+ import moment from 'moment';
7
8
  import { LabelCreateType } from './types';
9
+ export function disabledAbsoluteDate(current) {
10
+ if (!current) return false;
11
+ return current.isAfter(moment().endOf('day')) || current.isBefore(moment().subtract(2, 'years').startOf('day'));
12
+ }
8
13
  export function buildCondition(type) {
9
14
  switch (type) {
10
15
  case 'add':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/business-lib",
3
- "version": "1.2.33-hrFix.1",
3
+ "version": "1.2.33-hrFix.5",
4
4
  "module": "es/index.js",
5
5
  "typings": "es/index.d.ts",
6
6
  "files": [
@@ -55,7 +55,7 @@
55
55
  "react": "^16.12.0 || ^17.0.0",
56
56
  "yorkie": "^2.0.0"
57
57
  },
58
- "gitHead": "f91f93fe67340b40705b3926e192d5eb50ff5f95",
58
+ "gitHead": "845059a0eba0a2d3aca0262a6dd87175246624a9",
59
59
  "gitHooks": {
60
60
  "pre-commit": "lint-staged"
61
61
  }