@zgfe/business-lib 1.2.51-ht.1 → 1.2.51-ljy.1

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.
Files changed (39) hide show
  1. package/es/assets/colorIcon/demo_index.html +4 -717
  2. package/es/assets/colorIcon/iconfont.css +4 -128
  3. package/es/assets/colorIcon/iconfont.js +16 -16
  4. package/es/assets/colorIcon/iconfont.json +0 -217
  5. package/es/assets/colorIcon/iconfont.svg +0 -62
  6. package/es/assets/colorIcon/iconfont.ttf +0 -0
  7. package/es/assets/colorIcon/iconfont.woff +0 -0
  8. package/es/assets/colorIcon/iconfont.woff2 +0 -0
  9. package/es/assets/iconfont/demo_index.html +118 -3
  10. package/es/assets/iconfont/iconfont.css +23 -3
  11. package/es/assets/iconfont/iconfont.js +7 -7
  12. package/es/assets/iconfont/iconfont.json +35 -0
  13. package/es/assets/iconfont/iconfont.ttf +0 -0
  14. package/es/assets/iconfont/iconfont.woff +0 -0
  15. package/es/assets/iconfont/iconfont.woff2 +0 -0
  16. package/es/datePickerOld/context.d.ts +15 -0
  17. package/es/datePickerOld/context.js +3 -0
  18. package/es/datePickerOld/datePicker.d.ts +8 -0
  19. package/es/datePickerOld/datePicker.js +151 -0
  20. package/es/datePickerOld/demo/customType.d.ts +4 -0
  21. package/es/datePickerOld/demo/customType.js +44 -0
  22. package/es/datePickerOld/demo/day.d.ts +4 -0
  23. package/es/datePickerOld/demo/day.js +48 -0
  24. package/es/datePickerOld/demo/index.d.ts +4 -0
  25. package/es/datePickerOld/demo/index.js +41 -0
  26. package/es/datePickerOld/index.d.ts +6 -0
  27. package/es/datePickerOld/index.js +218 -0
  28. package/es/datePickerOld/popoverContent.d.ts +11 -0
  29. package/es/datePickerOld/popoverContent.js +48 -0
  30. package/es/datePickerOld/shortcut.d.ts +7 -0
  31. package/es/datePickerOld/shortcut.js +202 -0
  32. package/es/datePickerOld/styles/index.less +165 -0
  33. package/es/datePickerOld/types.d.ts +39 -0
  34. package/es/datePickerOld/types.js +12 -0
  35. package/es/datePickerOld/utils.d.ts +7 -0
  36. package/es/datePickerOld/utils.js +47 -0
  37. package/es/index.d.ts +2 -1
  38. package/es/index.js +2 -1
  39. package/package.json +3 -3
