@zgfe/business-lib 1.2.16-ht.2 → 1.2.16

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,9 +194,11 @@
194
194
  }
195
195
  }
196
196
 
197
- &:hover:not(.ant-picker-disabled),
198
- &.ant-picker-focused {
199
- border-color: @primary-color!important;
197
+ &:not(.ant-picker-disabled, .ant-picker-status-error) {
198
+ &:hover,
199
+ &.ant-picker-focused {
200
+ border-color: @primary-color!important;
201
+ }
200
202
  }
201
203
 
202
204
  .ant-picker-active-bar {
@@ -22,6 +22,5 @@ declare const Apis: {
22
22
  queryUserGroup: string;
23
23
  queryAllTags: string;
24
24
  querySubjectList: string;
25
- queryPanels: string;
26
25
  };
27
26
  export default Apis;
@@ -21,7 +21,6 @@ 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',
25
- queryPanels: '/zg/web/v2/apppanel/panels'
24
+ querySubjectList: '/zg/web/v2/analysisSubject/queryAllSubject'
26
25
  };
27
26
  export default Apis;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const _default: () => React.JSX.Element;
3
+ export default _default;
@@ -0,0 +1,117 @@
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
+ });
@@ -1,10 +1,15 @@
1
1
  import { SizeType } from 'antd/es/config-provider/SizeContext';
2
+ import moment from 'moment';
2
3
  import React from 'react';
4
+ import { BizSelectTypes } from '..';
3
5
  import './styles/index.less';
4
6
  export declare enum CycleTimeUnit {
7
+ hour = 0,
5
8
  day = 1,
6
9
  week = 2,
7
- month = 3
10
+ month = 3,
11
+ year = 4,
12
+ custom = 5
8
13
  }
9
14
  interface Value {
10
15
  unit: CycleTimeUnit;
@@ -18,5 +23,10 @@ declare const BizCycleTime: React.FC<{
18
23
  onChange?: (val: Value) => void;
19
24
  size?: SizeType;
20
25
  disable?: boolean;
26
+ showHour?: boolean;
27
+ format?: string;
28
+ options?: BizSelectTypes.Option[];
29
+ minTime?: moment.Moment | 'Now';
30
+ maxTime?: moment.Moment | 'Now';
21
31
  }>;
22
32
  export default BizCycleTime;
@@ -12,16 +12,23 @@ 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";
15
16
  CycleTimeUnit[CycleTimeUnit["day"] = 1] = "day";
16
17
  CycleTimeUnit[CycleTimeUnit["week"] = 2] = "week";
17
18
  CycleTimeUnit[CycleTimeUnit["month"] = 3] = "month";
19
+ CycleTimeUnit[CycleTimeUnit["year"] = 4] = "year";
20
+ CycleTimeUnit[CycleTimeUnit["custom"] = 5] = "custom";
18
21
  })(CycleTimeUnit || (CycleTimeUnit = {}));
