@zgfe/business-lib 1.2.15-data.1 → 1.2.15-data.2

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.
@@ -86,6 +86,7 @@ export default (function () {
86
86
  showHour: true,
87
87
  options: customOptions,
88
88
  format: "HH",
89
+ minTime: "Now",
89
90
  onChange: onChange
90
91
  }), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, "Form")), /*#__PURE__*/React.createElement(Form, {
91
92
  form: form
@@ -1,4 +1,5 @@
1
1
  import { SizeType } from 'antd/es/config-provider/SizeContext';
2
+ import moment from 'moment';
2
3
  import React from 'react';
3
4
  import { BizSelectTypes } from '..';
4
5
  import './styles/index.less';
@@ -25,5 +26,7 @@ declare const BizCycleTime: React.FC<{
25
26
  showHour?: boolean;
26
27
  format?: string;
27
28
  options?: BizSelectTypes.Option[];
29
+ minTime?: moment.Moment | 'Now';
30
+ maxTime?: moment.Moment | 'Now';
28
31
  }>;
29
32
  export default BizCycleTime;
@@ -24,7 +24,9 @@ var BizCycleTime = function BizCycleTime(props) {
24
24
  size = props.size,
25
25
  disable = props.disable,
26
26
  showHour = props.showHour,
27
- options = props.options;
27
+ options = props.options,
28
+ minTime = props.minTime,
29
+ maxTime = props.maxTime;
28
30
  var classPrefix = 'biz-cycle-time';
29
31
  var unitList = options || [{
30
32
  label: '每日',
@@ -187,7 +189,17 @@ var BizCycleTime = function BizCycleTime(props) {
187
189
  disabled: disable,
188
190
  placeholder: props.placeholder,
189
191
  onChange: function onChange(time) {
190
- setTime(time === null || time === void 0 ? void 0 : time.format('YYYY-MM-DD HH:mm:ss'));
192
+ var _currentTime;
193
+ var currentTime = time;
194
+ if (minTime) {
195
+ var minData = minTime === 'Now' ? moment() : moment(minTime);
196
+ currentTime = minData < moment(time) ? time : minData;
197
+ }
198
+ if (maxTime) {
199
+ var maxData = maxTime === 'Now' ? moment() : moment(minTime);
200
+ currentTime = maxData > moment(time) ? time : maxData;
201
+ }
202
+ setTime((_currentTime = currentTime) === null || _currentTime === void 0 ? void 0 : _currentTime.format('YYYY-MM-DD HH:mm:ss'));
191
203
  },
192
204
  disabledTime: unit === null || unit === void 0 ? void 0 : unit.disabledTime,
193
205
  disabledDate: unit === null || unit === void 0 ? void 0 : unit.disabledDate
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/business-lib",
3
- "version": "1.2.15-data.1",
3
+ "version": "1.2.15-data.2",
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": "5f1d7561bfb17676b225b2e8fd80cffab1d04567",
58
+ "gitHead": "39f628374430fd56999cfd30173fe6edabb16f86",
59
59
  "gitHooks": {
60
60
  "pre-commit": "lint-staged"
61
61
  }