@zgfe/business-lib 1.2.16-data.0 → 1.2.16-ht.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.
@@ -194,11 +194,9 @@
194
194
  }
195
195
  }
196
196
 
197
- &:not(.ant-picker-disabled, .ant-picker-status-error) {
198
- &:hover,
199
- &.ant-picker-focused {
200
- border-color: @primary-color!important;
201
- }
197
+ &:hover:not(.ant-picker-disabled),
198
+ &.ant-picker-focused {
199
+ border-color: @primary-color!important;
202
200
  }
203
201
 
204
202
  .ant-picker-active-bar {
@@ -22,5 +22,6 @@ declare const Apis: {
22
22
  queryUserGroup: string;
23
23
  queryAllTags: string;
24
24
  querySubjectList: string;
25
+ queryPanels: string;
25
26
  };
26
27
  export default Apis;
@@ -21,6 +21,7 @@ var Apis = {
21
21
  getTagDetail: '/zg/web/v2/labelGroup/label/labelLayer',
22
22
  queryUserGroup: '/zg/web/v2/userGroup/getAll',
23
23
  queryAllTags: '/zg/web/v2/v4/userGroup/label/list',
24
- querySubjectList: '/zg/web/v2/analysisSubject/queryAllSubject'
24
+ querySubjectList: '/zg/web/v2/analysisSubject/queryAllSubject',
25
+ queryPanels: '/zg/web/v2/apppanel/panels'
25
26
  };
26
27
  export default Apis;
@@ -1,15 +1,10 @@
1
1
  import { SizeType } from 'antd/es/config-provider/SizeContext';
2
- import moment from 'moment';
3
2
  import React from 'react';
4
- import { BizSelectTypes } from '..';
5
3
  import './styles/index.less';
6
4
  export declare enum CycleTimeUnit {
7
- hour = 0,
8
5
  day = 1,
9
6
  week = 2,
10
- month = 3,
11
- year = 4,
12
- custom = 5
7
+ month = 3
13
8
  }
14
9
  interface Value {
15
10
  unit: CycleTimeUnit;
@@ -23,10 +18,5 @@ declare const BizCycleTime: React.FC<{
23
18
  onChange?: (val: Value) => void;
24
19
  size?: SizeType;
25
20
  disable?: boolean;
26
- showHour?: boolean;
27
- format?: string;
28
- options?: BizSelectTypes.Option[];
29
- minTime?: moment.Moment | 'Now';
30
- maxTime?: moment.Moment | 'Now';
31
21
  }>;
32
22
  export default BizCycleTime;
@@ -12,23 +12,16 @@ import MonthDay from './month';
12
12
  import './styles/index.less';
13
13
  export var CycleTimeUnit;
14
14
  (function (CycleTimeUnit) {
15
- CycleTimeUnit[CycleTimeUnit["hour"] = 0] = "hour";
16
15
  CycleTimeUnit[CycleTimeUnit["day"] = 1] = "day";
17
16
  CycleTimeUnit[CycleTimeUnit["week"] = 2] = "week";
18
17
  CycleTimeUnit[CycleTimeUnit["month"] = 3] = "month";
19
- CycleTimeUnit[CycleTimeUnit["year"] = 4] = "year";
20
- CycleTimeUnit[CycleTimeUnit["custom"] = 5] = "custom";
21
18
  })(CycleTimeUnit || (CycleTimeUnit = {}));
22
19
  var BizCycleTime = function BizCycleTime(props) {
23
20
  var multiple = props.multiple,
24
21
  size = props.size,
25
- disable = props.disable,
26
- showHour = props.showHour,
27
- options = props.options,
28
- minTime = props.minTime,
29
- maxTime = props.maxTime;
22
+ disable = props.disable;
30
23
  var classPrefix = 'biz-cycle-time';
31
- var unitList = options || [{
24
+ var unitList = [{
32
25
  label: '每日',
33
26
  value: CycleTimeUnit.day
34
27
  }, {
@@ -66,9 +59,6 @@ var BizCycleTime = function BizCycleTime(props) {
66
59
  _useState10 = _slicedToArray(_useState9, 2),
67
60
  initing = _useState10[0],
68
61
  setIniting = _useState10[1];
69
- var _useState11 = useState(props.format || 'hh:mm:ss'),
70
- _useState12 = _slicedToArray(_useState11, 1),
71
- format = _useState12[0];
72
62
  useEffect(function () {
73
63
  if (!props.value) {
74
64
  setIniting(false);
@@ -76,13 +66,12 @@ var BizCycleTime = function BizCycleTime(props) {
76
66
  }
77
67
  setIniting(true);
78
68
  unitList.forEach(function (item) {
79
- var _props$value, _props$value2, _props$value3, _props$value4;
69
+ var _props$value;
80
70
  if (item.value === ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.unit)) {
81
71
  setUnit(item);
82
72
  switch (item.value) {
83
73
  case CycleTimeUnit.day:
84
- case CycleTimeUnit.custom:
85
- setTime((_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.time);
74
+ setTime(props.value.time);
86
75
  break;
87
76
  case CycleTimeUnit.week:
88
77
  var valList = [];
@@ -96,7 +85,6 @@ var BizCycleTime = function BizCycleTime(props) {
96
85
  } else {
97
86
  setDay(valList[0]);
98
87
  }
99
- if (showHour) setTime((_props$value3 = props.value) === null || _props$value3 === void 0 ? void 0 : _props$value3.time);
100
88
  break;
101
89
  case CycleTimeUnit.month:
102
90
  setDay(props.value.day.map(function (v) {
@@ -105,7 +93,6 @@ var BizCycleTime = function BizCycleTime(props) {
105
93
  value: v
106
94
  };
107
95
  }));
108
- if (showHour) setTime((_props$value4 = props.value) === null || _props$value4 === void 0 ? void 0 : _props$value4.time);
109
96
  break;
110
97
  }
111
98
  }
@@ -124,12 +111,9 @@ var BizCycleTime = function BizCycleTime(props) {
124
111
  }) : [day.value],
125
112
  time: time
126
113
  };
127
- if (unit.value === CycleTimeUnit.hour) {
114
+ if (unit.value === CycleTimeUnit.day) {
128
115
  delete res.day;
129
- delete res.time;
130
- } else if (unit.value === CycleTimeUnit.day || unit.value === CycleTimeUnit.custom) {
131
- delete res.day;
132
- } else if (!showHour) {
116
+ } else {
133
117
  delete res.time;
134
118
  }
135
119
  if (props.onChange) props.onChange(res);
@@ -151,9 +135,18 @@ var BizCycleTime = function BizCycleTime(props) {
151
135
  disable: disable,
152
136
  onChange: function onChange(v) {
153
137
  setDay([]);
154
- setTime(showHour && v.value !== CycleTimeUnit.custom ? '00' : undefined);
138
+ setTime(undefined);
155
139
  setUnit(v);
156
140
  }
141
+ }), unit.value === CycleTimeUnit.day && /*#__PURE__*/React.createElement(DatePicker.TimePicker, {
142
+ className: "".concat(classPrefix, "-hour"),
143
+ size: size,
144
+ placeholder: props.placeholder,
145
+ defaultValue: time ? moment(time, 'hh:mm:ss') : undefined,
146
+ onChange: function onChange(time) {
147
+ setTime(time === null || time === void 0 ? void 0 : time.format('hh:mm:ss'));
148
+ },
149
+ disabled: disable
157
150
  }), unit.value === CycleTimeUnit.week && /*#__PURE__*/React.createElement(BizSelect, {
158
151
  options: days,
159
152
  labelField: "label",
@@ -173,36 +166,6 @@ var BizCycleTime = function BizCycleTime(props) {
173
166
  defaultValue: day,
174
167
  onChange: setDayList,
175
168
  disable: disable
176
- }), unit.value === CycleTimeUnit.day || unit.value && unit.value !== CycleTimeUnit.custom && showHour ? /*#__PURE__*/React.createElement(DatePicker.TimePicker, {
177
- className: "".concat(classPrefix, "-hour"),
178
- size: size,
179
- placeholder: props.placeholder,
180
- value: time ? moment(time, format) : undefined,
181
- format: format,
182
- onChange: function onChange(time) {
183
- setTime(time === null || time === void 0 ? void 0 : time.format(format));
184
- },
185
- disabled: disable
186
- }) : null, unit.value == CycleTimeUnit.custom && /*#__PURE__*/React.createElement(DatePicker, {
187
- value: time ? moment(time, 'YYYY-MM-DD HH:mm:ss') : undefined,
188
- showTime: true,
189
- disabled: disable,
190
- placeholder: props.placeholder,
191
- onChange: function onChange(time) {
192
- var _currentTime;
193
- var currentTime = time;
194
- if (minTime) {
195
- var minData = minTime === 'Now' ? moment() : moment(minTime);
196
- currentTime = minData < moment(time) ? time : minData;
197
- }
198
- if (maxTime) {
199
- var maxData = maxTime === 'Now' ? moment() : moment(minTime);
200
- currentTime = maxData > moment(time) ? time : maxData;
201
- }
202
- setTime((_currentTime = currentTime) === null || _currentTime === void 0 ? void 0 : _currentTime.format('YYYY-MM-DD HH:mm:ss'));
203
- },
204
- disabledTime: unit === null || unit === void 0 ? void 0 : unit.disabledTime,
205
- disabledDate: unit === null || unit === void 0 ? void 0 : unit.disabledDate
206
169
  }));
207
170
  };
208
171
  BizCycleTime.defaultProps = {
@@ -5,11 +5,10 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
5
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
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  import { Dropdown, Tag } from 'antd';
8
- import React, { useContext, useEffect, useState } from 'react';
8
+ import React, { useEffect, useState } from 'react';
9
9
  import { IconFont } from '..';
10
10
  import './styles/month.less';
11
11
  import _ from 'lodash';
12
- import { FormItemInputContext } from 'antd/es/form/context';
13
12
  var MonthDay = function MonthDay(props) {
14
13
  var classPrefix = 'biz-month-day';
15
14
  var disable = props.disable;
@@ -21,8 +20,6 @@ var MonthDay = function MonthDay(props) {
21
20
  _useState4 = _slicedToArray(_useState3, 2),
22
21
  visible = _useState4[0],
23
22
  setVisible = _useState4[1];
24
- var _useContext = useContext(FormItemInputContext),
25
- status = _useContext.status;
26
23
  var dayList = [];
27
24
  for (var i = 1; i < 33; i++) {
28
25
  dayList.push({
@@ -93,7 +90,7 @@ var MonthDay = function MonthDay(props) {
93
90
  }, /*#__PURE__*/React.createElement("div", {
94
91
  className: "".concat(classPrefix, "-wrapper")
95
92
  }, /*#__PURE__*/React.createElement("div", {
96
- className: "".concat(classPrefix, "-handle ").concat(props.size, " ").concat(!chosenDayList.length ? "holder" : '', " ").concat(disable ? 'disable' : '').concat(status ? " ".concat(classPrefix, "-status-").concat(status) : '')
93
+ className: "".concat(classPrefix, "-handle ").concat(props.size, " ").concat(!chosenDayList.length ? "holder" : '', " ").concat(disable ? 'disable' : '')
97
94
  }, /*#__PURE__*/React.createElement("div", {
98
95
  className: "".concat(classPrefix, "-val")
99
96
  }, chosenDayList.map(function (item) {
@@ -1,7 +1,6 @@
1
1
  @import '../../assets//styles/inner.less';
2
2
  .biz-cycle-time {
3
- display: flex;
4
- gap: 12px;
3
+ display: inline-block;
5
4
  &-unit {
6
5
  width: 129px;
7
6
  }
@@ -16,6 +15,7 @@
16
15
  &-day,
17
16
  &-hour {
18
17
  display: inline-block;
18
+ margin-right: @margin-xs;
19
19
  }
20
20
  &-hour {
21
21
  width: 220px;
@@ -35,13 +35,6 @@
35
35
  &-holder {
36
36
  color: @input-placeholder-color;
37
37
  }
38
-
39
- &-status-error:not(.disable) {
40
- border-color: @error-color;
41
- &.biz-month-day-handle:hover {
42
- border-color: @error-color;
43
- }
44
- }
45
38
  &-val {
46
39
  flex: 1;
47
40
  .ant-tag {
@@ -53,10 +46,6 @@
53
46
  vertical-align: top;
54
47
  &.ant-dropdown-open > .biz-month-day-handle {
55
48
  .__default-focused();
56
- &.biz-month-day-status-error:not(.disable) {
57
- border-color: @error-color;
58
- box-shadow: 0 0 0 4px rgba(#ff8170, 0.2) !important;
59
- }
60
49
  }
61
50
  .biz-month-day-handle {
62
51
  &.disable {
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import './styles/index.less';
3
+ import { ChangePanelModalProps } from './types';
4
+ declare const ChangePanelModal: React.FC<ChangePanelModalProps>;
5
+ export default ChangePanelModal;
@@ -0,0 +1,67 @@
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
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
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."); }
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); }
10
+ 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; }
11
+ 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; } }
12
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
+ import { Spin } from 'antd';
14
+ import React, { useState, useEffect, useContext } from 'react';
15
+ import { BizGlobalDataContext, BizTargetFromPanelContext } from '../../../..';
16
+ import PanelItem from './panelItem';
17
+ import './styles/index.less';
18
+ var classPrefix = 'change-panel-modal';
19
+ import request from '../../../../utils/ajax';
20
+ import Apis from '../../../../constants/apis';
21
+ var ChangePanelModal = function ChangePanelModal() {
22
+ var _useState = useState(true),
23
+ _useState2 = _slicedToArray(_useState, 2),
24
+ loading = _useState2[0],
25
+ setLoading = _useState2[1];
26
+ var _useState3 = useState([]),
27
+ _useState4 = _slicedToArray(_useState3, 2),
28
+ eleArr = _useState4[0],
29
+ setEleArr = _useState4[1];
30
+ var _useContext = useContext(BizTargetFromPanelContext),
31
+ itemValue = _useContext.itemValue;
32
+ console.log('itemValue', itemValue);
33
+ var _useContext2 = useContext(BizGlobalDataContext),
34
+ currentApp = _useContext2.currentApp;
35
+ useEffect(function () {
36
+ request(Apis.queryPanels, {
37
+ method: 'post',
38
+ data: {
39
+ appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
40
+ platform: (currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform) || 0,
41
+ roleType: 3
42
+ }
43
+ }).then(function (res) {
44
+ var dealEleArr = [];
45
+ ((res === null || res === void 0 ? void 0 : res.data) || []).map(function (item) {
46
+ item.elements.map(function (v) {
47
+ if (v.reqParam.data.module === (itemValue === null || itemValue === void 0 ? void 0 : itemValue.target.params.module)) {
48
+ dealEleArr.push(_objectSpread(_objectSpread({}, v), {}, {
49
+ panelId: item.id
50
+ }));
51
+ }
52
+ });
53
+ });
54
+ setEleArr(dealEleArr);
55
+ setLoading(false);
56
+ });
57
+ }, []);
58
+ return /*#__PURE__*/React.createElement("div", null, loading ? /*#__PURE__*/React.createElement(Spin, null) : eleArr.length > 0 ? eleArr.map(function (item) {
59
+ return /*#__PURE__*/React.createElement(PanelItem, {
60
+ data: item,
61
+ key: item.id
62
+ });
63
+ }) : /*#__PURE__*/React.createElement("p", {
64
+ className: "".concat(classPrefix, "-empty-data")
65
+ }, "\u6682\u65E0\u6570\u636E"));
66
+ };
67
+ export default ChangePanelModal;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import './styles/index.less';
3
+ import { PanelItemProps } from './types';
4
+ declare const PanelItem: React.FC<PanelItemProps>;
5
+ export default PanelItem;
@@ -0,0 +1,129 @@
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 { Popover, Input, message, Modal } from 'antd';
8
+ import React, { useState, useContext, useRef } from 'react';
9
+ import { BizTargetFromPanelContext } from '../../types';
10
+ import { ajax, IconFont } from './../../../../';
11
+ import './styles/index.less';
12
+ import Apis from '../../../../constants/apis';
13
+ var classPrefix = 'modules-panel-item';
14
+ var PanelItem = function PanelItem(props) {
15
+ var data = props.data;
16
+ var _useState = useState(false),
17
+ _useState2 = _slicedToArray(_useState, 2),
18
+ edit = _useState2[0],
19
+ setEdit = _useState2[1];
20
+ var _useState3 = useState(data.name),
21
+ _useState4 = _slicedToArray(_useState3, 2),
22
+ value = _useState4[0],
23
+ setValue = _useState4[1];
24
+ var _useContext = useContext(BizTargetFromPanelContext),
25
+ itemValue = _useContext.itemValue,
26
+ afterEditTarget = _useContext.afterEditTarget;
27
+ var _useState5 = useState(false),
28
+ _useState6 = _slicedToArray(_useState5, 2),
29
+ popoverShow = _useState6[0],
30
+ setPopoverShow = _useState6[1];
31
+ var inputRef = useRef(null);
32
+ var onChange = function onChange(e) {
33
+ setValue(e.currentTarget.value);
34
+ };
35
+ var onBlur = function onBlur() {
36
+ var _props$data, _props$data2;
37
+ ajax(Apis.updateElementName, {
38
+ method: 'post',
39
+ data: {
40
+ panelId: (_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.panelId,
41
+ elementId: (_props$data2 = props.data) === null || _props$data2 === void 0 ? void 0 : _props$data2.id,
42
+ name: value
43
+ }
44
+ }).then(function (res) {
45
+ if (res && res.code === '103000') {
46
+ message.success('修改指标名称成功');
47
+ } else {
48
+ message.success('修改指标名称失败');
49
+ }
50
+ }).catch(function () {
51
+ message.success('修改指标名称失败');
52
+ }).finally(function () {
53
+ setEdit(false);
54
+ });
55
+ };
56
+ var onDelete = function onDelete() {
57
+ setPopoverShow(false);
58
+ Modal.confirm({
59
+ title: '提示',
60
+ content: '确认删除此用户分组?',
61
+ cancelText: '取消',
62
+ okText: '确定',
63
+ onOk: function onOk() {
64
+ var _props$data3, _props$data4;
65
+ ajax(Apis.delPanelElement, {
66
+ method: 'post',
67
+ data: {
68
+ panelId: (_props$data3 = props.data) === null || _props$data3 === void 0 ? void 0 : _props$data3.panelId,
69
+ elementId: (_props$data4 = props.data) === null || _props$data4 === void 0 ? void 0 : _props$data4.id
70
+ }
71
+ }).then(function (res) {
72
+ if (!res) return;
73
+ message.success('删除成功');
74
+ window.history.back();
75
+ }).catch(function () {
76
+ message.error('删除失败');
77
+ });
78
+ }
79
+ });
80
+ };
81
+ var onChangePanel = function onChangePanel() {
82
+ afterEditTarget === null || afterEditTarget === void 0 ? void 0 : afterEditTarget('changeItem', props.data);
83
+ };
84
+ var edteHandle = function edteHandle() {
85
+ setEdit(true);
86
+ setTimeout(function () {
87
+ inputRef.current.focus();
88
+ }, 0);
89
+ };
90
+ var onOpenChange = function onOpenChange(open) {
91
+ setPopoverShow(open);
92
+ };
93
+ return /*#__PURE__*/React.createElement("div", {
94
+ className: "".concat(classPrefix, " ").concat(edit ? 'edit' : '', " ").concat(itemValue.target.id == data.id ? 'active' : ''),
95
+ key: data.id
96
+ }, !edit && /*#__PURE__*/React.createElement("span", {
97
+ className: "".concat(classPrefix, "-text"),
98
+ onClick: function onClick() {
99
+ return onChangePanel();
100
+ }
101
+ }, value), edit && /*#__PURE__*/React.createElement(Input, {
102
+ ref: inputRef,
103
+ value: value,
104
+ onChange: onChange,
105
+ onBlur: onBlur
106
+ }), /*#__PURE__*/React.createElement(Popover, {
107
+ overlayClassName: "".concat(classPrefix, "-popover"),
108
+ open: popoverShow,
109
+ placement: "bottomLeft",
110
+ content: /*#__PURE__*/React.createElement("div", null, itemValue.target.id !== data.id && /*#__PURE__*/React.createElement("p", {
111
+ className: "text",
112
+ onClick: function onClick() {
113
+ edteHandle();
114
+ }
115
+ }, "\u7F16\u8F91\u540D\u79F0"), /*#__PURE__*/React.createElement("p", {
116
+ className: "text delete",
117
+ onClick: function onClick() {
118
+ onDelete();
119
+ }
120
+ }, "\u5220\u9664\u770B\u677F")),
121
+ onOpenChange: onOpenChange
122
+ }, /*#__PURE__*/React.createElement(IconFont, {
123
+ onClick: function onClick() {
124
+ return setPopoverShow(true);
125
+ },
126
+ type: "gengduocaozuo"
127
+ })));
128
+ };
129
+ export default PanelItem;
@@ -0,0 +1,92 @@
1
+ // @import '../../../style/base.less';
2
+
3
+ .change-panel-modal {
4
+ &-add-panel {
5
+ display: flex;
6
+ align-items: center;
7
+ height: 32px;
8
+ color: #165dff;
9
+ cursor: pointer;
10
+ .tianjia1 {
11
+ margin-right: 8px;
12
+ font-weight: 800;
13
+ font-size: 14px;
14
+ }
15
+ }
16
+ &-empty-data {
17
+ text-align: center;
18
+ }
19
+ }
20
+
21
+ .modules-panel-item {
22
+ display: flex;
23
+ align-items: center;
24
+ justify-content: space-between;
25
+ height: 32px;
26
+ padding: 0px 8px;
27
+ color: #021429;
28
+ line-height: 32px;
29
+ background: #fff;
30
+ border-radius: 8px;
31
+ cursor: pointer;
32
+ &-popover {
33
+ .ant-popover-arrow {
34
+ display: none;
35
+ }
36
+ .ant-popover-content {
37
+ margin-top: -27px;
38
+ margin-left: 0;
39
+ }
40
+ .ant-popover-inner-content {
41
+ padding: 4px 0;
42
+ }
43
+ .text {
44
+ height: 32px;
45
+ margin: 0;
46
+ padding: 0 16px;
47
+ line-height: 32px;
48
+ cursor: pointer;
49
+ }
50
+ .delete {
51
+ // color: #fb5547;
52
+ }
53
+ .text:hover {
54
+ background: #e8efff;
55
+ }
56
+ }
57
+ &-text {
58
+ width: 100%;
59
+ // .__text-cut-one();
60
+ }
61
+ .gengduocaozuo {
62
+ display: none;
63
+ margin-left: 8px;
64
+ font-size: 16px !important;
65
+ }
66
+ .ant-input {
67
+ box-shadow: none !important;
68
+ }
69
+ }
70
+ .modules-panel-item:hover {
71
+ color: #165dff;
72
+ background: #e8efff;
73
+ .gengduocaozuo {
74
+ display: block;
75
+ }
76
+ }
77
+ .modules-panel-item.active {
78
+ padding: 0 8px;
79
+ color: #fff;
80
+ line-height: 40px;
81
+ background: #165dff;
82
+ .gengduocaozuo {
83
+ display: block;
84
+ }
85
+ }
86
+ .modules-panel-item.edit {
87
+ height: 40px;
88
+ padding: 0 8px;
89
+ color: rgba(103, 114, 127, 1);
90
+ line-height: 40px;
91
+ background: #e8efff;
92
+ }
@@ -0,0 +1,5 @@
1
+ export interface ChangePanelModalProps {
2
+ }
3
+ export interface PanelItemProps {
4
+ data: any;
5
+ }
@@ -90,8 +90,14 @@ var BizEditText = /*#__PURE__*/React.forwardRef(function (props, ref) {
90
90
  }), errorText ? /*#__PURE__*/React.createElement("span", {
91
91
  className: "".concat(classPrefix, "-error-tip")
92
92
  }, errorText) : null) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
93
- className: "".concat(classPrefix, "-content")
94
- }, props.value), props.canEdit ? /*#__PURE__*/React.createElement(IconFont, {
93
+ className: "".concat(classPrefix, "-content"),
94
+ onClick: function onClick() {
95
+ props.isOnlyTxt && setIsEdit(true);
96
+ setTimeout(function () {
97
+ inputRef && inputRef.current.focus();
98
+ }, 0);
99
+ }
100
+ }, props.value), props.canEdit && !props.isOnlyTxt ? /*#__PURE__*/React.createElement(IconFont, {
95
101
  className: "".concat(classPrefix, "-icon"),
96
102
  type: "bianji1",
97
103
  onClick: function onClick() {
@@ -1,36 +1,5 @@
1
- import React from 'react';
2
- import { IconFont } from '../..';
3
- import { classPrefix } from '.';
4
1
  export var panelBtn = function panelBtn(callback, disabled) {
5
2
  return [{
6
- key: '11',
7
- label: /*#__PURE__*/React.createElement("a", {
8
- className: "".concat(classPrefix, "-btn-more")
9
- }, /*#__PURE__*/React.createElement(IconFont, {
10
- type: "gengduocaozuo1"
11
- })),
12
- itemType: 'dropdown',
13
- type: 'default',
14
- children: [{
15
- key: '110',
16
- label: '编辑名称',
17
- icon: /*#__PURE__*/React.createElement(IconFont, {
18
- type: "bianji"
19
- }),
20
- onClick: function onClick() {
21
- callback('edit');
22
- }
23
- }, {
24
- key: '111',
25
- label: '删除指标',
26
- icon: /*#__PURE__*/React.createElement(IconFont, {
27
- type: "shanchu"
28
- }),
29
- onClick: function onClick() {
30
- callback('delete');
31
- }
32
- }]
33
- }, {
34
3
  key: '12',
35
4
  label: '',
36
5
  itemType: 'divider'
@@ -9,7 +9,7 @@ import { DemoWrapper, BizTargetFromPanel, BizTargetFromPanelContext } from '@zgf
9
9
  import { Button, Spin } from 'antd';
10
10
  var params = {
11
11
  app_id: 4,
12
- module: 'insight',
12
+ module: 'funnel',
13
13
  targets: [{
14
14
  type: 'event',
15
15
  alias: '事件概览',
@@ -43,6 +43,7 @@ var BizTargetFromPanel = function BizTargetFromPanel(props) {
43
43
  var titleRef = useRef(null);
44
44
  useEffect(function () {
45
45
  var _props$value2, _props$value3;
46
+ console.log('props.value', props.value);
46
47
  if (!((_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.panelId)) return;
47
48
  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
49
  }, []);
@@ -133,7 +134,9 @@ var BizTargetFromPanel = function BizTargetFromPanel(props) {
133
134
  }
134
135
  return /*#__PURE__*/React.createElement(BizTargetFromPanelContext.Provider, {
135
136
  value: {
136
- handleSearch: setBtnOptions
137
+ handleSearch: setBtnOptions,
138
+ afterEditTarget: props.afterEditTarget,
139
+ itemValue: props.value
137
140
  }
138
141
  }, /*#__PURE__*/React.createElement(Spin, {
139
142
  spinning: loading,
@@ -1,10 +1,22 @@
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 { IconFont } from '../..';
3
9
  import BizEditText from './components/title';
10
+ import { Popover } from 'antd';
4
11
  import './styles/layout.less';
5
12
  import BizBtnMenu from './components/btnMenu';
13
+ import ChangePanelModal from './components/changePanelModal';
6
14
  var BizOptionLayout = /*#__PURE__*/React.forwardRef(function (props, ref) {
7
15
  var className = props.className;
16
+ var _useState = useState(false),
17
+ _useState2 = _slicedToArray(_useState, 2),
18
+ show = _useState2[0],
19
+ setShow = _useState2[1];
8
20
  var classPrefix = 'biz-option-layout';
9
21
  return /*#__PURE__*/React.createElement("div", {
10
22
  className: "".concat(classPrefix, " ").concat(className || '')
@@ -24,11 +36,28 @@ var BizOptionLayout = /*#__PURE__*/React.forwardRef(function (props, ref) {
24
36
  name: props.name,
25
37
  value: props.value,
26
38
  max: props.max,
27
- isInput: props.isInput,
39
+ isOnlyTxt: true,
28
40
  canEdit: props.canEdit,
29
41
  onChange: props.onChange,
30
42
  onService: props.onService
31
- })), props.extra, /*#__PURE__*/React.createElement(BizBtnMenu, {
43
+ }), props.canEdit && /*#__PURE__*/React.createElement(Popover, {
44
+ overlayClassName: "".concat(classPrefix, "-panel-content"),
45
+ arrowPointAtCenter: true,
46
+ open: show,
47
+ content: /*#__PURE__*/React.createElement(ChangePanelModal, null),
48
+ trigger: "click",
49
+ placement: "bottomLeft",
50
+ onOpenChange: function onOpenChange(show) {
51
+ return setShow(show);
52
+ }
53
+ }, /*#__PURE__*/React.createElement("div", {
54
+ className: "".concat(classPrefix, "-header-title-icon"),
55
+ onClick: function onClick() {
56
+ return setShow(true);
57
+ }
58
+ }, /*#__PURE__*/React.createElement(IconFont, {
59
+ type: "xiangxia"
60
+ })))), props.extra, /*#__PURE__*/React.createElement(BizBtnMenu, {
32
61
  className: props.optionClass,
33
62
  menu: props.options || []
34
63
  })), props.children && /*#__PURE__*/React.createElement("div", {
@@ -26,6 +26,22 @@
26
26
  color: @primary-color;
27
27
  }
28
28
  }
29
+ &-icon {
30
+ display: flex;
31
+ align-items: center;
32
+ justify-content: center;
33
+ width: 20px;
34
+ height: 20px;
35
+ margin-left: 8px;
36
+ color: #5f6085;
37
+ font-size: 12px;
38
+ background: #f2f3f4;
39
+ border-radius: 10px;
40
+ }
41
+ &-icon:hover {
42
+ color: #165dff;
43
+ background: #e8efff;
44
+ }
29
45
  }
30
46
  &-option {
31
47
  display: flex;
@@ -41,4 +57,34 @@
41
57
  height: calc(100% - 64px);
42
58
  overflow: auto;
43
59
  }
60
+
61
+ &-panel-content {
62
+ z-index: 1000;
63
+ width: 284px;
64
+ max-height: 304px;
65
+ padding: 0;
66
+ overflow: auto;
67
+ background: #fff;
68
+ border-radius: 10px;
69
+ box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.1);
70
+ .ant-popover-arrow {
71
+ display: none !important;
72
+ }
73
+ .ant-popover-inner-content {
74
+ width: 100%;
75
+ padding: 8px;
76
+ }
77
+ .ant-tabs {
78
+ .ant-tabs-tab-btn {
79
+ font-size: 16px;
80
+ }
81
+ .ant-tabs-nav {
82
+ margin-bottom: 4px;
83
+ padding-left: 45px;
84
+ }
85
+ .ant-tabs-nav::before {
86
+ border: none !important;
87
+ }
88
+ }
89
+ }
44
90
  }
@@ -51,6 +51,7 @@ export declare namespace BizOptionTitleProps {
51
51
  value?: string;
52
52
  max?: number;
53
53
  isInput?: boolean;
54
+ isOnlyTxt?: boolean;
54
55
  canEdit?: boolean;
55
56
  required?: boolean;
56
57
  width?: number;
@@ -85,4 +86,6 @@ export declare namespace BizOptionTitleProps {
85
86
  }
86
87
  export declare const BizTargetFromPanelContext: React.Context<{
87
88
  handleSearch?: ((isSearch?: boolean) => void) | undefined;
89
+ afterEditTarget?: ((type: string, value?: any) => void) | undefined;
90
+ itemValue?: BizOptionTitleProps.Value | undefined;
88
91
  }>;
@@ -185,9 +185,5 @@
185
185
  &.biz-select-handle-input:hover {
186
186
  border-color: @error-color;
187
187
  }
188
- &.biz-select-handle-input.active:not(.disable) {
189
- border-color: @error-color;
190
- box-shadow: 0 0 0 4px rgba(#ff8170, 0.2) !important;
191
- }
192
188
  }
193
189
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/business-lib",
3
- "version": "1.2.16-data.0",
3
+ "version": "1.2.16-ht.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": "a6e1f99eb38f763af7e8a4f0046e27498d0f4aa6",
58
+ "gitHead": "67fee454c908db5994560784e4ef0298c92c52e6",
59
59
  "gitHooks": {
60
60
  "pre-commit": "lint-staged"
61
61
  }
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- declare const _default: () => React.JSX.Element;
3
- export default _default;
@@ -1,117 +0,0 @@
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 from 'react';
8
- import { BizCycleTime } from '@zgfe/business-lib';
9
- import { CycleTimeUnit } from '..';
10
- import { Button, Form } from 'antd';
11
- import moment from 'moment';
12
- export default (function () {
13
- var options = [{
14
- label: '每小时',
15
- value: CycleTimeUnit.hour
16
- }, {
17
- label: '每日',
18
- value: CycleTimeUnit.day
19
- }, {
20
- label: '每周',
21
- value: CycleTimeUnit.week
22
- }, {
23
- label: '每月',
24
- value: CycleTimeUnit.month
25
- }];
26
- var customOptions = [].concat(options, [{
27
- label: '指定时间',
28
- value: CycleTimeUnit.custom,
29
- disabledDate: function disabledDate(current) {
30
- return current && current < moment().subtract(1, 'day').endOf('day');
31
- },
32
- disabledTime: function disabledTime(current) {
33
- var range = function range(start, end) {
34
- var result = [];
35
- for (var i = start; i < end; i++) {
36
- result.push(i);
37
- }
38
- return result;
39
- };
40
- var minutes = Number(moment().minutes());
41
- var hour = Number(moment().hours());
42
- var disMinutes = 0;
43
- var disHour = 0;
44
- if (moment().date() === (current === null || current === void 0 ? void 0 : current.date())) {
45
- disHour = hour;
46
- if (current.hour() > hour) {
47
- disMinutes = 0;
48
- } else {
49
- disMinutes = minutes;
50
- }
51
- }
52
- return {
53
- disabledHours: function disabledHours() {
54
- return range(0, disHour);
55
- },
56
- disabledMinutes: function disabledMinutes() {
57
- return range(0, disMinutes);
58
- }
59
- };
60
- }
61
- }]);
62
- var _Form$useForm = Form.useForm(),
63
- _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
64
- form = _Form$useForm2[0];
65
- var onChange = function onChange(data) {
66
- console.log('change:', data);
67
- };
68
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, "\u9ED8\u8BA4\u503C")), /*#__PURE__*/React.createElement(BizCycleTime, {
69
- value: {
70
- unit: 3,
71
- day: [1, 23, 4],
72
- time: '12:00:00'
73
- },
74
- multiple: true,
75
- showHour: true,
76
- options: options,
77
- onChange: onChange
78
- }), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, "\u65E0\u9ED8\u8BA4\u503C")), /*#__PURE__*/React.createElement(BizCycleTime, {
79
- multiple: true,
80
- showHour: true,
81
- options: options,
82
- format: "HH",
83
- onChange: onChange
84
- }), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, "\u6307\u5B9A\u65F6\u95F4")), /*#__PURE__*/React.createElement(BizCycleTime, {
85
- multiple: true,
86
- showHour: true,
87
- options: customOptions,
88
- format: "HH",
89
- minTime: "Now",
90
- onChange: onChange
91
- }), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, "Form")), /*#__PURE__*/React.createElement(Form, {
92
- form: form
93
- }, /*#__PURE__*/React.createElement(Form.Item, {
94
- label: "\u65E5\u671F",
95
- name: "date",
96
- rules: [{
97
- validator: function validator(_, value) {
98
- if (value.unit > 1 && !value.day.length) {
99
- return Promise.reject('请选择日期');
100
- }
101
- if (value.unit > 0 && !value.time) {
102
- return Promise.reject('请选择小时');
103
- }
104
- return Promise.resolve();
105
- }
106
- }]
107
- }, /*#__PURE__*/React.createElement(BizCycleTime, {
108
- multiple: true,
109
- showHour: true,
110
- options: options,
111
- format: "HH",
112
- onChange: onChange
113
- })), /*#__PURE__*/React.createElement(Form.Item, null, /*#__PURE__*/React.createElement(Button, {
114
- type: "primary",
115
- htmlType: "submit"
116
- }, "\u786E\u5B9A"))));
117
- });