@zgfe/business-lib 1.1.60 → 1.1.61-tags.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.
Files changed (40) hide show
  1. package/es/assets/demo/picker.d.ts +2 -0
  2. package/es/assets/demo/picker.js +22 -0
  3. package/es/assets/styles/chunks.less +10 -5
  4. package/es/assets/styles/resetAntd.less +1 -8
  5. package/es/assets/styles/variable.less +3 -0
  6. package/es/attrCondition/styles/index.less +0 -1
  7. package/es/attrConditions/styles/index.less +3 -5
  8. package/es/attributeSelector/index.js +1 -1
  9. package/es/attributeSelector/styles/index.less +4 -0
  10. package/es/chart/index.js +6 -2
  11. package/es/chart/types.d.ts +1 -0
  12. package/es/eventSelector/demo/index.js +1 -6
  13. package/es/eventSelector/index.js +1 -1
  14. package/es/eventSelector/styles/index.less +5 -1
  15. package/es/index.d.ts +2 -1
  16. package/es/index.js +2 -1
  17. package/es/quickDatePicker/demo/index.d.ts +3 -0
  18. package/es/quickDatePicker/demo/index.js +35 -0
  19. package/es/quickDatePicker/index.d.ts +6 -0
  20. package/es/quickDatePicker/index.js +178 -0
  21. package/es/quickDatePicker/styles/index.less +124 -0
  22. package/es/quickDatePicker/types.d.ts +24 -0
  23. package/es/quickDatePicker/types.js +1 -0
  24. package/es/quickDatePicker/utils.d.ts +10 -0
  25. package/es/quickDatePicker/utils.js +42 -0
  26. package/es/targetConditionGroup/styles/index.less +3 -0
  27. package/es/targetSelector/styles/index.less +3 -0
  28. package/es/userCondition/conditions/tagsCondition.js +1 -4
  29. package/es/userCondition/conditions/textDesc.js +3 -2
  30. package/es/userCondition/demo/mockData.d.ts +27 -41
  31. package/es/userCondition/demo/mockData.js +121 -175
  32. package/es/userCondition/types.d.ts +1 -0
  33. package/es/userCondition/util.d.ts +11 -1
  34. package/es/userCondition/util.js +34 -10
  35. package/es/userGroup/index.js +10 -2
  36. package/es/userGroup/styles/index.less +3 -1
  37. package/es/userTagsSelector/cascaderOverlay.js +27 -2
  38. package/es/userTagsSelector/demo/index.js +1 -1
  39. package/es/userTagsSelector/index.js +4 -2
  40. package/package.json +2 -2
@@ -0,0 +1,2 @@
1
+ declare const _default: () => JSX.Element;
2
+ export default _default;
@@ -0,0 +1,22 @@
1
+ import { Card, DatePicker, Space } from 'antd';
2
+ import React from 'react';
3
+ import AssetsDemo from '.';
4
+ var RangePicker = DatePicker.RangePicker;
5
+ export default (function () {
6
+ return /*#__PURE__*/React.createElement(AssetsDemo, null, /*#__PURE__*/React.createElement(Card, {
7
+ title: "Input"
8
+ }, /*#__PURE__*/React.createElement(Space, {
9
+ direction: "vertical",
10
+ size: 12
11
+ }, /*#__PURE__*/React.createElement(RangePicker, null), /*#__PURE__*/React.createElement(RangePicker, {
12
+ showTime: true
13
+ }), /*#__PURE__*/React.createElement(RangePicker, {
14
+ picker: "week"
15
+ }), /*#__PURE__*/React.createElement(RangePicker, {
16
+ picker: "month"
17
+ }), /*#__PURE__*/React.createElement(RangePicker, {
18
+ picker: "quarter"
19
+ }), /*#__PURE__*/React.createElement(RangePicker, {
20
+ picker: "year"
21
+ }))));
22
+ });
@@ -25,10 +25,15 @@
25
25
 
26
26
  // 下拉组件操作栏样式
27
27
  .__select-handle {
28
- padding: @padding-xss;
29
- border: 1px solid @border-color-base;
28
+ // padding: @padding-xss;
29
+ // border: 1px solid @border-color-base;
30
+ background: @custom-background;
31
+ border: 1px solid @custom-background;
30
32
  border-radius: @border-radius-small;
31
33
  cursor: pointer;
34
+ &:hover {
35
+ border: 1px solid @primary-color;
36
+ }
32
37
  }
