@zgfe/business-lib 1.2.70-hxd.9 → 1.2.71-hxd.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.
- package/README.md +12 -12
- package/config.js +41 -41
- package/es/AUMFormulaTarget/components/formula/index.js +6 -4
- package/es/AUMFormulaTarget/components/formula/index.less +86 -86
- package/es/AUMFormulaTarget/components/panel/cdpCshCondition.js +2 -2
- package/es/AUMFormulaTarget/components/panel/index.less +269 -269
- package/es/AUMFormulaTarget/components/symbol/index.less +49 -49
- package/es/AUMFormulaTarget/demo/index.js +1 -1
- package/es/AUMFormulaTarget/index.d.ts +4 -1
- package/es/AUMFormulaTarget/styles/index.less +74 -74
- package/es/addToPanel/components/radioGroup.d.ts +4 -1
- package/es/addToPanel/components/styleList.d.ts +4 -1
- package/es/addToPanel/index.d.ts +4 -1
- package/es/addToPanel/index.js +1 -1
- package/es/addToPanel/styles/addPanel.less +25 -25
- package/es/addToPanel/styles/index.less +17 -17
- package/es/addToPanel/styles/style.less +66 -66
- package/es/addToScene/index.js +3 -8
- package/es/addToScene/styles/index.less +30 -30
- package/es/amountSelector/demo/index.d.ts +3 -0
- package/es/amountSelector/demo/index.js +9 -0
- package/es/amountSelector/index.d.ts +10 -0
- package/es/amountSelector/index.js +21 -0
- package/es/amountSelector/styles/index.less +27 -0
- package/es/amountSelector/types.d.ts +4 -0
- package/es/amountSelector/types.js +1 -0
- package/es/amountSelector/util.d.ts +3 -0
- package/es/amountSelector/util.js +18 -0
- package/es/assets/colorIcon/demo.css +539 -539
- package/es/assets/colorIcon/demo_index.html +1985 -1454
- package/es/assets/colorIcon/iconfont.css +329 -236
- package/es/assets/colorIcon/iconfont.js +13 -14
- package/es/assets/colorIcon/iconfont.json +555 -394
- package/es/assets/colorIcon/iconfont.ttf +0 -0
- package/es/assets/colorIcon/iconfont.woff +0 -0
- package/es/assets/colorIcon/iconfont.woff2 +0 -0
- package/es/assets/iconfont/demo.css +539 -539
- package/es/assets/iconfont/demo_index.html +5563 -5708
- package/es/assets/iconfont/iconfont.css +1015 -975
- package/es/assets/iconfont/iconfont.js +1 -1
- package/es/assets/iconfont/iconfont.json +1584 -1689
- package/es/assets/styles/chunks.less +183 -183
- package/es/assets/styles/inner.less +3 -3
- package/es/assets/styles/resetAntd.less +568 -564
- package/es/assets/styles/variable.less +21 -21
- package/es/assets/theme.js +1 -1
- package/es/attrCondition/demo/group.js +1 -1
- package/es/attrCondition/group.js +11 -6
- package/es/attrCondition/index.js +11 -6
- package/es/attrCondition/styles/index.less +101 -101
- package/es/attrCondition/useAttrCondition.js +7 -5
- package/es/attrConditions/components/operateList.js +6 -3
- package/es/attrConditions/components/stringList.js +5 -9
- package/es/attrConditions/index.d.ts +4 -1
- package/es/attrConditions/index.js +4 -2
- package/es/attrConditions/styles/group.less +49 -49
- package/es/attrConditions/styles/index.less +151 -151
- package/es/attrConditions/types.d.ts +4 -0
- package/es/attrConditions/utils/operates.d.ts +4 -0
- package/es/attrConditions/utils/operates.js +37 -0
- package/es/attributeSelector/index.js +11 -11
- package/es/attributeSelector/listPanel.js +313 -101
- package/es/attributeSelector/styles/index.less +141 -141
- package/es/attributeSelector/types.d.ts +2 -0
- package/es/attributeSelector/util.js +3 -0
- package/es/chart/demo/data/data5 copy.js +2 -2
- package/es/chart/demo/index.js +1 -1
- package/es/chart/demo/line_bar_stack.js +4 -4
- package/es/chart/demo/stack.js +1 -1
- package/es/chart/index.js +10 -12
- package/es/chart/styles/index.less +113 -113
- package/es/chart/util/color.js +1 -1
- package/es/chart/util/data/china.js +17 -17
- package/es/colorIcon/index.js +2 -4
- package/es/constants/apis.d.ts +4 -0
- package/es/constants/apis.js +6 -2
- package/es/constants/common.d.ts +11 -0
- package/es/constants/common.js +31 -0
- package/es/context/index.d.ts +2 -0
- package/es/cycleTime/index.js +6 -8
- package/es/cycleTime/month.js +2 -5
- package/es/cycleTime/styles/index.less +24 -24
- package/es/cycleTime/styles/month.less +95 -95
- package/es/dataSetGroup/index.js +0 -1
- package/es/dataSetGroup/styles/index.less +146 -146
- package/es/datePicker/index.d.ts +4 -1
- package/es/datePicker/styles/index.less +53 -53
- package/es/datePickerV2/demo/index.js +1 -1
- package/es/datePickerV2/index.d.ts +4 -1
- package/es/datePickerV2/index.js +13 -4
- package/es/datePickerV2/popoverContent.js +1 -1
- package/es/datePickerV2/shortcut.js +1 -1
- package/es/datePickerV2/styles/index.less +194 -194
- package/es/datePickerV2/types.d.ts +1 -0
- package/es/datePickerV2/utils.js +8 -2
- package/es/demoWrapper/content.js +9 -10
- package/es/demoWrapper/index.less +3 -3
- package/es/demoWrapper/innerDemo.js +1 -1
- package/es/dialog/index.d.ts +4 -1
- package/es/dialog/styles/index.less +22 -22
- package/es/dnd/demo/index.js +5 -1
- package/es/dnd/demo/styles/index.less +34 -34
- package/es/dnd/index.d.ts +4 -1
- package/es/dnd/item.js +14 -0
- package/es/dnd/styles/index.less +19 -19
- package/es/eventSelector/index.d.ts +4 -1
- package/es/eventSelector/index.js +3 -2
- package/es/eventSelector/listPanel.js +9 -13
- package/es/eventSelector/option.d.ts +1 -0
- package/es/eventSelector/option.js +14 -3
- package/es/eventSelector/styles/index.less +127 -123
- package/es/eventSelector/types.d.ts +1 -0
- package/es/formulaTarget/components/formula/index.js +2 -1
- package/es/formulaTarget/components/formula/index.less +76 -76
- package/es/formulaTarget/components/formula/types.d.ts +1 -0
- package/es/formulaTarget/components/formulaItem/index.js +7 -2
- package/es/formulaTarget/components/formulaItem/types.d.ts +1 -0
- package/es/formulaTarget/components/panel/index.js +2 -1
- package/es/formulaTarget/components/panel/index.less +139 -139
- package/es/formulaTarget/components/panel/item.js +5 -1
- package/es/formulaTarget/components/panel/types.d.ts +2 -0
- package/es/formulaTarget/components/symbol/index.less +49 -49
- package/es/formulaTarget/index.d.ts +4 -1
- package/es/formulaTarget/index.js +2 -1
- package/es/formulaTarget/styles/index.less +74 -74
- package/es/formulaTarget/types.d.ts +1 -0
- package/es/hooks/types/subject.d.ts +14 -14
- package/es/hooks/useBizStore.js +3 -9
- package/es/icon/demo/list.less +32 -32
- package/es/icon/iconFont.d.ts +4 -1
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -1
- package/es/layout/analysisLayout/demo/index.less +12 -12
- package/es/layout/analysisLayout/index.d.ts +4 -1
- package/es/layout/analysisLayout/index.less +118 -118
- package/es/layout/columnLayout/demo/index.less +15 -15
- package/es/layout/columnLayout/index.d.ts +4 -1
- package/es/layout/columnLayout/index.less +81 -81
- package/es/layout/detail/index.less +27 -27
- package/es/layout/optionTitle/components/btnMenu/index.less +18 -18
- package/es/layout/optionTitle/components/changePanelModal/styles/index.less +92 -92
- package/es/layout/optionTitle/components/title/index.d.ts +1 -2
- package/es/layout/optionTitle/components/title/index.js +10 -6
- package/es/layout/optionTitle/components/title/index.less +43 -43
- package/es/layout/optionTitle/demo/index.less +12 -12
- package/es/layout/optionTitle/index.js +1 -1
- package/es/layout/optionTitle/styles/index.less +30 -30
- package/es/layout/optionTitle/styles/layout.less +90 -90
- package/es/layout/optionTitle/styles/search.less +27 -27
- package/es/loading/styles/index.less +20 -20
- package/es/loginForm/index.less +7 -7
- package/es/platformSelector/styles/index.less +26 -26
- package/es/productCondition/conditionTypeList.d.ts +4 -1
- package/es/productCondition/conditions/cdpCshCondition.js +9 -6
- package/es/productCondition/conditions/constants.d.ts +2 -0
- package/es/productCondition/conditions/constants.js +2 -0
- package/es/productCondition/conditions/order/runPeriodCondition.js +2 -4
- package/es/productCondition/conditions/periodCondition.d.ts +4 -1
- package/es/productCondition/conditions/propCondition.d.ts +4 -1
- package/es/productCondition/conditions/styles/cdpCondition.less +31 -31
- package/es/productCondition/conditions/styles/cdpCshCondition.less +41 -41
- package/es/productCondition/conditions/styles/eventCondition.less +51 -51
- package/es/productCondition/conditions/styles/periodCondition.less +26 -26
- package/es/productCondition/conditions/styles/propCondition.less +43 -43
- package/es/productCondition/conditions/styles/runTimesCondition.less +19 -19
- package/es/productCondition/conditions/styles/tagsCondition.less +20 -20
- package/es/productCondition/conditions/styles/textDesc.less +17 -17
- package/es/productCondition/index.d.ts +4 -1
- package/es/productCondition/styles/conditionTypeList.less +32 -30
- package/es/productCondition/styles/conditionWrap.less +18 -18
- package/es/productCondition/styles/index.less +33 -33
- package/es/productCondition/styles/orConditions.less +34 -34
- package/es/productCondition/styles/relationLabel.less +19 -19
- package/es/productCondition/types.d.ts +3 -1
- package/es/productCondition/util.d.ts +4 -0
- package/es/productCondition/util.js +4 -2
- package/es/quickDatePicker/demo/index.js +31 -11
- package/es/quickDatePicker/index.js +122 -23
- package/es/quickDatePicker/styles/index.less +141 -138
- package/es/quickDatePicker/types.d.ts +13 -0
- package/es/quickDatePicker/utils.d.ts +6 -0
- package/es/quickDatePicker/utils.js +54 -1
- package/es/select/demo/index.js +2 -1
- package/es/select/handle.js +2 -9
- package/es/select/index.d.ts +4 -1
- package/es/select/option.js +1 -1
- package/es/select/overlay.js +2 -2
- package/es/select/styles/handle.less +206 -193
- package/es/select/styles/index.less +129 -129
- package/es/socket/demo/demo.js +2 -2
- package/es/socket/demo/index.less +27 -27
- package/es/subjectWrapper/index.js +3 -1
- package/es/subjectWrapper/index.less +12 -12
- package/es/table/demo/data/color.js +1 -1
- package/es/table/index.js +3 -30
- package/es/table/styles/index.less +5 -5
- package/es/targetConditionGroup/components/targetDimension.js +147 -53
- package/es/targetConditionGroup/demo/group.js +5 -18
- package/es/targetConditionGroup/demo/styles/index.less +29 -29
- package/es/targetConditionGroup/index.d.ts +4 -1
- package/es/targetConditionGroup/index.js +12 -10
- package/es/targetConditionGroup/styles/index.less +53 -53
- package/es/targetConditionGroup/types.d.ts +1 -0
- package/es/targetSelector/editBox.d.ts +1 -0
- package/es/targetSelector/editBox.js +8 -3
- package/es/targetSelector/index.js +2 -1
- package/es/targetSelector/optionIcon.d.ts +4 -1
- package/es/targetSelector/optionIcon.js +3 -0
- package/es/targetSelector/styles/index.less +142 -110
- package/es/userCondition/conditionTypeList.d.ts +4 -1
- package/es/userCondition/conditionTypeList.js +5 -4
- package/es/userCondition/conditions/cdpCondition.js +9 -6
- package/es/userCondition/conditions/cdpCshCondition.js +9 -6
- package/es/userCondition/conditions/constants.d.ts +2 -0
- package/es/userCondition/conditions/constants.js +2 -0
- package/es/userCondition/conditions/dataAttribute.js +11 -7
- package/es/userCondition/conditions/eventCondition.js +16 -24
- package/es/userCondition/conditions/order/runPeriodCondition.d.ts +4 -1
- package/es/userCondition/conditions/periodCondition.d.ts +4 -1
- package/es/userCondition/conditions/periodCondition.js +19 -11
- package/es/userCondition/conditions/propCondition.js +5 -3
- package/es/userCondition/conditions/styles/cdpCondition.less +37 -37
- package/es/userCondition/conditions/styles/cdpCshCondition.less +47 -47
- package/es/userCondition/conditions/styles/eventCondition.less +71 -57
- package/es/userCondition/conditions/styles/periodCondition.less +32 -26
- package/es/userCondition/conditions/styles/propCondition.less +43 -43
- package/es/userCondition/conditions/styles/runTimesCondition.less +19 -19
- package/es/userCondition/conditions/styles/tagsCondition.less +20 -20
- package/es/userCondition/conditions/styles/textDesc.less +16 -17
- package/es/userCondition/conditions/tagsCondition.js +12 -5
- package/es/userCondition/conditions/textDesc.js +9 -5
- package/es/userCondition/demo/index.js +20 -14
- package/es/userCondition/demo/mockData.d.ts +20 -94
- package/es/userCondition/demo/mockData.js +31 -76
- package/es/userCondition/index.d.ts +5 -1
- package/es/userCondition/index.js +37 -21
- package/es/userCondition/styles/conditionTypeList.less +32 -30
- package/es/userCondition/styles/conditionWrap.less +18 -18
- package/es/userCondition/styles/index.less +33 -33
- package/es/userCondition/styles/orConditions.less +34 -34
- package/es/userCondition/styles/relationLabel.less +19 -19
- package/es/userCondition/types.d.ts +5 -2
- package/es/userCondition/util.d.ts +4 -0
- package/es/userCondition/util.js +4 -2
- package/es/userGroup/demo/index.js +2 -9
- package/es/userGroup/index.d.ts +4 -1
- package/es/userGroup/index.js +63 -15
- package/es/userGroup/overlay.js +17 -3
- package/es/userGroup/styles/index.less +199 -145
- package/es/userGroup/types.d.ts +2 -0
- package/es/userGroup/util.d.ts +2 -0
- package/es/userGroup/util.js +47 -0
- package/es/userGroupHeader/demo/index.js +1 -1
- package/es/userGroupHeader/index.d.ts +1 -0
- package/es/userGroupHeader/index.js +53 -6
- package/es/userGroupHeader/styles/index.less +50 -31
- package/es/userTagsSelector/cascaderOverlay.d.ts +4 -1
- package/es/userTagsSelector/cascaderOverlay.js +9 -2
- package/es/userTagsSelector/components/search/index.less +6 -6
- package/es/userTagsSelector/components/tagList/index.d.ts +4 -1
- package/es/userTagsSelector/components/tagList/index.less +13 -13
- package/es/userTagsSelector/groups/index.d.ts +4 -1
- package/es/userTagsSelector/groups/styles/option.less +55 -55
- package/es/userTagsSelector/index.d.ts +4 -1
- package/es/userTagsSelector/index.js +32 -2
- package/es/userTagsSelector/multipleCheckPanel/styles/option.less +40 -40
- package/es/userTagsSelector/styles/cascaderOverlay.less +34 -34
- package/es/userTagsSelector/styles/index.less +20 -10
- package/es/userTagsSelector/types.d.ts +2 -0
- package/es/userTagsSelector/util.d.ts +1 -0
- package/es/userTagsSelector/util.js +20 -0
- package/es/utils/ajax.js +63 -26
- package/es/utils/eventApi.d.ts +14 -0
- package/es/utils/eventApi.js +128 -0
- package/es/utils/index.d.ts +2 -1
- package/es/utils/index.js +2 -1
- package/es/utils/type.d.ts +1 -0
- package/es/utils/util.d.ts +1 -0
- package/es/utils/util.js +18 -0
- package/package.json +2 -2
- package/es/assets/colorIcon/iconfont.svg +0 -129
|
@@ -1,3 +1,9 @@
|
|
|
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); }
|
|
1
7
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
8
|
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
9
|
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); }
|
|
@@ -7,14 +13,19 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
7
13
|
import React, { useEffect, useState, useRef } from 'react';
|
|
8
14
|
import './styles/index.less';
|
|
9
15
|
import moment from 'moment';
|
|
10
|
-
import { quickModuleOneOptions, quickModuleTwoOptions } from './utils';
|
|
16
|
+
import { quickModuleOneOptions, quickModuleTwoOptions, getPreviousTimePeriod } from './utils';
|
|
11
17
|
import IconFont from '../icon/iconFont';
|
|
12
18
|
import { DatePicker } from 'antd';
|
|
13
19
|
import { util } from '../utils';
|
|
14
20
|
var RangePicker = DatePicker.RangePicker;
|
|
15
21
|
export var classPrefix = 'biz-quick-date-picker-wrap';
|
|
16
22
|
var BizQuickDatePicker = function BizQuickDatePicker(props) {
|
|
17
|
-
var defaultValue = props.defaultValue
|
|
23
|
+
var defaultValue = props.defaultValue,
|
|
24
|
+
disabled = props.disabled,
|
|
25
|
+
isShowDefaultQuick = props.isShowDefaultQuick,
|
|
26
|
+
customQuickModuleOptions = props.customQuickModuleOptions,
|
|
27
|
+
isComparison = props.isComparison,
|
|
28
|
+
defaultOpen = props.defaultOpen;
|
|
18
29
|
var domId = util.guid();
|
|
19
30
|
var _useState = useState(false),
|
|
20
31
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -28,32 +39,48 @@ var BizQuickDatePicker = function BizQuickDatePicker(props) {
|
|
|
28
39
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
29
40
|
unit = _useState6[0],
|
|
30
41
|
setUnit = _useState6[1];
|
|
31
|
-
var _useState7 = useState(
|
|
42
|
+
var _useState7 = useState(0),
|
|
32
43
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
var _useState9 = useState('
|
|
44
|
+
type = _useState8[0],
|
|
45
|
+
setType = _useState8[1];
|
|
46
|
+
var _useState9 = useState([moment().subtract(6, 'day'), moment()]),
|
|
36
47
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
var _useState11 = useState(
|
|
48
|
+
value = _useState10[0],
|
|
49
|
+
setValue = _useState10[1];
|
|
50
|
+
var _useState11 = useState('过去7天'),
|
|
40
51
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
var _useState13 = useState(
|
|
52
|
+
showText = _useState12[0],
|
|
53
|
+
setShowText = _useState12[1];
|
|
54
|
+
var _useState13 = useState(80),
|
|
44
55
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
45
|
-
|
|
46
|
-
|
|
56
|
+
tipWidth = _useState14[0],
|
|
57
|
+
setTipWidth = _useState14[1];
|
|
58
|
+
var _useState15 = useState(true),
|
|
59
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
60
|
+
initialize = _useState16[0],
|
|
61
|
+
setInitialize = _useState16[1];
|
|
47
62
|
useEffect(function () {
|
|
48
63
|
if (!initialize) return;
|
|
49
64
|
var _value = defaultValue || props.value;
|
|
65
|
+
if (isComparison && showText !== '自定义') {
|
|
66
|
+
setType((defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.value) || 0);
|
|
67
|
+
var comparisonValue = {
|
|
68
|
+
type: (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.unit) || 'day',
|
|
69
|
+
value: (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.value) || 0,
|
|
70
|
+
width: (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.width) || 50,
|
|
71
|
+
label: (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.label) || '自定义',
|
|
72
|
+
isDefaultVsTime: (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.isDefaultVsTime) || false
|
|
73
|
+
};
|
|
74
|
+
customQuickModuleHandle(_objectSpread({}, comparisonValue));
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
50
77
|
if (_value && _value.begin !== '') {
|
|
51
78
|
_value.relative && setRelative(_value.relative);
|
|
52
79
|
_value.unit && setUnit(_value.unit);
|
|
53
80
|
if (_value.relative === -1) {
|
|
54
81
|
setValue([moment(_value.begin), moment(_value.end)]);
|
|
55
82
|
setShowText('自定义');
|
|
56
|
-
setTipWidth(62);
|
|
83
|
+
isComparison ? setTipWidth(92) : setTipWidth(62);
|
|
57
84
|
} else if (_value.relative !== undefined) {
|
|
58
85
|
setInitialize(false);
|
|
59
86
|
setTimeHandle(_value.unit, _value.relative);
|
|
@@ -61,7 +88,7 @@ var BizQuickDatePicker = function BizQuickDatePicker(props) {
|
|
|
61
88
|
_data.map(function (item) {
|
|
62
89
|
if (item.value === _value.relative && item.type === _value.unit) {
|
|
63
90
|
setShowText(item.label);
|
|
64
|
-
setTipWidth(item.width);
|
|
91
|
+
setTipWidth(isComparison ? item.width + 30 : item.width);
|
|
65
92
|
}
|
|
66
93
|
});
|
|
67
94
|
}
|
|
@@ -72,7 +99,8 @@ var BizQuickDatePicker = function BizQuickDatePicker(props) {
|
|
|
72
99
|
};
|
|
73
100
|
var onChange = function onChange(date, dateString) {
|
|
74
101
|
setShowText('自定义');
|
|
75
|
-
|
|
102
|
+
setType(0);
|
|
103
|
+
isComparison ? setTipWidth(92) : setTipWidth(62);
|
|
76
104
|
setRelative(-1);
|
|
77
105
|
if (date === null) {
|
|
78
106
|
setValue(undefined);
|
|
@@ -95,7 +123,11 @@ var BizQuickDatePicker = function BizQuickDatePicker(props) {
|
|
|
95
123
|
}
|
|
96
124
|
};
|
|
97
125
|
var disabledDate = function disabledDate(current) {
|
|
98
|
-
|
|
126
|
+
if (isComparison) {
|
|
127
|
+
return current && (current < moment().subtract(13, 'months').startOf('day') || current > moment().endOf('day'));
|
|
128
|
+
} else {
|
|
129
|
+
return current && current > moment().endOf('month');
|
|
130
|
+
}
|
|
99
131
|
};
|
|
100
132
|
var setTimeHandle = function setTimeHandle(type, value) {
|
|
101
133
|
var _value;
|
|
@@ -123,16 +155,72 @@ var BizQuickDatePicker = function BizQuickDatePicker(props) {
|
|
|
123
155
|
}
|
|
124
156
|
};
|
|
125
157
|
var quickModuleHandle = function quickModuleHandle(item) {
|
|
126
|
-
setTipWidth(item.width);
|
|
158
|
+
setTipWidth(isComparison ? item.width + 30 : item.width);
|
|
127
159
|
setRelative(item.value);
|
|
128
160
|
setUnit(item.type);
|
|
129
161
|
setShowText(item.label);
|
|
130
162
|
setTimeHandle(item.type, item.value);
|
|
131
163
|
};
|
|
132
164
|
var RangePickerRef = useRef(null);
|
|
165
|
+
var customQuickModuleHandle = function customQuickModuleHandle(item) {
|
|
166
|
+
var isDefaultVsTime = item.isDefaultVsTime,
|
|
167
|
+
width = item.width,
|
|
168
|
+
type = item.type,
|
|
169
|
+
value = item.value,
|
|
170
|
+
label = item.label;
|
|
171
|
+
var isLastYear = value === 6;
|
|
172
|
+
setTipWidth(isComparison ? width + 30 : width);
|
|
173
|
+
setType(value);
|
|
174
|
+
setShowText(label);
|
|
175
|
+
var dateRange;
|
|
176
|
+
if (isDefaultVsTime) {
|
|
177
|
+
dateRange = {
|
|
178
|
+
start: defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.begin,
|
|
179
|
+
end: defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.end
|
|
180
|
+
};
|
|
181
|
+
} else {
|
|
182
|
+
var _value = {
|
|
183
|
+
begin: defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.begin,
|
|
184
|
+
end: defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.end,
|
|
185
|
+
unit: defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.unit,
|
|
186
|
+
isLastYear: isLastYear
|
|
187
|
+
};
|
|
188
|
+
var previousPeriod = getPreviousTimePeriod(_value.begin, _value.end, _value.unit, isLastYear ? true : false);
|
|
189
|
+
dateRange = {
|
|
190
|
+
start: previousPeriod.previousStart,
|
|
191
|
+
end: previousPeriod.previousEnd
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
if (dateRange.start && dateRange.end) {
|
|
195
|
+
var _props$onChange;
|
|
196
|
+
setValue([moment(dateRange.start), moment(dateRange.end)]);
|
|
197
|
+
var changeValue = {
|
|
198
|
+
unit: type,
|
|
199
|
+
begin: moment(dateRange.start).format('YYYY-MM-DD'),
|
|
200
|
+
end: moment(dateRange.end).format('YYYY-MM-DD'),
|
|
201
|
+
relative: 0,
|
|
202
|
+
value: value,
|
|
203
|
+
label: label || '上一段时间'
|
|
204
|
+
};
|
|
205
|
+
(_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, changeValue);
|
|
206
|
+
setInitialize(false);
|
|
207
|
+
}
|
|
208
|
+
};
|
|
133
209
|
var renderExtraFooter = function renderExtraFooter() {
|
|
134
210
|
return /*#__PURE__*/React.createElement("div", {
|
|
135
211
|
className: "".concat(classPrefix, "-content-options")
|
|
212
|
+
}, customQuickModuleOptions && isComparison && /*#__PURE__*/React.createElement("div", {
|
|
213
|
+
className: "".concat(classPrefix, "-content-options-customOptions")
|
|
214
|
+
}, /*#__PURE__*/React.createElement("ol", null, customQuickModuleOptions && customQuickModuleOptions.map(function (item) {
|
|
215
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
216
|
+
className: "".concat(item.value == type ? 'active' : ''),
|
|
217
|
+
key: item.label,
|
|
218
|
+
onClick: function onClick() {
|
|
219
|
+
return customQuickModuleHandle(item);
|
|
220
|
+
}
|
|
221
|
+
}, item.label);
|
|
222
|
+
}))), isShowDefaultQuick && /*#__PURE__*/React.createElement("div", {
|
|
223
|
+
className: "".concat(classPrefix, "-content-options-defaultOptions")
|
|
136
224
|
}, /*#__PURE__*/React.createElement("ol", null, quickModuleOneOptions.map(function (item) {
|
|
137
225
|
return /*#__PURE__*/React.createElement("li", {
|
|
138
226
|
className: "".concat(item.type === unit && item.value === relative ? 'active' : ''),
|
|
@@ -149,15 +237,15 @@ var BizQuickDatePicker = function BizQuickDatePicker(props) {
|
|
|
149
237
|
return quickModuleHandle(item);
|
|
150
238
|
}
|
|
151
239
|
}, item.label);
|
|
152
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
153
|
-
className: "".concat(relative === -1 ? 'active' : '')
|
|
240
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
241
|
+
className: "customTime ".concat(relative === -1 ? 'active' : '')
|
|
154
242
|
}, "\u81EA\u5B9A\u4E49\u65F6\u95F4", /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(IconFont, {
|
|
155
243
|
type: "fanhuiicon"
|
|
156
244
|
}))));
|
|
157
245
|
};
|
|
158
246
|
return /*#__PURE__*/React.createElement("div", {
|
|
159
247
|
id: domId,
|
|
160
|
-
className: "".concat(classPrefix, " clearfix ").concat(show ? 'focus' : '')
|
|
248
|
+
className: "".concat(classPrefix, " clearfix ").concat(show ? 'focus' : '', " ").concat(disabled ? 'disabled' : '')
|
|
161
249
|
}, /*#__PURE__*/React.createElement("div", {
|
|
162
250
|
className: "".concat(classPrefix, "-tip"),
|
|
163
251
|
style: {
|
|
@@ -168,16 +256,27 @@ var BizQuickDatePicker = function BizQuickDatePicker(props) {
|
|
|
168
256
|
paddingLeft: "".concat(tipWidth, "px")
|
|
169
257
|
},
|
|
170
258
|
popupClassName: "".concat(classPrefix, "-content"),
|
|
259
|
+
className: "".concat(disabled ? 'disabled' : ''),
|
|
171
260
|
ref: RangePickerRef,
|
|
172
261
|
getPopupContainer: function getPopupContainer() {
|
|
173
262
|
return document.getElementById(domId);
|
|
174
263
|
},
|
|
175
264
|
separator: '至',
|
|
176
265
|
value: value,
|
|
266
|
+
disabled: disabled,
|
|
267
|
+
defaultOpen: defaultOpen,
|
|
177
268
|
onOpenChange: onOpenChange,
|
|
178
269
|
disabledDate: disabledDate,
|
|
179
270
|
onChange: onChange,
|
|
180
|
-
renderExtraFooter: renderExtraFooter
|
|
271
|
+
renderExtraFooter: renderExtraFooter,
|
|
272
|
+
suffixIcon: /*#__PURE__*/React.createElement(IconFont, {
|
|
273
|
+
type: "rili-2"
|
|
274
|
+
})
|
|
181
275
|
}));
|
|
182
276
|
};
|
|
277
|
+
BizQuickDatePicker.defaultProps = {
|
|
278
|
+
isShowDefaultQuick: true,
|
|
279
|
+
isComparison: false,
|
|
280
|
+
defaultOpen: false
|
|
281
|
+
};
|
|
183
282
|
export default BizQuickDatePicker;
|
|
@@ -1,138 +1,141 @@
|
|
|
1
|
-
@import '../../assets/styles/inner.less';
|
|
2
|
-
|
|
3
|
-
.biz-quick-date-picker-wrap {
|
|
4
|
-
position: relative;
|
|
5
|
-
display: inline-block;
|
|
6
|
-
height: 34px;
|
|
7
|
-
padding: 4px 8px;
|
|
8
|
-
background: #fafafb;
|
|
9
|
-
border: 1px solid #fafafb;
|
|
10
|
-
border-radius: 4px;
|
|
11
|
-
&-tip {
|
|
12
|
-
position: absolute;
|
|
13
|
-
top: 4px;
|
|
14
|
-
left: 8px;
|
|
15
|
-
z-index: 2;
|
|
16
|
-
border-radius: 2px;
|
|
17
|
-
}
|
|
18
|
-
.ant-picker-range-arrow {
|
|
19
|
-
display: none !important;
|
|
20
|
-
}
|
|
21
|
-
.ant-picker-focused {
|
|
22
|
-
box-shadow: none !important;
|
|
23
|
-
}
|
|
24
|
-
> :nth-child(1) {
|
|
25
|
-
float: left;
|
|
26
|
-
height: 24px;
|
|
27
|
-
margin-right: 8px;
|
|
28
|
-
padding: 2px 8px;
|
|
29
|
-
color: @primary-color;
|
|
30
|
-
vertical-align: middle;
|
|
31
|
-
background: #e8efff;
|
|
32
|
-
}
|
|
33
|
-
.ant-picker {
|
|
34
|
-
padding: 0;
|
|
35
|
-
vertical-align: middle;
|
|
36
|
-
border: none;
|
|
37
|
-
border-radius: 0 !important;
|
|
38
|
-
.ant-picker-clear {
|
|
39
|
-
right: 0;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
.ant-picker:hover {
|
|
43
|
-
.ant-picker-input > input,
|
|
44
|
-
.ant-picker-range-separator {
|
|
45
|
-
color: #021429 !important;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
&-content {
|
|
49
|
-
float: left;
|
|
50
|
-
.ant-picker-panel-container {
|
|
51
|
-
display: flex;
|
|
52
|
-
flex-direction: row-reverse;
|
|
53
|
-
border-radius: 8px;
|
|
54
|
-
.ant-picker-footer {
|
|
55
|
-
width: auto;
|
|
56
|
-
min-width: auto;
|
|
57
|
-
border-bottom: 1px solid #e8efff;
|
|
58
|
-
box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.1);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
&-options {
|
|
62
|
-
width: 170px;
|
|
63
|
-
padding-bottom: 25px;
|
|
64
|
-
color: #67727f;
|
|
65
|
-
ol,
|
|
66
|
-
li {
|
|
67
|
-
margin: 0;
|
|
68
|
-
padding: 0;
|
|
69
|
-
list-style: none;
|
|
70
|
-
list-style-type: none;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
.biz-quick-date-picker-wrap.
|
|
124
|
-
border: 1px solid @primary-color;
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
1
|
+
@import '../../assets/styles/inner.less';
|
|
2
|
+
|
|
3
|
+
.biz-quick-date-picker-wrap {
|
|
4
|
+
position: relative;
|
|
5
|
+
display: inline-block;
|
|
6
|
+
height: 34px;
|
|
7
|
+
padding: 4px 8px;
|
|
8
|
+
background: #fafafb;
|
|
9
|
+
border: 1px solid #fafafb;
|
|
10
|
+
border-radius: 4px;
|
|
11
|
+
&-tip {
|
|
12
|
+
position: absolute;
|
|
13
|
+
top: 4px;
|
|
14
|
+
left: 8px;
|
|
15
|
+
z-index: 2;
|
|
16
|
+
border-radius: 2px;
|
|
17
|
+
}
|
|
18
|
+
.ant-picker-range-arrow {
|
|
19
|
+
display: none !important;
|
|
20
|
+
}
|
|
21
|
+
.ant-picker-focused {
|
|
22
|
+
box-shadow: none !important;
|
|
23
|
+
}
|
|
24
|
+
> :nth-child(1) {
|
|
25
|
+
float: left;
|
|
26
|
+
height: 24px;
|
|
27
|
+
margin-right: 8px;
|
|
28
|
+
padding: 2px 8px;
|
|
29
|
+
color: @primary-color;
|
|
30
|
+
vertical-align: middle;
|
|
31
|
+
background: #e8efff;
|
|
32
|
+
}
|
|
33
|
+
.ant-picker {
|
|
34
|
+
padding: 0;
|
|
35
|
+
vertical-align: middle;
|
|
36
|
+
border: none;
|
|
37
|
+
border-radius: 0 !important;
|
|
38
|
+
.ant-picker-clear {
|
|
39
|
+
right: 0;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
.ant-picker:not(.disabled):hover {
|
|
43
|
+
.ant-picker-input > input,
|
|
44
|
+
.ant-picker-range-separator {
|
|
45
|
+
color: #021429 !important;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
&-content {
|
|
49
|
+
float: left;
|
|
50
|
+
.ant-picker-panel-container {
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: row-reverse;
|
|
53
|
+
border-radius: 8px;
|
|
54
|
+
.ant-picker-footer {
|
|
55
|
+
width: auto;
|
|
56
|
+
min-width: auto;
|
|
57
|
+
border-bottom: 1px solid #e8efff;
|
|
58
|
+
box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.1);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
&-options {
|
|
62
|
+
width: 170px;
|
|
63
|
+
padding-bottom: 25px;
|
|
64
|
+
color: #67727f;
|
|
65
|
+
ol,
|
|
66
|
+
li {
|
|
67
|
+
margin: 0;
|
|
68
|
+
padding: 0;
|
|
69
|
+
list-style: none;
|
|
70
|
+
list-style-type: none;
|
|
71
|
+
}
|
|
72
|
+
&-defaultOptions,
|
|
73
|
+
&-customOptions {
|
|
74
|
+
> :nth-child(1),
|
|
75
|
+
> :nth-child(2) {
|
|
76
|
+
display: flex;
|
|
77
|
+
flex-wrap: wrap;
|
|
78
|
+
justify-content: space-between;
|
|
79
|
+
margin-top: 16px;
|
|
80
|
+
padding-bottom: 4px;
|
|
81
|
+
border-bottom: 1px solid #ecedf0;
|
|
82
|
+
li {
|
|
83
|
+
width: 81px;
|
|
84
|
+
height: 24px;
|
|
85
|
+
margin-bottom: 8px;
|
|
86
|
+
line-height: 24px;
|
|
87
|
+
text-align: center;
|
|
88
|
+
background: #fafafb;
|
|
89
|
+
border-radius: 24px;
|
|
90
|
+
cursor: pointer;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
> :nth-child(2) {
|
|
94
|
+
margin-top: 14px;
|
|
95
|
+
li {
|
|
96
|
+
border-radius: 2px;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
.customTime {
|
|
101
|
+
display: flex;
|
|
102
|
+
justify-content: space-between;
|
|
103
|
+
width: 100%;
|
|
104
|
+
height: 32px;
|
|
105
|
+
margin-top: 12px;
|
|
106
|
+
padding: 0 12px;
|
|
107
|
+
line-height: 32px;
|
|
108
|
+
background: #fafafb;
|
|
109
|
+
border-radius: 2px;
|
|
110
|
+
> :first-child {
|
|
111
|
+
transform: rotate(180deg);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
.active,
|
|
115
|
+
li.active {
|
|
116
|
+
color: @primary-color;
|
|
117
|
+
background: #e8efff;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.biz-quick-date-picker-wrap:not(.disabled):hover {
|
|
124
|
+
border: 1px solid @primary-color;
|
|
125
|
+
}
|
|
126
|
+
.biz-quick-date-picker-wrap.focus {
|
|
127
|
+
border: 1px solid @primary-color;
|
|
128
|
+
box-shadow: 0 0 0 4px #f0f7ff;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.clearfix:after {
|
|
132
|
+
display: block;
|
|
133
|
+
clear: both;
|
|
134
|
+
height: 0;
|
|
135
|
+
content: '';
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.clearfix {
|
|
139
|
+
/* 触发 hasLayout */
|
|
140
|
+
zoom: 1;
|
|
141
|
+
}
|
|
@@ -4,6 +4,10 @@ export declare namespace QuickDatePickerTypes {
|
|
|
4
4
|
value: number;
|
|
5
5
|
type: 'week' | 'month' | 'day';
|
|
6
6
|
width: number;
|
|
7
|
+
isDefaultVsTime?: boolean;
|
|
8
|
+
begin?: string;
|
|
9
|
+
end?: string;
|
|
10
|
+
unit?: 'day' | 'week' | 'month';
|
|
7
11
|
}
|
|
8
12
|
interface Range {
|
|
9
13
|
begin: string;
|
|
@@ -12,11 +16,20 @@ export declare namespace QuickDatePickerTypes {
|
|
|
12
16
|
interface Value extends Range {
|
|
13
17
|
unit: 'day' | 'week' | 'month';
|
|
14
18
|
relative?: number;
|
|
19
|
+
value?: number;
|
|
20
|
+
width?: number;
|
|
21
|
+
label?: string;
|
|
22
|
+
isDefaultVsTime?: boolean;
|
|
15
23
|
}
|
|
16
24
|
interface Props {
|
|
17
25
|
defaultValue?: Value;
|
|
18
26
|
value?: Value;
|
|
19
27
|
onChange?: (data: Value) => void;
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
isShowDefaultQuick?: boolean;
|
|
30
|
+
customQuickModuleOptions?: Options[];
|
|
31
|
+
isComparison?: boolean;
|
|
32
|
+
defaultOpen?: boolean;
|
|
20
33
|
}
|
|
21
34
|
interface ListOption {
|
|
22
35
|
count: number;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import moment from 'moment';
|
|
1
2
|
export declare const quickModuleOneOptions: {
|
|
2
3
|
label: string;
|
|
3
4
|
value: number;
|
|
@@ -10,3 +11,8 @@ export declare const quickModuleTwoOptions: {
|
|
|
10
11
|
type: 'day';
|
|
11
12
|
width: number;
|
|
12
13
|
}[];
|
|
14
|
+
export declare function getPreviousTimePeriod(startDate: any, endDate: any, unit?: string, samePeriodLastYear?: boolean): {
|
|
15
|
+
previousStart: moment.Moment;
|
|
16
|
+
previousEnd: moment.Moment;
|
|
17
|
+
isLastYear: boolean;
|
|
18
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import moment from 'moment';
|
|
1
2
|
export var quickModuleOneOptions = [{
|
|
2
3
|
label: '本周',
|
|
3
4
|
value: 1,
|
|
@@ -49,4 +50,56 @@ export var quickModuleTwoOptions = [{
|
|
|
49
50
|
value: 180,
|
|
50
51
|
type: 'day',
|
|
51
52
|
width: 90
|
|
52
|
-
}];
|
|
53
|
+
}];
|
|
54
|
+
export function getPreviousTimePeriod(startDate, endDate) {
|
|
55
|
+
var unit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'day';
|
|
56
|
+
var samePeriodLastYear = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
57
|
+
var start = moment(startDate);
|
|
58
|
+
var end = moment(endDate);
|
|
59
|
+
if (!start.isValid() || !end.isValid()) {
|
|
60
|
+
throw new Error('Invalid date input');
|
|
61
|
+
}
|
|
62
|
+
if (samePeriodLastYear) {
|
|
63
|
+
return {
|
|
64
|
+
previousStart: start.clone().subtract(1, 'year'),
|
|
65
|
+
previousEnd: end.clone().subtract(1, 'year'),
|
|
66
|
+
isLastYear: true
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
var duration = moment.duration(end.diff(start));
|
|
70
|
+
var previousStart;
|
|
71
|
+
var previousEnd;
|
|
72
|
+
switch (unit.toLowerCase()) {
|
|
73
|
+
case 'hour':
|
|
74
|
+
previousEnd = start.clone().subtract(1, 'millisecond');
|
|
75
|
+
previousStart = previousEnd.clone().subtract(duration);
|
|
76
|
+
break;
|
|
77
|
+
case 'day':
|
|
78
|
+
previousEnd = start.clone().subtract(1, 'millisecond');
|
|
79
|
+
previousStart = previousEnd.clone().subtract(duration);
|
|
80
|
+
break;
|
|
81
|
+
case 'week':
|
|
82
|
+
previousEnd = start.clone().subtract(1, 'millisecond');
|
|
83
|
+
previousStart = previousEnd.clone().subtract(duration, 'week');
|
|
84
|
+
break;
|
|
85
|
+
case 'month':
|
|
86
|
+
previousEnd = start.clone().subtract(1, 'millisecond');
|
|
87
|
+
previousStart = previousEnd.clone().subtract(duration, 'month');
|
|
88
|
+
if (start.date() !== previousStart.date()) {
|
|
89
|
+
previousStart.endOf('month');
|
|
90
|
+
}
|
|
91
|
+
break;
|
|
92
|
+
case 'year':
|
|
93
|
+
previousEnd = start.clone().subtract(1, 'millisecond');
|
|
94
|
+
previousStart = previousEnd.clone().subtract(duration, 'year');
|
|
95
|
+
break;
|
|
96
|
+
default:
|
|
97
|
+
previousEnd = start.clone().subtract(1, 'millisecond');
|
|
98
|
+
previousStart = previousEnd.clone().subtract(duration);
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
previousStart: previousStart,
|
|
102
|
+
previousEnd: previousEnd,
|
|
103
|
+
isLastYear: false
|
|
104
|
+
};
|
|
105
|
+
}
|
package/es/select/demo/index.js
CHANGED
package/es/select/handle.js
CHANGED
|
@@ -27,7 +27,7 @@ var SelectHandle = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
27
27
|
setFocus = _useState2[1];
|
|
28
28
|
var handleRef = useRef(null);
|
|
29
29
|
var inputRef = useRef(null);
|
|
30
|
-
var textRef = useRef();
|
|
30
|
+
var textRef = useRef(null);
|
|
31
31
|
var _useState3 = useState(''),
|
|
32
32
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
33
33
|
searchValue = _useState4[0],
|
|
@@ -114,7 +114,7 @@ var SelectHandle = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
114
114
|
color: "#fff"
|
|
115
115
|
}, /*#__PURE__*/React.createElement(Tag, {
|
|
116
116
|
closable: true,
|
|
117
|
-
className: "".concat(classPrefix, "-tag ").concat(disable || disableKeyMap[item[keyField]] ? 'disable' : ''),
|
|
117
|
+
className: "".concat(classPrefix, "-tag state-").concat(item.ancestryState, " ").concat(disable || disableKeyMap[item[keyField]] ? 'disable' : ''),
|
|
118
118
|
onClose: function onClose() {
|
|
119
119
|
!disable && !disableKeyMap[item[keyField]] && onDelete(item);
|
|
120
120
|
}
|
|
@@ -175,11 +175,4 @@ var SelectHandle = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
175
175
|
type: 'qingchu'
|
|
176
176
|
}))));
|
|
177
177
|
});
|
|
178
|
-
SelectHandle.defaultProps = {
|
|
179
|
-
labelField: 'label',
|
|
180
|
-
keyField: 'id',
|
|
181
|
-
border: true,
|
|
182
|
-
showSelectIcon: true,
|
|
183
|
-
extraLabel: ''
|
|
184
|
-
};
|
|
185
178
|
export default SelectHandle;
|