@zgfe/business-lib 1.1.82-user.1 → 1.1.82-user.3

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.
@@ -90,7 +90,7 @@ var BizAddToPanel = function BizAddToPanel(props) {
90
90
  if (!searchParam.appId && searchParam['app_id']) {
91
91
  searchParam.appId = searchParam['app_id'];
92
92
  }
93
- searchParam.chartType = form.chartType;
93
+ searchParam.chartType = form.chartType || props.params.chartType;
94
94
  form.extendTarget ? searchParam.extendTarget = form.extendTarget : null;
95
95
  var resData = {
96
96
  data: searchParam,
@@ -1,5 +1,5 @@
1
1
  export default {
2
- xAxis: ['2022-03-31', '2022-04-01', '2022-04-02', '2022-04-03', '2022-04-04', '2022-04-05', '2022-04-06', '2022-04-07', '2022-04-08', '2022-04-09', '2022-04-10', '2022-04-11', '2022-04-12', '2022-04-13'],
2
+ xAxis: ['2022-03-31', '2022-04-01', '2022-04-02', '2022-04-03', '2022-04-04', '2022-04-05', '2022-04-06', '2022-04-07', '2022-04-08', '2022-04-09', '2022-04-10', '2022-04-11', '2023-09-17', '2023-09-18'],
3
3
  series: [{
4
4
  names: ['付款成功付款成功付款成功付款成功付款成功付款成功付款成功付款成功付款成功付款成功付款成功付款成功付款成功付款成功'],
5
5
  values: [26, 27, 43, 44, 40, 34, 33, 33, 34, 24, 30, 31, 31, 38]
package/es/chart/index.js CHANGED
@@ -17,6 +17,8 @@ import { getChartOption, getPieOption, getMapOption } from './util/chartOptionCo
17
17
  import { provinceSeries, citySeries, maxMinValue } from './util/mapUtil';
18
18
  import { formatPieData, formatChartData } from './util/formatData';
19
19
  import './util/data/china.js';
20
+ import moment from 'moment';
21
+ import _ from 'lodash';
20
22
  var BizChart = /*#__PURE__*/React.forwardRef(function (props, ref) {
21
23
  var type = props.type,
22
24
  data = props.data,
@@ -46,6 +48,53 @@ var BizChart = /*#__PURE__*/React.forwardRef(function (props, ref) {
46
48
  _useState4 = _slicedToArray(_useState3, 2),
47
49
  instance = _useState4[0],
48
50
  setInstance = _useState4[1];
51
+ function dashedLineFormat(option) {
52
+ var overTime = false;
53
+ option.xAxis.data.forEach(function (label, index) {
54
+ if (overTime) return;
55
+ if (!/\d{4}-\d{2}-\d{2}/.test(label)) return;
56
+ var laterTime = label.replace(/[-:\s]*/g, '');
57
+ var currentDate = new Date();
58
+ var currentDateTime = moment().format('YYYYMMDD');
59
+ if (/\d{2}:\d{2}:\d{2}/.test(label)) {
60
+ currentDateTime += currentDate.toTimeString().match(/\d{2}:\d{2}:\d{2}/)[0].replace(/:/g, '');
61
+ } else if (/\|/.test(label)) {
62
+ laterTime = label.split('|')[1].replace(/[-:\s]*/g, '');
63
+ }
64
+ if (parseInt(laterTime) >= Number(currentDateTime)) {
65
+ overTime = true;
66
+ var dashedSeries = [];
67
+ option.series.forEach(function (series, seriesIndex) {
68
+ var dashedItem = addDashedSeries(series, index - 1);
69
+ dashedItem.itemStyle.normal.color = dashedItem.lineStyle.normal.color = option.color[seriesIndex];
70
+ dashedSeries.push(dashedItem);
71
+ });
72
+ option.series = option.series.concat(dashedSeries);
73
+ }
74
+ });
75
+ return option;
76
+ }
77
+ function addDashedSeries(series, dashedIndex) {
78
+ var dashedSeries = _.cloneDeep(series);
79
+ if (!dashedSeries.lineStyle) dashedSeries.lineStyle = {
80
+ normal: {}
81
+ };
82
+ dashedSeries.lineStyle.normal.type = 'dashed';
83
+ if (!dashedSeries.itemStyle) dashedSeries.itemStyle = {
84
+ normal: {}
85
+ };
86
+ series.data.forEach(function (_v, i) {
87
+ if (i > dashedIndex) {
88
+ series.data.splice(i, 1, null);
89
+ }
90
+ });
91
+ dashedSeries.data.forEach(function (_v, i) {
92
+ if (i < dashedIndex) {
93
+ dashedSeries.data.splice(i, 1, null);
94
+ }
95
+ });
96
+ return dashedSeries;
97
+ }
49
98
  useEffect(function () {
50
99
  if (option) {
51
100
  setChartOption(function () {
@@ -70,6 +119,9 @@ var BizChart = /*#__PURE__*/React.forwardRef(function (props, ref) {
70
119
  if (colors) {
71
120
  eOption.color = colors;
72
121
  }
122
+ if (type === 'line') {
123
+ eOption = dashedLineFormat(eOption);
124
+ }
73
125
  setChartOption(function () {
74
126
  return _objectSpread({}, eOption);
75
127
  });
@@ -14,7 +14,12 @@ var tooltipFormatterDefault = function tooltipFormatterDefault(params, resultFor
14
14
  }
15
15
  var htmlArray = [];
16
16
  htmlArray.push("<div class=\"biz-chart-tooltip-title\">".concat(xLabel, "</div>"));
17
+ var seriesMap = {};
17
18
  params.forEach(function (item) {
19
+ if (item.value === null || item.value === undefined || seriesMap[item.seriesName] !== null && seriesMap[item.seriesName] !== undefined) {
20
+ return;
21
+ }
22
+ seriesMap[item.seriesName] = item.value;
18
23
  var lineLabel = item.value;
19
24
  if (item.seriesName.indexOf('CTR') > -1) {
20
25
  lineLabel += '%';
@@ -54,6 +54,8 @@ export interface GlobalContextProps {
54
54
  tagList?: UserTagsSelectorTypes.Tag[];
55
55
  tagLoading?: boolean;
56
56
  setTagList?: React.Dispatch<React.SetStateAction<UserTagsSelectorTypes.Tag[]>>;
57
+ queryGroups?: () => void;
58
+ queryTags?: () => void;
57
59
  showUserGroupModal?: (onCreate: (group: UserGroupTypes.Group) => void, onBack?: () => void) => void;
58
60
  eventGroupList?: EventGroup[];
59
61
  eventNameMap?: Record<string, AnalysisEvent>;
@@ -91,7 +91,9 @@ var DemoContent = function DemoContent(_ref3) {
91
91
  setUserGroupList = _useBizStore.setUserGroupList,
92
92
  tagList = _useBizStore.tagList,
93
93
  tagLoading = _useBizStore.tagLoading,
94
- setTagList = _useBizStore.setTagList;
94
+ setTagList = _useBizStore.setTagList,
95
+ queryGroups = _useBizStore.queryGroups,
96
+ queryTags = _useBizStore.queryTags;
95
97
  useEffect(function () {
96
98
  if (!needMeta || !currentApp) return;
97
99
  if (currentApp.appsHasData && currentApp.appsHasData.length) {
@@ -172,7 +174,9 @@ var DemoContent = function DemoContent(_ref3) {
172
174
  setUserGroupList: setUserGroupList,
173
175
  tagList: tagList,
174
176
  tagLoading: tagLoading,
175
- setTagList: setTagList
177
+ setTagList: setTagList,
178
+ queryGroups: queryGroups,
179
+ queryTags: queryTags
176
180
  }, contextProps)
177
181
  }, children));
178
182
  };
@@ -1,5 +1,7 @@
1
1
  import React from 'react';
2
+ import { GlobalContextProps } from '../context';
2
3
  declare const InnerDemo: React.FC<{
4
+ contextProps?: GlobalContextProps;
3
5
  children?: React.ReactNode;
4
6
  }>;
5
7
  export default InnerDemo;
@@ -1,10 +1,12 @@
1
1
  import React from 'react';
2
2
  import DemoWrapper from '.';
3
3
  var InnerDemo = function InnerDemo(_ref) {
4
- var children = _ref.children;
4
+ var children = _ref.children,
5
+ contextProps = _ref.contextProps;
5
6
  return /*#__PURE__*/React.createElement(DemoWrapper, {
6
7
  needMeta: true,
7
- defaultApp: globalConfig.appId
8
+ defaultApp: globalConfig.appId,
9
+ contextProps: contextProps
8
10
  }, /*#__PURE__*/React.createElement("div", {
9
11
  style: {
10
12
  padding: '16px',
@@ -12,5 +12,7 @@ declare function useBizStore({ currentApp, menuNameMap, }: {
12
12
  tagLoading: boolean;
13
13
  setUserGroupList: React.Dispatch<React.SetStateAction<UserGroupTypes.Group[]>>;
14
14
  setTagList: React.Dispatch<React.SetStateAction<UserTagsSelectorTypes.Tag[]>>;
15
+ queryTags: () => void;
16
+ queryGroups: () => void;
15
17
  };
16
18
  export default useBizStore;
@@ -91,7 +91,9 @@ function useBizStore(_ref) {
91
91
  tagList: tagList,
92
92
  tagLoading: tagLoading,
93
93
  setUserGroupList: setUserGroupList,
94
- setTagList: setTagList
94
+ setTagList: setTagList,
95
+ queryTags: queryTags,
96
+ queryGroups: queryGroups
95
97
  };
96
98
  }
97
99
  export default useBizStore;
@@ -44,7 +44,7 @@ var BizTargetFromPanel = function BizTargetFromPanel(props) {
44
44
  useEffect(function () {
45
45
  var _props$value2, _props$value3;
46
46
  if (!((_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.panelId)) return;
47
- setOptions(((_props$value3 = props.value) === null || _props$value3 === void 0 ? void 0 : _props$value3.target.id) ? panelBtn(onClick) : panelCreateBtn(onClick));
47
+ setOptions(((_props$value3 = props.value) === null || _props$value3 === void 0 ? void 0 : _props$value3.target.id) ? panelBtn(onClick, props === null || props === void 0 ? void 0 : props.disabled) : panelCreateBtn(onClick, props === null || props === void 0 ? void 0 : props.disabled));
48
48
  }, []);
49
49
  var onClick = function onClick(type) {
50
50
  if (type === BizOptionTitleProps.OptionTypes.CANCEL) {
@@ -3,6 +3,7 @@ import AddToPanel from '../../addToPanel/types';
3
3
  export declare namespace BizOptionTitleProps {
4
4
  export interface Props {
5
5
  value?: Value;
6
+ disabled?: boolean;
6
7
  styleOptions?: AddToPanel.TabItem[];
7
8
  children?: React.ReactNode;
8
9
  afterEditTarget?: (type: string, value?: any) => void;
@@ -1,17 +1,103 @@
1
- import React from 'react';
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, { useState } from 'react';
2
8
  import { BizUserGroup } from '@zgfe/business-lib';
3
9
  import InnerDemo from '../../demoWrapper/innerDemo';
4
10
  import { Space } from 'antd';
11
+ import { BizDialog } from '@zgfe/business-lib';
12
+ var group = {
13
+ appId: 251,
14
+ color: '#8db3e2',
15
+ createTime: {
16
+ date: 18,
17
+ day: 1,
18
+ hours: 11,
19
+ minutes: 14,
20
+ month: 8,
21
+ seconds: 53,
22
+ time: 1695006893000,
23
+ timezoneOffset: -480,
24
+ year: 123
25
+ },
26
+ description: '',
27
+ groupType: 0,
28
+ id: 943,
29
+ isComplete: 1,
30
+ isDelete: 0,
31
+ json: [[{
32
+ eventId: '-3',
33
+ runPeriod: {
34
+ values: ['30', '0'],
35
+ operator: 'relative'
36
+ },
37
+ runTimes: {
38
+ values: ['1'],
39
+ operator: '>='
40
+ },
41
+ attrs: []
42
+ }]],
43
+ name: 'cvd2',
44
+ platform: 0,
45
+ size: 0,
46
+ source: '',
47
+ staticGroupCondition: '',
48
+ tableName: '',
49
+ timeRange: 0,
50
+ updateTime: {
51
+ date: 18,
52
+ day: 1,
53
+ hours: 11,
54
+ minutes: 14,
55
+ month: 8,
56
+ seconds: 53,
57
+ time: 1695006893000,
58
+ timezoneOffset: -480,
59
+ year: 123
60
+ }
61
+ };
5
62
  var UserGroupDemo = function UserGroupDemo() {
6
- return /*#__PURE__*/React.createElement(InnerDemo, null, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(BizUserGroup, {
63
+ var _useState = useState(),
64
+ _useState2 = _slicedToArray(_useState, 2),
65
+ groupCallback = _useState2[0],
66
+ setGroupCallback = _useState2[1];
67
+ var _useState3 = useState(false),
68
+ _useState4 = _slicedToArray(_useState3, 2),
69
+ showUserGroupModal = _useState4[0],
70
+ setShowUserGroupModal = _useState4[1];
71
+ return /*#__PURE__*/React.createElement(InnerDemo, {
72
+ contextProps: {
73
+ showUserGroupModal: function showUserGroupModal(onCreate, onBack) {
74
+ setGroupCallback({
75
+ onCreate: onCreate,
76
+ onBack: onBack
77
+ });
78
+ setShowUserGroupModal(true);
79
+ }
80
+ }
81
+ }, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(BizUserGroup, {
7
82
  enableDelete: false,
8
83
  enableTags: true,
9
- value: ['4061:679558480527360'],
10
84
  placeholder: "\u652F\u6301\u6807\u7B7E",
11
85
  onChange: function onChange(value) {
12
86
  return console.log(value);
13
87
  }
14
- }), /*#__PURE__*/React.createElement(BizUserGroup, {
88
+ }), showUserGroupModal && /*#__PURE__*/React.createElement(BizDialog, {
89
+ open: true,
90
+ title: "\u6DFB\u52A0\u7528\u6237\u7FA4",
91
+ closable: true,
92
+ onOk: function onOk() {
93
+ var _groupCallback$onCrea;
94
+ setShowUserGroupModal(false);
95
+ groupCallback === null || groupCallback === void 0 ? void 0 : (_groupCallback$onCrea = groupCallback.onCreate) === null || _groupCallback$onCrea === void 0 ? void 0 : _groupCallback$onCrea.call(groupCallback, group);
96
+ },
97
+ onCancel: function onCancel() {
98
+ setShowUserGroupModal(false);
99
+ }
100
+ }, "\u6DFB\u52A0\u7528\u6237\u7FA4"), /*#__PURE__*/React.createElement(BizUserGroup, {
15
101
  value: 758,
16
102
  enableDelete: false,
17
103
  placeholder: "\u4E0D\u652F\u6301\u6807\u7B7E",
@@ -8,7 +8,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
8
8
  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; }
9
9
  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; } }
10
10
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
- import React, { useContext, useEffect, useRef, useState } from 'react';
11
+ import React, { useContext, useEffect, useState } from 'react';
12
12
  import { classPrefix } from '.';
13
13
  import CascaderOverlay from '../userTagsSelector/cascaderOverlay';
14
14
  import Search from '../userTagsSelector/components/search';
@@ -58,7 +58,6 @@ var Overlay = function Overlay(_ref2) {
58
58
  enableTags = _useContext2.enableTags,
59
59
  value = _useContext2.value,
60
60
  setValue = _useContext2.setValue;
61
- var groupRef = useRef();
62
61
  useEffect(function () {
63
62
  onSearch('');
64
63
  if (!enableTags) setType('userGroup');
@@ -71,16 +70,8 @@ var Overlay = function Overlay(_ref2) {
71
70
  }, []);
72
71
  useEffect(function () {
73
72
  if (!setValue) return;
74
- console.log('setValue', type, currentGroup);
75
73
  setValue(type === 'tag' ? chosenTags : currentGroup);
76
74
  }, [type, chosenTags, currentGroup]);
77
- useEffect(function () {
78
- if (!groupRef.current) return;
79
- console.log('groupRef.current:', groupRef.current);
80
- setCurrentGroup(function () {
81
- return groupRef.current;
82
- });
83
- }, [groupRef.current]);
84
75
  function onSearch(v) {
85
76
  if (v) {
86
77
  setShowList((userGroupList === null || userGroupList === void 0 ? void 0 : userGroupList.filter(function (item) {
@@ -94,11 +85,7 @@ var Overlay = function Overlay(_ref2) {
94
85
  onClickCreate === null || onClickCreate === void 0 ? void 0 : onClickCreate();
95
86
  if (showUserGroupModal) {
96
87
  showUserGroupModal(function (group) {
97
- console.log('add:', group);
98
- groupRef.current = group;
99
- setCurrentGroup(function () {
100
- return group;
101
- });
88
+ setValue && setValue(group);
102
89
  setUserGroupList === null || setUserGroupList === void 0 ? void 0 : setUserGroupList([group].concat(_toConsumableArray(userGroupList)));
103
90
  });
104
91
  }
@@ -81,7 +81,9 @@ var BizUserGroupHeader = function BizUserGroupHeader(_ref) {
81
81
  size: 12
82
82
  }, /*#__PURE__*/React.createElement(Space, {
83
83
  size: 16
84
- }, /*#__PURE__*/React.createElement("label", null, "\u5206\u6790\u7528\u6237\u7FA4"), showBtn && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("a", {
84
+ }, /*#__PURE__*/React.createElement("label", {
85
+ className: "".concat(classPrefix, "-title")
86
+ }, "\u5206\u6790\u7528\u6237\u7FA4"), showBtn && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("a", {
85
87
  className: "".concat(classPrefix, "-sure"),
86
88
  onClick: onSure
87
89
  }, "\u786E\u5B9A"), /*#__PURE__*/React.createElement("a", {
@@ -2,8 +2,9 @@
2
2
  .biz-user-group-header {
3
3
  padding: 6px @margin-lg;
4
4
  background: #fff;
5
- & > label {
5
+ &-title {
6
6
  color: @text-color-secondary;
7
+ font-weight: 500;
7
8
  }
8
9
  &-sure {
9
10
  display: none;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/business-lib",
3
- "version": "1.1.82-user.1",
3
+ "version": "1.1.82-user.3",
4
4
  "module": "es/index.js",
5
5
  "typings": "es/index.d.ts",
6
6
  "files": [
@@ -55,7 +55,7 @@
55
55
  "react": "^16.12.0 || ^17.0.0",
56
56
  "yorkie": "^2.0.0"
57
57
  },
58
- "gitHead": "c9a4b459604075bc3b812793c795c7c2a2baf9ed",
58
+ "gitHead": "16fb86446971d7caf7832ab1f46d204f95c514aa",
59
59
  "gitHooks": {
60
60
  "pre-commit": "lint-staged"
61
61
  }