@@ -0,0 +1,48 @@
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
+ 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
+ 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
+ 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
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
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 { Button, Tabs } from 'antd';
8
+ import React, { useRef } from 'react';
9
+ import PickerShortcut from './shortcut';
10
+ import BizDate from './datePicker';
11
+ import { classPrefix } from '.';
12
+ export default (function (props) {
13
+ var selectRange = props.selectRange,
14
+ setDateRange = props.setDateRange,
15
+ setOpen = props.setOpen,
16
+ currentType = props.currentType;
17
+ var ref = useRef();
18
+ return /*#__PURE__*/React.createElement(Tabs, {
19
+ defaultActiveKey: "1"
20
+ }, /*#__PURE__*/React.createElement(Tabs.TabPane, {
21
+ tab: "\u6700\u8FD1",
22
+ key: "1"
23
+ }, /*#__PURE__*/React.createElement(PickerShortcut, {
24
+ selectRange: selectRange,
25
+ currentType: currentType
26
+ })), /*#__PURE__*/React.createElement(Tabs.TabPane, {
27
+ tab: "\u81EA\u5B9A\u4E49",
28
+ key: "2"
29
+ }, /*#__PURE__*/React.createElement(BizDate, _objectSpread({
30
+ ref: ref
31
+ }, props)), /*#__PURE__*/React.createElement("div", {
32
+ className: "".concat(classPrefix, "-popoverContent-btns")
33
+ }, /*#__PURE__*/React.createElement(Button, {
34
+ onClick: function onClick() {
35
+ return setOpen(false);
36
+ }
37
+ }, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button, {
38
+ type: "primary",
39
+ onClick: function onClick() {
40
+ if (ref.current) {
41
+ var _ref$current;
42
+ var dateValue = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.getDateValue();
43
+ setDateRange(dateValue);
44
+ setOpen(false);
45
+ }
46
+ }
47
+ }, "\u786E\u5B9A"))));
48
+ });
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { DatePickerTypes } from './types';
3
+ declare const PickerShortcut: React.FC<{
4
+ selectRange?: number;
5
+ currentType?: DatePickerTypes.Unit;
6
+ }>;
7
+ export default PickerShortcut;
@@ -0,0 +1,202 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
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."); }
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); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import React, { useContext, useEffect, useState } from 'react';
8
+ import { DatePickerTypes } from './types';
9
+ import { classPrefix } from '.';
10
+ import DatePickerContext from './context';
11
+ import moment from 'moment';
12
+ import { getDateRange } from './utils';
13
+ import { Button, InputNumber } from 'antd';
14
+ var getTypeList = function getTypeList(currentType, mode, includeToday) {
15
+ var _shortcuts$find;
16
+ var shortcuts = [{
17
+ label: '按小时',
18
+ value: DatePickerTypes.Unit.hour,
19
+ children: [{
20
+ value: '昨天',
21
+ count: 1
22
+ }, {
23
+ value: '前天',
24
+ count: 2
25
+ }]
26
+ }, {
27
+ label: '按天',
28
+ value: DatePickerTypes.Unit.day,
29
+ children: [{
30
+ value: '今天',
31
+ count: 0
32
+ }, {
33
+ value: '昨天',
34
+ count: 1
35
+ }, {
36
+ value: '7天',
37
+ count: 7
38
+ }, {
39
+ value: '14天',
40
+ count: 14
41
+ }, {
42
+ value: '30天',
43
+ count: 30
44
+ }]
45
+ }, {
46
+ label: '按周',
47
+ value: DatePickerTypes.Unit.week,
48
+ children: [{
49
+ value: '4周',
50
+ count: 4
51
+ }, {
52
+ value: '8周',
53
+ count: 8
54
+ }, {
55
+ value: '12周',
56
+ count: 12
57
+ }]
58
+ }, {
59
+ label: '按月',
60
+ value: DatePickerTypes.Unit.month,
61
+ children: [{
62
+ value: '1个月',
63
+ count: 1
64
+ }, {
65
+ value: '2个月',
66
+ count: 2
67
+ }, {
68
+ value: '3个月',
69
+ count: 3
70
+ }]
71
+ }, {
72
+ label: '按季度',
73
+ value: DatePickerTypes.Unit.quarter,
74
+ children: [{
75
+ value: '1季度',
76
+ count: 1
77
+ }, {
78
+ value: '2季度',
79
+ count: 2
80
+ }, {
81
+ value: '4季度',
82
+ count: 4
83
+ }]
84
+ }];
85
+ var list = (((_shortcuts$find = shortcuts.find(function (item) {
86
+ return item.value === currentType;
87
+ })) === null || _shortcuts$find === void 0 ? void 0 : _shortcuts$find.children) || []).filter(function (item) {
88
+ if (currentType === 'day') {
89
+ if ((mode === 'general' || !includeToday) && (item.count === 0 || item.count === 1)) return false;
90
+ return true;
91
+ }
92
+ return true;
93
+ });
94
+ return list;
95
+ };
96
+ var DateOptionMap = {
97
+ day: '天',
98
+ week: '周',
99
+ month: '月',
100
+ quarter: '季度'
101
+ };
102
+ var PickerShortcut = function PickerShortcut(_ref) {
103
+ var selectRange = _ref.selectRange;
104
+ var _useContext = useContext(DatePickerContext),
105
+ currentType = _useContext.currentType,
106
+ mode = _useContext.mode,
107
+ includeToday = _useContext.includeToday,
108
+ dateRange = _useContext.dateRange,
109
+ relative = _useContext.relative,
110
+ setDateRange = _useContext.setDateRange,
111
+ setRelative = _useContext.setRelative,
112
+ setLabel = _useContext.setLabel,
113
+ setOpen = _useContext.setOpen;
114
+ var _useState = useState(),
115
+ _useState2 = _slicedToArray(_useState, 2),
116
+ active = _useState2[0],
117
+ setActive = _useState2[1];
118
+ var _useState3 = useState(active),
119
+ _useState4 = _slicedToArray(_useState3, 2),
120
+ numbers = _useState4[0],
121
+ setNumbers = _useState4[1];
122
+ var list = getTypeList(currentType, mode, includeToday);
123
+ useEffect(function () {
124
+ list = getTypeList(currentType, mode, includeToday);
125
+ if (!relative && !dateRange) {
126
+ var _active = list[0];
127
+ setActive(_active === null || _active === void 0 ? void 0 : _active.count);
128
+ setLabel === null || setLabel === void 0 ? void 0 : setLabel(_active === null || _active === void 0 ? void 0 : _active.value);
129
+ if (_active && setRelative) {
130
+ setRelative([_active === null || _active === void 0 ? void 0 : _active.count, includeToday ? 0 : 1]);
131
+ }
132
+ }
133
+ }, [currentType, mode, includeToday]);
134
+ useEffect(function () {
135
+ if (!dateRange || !dateRange.begin || !dateRange.end) return;
136
+ var begin = dateRange.begin,
137
+ end = dateRange.end;
138
+ var item = list.find(function (item) {
139
+ var match = getDateRange(currentType, item.count, includeToday);
140
+ return moment(begin).isSame(match.begin) && moment(end).isSame(match.end);
141
+ });
142
+ setActive(item === null || item === void 0 ? void 0 : item.count);
143
+ setLabel === null || setLabel === void 0 ? void 0 : setLabel(item === null || item === void 0 ? void 0 : item.value);
144
+ if (relative && (!item || item.count !== relative[0]) && setRelative) {
145
+ setRelative(undefined);
146
+ }
147
+ }, [dateRange]);
148
+ useEffect(function () {
149
+ if (active === undefined || !setDateRange) return;
150
+ setDateRange(getDateRange(currentType, active, includeToday));
151
+ setNumbers(active);
152
+ }, [active]);
153
+ useEffect(function () {
154
+ if (!relative || !setDateRange) return;
155
+ var _relative = _slicedToArray(relative, 1),
156
+ count = _relative[0];
157
+ var item = list.find(function (item) {
158
+ return item.count === count;
159
+ });
160
+ setActive(item === null || item === void 0 ? void 0 : item.count);
161
+ setLabel === null || setLabel === void 0 ? void 0 : setLabel(item === null || item === void 0 ? void 0 : item.value);
162
+ setDateRange(getDateRange(currentType, count, includeToday));
163
+ }, [relative]);
164
+ return /*#__PURE__*/React.createElement("div", {
165
+ className: "".concat(classPrefix, "-shortcut")
166
+ }, /*#__PURE__*/React.createElement("div", {
167
+ className: "".concat(classPrefix, "-list")
168
+ }, mode !== 'superSimple' && /*#__PURE__*/React.createElement(React.Fragment, null, list.map(function (item, index) {
169
+ return /*#__PURE__*/React.createElement("div", {
170
+ key: index,
171
+ className: "".concat(classPrefix, "-item ").concat(active === item.count ? 'active' : ''),
172
+ onClick: function onClick() {
173
+ setActive(item.count);
174
+ setLabel === null || setLabel === void 0 ? void 0 : setLabel(item === null || item === void 0 ? void 0 : item.value);
175
+ if (setRelative) setRelative([item.count, includeToday ? 0 : 1]);
176
+ }
177
+ }, item.value);
178
+ }))), currentType !== DatePickerTypes.Unit.hour && /*#__PURE__*/React.createElement("div", {
179
+ className: "".concat(classPrefix, "-list-relative")
180
+ }, /*#__PURE__*/React.createElement("div", {
181
+ className: "".concat(classPrefix, "-list-relative-content")
182
+ }, /*#__PURE__*/React.createElement("span", null, "\u8FD1"), /*#__PURE__*/React.createElement(InputNumber, {
183
+ min: 1,
184
+ max: currentType == DatePickerTypes.Unit.month ? selectRange || 12 : selectRange || 365,
185
+ controls: false,
186
+ style: {
187
+ width: '58px'
188
+ },
189
+ value: numbers,
190
+ onChange: function onChange(value) {
191
+ return setNumbers(value);
192
+ }
193
+ }), /*#__PURE__*/React.createElement("span", null, Reflect.get(DateOptionMap, currentType))), /*#__PURE__*/React.createElement(Button, {
194
+ type: "primary",
195
+ onClick: function onClick() {
196
+ if (!setDateRange) return;
197
+ setDateRange(getDateRange(currentType, numbers, includeToday));
198
+ setOpen === null || setOpen === void 0 ? void 0 : setOpen(false);
199
+ }
200
+ }, "\u786E\u8BA4")));
201
+ };
202
+ export default PickerShortcut;
@@ -0,0 +1,165 @@
1
+ @import '../../assets/styles/inner.less';
2
+
3
+ .biz-date-picker-old-wrap {
4
+ display: flex;
5
+
6
+ &-type {
7
+ width: 88px;
8
+ }
9
+
10
+ &-shortcut {
11
+ display: flex;
12
+ }
13
+
14
+ &-list {
15
+ display: flex;
16
+ margin: 0 16px 0 0;
17
+
18
+ &-relative {
19
+ display: flex;
20
+ gap: 24px;
21
+ align-items: center;
22
+
23
+ &-content {
24
+ display: flex;
25
+ align-items: center;
26
+ span {
27
+ margin: 0 8px;
28
+ }
29
+
30
+ .ant-input-number {
31
+ background-color: #fff !important;
32
+ border: 1px solid var(---, #ecedf0);
33
+ border-radius: 4px;
34
+ }
35
+ }
36
+ }
37
+ }
38
+
39
+ .biz-select-handle {
40
+ margin-right: 16px;
41
+ padding: 0;
42
+ }
43
+
44
+ &-item {
45
+ display: flex;
46
+ align-items: center;
47
+ justify-content: center;
48
+ width: 58px;
49
+ height: @height-base;
50
+ color: @text-color-secondary;
51
+ border: 1px solid @border-color-base;
52
+ cursor: pointer;
53
+
54
+ &:first-child {
55
+ border-radius: @border-radius-small 0px 0px @border-radius-small;
56
+ }
57
+
58
+ &:last-child {
59
+ border-radius: 0px @border-radius-small @border-radius-small 0px;
60
+ }
61
+
62
+ &:hover {
63
+ .__default-hover();
64
+ border-color: @border-color-base;
65
+ }
66
+
67
+ &.active {
68
+ color: @primary-color;
69
+ background: @primary-color-hover;
70
+ border: 1px solid @primary-color;
71
+ }
72
+ }
73
+
74
+ &-input {
75
+ display: flex;
76
+ flex-shrink: 0;
77
+ gap: 4px;
78
+ align-items: center;
79
+ justify-content: space-between;
80
+ width: 262px;
81
+ padding: 0px 12px;
82
+ font-size: 14px;
83
+ background: #fff;
84
+ border: 1px solid var(---, #ecedf0);
85
+ border-radius: 4px;
86
+
87
+ &-label {
88
+ display: flex;
89
+ gap: 4px;
90
+ align-items: center;
91
+ }
92
+
93
+ &:hover {
94
+ // color: #165dff;
95
+ border-color: @primary-color;
96
+ cursor: pointer;
97
+ }
98
+
99
+ &:focus {
100
+ border-color: @primary-color;
101
+ }
102
+
103
+ &:active {
104
+ border-color: @primary-color;
105
+ }
106
+
107
+ &-active {
108
+ border-color: @primary-color;
109
+ box-shadow: 0 0 0 4px #f0f7ff;
110
+ }
111
+
112
+ &-popover {
113
+ padding-top: 0;
114
+ .ant-popover-arrow {
115
+ display: none;
116
+ }
117
+
118
+ .ant-popover-inner-content {
119
+ padding: 0 16px 16px;
120
+ }
121
+
122
+ .ant-picker-dropdown {
123
+ padding-top: 0;
124
+
125
+ .ant-picker-range-arrow {
126
+ display: none;
127
+ }
128
+ }
129
+
130
+ .ant-tabs-top > .ant-tabs-nav::before {
131
+ border-bottom: 1px solid #fafafb;
132
+ }
133
+
134
+ .ant-popover-inner {
135
+ background: #fff;
136
+ border-radius: 8px;
137
+ box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.1);
138
+ }
139
+ }
140
+ }
141
+
142
+ &-panel {
143
+ & div:last-of-type {
144
+ position: relative !important;
145
+ }
146
+
147
+ .ant-picker-panel-container {
148
+ background: #fff;
149
+ border: 1px solid var(--io-n-02, #fafafb);
150
+ border-radius: 10px;
151
+ box-shadow: none;
152
+ }
153
+
154
+ .ant-picker-panel-container .ant-picker-panel-focused {
155
+ border-color: var(--io-n-02, #fafafb);
156
+ }
157
+ }
158
+
159
+ &-popoverContent-btns {
160
+ display: flex;
161
+ gap: 16px;
162
+ justify-content: flex-end;
163
+ padding-top: 16px;
164
+ }
165
+ }
@@ -0,0 +1,39 @@
1
+ export declare namespace DatePickerTypes {
2
+ enum Unit {
3
+ 'hour' = "hour",
4
+ 'day' = "day",
5
+ 'week' = "week",
6
+ 'month' = "month",
7
+ 'quarter' = "quarter",
8
+ 'custom' = "custom"
9
+ }
10
+ interface Range {
11
+ begin?: string;
12
+ end?: string;
13
+ }
14
+ interface Value extends Range {
15
+ unit: Unit;
16
+ relative?: [number, number];
17
+ }
18
+ interface Props {
19
+ defaultValue?: Value;
20
+ value?: Value;
21
+ includeToday?: boolean;
22
+ selectRange?: number;
23
+ timeRangeOpen?: number;
24
+ selectRangeUnit?: 'days' | 'weeks' | 'months' | 'quarter';
25
+ onChange?: (data: Value) => void;
26
+ onOpenChange?: (data: boolean) => void;
27
+ mode?: 'general' | 'simple' | 'superSimple';
28
+ dateTypeList?: Unit[];
29
+ }
30
+ interface Option {
31
+ label: string;
32
+ value: Unit;
33
+ children: ListOption[];
34
+ }
35
+ interface ListOption {
36
+ count: number;
37
+ value: string;
38
+ }
39
+ }
@@ -0,0 +1,12 @@
1
+ export var DatePickerTypes;
2
+ (function (DatePickerTypes) {
3
+ var Unit;
4
+ (function (Unit) {
5
+ Unit["hour"] = "hour";
6
+ Unit["day"] = "day";
7
+ Unit["week"] = "week";
8
+ Unit["month"] = "month";
9
+ Unit["quarter"] = "quarter";
10
+ Unit["custom"] = "custom";
11
+ })(Unit = DatePickerTypes.Unit || (DatePickerTypes.Unit = {}));
12
+ })(DatePickerTypes || (DatePickerTypes = {}));
@@ -0,0 +1,7 @@
1
+ import moment from 'moment';
2
+ import { DatePickerTypes } from './types';
3
+ export declare const getDateRange: (type: DatePickerTypes.Unit, count: number, includeToday: boolean) => {
4
+ begin: string;
5
+ end: string;
6
+ };
7
+ export declare const isTodayInRange: (_startDate: moment.Moment, _endDate: moment.Moment) => boolean;
@@ -0,0 +1,47 @@
1
+ import moment from 'moment';
2
+ import { DatePickerTypes } from './types';
3
+ function getAbsoluteDate(unit, count, maxDate) {
4
+ var res = {};
5
+ var dayTime = 24 * 60 * 60 * 1000;
6
+ switch (unit) {
7
+ case DatePickerTypes.Unit.hour:
8
+ res.endDate = res.startDate = moment().subtract(count, 'days').toDate();
9
+ break;
10
+ case DatePickerTypes.Unit.day:
11
+ res.startDate = moment().subtract(count, 'days').toDate();
12
+ count == 1 ? res.endDate = moment().subtract(count, 'days').toDate() : res.endDate = maxDate;
13
+ break;
14
+ case DatePickerTypes.Unit.week:
15
+ res.endDate = maxDate;
16
+ var firstOfWeek = new Date(maxDate.getTime() - (maxDate.getDay() - 1) * dayTime);
17
+ res.startDate = new Date(firstOfWeek.getTime() - count * 7 * dayTime);
18
+ break;
19
+ case DatePickerTypes.Unit.month:
20
+ res.endDate = maxDate;
21
+ var firstOfMonth = new Date(maxDate.getTime() - (maxDate.getDate() - 1) * dayTime);
22
+ firstOfMonth.setMonth(firstOfMonth.getMonth() - count);
23
+ res.startDate = new Date(firstOfMonth);
24
+ break;
25
+ case DatePickerTypes.Unit.quarter:
26
+ res.endDate = maxDate;
27
+ var firstOfQuarter = new Date(maxDate.getTime() - (maxDate.getDate() - 1) * dayTime);
28
+ firstOfQuarter.setMonth(firstOfQuarter.getMonth() - firstOfQuarter.getMonth() % 3 - 3 * (count - 1));
29
+ res.startDate = new Date(firstOfQuarter);
30
+ break;
31
+ }
32
+ return res;
33
+ }
34
+ export var getDateRange = function getDateRange(type, count, includeToday) {
35
+ var maxDate = moment().subtract(includeToday || count == 0 ? 0 : 1, 'days').toDate();
36
+ var res = getAbsoluteDate(type, count, maxDate);
37
+ return {
38
+ begin: moment(res.startDate).format('YYYY-MM-DD'),
39
+ end: moment(res.endDate).format('YYYY-MM-DD')
40
+ };
41
+ };
42
+ export var isTodayInRange = function isTodayInRange(_startDate, _endDate) {
43
+ var startDate = _startDate.format('x');
44
+ var endDate = moment(_endDate).add(1, 'days').format('x');
45
+ var dateToCheck = moment(new Date()).format('x');
46
+ return dateToCheck >= startDate && dateToCheck <= endDate;
47
+ };
package/es/index.d.ts CHANGED
@@ -47,7 +47,8 @@ import useBizStore from './hooks/useBizStore';
47
47
  import useChanged from './hooks/useChanged';
48
48
  import useSubject from './hooks/useSubject';
49
49
  import DataSetGroup from './dataSetGroup';
50
- export { BizTargetDimension, BizTargetFromPanel, BizSearchInput, BizSelect, BizDialog, BizChart, BizTable, BizLayout, BizAnalysisLayout, BizDetailLayout, BizUserGroup, BizUserGroupHeader, IconFont, ColorIcon, BizFormulaTarget, BizAUMFormulaTarget, BizTargetSelector, BizEventSelector, BizAttributeSelector, BizGlobalDataContext, BizTargetFromPanelContext, BizTargetCondition, BizDatePicker, BizQuickDatePicker, BizLoading, BizConditionItem, BizConditionGroup, BizAttrCondition, BizAttrConditionGroup, BizUserCondition, BizProductCondition, BizAddToScene, BizAddToPanel, BizCycleTime, BizDnd, BizLoginForm, DemoWrapper, SocketClient, ajax, util, base64, theme, convertAttributeData, BizUserTagsSelect, setGlobalConfig, chartColors, useBizStore, useChanged, useSubject, DataSetGroup, };
50
+ import BizDatePickerOld from './datePickerOld';
51
+ export { BizTargetDimension, BizTargetFromPanel, BizSearchInput, BizSelect, BizDialog, BizChart, BizTable, BizLayout, BizAnalysisLayout, BizDetailLayout, BizUserGroup, BizUserGroupHeader, IconFont, ColorIcon, BizFormulaTarget, BizAUMFormulaTarget, BizTargetSelector, BizEventSelector, BizAttributeSelector, BizGlobalDataContext, BizTargetFromPanelContext, BizTargetCondition, BizDatePicker, BizQuickDatePicker, BizLoading, BizConditionItem, BizConditionGroup, BizAttrCondition, BizAttrConditionGroup, BizUserCondition, BizProductCondition, BizAddToScene, BizAddToPanel, BizCycleTime, BizDnd, BizLoginForm, DemoWrapper, SocketClient, ajax, util, base64, theme, convertAttributeData, BizUserTagsSelect, setGlobalConfig, chartColors, useBizStore, useChanged, useSubject, DataSetGroup, BizDatePickerOld, };
51
52
  export type { UserGroupTypes } from './userGroup/types';
52
53
  export type { BizProductConditionT } from './productCondition/types';
53
54
  export type { BizSelectTypes } from './select/types';
package/es/index.js CHANGED
@@ -46,4 +46,5 @@ import useBizStore from './hooks/useBizStore';
46
46
  import useChanged from './hooks/useChanged';
47
47
  import useSubject from './hooks/useSubject';
48
48
  import DataSetGroup from './dataSetGroup';
49
- export { BizTargetDimension, BizTargetFromPanel, BizSearchInput, BizSelect, BizDialog, BizChart, BizTable, BizLayout, BizAnalysisLayout, BizDetailLayout, BizUserGroup, BizUserGroupHeader, IconFont, ColorIcon, BizFormulaTarget, BizAUMFormulaTarget, BizTargetSelector, BizEventSelector, BizAttributeSelector, BizGlobalDataContext, BizTargetFromPanelContext, BizTargetCondition, BizDatePicker, BizQuickDatePicker, BizLoading, BizConditionItem, BizConditionGroup, BizAttrCondition, BizAttrConditionGroup, BizUserCondition, BizProductCondition, BizAddToScene, BizAddToPanel, BizCycleTime, BizDnd, BizLoginForm, DemoWrapper, SocketClient, ajax, util, base64, theme, convertAttributeData, BizUserTagsSelect, setGlobalConfig, chartColors, useBizStore, useChanged, useSubject, DataSetGroup };
49
+ import BizDatePickerOld from './datePickerOld';
50
+ export { BizTargetDimension, BizTargetFromPanel, BizSearchInput, BizSelect, BizDialog, BizChart, BizTable, BizLayout, BizAnalysisLayout, BizDetailLayout, BizUserGroup, BizUserGroupHeader, IconFont, ColorIcon, BizFormulaTarget, BizAUMFormulaTarget, BizTargetSelector, BizEventSelector, BizAttributeSelector, BizGlobalDataContext, BizTargetFromPanelContext, BizTargetCondition, BizDatePicker, BizQuickDatePicker, BizLoading, BizConditionItem, BizConditionGroup, BizAttrCondition, BizAttrConditionGroup, BizUserCondition, BizProductCondition, BizAddToScene, BizAddToPanel, BizCycleTime, BizDnd, BizLoginForm, DemoWrapper, SocketClient, ajax, util, base64, theme, convertAttributeData, BizUserTagsSelect, setGlobalConfig, chartColors, useBizStore, useChanged, useSubject, DataSetGroup, BizDatePickerOld };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/business-lib",
3
- "version": "1.2.51-ht.1",
3
+ "version": "1.2.51-ljy.1",
4
4
  "module": "es/index.js",
5
5
  "typings": "es/index.d.ts",
6
6
  "files": [
@@ -45,7 +45,7 @@
45
45
  "@types/lodash": "^4.14.182",
46
46
  "@umijs/fabric": "^2.8.1",
47
47
  "@umijs/test": "^3.0.5",
48
- "antd": "^4.22.8",
48
+ "antd": "4.24.16",
49
49
  "dumi": "^1.1.0",
50
50
  "father-build": "^1.17.2",
51
51
  "gh-pages": "^3.0.0",
@@ -55,7 +55,7 @@
55
55
  "react": "^16.12.0 || ^17.0.0",
56
56
  "yorkie": "^2.0.0"
57
57
  },
58
- "gitHead": "547bbdd9aed422358e09236171f862d4c386cc4e",
58
+ "gitHead": "9a7a09c57f1d248349441367e54a637f97d8f4f5",
59
59
  "gitHooks": {
60
60
  "pre-commit": "lint-staged"
61
61
  }