19
22
  var BizCycleTime = function BizCycleTime(props) {
20
23
  var multiple = props.multiple,
21
24
  size = props.size,
22
- disable = props.disable;
25
+ disable = props.disable,
26
+ showHour = props.showHour,
27
+ options = props.options,
28
+ minTime = props.minTime,
29
+ maxTime = props.maxTime;
23
30
  var classPrefix = 'biz-cycle-time';
24
- var unitList = [{
31
+ var unitList = options || [{
25
32
  label: '每日',
26
33
  value: CycleTimeUnit.day
27
34
  }, {
@@ -59,6 +66,9 @@ var BizCycleTime = function BizCycleTime(props) {
59
66
  _useState10 = _slicedToArray(_useState9, 2),
60
67
  initing = _useState10[0],
61
68
  setIniting = _useState10[1];
69
+ var _useState11 = useState(props.format || 'hh:mm:ss'),
70
+ _useState12 = _slicedToArray(_useState11, 1),
71
+ format = _useState12[0];
62
72
  useEffect(function () {
63
73
  if (!props.value) {
64
74
  setIniting(false);
@@ -66,12 +76,13 @@ var BizCycleTime = function BizCycleTime(props) {
66
76
  }
67
77
  setIniting(true);
68
78
  unitList.forEach(function (item) {
69
- var _props$value;
79
+ var _props$value, _props$value2, _props$value3, _props$value4;
70
80
  if (item.value === ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.unit)) {
71
81
  setUnit(item);
72
82
  switch (item.value) {
73
83
  case CycleTimeUnit.day:
74
- setTime(props.value.time);
84
+ case CycleTimeUnit.custom:
85
+ setTime((_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.time);
75
86
  break;
76
87
  case CycleTimeUnit.week:
77
88
  var valList = [];
@@ -85,6 +96,7 @@ var BizCycleTime = function BizCycleTime(props) {
85
96
  } else {
86
97
  setDay(valList[0]);
87
98
  }
99
+ if (showHour) setTime((_props$value3 = props.value) === null || _props$value3 === void 0 ? void 0 : _props$value3.time);
88
100
  break;
89
101
  case CycleTimeUnit.month:
90
102
  setDay(props.value.day.map(function (v) {
@@ -93,6 +105,7 @@ var BizCycleTime = function BizCycleTime(props) {
93
105
  value: v
94
106
  };
95
107
  }));
108
+ if (showHour) setTime((_props$value4 = props.value) === null || _props$value4 === void 0 ? void 0 : _props$value4.time);
96
109
  break;
97
110
  }
98
111
  }
@@ -111,9 +124,12 @@ var BizCycleTime = function BizCycleTime(props) {
111
124
  }) : [day.value],
112
125
  time: time
113
126
  };
114
- if (unit.value === CycleTimeUnit.day) {
127
+ if (unit.value === CycleTimeUnit.hour) {
115
128
  delete res.day;
116
- } else {
129
+ delete res.time;
130
+ } else if (unit.value === CycleTimeUnit.day || unit.value === CycleTimeUnit.custom) {
131
+ delete res.day;
132
+ } else if (!showHour) {
117
133
  delete res.time;
118
134
  }
119
135
  if (props.onChange) props.onChange(res);
@@ -135,18 +151,9 @@ var BizCycleTime = function BizCycleTime(props) {
135
151
  disable: disable,
136
152
  onChange: function onChange(v) {
137
153
  setDay([]);
138
- setTime(undefined);
154
+ setTime(showHour && v.value !== CycleTimeUnit.custom ? '00' : undefined);
139
155
  setUnit(v);
140
156
  }
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
150
157
  }), unit.value === CycleTimeUnit.week && /*#__PURE__*/React.createElement(BizSelect, {
151
158
  options: days,
152
159
  labelField: "label",
@@ -166,6 +173,36 @@ var BizCycleTime = function BizCycleTime(props) {
166
173
  defaultValue: day,
167
174
  onChange: setDayList,
168
175
  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
169
206
  }));
170
207
  };
171
208
  BizCycleTime.defaultProps = {
@@ -5,10 +5,11 @@ 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, { useEffect, useState } from 'react';
8
+ import React, { useContext, 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';
12
13
  var MonthDay = function MonthDay(props) {
13
14
  var classPrefix = 'biz-month-day';
14
15
  var disable = props.disable;
@@ -20,6 +21,8 @@ var MonthDay = function MonthDay(props) {
20
21
  _useState4 = _slicedToArray(_useState3, 2),
21
22
  visible = _useState4[0],
22
23
  setVisible = _useState4[1];
24
+ var _useContext = useContext(FormItemInputContext),
25
+ status = _useContext.status;
23
26
  var dayList = [];
24
27
  for (var i = 1; i < 33; i++) {
25
28
  dayList.push({
@@ -90,7 +93,7 @@ var MonthDay = function MonthDay(props) {
90
93
  }, /*#__PURE__*/React.createElement("div", {
91
94
  className: "".concat(classPrefix, "-wrapper")
92
95
  }, /*#__PURE__*/React.createElement("div", {
93
- className: "".concat(classPrefix, "-handle ").concat(props.size, " ").concat(!chosenDayList.length ? "holder" : '', " ").concat(disable ? 'disable' : '')
96
+ className: "".concat(classPrefix, "-handle ").concat(props.size, " ").concat(!chosenDayList.length ? "holder" : '', " ").concat(disable ? 'disable' : '').concat(status ? " ".concat(classPrefix, "-status-").concat(status) : '')
94
97
  }, /*#__PURE__*/React.createElement("div", {
95
98
  className: "".concat(classPrefix, "-val")
96
99
  }, chosenDayList.map(function (item) {
@@ -1,6 +1,7 @@
1
1
  @import '../../assets//styles/inner.less';
2
2
  .biz-cycle-time {
3
- display: inline-block;
3
+ display: flex;
4
+ gap: 12px;
4
5
  &-unit {
5
6
  width: 129px;
6
7
  }
@@ -15,7 +16,6 @@
15
16
  &-day,
16
17
  &-hour {
17
18
  display: inline-block;
18
- margin-right: @margin-xs;
19
19
  }
20
20
  &-hour {
21
21
  width: 220px;
@@ -35,6 +35,13 @@
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
+ }
38
45
  &-val {
39
46
  flex: 1;
40
47
  .ant-tag {
@@ -46,6 +53,10 @@
46
53
  vertical-align: top;
47
54
  &.ant-dropdown-open > .biz-month-day-handle {
48
55
  .__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
+ }
49
60
  }
50
61
  .biz-month-day-handle {
51
62
  &.disable {
@@ -90,14 +90,8 @@ 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
- 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, {
93
+ className: "".concat(classPrefix, "-content")
94
+ }, props.value), props.canEdit ? /*#__PURE__*/React.createElement(IconFont, {
101
95
  className: "".concat(classPrefix, "-icon"),
102
96
  type: "bianji1",
103
97
  onClick: function onClick() {
@@ -1,5 +1,36 @@
1
+ import React from 'react';
2
+ import { IconFont } from '../..';
3
+ import { classPrefix } from '.';
1
4
  export var panelBtn = function panelBtn(callback, disabled) {
2
5
  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
+ }, {
3
34
  key: '12',
4
35
  label: '',
5
36
  itemType: 'divider'
@@ -43,7 +43,6 @@ 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);
47
46
  if (!((_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.panelId)) return;
48
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));
49
48
  }, []);
@@ -134,8 +133,7 @@ var BizTargetFromPanel = function BizTargetFromPanel(props) {
134
133
  }
135
134
  return /*#__PURE__*/React.createElement(BizTargetFromPanelContext.Provider, {
136
135
  value: {
137
- handleSearch: setBtnOptions,
138
- itemValue: props.value
136
+ handleSearch: setBtnOptions
139
137
  }
140
138
  }, /*#__PURE__*/React.createElement(Spin, {
141
139
  spinning: loading,
@@ -1,22 +1,10 @@
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';
1
+ import React from 'react';
8
2
  import { IconFont } from '../..';
9
3
  import BizEditText from './components/title';
10
- import { Popover } from 'antd';
11
4
  import './styles/layout.less';
12
5
  import BizBtnMenu from './components/btnMenu';
13
- import ChangePanelModal from './components/changePanelModal';
14
6
  var BizOptionLayout = /*#__PURE__*/React.forwardRef(function (props, ref) {
15
7
  var className = props.className;
16
- var _useState = useState(false),
17
- _useState2 = _slicedToArray(_useState, 2),
18
- show = _useState2[0],
19
- setShow = _useState2[1];
20
8
  var classPrefix = 'biz-option-layout';
21
9
  return /*#__PURE__*/React.createElement("div", {
22
10
  className: "".concat(classPrefix, " ").concat(className || '')
@@ -36,28 +24,11 @@ var BizOptionLayout = /*#__PURE__*/React.forwardRef(function (props, ref) {
36
24
  name: props.name,
37
25
  value: props.value,
38
26
  max: props.max,
39
- isOnlyTxt: true,
27
+ isInput: props.isInput,
40
28
  canEdit: props.canEdit,
41
29
  onChange: props.onChange,
42
30
  onService: props.onService
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, {
31
+ })), props.extra, /*#__PURE__*/React.createElement(BizBtnMenu, {
61
32
  className: props.optionClass,
62
33
  menu: props.options || []
63
34
  })), props.children && /*#__PURE__*/React.createElement("div", {
@@ -26,22 +26,6 @@
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
- }
45
29
  }
46
30
  &-option {
47
31
  display: flex;
@@ -57,34 +41,4 @@
57
41
  height: calc(100% - 64px);
58
42
  overflow: auto;
59
43
  }
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
- }
90
44
  }
@@ -51,7 +51,6 @@ export declare namespace BizOptionTitleProps {
51
51
  value?: string;
52
52
  max?: number;
53
53
  isInput?: boolean;
54
- isOnlyTxt?: boolean;
55
54
  canEdit?: boolean;
56
55
  required?: boolean;
57
56
  width?: number;
@@ -86,5 +85,4 @@ export declare namespace BizOptionTitleProps {
86
85
  }
87
86
  export declare const BizTargetFromPanelContext: React.Context<{
88
87
  handleSearch?: ((isSearch?: boolean) => void) | undefined;
89
- itemValue?: BizOptionTitleProps.Value | undefined;
90
88
  }>;
@@ -185,5 +185,9 @@
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
+ }
188
192
  }
189
193
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/business-lib",
3
- "version": "1.2.16-ht.2",
3
+ "version": "1.2.16",
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": "2d2418643434313cb4710c1b67113216e6376f01",
58
+ "gitHead": "d94d26fd5bbb03478db11028e765a264ea2493e0",
59
59
  "gitHooks": {
60
60
  "pre-commit": "lint-staged"
61
61
  }
@@ -1,5 +0,0 @@
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;
@@ -1,62 +0,0 @@
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 } 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(BizGlobalDataContext),
31
- currentApp = _useContext.currentApp;
32
- useEffect(function () {
33
- request(Apis.queryPanels, {
34
- method: 'post',
35
- data: {
36
- appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
37
- platform: (currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform) || 0,
38
- roleType: 3
39
- }
40
- }).then(function (res) {
41
- var dealEleArr = [];
42
- ((res === null || res === void 0 ? void 0 : res.data) || []).map(function (item) {
43
- item.elements.map(function (v) {
44
- dealEleArr.push(_objectSpread(_objectSpread({}, v), {}, {
45
- panelId: item.id
46
- }));
47
- });
48
- });
49
- setEleArr(dealEleArr);
50
- setLoading(false);
51
- });
52
- }, []);
53
- return /*#__PURE__*/React.createElement("div", null, loading ? /*#__PURE__*/React.createElement(Spin, null) : eleArr.length > 0 ? eleArr.map(function (item) {
54
- return /*#__PURE__*/React.createElement(PanelItem, {
55
- data: item,
56
- key: item.id
57
- });
58
- }) : /*#__PURE__*/React.createElement("p", {
59
- className: "".concat(classPrefix, "-empty-data")
60
- }, "\u6682\u65E0\u6570\u636E"));
61
- };
62
- export default ChangePanelModal;
@@ -1,5 +0,0 @@
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;
@@ -1,136 +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 { Popover, Input, message, Modal } from 'antd';
8
- import React, { useState, useContext, useRef } from 'react';
9
- import { BizTargetFromPanelContext } from '../../types';
10
- import { ajax, IconFont, BizGlobalDataContext } 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
- var _useContext2 = useContext(BizGlobalDataContext),
27
- router = _useContext2.router,
28
- routes = _useContext2.routes;
29
- var _useState5 = useState(false),
30
- _useState6 = _slicedToArray(_useState5, 2),
31
- popoverShow = _useState6[0],
32
- setPopoverShow = _useState6[1];
33
- var inputRef = useRef(null);
34
- var onChange = function onChange(e) {
35
- setValue(e.currentTarget.value);
36
- };
37
- var onBlur = function onBlur() {
38
- var _props$data, _props$data2;
39
- ajax(Apis.updateElementName, {
40
- method: 'post',
41
- data: {
42
- panelId: (_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.panelId,
43
- elementId: (_props$data2 = props.data) === null || _props$data2 === void 0 ? void 0 : _props$data2.id,
44
- name: value
45
- }
46
- }).then(function (res) {
47
- if (res && res.code === '103000') {
48
- message.success('修改指标名称成功');
49
- } else {
50
- message.success('修改指标名称失败');
51
- }
52
- }).catch(function () {
53
- message.success('修改指标名称失败');
54
- }).finally(function () {
55
- setEdit(false);
56
- });
57
- };
58
- var onDelete = function onDelete() {
59
- setPopoverShow(false);
60
- Modal.confirm({
61
- title: '提示',
62
- content: '确认删除此用户分组?',
63
- cancelText: '取消',
64
- okText: '确定',
65
- onOk: function onOk() {
66
- var _props$data3, _props$data4;
67
- ajax(Apis.delPanelElement, {
68
- method: 'post',
69
- data: {
70
- panelId: (_props$data3 = props.data) === null || _props$data3 === void 0 ? void 0 : _props$data3.panelId,
71
- elementId: (_props$data4 = props.data) === null || _props$data4 === void 0 ? void 0 : _props$data4.id
72
- }
73
- }).then(function (res) {
74
- if (!res) return;
75
- message.success('删除成功');
76
- window.history.back();
77
- }).catch(function () {
78
- message.error('删除失败');
79
- });
80
- }
81
- });
82
- };
83
- var onChangePanel = function onChangePanel() {
84
- router && router.push({
85
- name: routes.panel,
86
- params: {
87
- editItem: props.data
88
- }
89
- });
90
- };
91
- var edteHandle = function edteHandle() {
92
- setEdit(true);
93
- setTimeout(function () {
94
- inputRef.current.focus();
95
- }, 0);
96
- };
97
- var onOpenChange = function onOpenChange(open) {
98
- setPopoverShow(open);
99
- };
100
- return /*#__PURE__*/React.createElement("div", {
101
- className: "".concat(classPrefix, " ").concat(edit ? 'edit' : '', " ").concat(itemValue.target.id == data.id ? 'active' : ''),
102
- key: data.id
103
- }, !edit && /*#__PURE__*/React.createElement("span", {
104
- className: "".concat(classPrefix, "-text"),
105
- onClick: function onClick() {
106
- return onChangePanel();
107
- }
108
- }, value), edit && /*#__PURE__*/React.createElement(Input, {
109
- ref: inputRef,
110
- value: value,
111
- onChange: onChange,
112
- onBlur: onBlur
113
- }), /*#__PURE__*/React.createElement(Popover, {
114
- overlayClassName: "".concat(classPrefix, "-popover"),
115
- open: popoverShow,
116
- placement: "bottomLeft",
117
- content: /*#__PURE__*/React.createElement("div", null, itemValue.target.id !== data.id && /*#__PURE__*/React.createElement("p", {
118
- className: "text",
119
- onClick: function onClick() {
120
- edteHandle();
121
- }
122
- }, "\u7F16\u8F91\u540D\u79F0"), /*#__PURE__*/React.createElement("p", {
123
- className: "text delete",
124
- onClick: function onClick() {
125
- onDelete();
126
- }
127
- }, "\u5220\u9664\u770B\u677F")),
128
- onOpenChange: onOpenChange
129
- }, /*#__PURE__*/React.createElement(IconFont, {
130
- onClick: function onClick() {
131
- return setPopoverShow(true);
132
- },
133
- type: "gengduocaozuo"
134
- })));
135
- };
136
- export default PanelItem;
@@ -1,92 +0,0 @@
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
- }
@@ -1,5 +0,0 @@
1
- export interface ChangePanelModalProps {
2
- }
3
- export interface PanelItemProps {
4
- data: any;
5
- }