33
38
 
34
39
  // 下拉组件展开panel样式
@@ -118,7 +123,7 @@
118
123
  .__default-overflow();
119
124
 
120
125
  &:hover:not(.disable) {
121
- background-color: @background-color-base;
126
+ // background-color: @background-color-base;
122
127
  border-color: @primary-color;
123
128
  box-shadow: none;
124
129
  }
@@ -132,14 +137,14 @@
132
137
 
133
138
  // 下拉框常用样式
134
139
  .__select-normal-secondary {
135
- background-color: @white;
140
+ // background-color: @white;
136
141
  border: 1px solid @border-color-base;
137
142
  border-radius: @border-radius-small;
138
143
 
139
144
  &:not(.disable) {
140
145
  &:hover,
141
146
  &.active {
142
- .__default-hover();
147
+ // .__default-hover();
143
148
  border-color: @border-color-base;
144
149
  box-shadow: none;
145
150
  }
@@ -178,14 +178,7 @@
178
178
 
179
179
  &:hover:not(.ant-picker-disabled),
180
180
  &.ant-picker-focused {
181
- .__default-hover() !important;
182
- border-color: @border-color-base!important;
183
- box-shadow: none !important;
184
-
185
- span,
186
- input {
187
- color: @primary-color!important;
188
- }
181
+ border-color: @primary-color!important;
189
182
  }
190
183
 
191
184
  .ant-picker-active-bar {
@@ -12,3 +12,6 @@
12
12
  @box-shadow-small: 0px 1px 2px @shadow-color-light;
13
13
  @primary-color-hover: color(~`colorPalette('@{primary-color}', 0.1) `);
14
14
  @box-shadow-form: 0 0 0 4px @primary-color-hover;
15
+ @custom-background: #fafafb;
16
+ @custom-focus: #f0f7ff;
17
+ @primary-color: '#165dff';
@@ -13,7 +13,6 @@
13
13
  .biz-attr-select-handle {
14
14
  width: 184px;
15
15
  padding: 0;
16
- border: none;
17
16
  }
18
17
  .ant-space-item:nth-of-type(3) {
19
18
  min-width: 184px;
@@ -2,9 +2,9 @@
2
2
 
3
3
  /* 筛选条件 */
4
4
  .biz-condition-item {
5
- &.border {
6
- .__select-handle();
7
- }
5
+ // &.border {
6
+ // .__select-handle();
7
+ // }
8
8
  &-panel {
9
9
  display: flex;
10
10
  width: 100%;
@@ -19,8 +19,6 @@
19
19
  .biz-attr-select-handle {
20
20
  margin-bottom: 2px;
21
21
  padding: 0;
22
- border: none;
23
- border-radius: 0;
24
22
  }
25
23
 
26
24
  .ant-input {
@@ -83,7 +83,7 @@ var BizAttributeSelector = function BizAttributeSelector(props) {
83
83
  setVisible(flag);
84
84
  };
85
85
  return /*#__PURE__*/React.createElement("div", {
86
- className: classPrefix
86
+ className: "".concat(classPrefix, " ").concat(visible ? 'focus' : '')
87
87
  }, /*#__PURE__*/React.createElement("div", {
88
88
  className: "".concat(classPrefix, "-handle")
89
89
  }, /*#__PURE__*/React.createElement(Dropdown, {
@@ -1,6 +1,10 @@
1
1
  @import '../../assets/styles/inner.less';
2
2
 
3
3
  .biz-attr-select {
4
+ border-radius: 4px;
5
+ &.focus {
6
+ box-shadow: 0 0 0 4px @custom-focus;
7
+ }
4
8
  &-handle {
5
9
  display: flex;
6
10
  flex-direction: row;
package/es/chart/index.js CHANGED
@@ -36,7 +36,8 @@ var BizChart = /*#__PURE__*/React.forwardRef(function (props, ref) {
36
36
  legendFormatter = props.legendFormatter,
37
37
  valueUnit = props.valueUnit,
38
38
  legendPosition = props.legendPosition,
39
- legendOrient = props.legendOrient;
39
+ legendOrient = props.legendOrient,
40
+ autoHeight = props.autoHeight;
40
41
  var _useState = useState({}),
41
42
  _useState2 = _slicedToArray(_useState, 2),
42
43
  chartOption = _useState2[0],
@@ -87,7 +88,10 @@ var BizChart = /*#__PURE__*/React.forwardRef(function (props, ref) {
87
88
  notMerge: true,
88
89
  lazyUpdate: true,
89
90
  theme: 'theme_name',
90
- style: {
91
+ style: autoHeight ? {
92
+ width: '100%',
93
+ height: '100%'
94
+ } : {
91
95
  width: '100%'
92
96
  }
93
97
  });
@@ -46,5 +46,6 @@ export declare namespace ChartTypes {
46
46
  showOther?: boolean;
47
47
  reverseXAxis?: boolean;
48
48
  seriesName?: string;
49
+ autoHeight?: boolean;
49
50
  }
50
51
  }
@@ -25,12 +25,7 @@ var EventDemo = function EventDemo() {
25
25
  var onChange = function onChange(data) {
26
26
  setValue(data);
27
27
  };
28
- return /*#__PURE__*/React.createElement("div", {
29
- style: {
30
- height: '500px',
31
- overflow: 'auto'
32
- }
33
- }, /*#__PURE__*/React.createElement("div", {
28
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
34
29
  style: {
35
30
  height: '700px'
36
31
  }
@@ -100,7 +100,7 @@ var BizEventSelector = function BizEventSelector(props) {
100
100
  setVisible(flag);
101
101
  };
102
102
  return /*#__PURE__*/React.createElement("div", {
103
- className: [classPrefix, border ? 'border' : ''].join(' ')
103
+ className: [classPrefix, border ? 'border' : '', visible ? 'focus' : ''].join(' ')
104
104
  }, /*#__PURE__*/React.createElement(Dropdown, {
105
105
  dropdownRender: function dropdownRender() {
106
106
  return /*#__PURE__*/React.createElement(EventListPanel, {
@@ -1,12 +1,16 @@
1
1
  @import '../../assets/styles/inner.less';
2
2
 
3
3
  .biz-event-select {
4
+ position: relative;
5
+ border-radius: 4px;
6
+ &.focus {
7
+ box-shadow: 0 0 0 4px @custom-focus;
8
+ }
4
9
  &.border {
5
10
  .biz-event-select-handle {
6
11
  .__select-handle();
7
12
  }
8
13
  }
9
- position: relative;
10
14
  &-list-panel {
11
15
  display: flex;
12
16
  flex-direction: row;
package/es/index.d.ts CHANGED
@@ -8,6 +8,7 @@ import BizTargetCondition from './targetConditionGroup';
8
8
  import BizConditionItem from './attrConditions';
9
9
  import BizConditionGroup from './attrConditions/group';
10
10
  import BizDatePicker from './datePicker';
11
+ import BizQuickDatePicker from './quickDatePicker';
11
12
  import BizSelect from './select';
12
13
  import BizDialog from './dialog';
13
14
  import BizChart from './chart';
@@ -34,7 +35,7 @@ import BizAttrCondition from './attrCondition';
34
35
  import BizAttrConditionGroup from './attrCondition/group';
35
36
  import BizTargetFromPanel from './layout/optionTitle';
36
37
  import { BizTargetFromPanelContext } from './layout/optionTitle/types';
37
- export { BizTargetFromPanel, BizSearchInput, BizSelect, BizDialog, BizChart, BizTable, BizAnalysisLayout, BizDetailLayout, BizUserGroup, IconFont, ColorIcon, BizTargetSelector, BizEventSelector, BizAttributeSelector, BizGlobalDataContext, BizTargetFromPanelContext, BizTargetCondition, BizDatePicker, BizConditionItem, BizConditionGroup, BizAttrCondition, BizAttrConditionGroup, BizUserCondition, BizAddToScene, BizAddToPanel, BizCycleTime, BizDnd, BizLoginForm, DemoWrapper, SocketClient, ajax, util, theme, convertAttributeData, BizUserTagsSelect, setGlobalConfig, };
38
+ export { BizTargetFromPanel, BizSearchInput, BizSelect, BizDialog, BizChart, BizTable, BizAnalysisLayout, BizDetailLayout, BizUserGroup, IconFont, ColorIcon, BizTargetSelector, BizEventSelector, BizAttributeSelector, BizGlobalDataContext, BizTargetFromPanelContext, BizTargetCondition, BizDatePicker, BizQuickDatePicker, BizConditionItem, BizConditionGroup, BizAttrCondition, BizAttrConditionGroup, BizUserCondition, BizAddToScene, BizAddToPanel, BizCycleTime, BizDnd, BizLoginForm, DemoWrapper, SocketClient, ajax, util, theme, convertAttributeData, BizUserTagsSelect, setGlobalConfig, };
38
39
  export type { UserGroupTypes } from './userGroup/types';
39
40
  export type { BizSelectTypes } from './select/types';
40
41
  export type { AttributeSelect } from './attributeSelector/types';
package/es/index.js CHANGED
@@ -7,6 +7,7 @@ import BizTargetCondition from './targetConditionGroup';
7
7
  import BizConditionItem from './attrConditions';
8
8
  import BizConditionGroup from './attrConditions/group';
9
9
  import BizDatePicker from './datePicker';
10
+ import BizQuickDatePicker from './quickDatePicker';
10
11
  import BizSelect from './select';
11
12
  import BizDialog from './dialog';
12
13
  import BizChart from './chart';
@@ -33,4 +34,4 @@ import BizAttrCondition from './attrCondition';
33
34
  import BizAttrConditionGroup from './attrCondition/group';
34
35
  import BizTargetFromPanel from './layout/optionTitle';
35
36
  import { BizTargetFromPanelContext } from './layout/optionTitle/types';
36
- export { BizTargetFromPanel, BizSearchInput, BizSelect, BizDialog, BizChart, BizTable, BizAnalysisLayout, BizDetailLayout, BizUserGroup, IconFont, ColorIcon, BizTargetSelector, BizEventSelector, BizAttributeSelector, BizGlobalDataContext, BizTargetFromPanelContext, BizTargetCondition, BizDatePicker, BizConditionItem, BizConditionGroup, BizAttrCondition, BizAttrConditionGroup, BizUserCondition, BizAddToScene, BizAddToPanel, BizCycleTime, BizDnd, BizLoginForm, DemoWrapper, SocketClient, ajax, util, theme, convertAttributeData, BizUserTagsSelect, setGlobalConfig };
37
+ export { BizTargetFromPanel, BizSearchInput, BizSelect, BizDialog, BizChart, BizTable, BizAnalysisLayout, BizDetailLayout, BizUserGroup, IconFont, ColorIcon, BizTargetSelector, BizEventSelector, BizAttributeSelector, BizGlobalDataContext, BizTargetFromPanelContext, BizTargetCondition, BizDatePicker, BizQuickDatePicker, BizConditionItem, BizConditionGroup, BizAttrCondition, BizAttrConditionGroup, BizUserCondition, BizAddToScene, BizAddToPanel, BizCycleTime, BizDnd, BizLoginForm, DemoWrapper, SocketClient, ajax, util, theme, convertAttributeData, BizUserTagsSelect, setGlobalConfig };
@@ -0,0 +1,3 @@
1
+ import '@zgfe/business-lib/es/assets/styles/resetAntd.less';
2
+ declare const _default: () => JSX.Element;
3
+ export default _default;
@@ -0,0 +1,35 @@
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 { BizQuickDatePicker } from '@zgfe/business-lib';
8
+ import React, { useState } from 'react';
9
+ import '@zgfe/business-lib/es/assets/styles/resetAntd.less';
10
+ export default (function () {
11
+ var _useState = useState({
12
+ unit: 'month',
13
+ begin: '2023-06-23',
14
+ end: '2023-06-30',
15
+ relative: 3
16
+ }),
17
+ _useState2 = _slicedToArray(_useState, 2),
18
+ time = _useState2[0],
19
+ setTime = _useState2[1];
20
+ var onChange = function onChange(data) {
21
+ setTime(data);
22
+ };
23
+ return /*#__PURE__*/React.createElement("div", {
24
+ style: {
25
+ display: 'flex'
26
+ }
27
+ }, /*#__PURE__*/React.createElement("div", {
28
+ style: {
29
+ lineHeight: '32px'
30
+ }
31
+ }, "\u9009\u62E9\u65F6\u95F4\uFF1A"), /*#__PURE__*/React.createElement(BizQuickDatePicker, {
32
+ defaultValue: time,
33
+ onChange: onChange
34
+ }));
35
+ });
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import './styles/index.less';
3
+ import { QuickDatePickerTypes } from './types';
4
+ export declare const classPrefix = "biz-quick-date-picker-wrap";
5
+ declare const BizQuickDatePicker: React.FC<QuickDatePickerTypes.Props>;
6
+ export default BizQuickDatePicker;
@@ -0,0 +1,178 @@
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, { useEffect, useState } from 'react';
8
+ import './styles/index.less';
9
+ import moment from 'moment';
10
+ import { quickModuleOneOptions, quickModuleTwoOptions } from './utils';
11
+ import IconFont from '../icon/iconFont';
12
+ import { DatePicker } from 'antd';
13
+ var RangePicker = DatePicker.RangePicker;
14
+ export var classPrefix = 'biz-quick-date-picker-wrap';
15
+ var changeCount = 0;
16
+ var BizQuickDatePicker = function BizQuickDatePicker(props) {
17
+ var defaultValue = props.defaultValue;
18
+ var _useState = useState(false),
19
+ _useState2 = _slicedToArray(_useState, 2),
20
+ show = _useState2[0],
21
+ setShow = _useState2[1];
22
+ var _useState3 = useState(-1),
23
+ _useState4 = _slicedToArray(_useState3, 2),
24
+ relative = _useState4[0],
25
+ setRelative = _useState4[1];
26
+ var _useState5 = useState('day'),
27
+ _useState6 = _slicedToArray(_useState5, 2),
28
+ unit = _useState6[0],
29
+ setUnit = _useState6[1];
30
+ var _useState7 = useState([moment().subtract(6, 'day'), moment()]),
31
+ _useState8 = _slicedToArray(_useState7, 2),
32
+ value = _useState8[0],
33
+ setValue = _useState8[1];
34
+ var _useState9 = useState('过去7天'),
35
+ _useState10 = _slicedToArray(_useState9, 2),
36
+ showText = _useState10[0],
37
+ setShowText = _useState10[1];
38
+ useEffect(function () {
39
+ var _value = defaultValue || props.value;
40
+ if (_value && _value.begin !== '') {
41
+ setValue([moment(_value.begin), moment(_value.end)]);
42
+ _value.relative && setRelative(_value.relative);
43
+ _value.unit && setUnit(_value.unit);
44
+ if (_value && _value.relative && _value.unit === 'day') {
45
+ quickModuleTwoOptions.map(function (item) {
46
+ if (item.value === _value.relative) {
47
+ setShowText(item.label);
48
+ }
49
+ });
50
+ } else {
51
+ quickModuleOneOptions.map(function (item) {
52
+ if (item.value === _value.relative) {
53
+ setShowText(item.label);
54
+ }
55
+ });
56
+ }
57
+ }
58
+ }, [defaultValue, props.value]);
59
+ var onChange = function onChange(date, dateString) {
60
+ changeCount++;
61
+ setShowText('自定义');
62
+ if (date === null) {
63
+ setValue(undefined);
64
+ setShow(false);
65
+ var changeValue = {
66
+ unit: 'day',
67
+ begin: '',
68
+ end: '',
69
+ relative: -1
70
+ };
71
+ props.onChange && props.onChange(changeValue);
72
+ } else {
73
+ setValue(date);
74
+ setRelative(-1);
75
+ if (changeCount >= 2 || value === undefined) {
76
+ setShow(false);
77
+ var _changeValue = {
78
+ unit: 'day',
79
+ begin: dateString[0],
80
+ end: dateString[1],
81
+ relative: -1
82
+ };
83
+ props.onChange && props.onChange(_changeValue);
84
+ }
85
+ }
86
+ };
87
+ useEffect(function () {
88
+ if (!show) changeCount = 0;
89
+ }, [show]);
90
+ var onBlur = function onBlur() {
91
+ setShow(false);
92
+ };
93
+ var onClick = function onClick() {
94
+ setShow(true);
95
+ };
96
+ var disabledDate = function disabledDate(current) {
97
+ return current && current > moment().endOf('month');
98
+ };
99
+ var quickModuleHandle = function quickModuleHandle(item) {
100
+ var _value;
101
+ if (item.type === 'week' || item.type === 'month') {
102
+ switch (Number(item.value)) {
103
+ case 1:
104
+ _value = [moment().weekday(1), moment().weekday(7)];
105
+ break;
106
+ case 2:
107
+ _value = [moment().weekday(1).subtract(1, 'week'), moment().weekday(7).subtract(1, 'week')];
108
+ break;
109
+ case 3:
110
+ _value = [moment().startOf('month'), moment().endOf('month')];
111
+ break;
112
+ case 4:
113
+ _value = [moment().startOf('month').subtract(1, 'month'), moment().endOf('month').subtract(1, 'month')];
114
+ break;
115
+ }
116
+ } else {
117
+ _value = [moment().subtract(Number(item.value) - 1, 'day'), moment()];
118
+ }
119
+ setRelative(item.value);
120
+ setUnit(item.type);
121
+ setShowText(item.label);
122
+ setValue(_value);
123
+ setShow(false);
124
+ if (_value) {
125
+ var changeValue = {
126
+ unit: item.type,
127
+ begin: _value[0].format('YYYY-MM-DD'),
128
+ end: _value[1].format('YYYY-MM-DD'),
129
+ relative: item.value
130
+ };
131
+ props.onChange && props.onChange(changeValue);
132
+ }
133
+ };
134
+ var renderExtraFooter = function renderExtraFooter() {
135
+ return /*#__PURE__*/React.createElement("div", {
136
+ className: "".concat(classPrefix, "-content-options")
137
+ }, /*#__PURE__*/React.createElement("ol", null, quickModuleOneOptions.map(function (item) {
138
+ return /*#__PURE__*/React.createElement("li", {
139
+ className: "".concat(item.type === unit && item.value === relative ? 'active' : ''),
140
+ key: item.label,
141
+ onClick: function onClick() {
142
+ return quickModuleHandle(item);
143
+ }
144
+ }, item.label);
145
+ })), /*#__PURE__*/React.createElement("ol", null, quickModuleTwoOptions.map(function (item) {
146
+ return /*#__PURE__*/React.createElement("li", {
147
+ className: "".concat(item.type === unit && item.value === relative ? 'active' : ''),
148
+ key: item.label,
149
+ onClick: function onClick() {
150
+ return quickModuleHandle(item);
151
+ }
152
+ }, item.label);
153
+ })), /*#__PURE__*/React.createElement("div", {
154
+ className: "".concat(relative === -1 ? 'active' : '')
155
+ }, "\u81EA\u5B9A\u4E49\u65F6\u95F4", /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(IconFont, {
156
+ type: "fanhuiicon"
157
+ }))));
158
+ };
159
+ return /*#__PURE__*/React.createElement("div", {
160
+ className: "".concat(classPrefix, " clearfix ").concat(show ? 'focus' : ''),
161
+ tabIndex: 1
162
+ }, /*#__PURE__*/React.createElement("div", {
163
+ onClick: function onClick() {
164
+ setShow(true);
165
+ }
166
+ }, showText), /*#__PURE__*/React.createElement(RangePicker, {
167
+ popupClassName: "".concat(classPrefix, "-content"),
168
+ separator: '至',
169
+ value: value,
170
+ onBlur: onBlur,
171
+ open: show,
172
+ onClick: onClick,
173
+ disabledDate: disabledDate,
174
+ onChange: onChange,
175
+ renderExtraFooter: renderExtraFooter
176
+ }));
177
+ };
178
+ export default BizQuickDatePicker;
@@ -0,0 +1,124 @@
1
+ @import '../../assets/styles/inner.less';
2
+
3
+ .biz-quick-date-picker-wrap {
4
+ display: inline-block;
5
+ height: 34px;
6
+ padding: 4px 8px;
7
+ background: #fafafb;
8
+ border: 1px solid #fafafb;
9
+ border-radius: 4px;
10
+ .ant-picker-focused {
11
+ box-shadow: none !important;
12
+ }
13
+ > :nth-child(1) {
14
+ float: left;
15
+ height: 24px;
16
+ margin-right: 8px;
17
+ padding: 2px 8px;
18
+ color: #165dff;
19
+ vertical-align: middle;
20
+ background: #e8efff;
21
+ }
22
+ .ant-picker {
23
+ padding: 0;
24
+ vertical-align: middle;
25
+ border: none;
26
+ border-radius: 0 !important;
27
+ .ant-picker-clear {
28
+ right: 0;
29
+ }
30
+ }
31
+ .ant-picker:hover {
32
+ .ant-picker-input > input,
33
+ .ant-picker-range-separator {
34
+ color: #021429 !important;
35
+ }
36
+ }
37
+ &-content {
38
+ float: left;
39
+ .ant-picker-panel-container {
40
+ display: flex;
41
+ flex-direction: row-reverse;
42
+ .ant-picker-footer {
43
+ width: auto;
44
+ min-width: auto;
45
+ border-bottom: 1px solid #e8efff;
46
+ box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.1);
47
+ }
48
+ }
49
+ &-options {
50
+ width: 170px;
51
+ padding-bottom: 25px;
52
+ color: #67727f;
53
+ ol,
54
+ li {
55
+ margin: 0;
56
+ padding: 0;
57
+ list-style: none;
58
+ list-style-type: none;
59
+ }
60
+ > :nth-child(1),
61
+ > :nth-child(2) {
62
+ display: flex;
63
+ flex-wrap: wrap;
64
+ justify-content: space-between;
65
+ margin-top: 8px;
66
+ padding-bottom: 4px;
67
+ border-bottom: 1px solid #ecedf0;
68
+ li {
69
+ width: 81px;
70
+ height: 24px;
71
+ margin-bottom: 8px;
72
+ line-height: 24px;
73
+ text-align: center;
74
+ background: #fafafb;
75
+ border-radius: 24px;
76
+ cursor: pointer;
77
+ }
78
+ }
79
+ > :nth-child(2) {
80
+ margin-top: 14px;
81
+ li {
82
+ border-radius: 0;
83
+ }
84
+ }
85
+ > :nth-child(3) {
86
+ display: flex;
87
+ justify-content: space-between;
88
+ width: 100%;
89
+ height: 32px;
90
+ margin-top: 12px;
91
+ padding: 0 12px;
92
+ line-height: 32px;
93
+ background: #fafafb;
94
+ > :first-child {
95
+ transform: rotate(180deg);
96
+ }
97
+ }
98
+ .active,
99
+ li.active {
100
+ color: #165dff;
101
+ background: #e8efff;
102
+ }
103
+ }
104
+ }
105
+ }
106
+
107
+ .biz-quick-date-picker-wrap:hover {
108
+ border: 1px solid #165dff;
109
+ }
110
+ .biz-quick-date-picker-wrap.focus {
111
+ box-shadow: 0 0 0 4px #f0f7ff;
112
+ }
113
+
114
+ .clearfix:after {
115
+ display: block;
116
+ clear: both;
117
+ height: 0;
118
+ content: '';
119
+ }
120
+
121
+ .clearfix {
122
+ /* 触发 hasLayout */
123
+ zoom: 1;
124
+ }
@@ -0,0 +1,24 @@
1
+ export declare namespace QuickDatePickerTypes {
2
+ interface Options {
3
+ label: string;
4
+ value: number;
5
+ type: 'week' | 'month' | 'day';
6
+ }
7
+ interface Range {
8
+ begin: string;
9
+ end: string;
10
+ }
11
+ interface Value extends Range {
12
+ unit: 'day' | 'week' | 'month';
13
+ relative?: number;
14
+ }
15
+ interface Props {
16
+ defaultValue?: Value;
17
+ value?: Value;
18
+ onChange?: (data: Value) => void;
19
+ }
20
+ interface ListOption {
21
+ count: number;
22
+ value: string;
23
+ }
24
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ export declare const quickModuleOneOptions: {
2
+ label: string;
3
+ value: number;
4
+ type: 'week' | 'month';
5
+ }[];
6
+ export declare const quickModuleTwoOptions: {
7
+ label: string;
8
+ value: number;
9
+ type: 'day';
10
+ }[];