@zgfe/business-lib 1.1.73-beta.2 → 1.1.73-beta.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.
@@ -21,6 +21,7 @@ import PanelItem from './item';
21
21
  import { validator } from '../formula/util';
22
22
  import { FormulaTypes } from './types';
23
23
  import { BizValidatorContext } from '../../../context';
24
+ import _ from 'lodash';
24
25
  export var classPrefix = 'formula-panel';
25
26
  var FormulaPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
26
27
  var _useContext = useContext(BizGlobalDataContext),
@@ -33,28 +34,38 @@ var FormulaPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
33
34
  _useState4 = _slicedToArray(_useState3, 2),
34
35
  searchValue = _useState4[0],
35
36
  setSearchValue = _useState4[1];
36
- var _useState5 = useState({}),
37
+ var _useState5 = useState([]),
37
38
  _useState6 = _slicedToArray(_useState5, 2),
38
- allList = _useState6[0],
39
- setAllList = _useState6[1];
40
- var _useState7 = useState(true),
39
+ eventList = _useState6[0],
40
+ setEventList = _useState6[1];
41
+ var _useState7 = useState({}),
41
42
  _useState8 = _slicedToArray(_useState7, 2),
42
- loading = _useState8[0],
43
- setLoading = _useState8[1];
44
- var _useState9 = useState(),
43
+ allList = _useState8[0],
44
+ setAllList = _useState8[1];
45
+ var _useState9 = useState(true),
45
46
  _useState10 = _slicedToArray(_useState9, 2),
46
- currentValue = _useState10[0],
47
- setCurrentValue = _useState10[1];
48
- var scrollableId = 'scrollableFormula' + Math.random();
49
- var _useState11 = useState(''),
47
+ loading = _useState10[0],
48
+ setLoading = _useState10[1];
49
+ var _useState11 = useState(),
50
50
  _useState12 = _slicedToArray(_useState11, 2),
51
- validateData = _useState12[0],
52
- setValidateData = _useState12[1];
51
+ currentValue = _useState12[0],
52
+ setCurrentValue = _useState12[1];
53
+ var scrollableId = 'scrollableFormula' + Math.random();
54
+ var _useState13 = useState(''),
55
+ _useState14 = _slicedToArray(_useState13, 2),
56
+ validateData = _useState14[0],
57
+ setValidateData = _useState14[1];
58
+ var _useState15 = useState(0),
59
+ _useState16 = _slicedToArray(_useState15, 2),
60
+ timer = _useState16[0],
61
+ setTimer = _useState16[1];
53
62
  var _useContext2 = useContext(BizValidatorContext),
54
63
  setValidate = _useContext2.setValidate;
55
64
  useEffect(function () {
65
+ var events = getEventList(eventGroupList);
66
+ setEventList(events);
56
67
  setAllList({
57
- event: getEventList(eventGroupList),
68
+ event: events,
58
69
  whole: indicatorList
59
70
  });
60
71
  setCurrentValue(props.value);
@@ -66,6 +77,24 @@ var FormulaPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
66
77
  useEffect(function () {
67
78
  props.onChange && props.onChange(currentValue);
68
79
  }, [currentValue]);
80
+ useEffect(function () {
81
+ if (loading) return;
82
+ if (timer) {
83
+ clearTimeout(timer);
84
+ }
85
+ setTimer(setTimeout(function () {
86
+ var searchList = eventList.filter(function (event) {
87
+ if (searchValue && !new RegExp(_.escapeRegExp(searchValue), 'i').test(event.alias || event.name)) return;
88
+ return true;
89
+ });
90
+ setAllList(function (list) {
91
+ return {
92
+ whole: list.whole,
93
+ event: searchList
94
+ };
95
+ });
96
+ }, 300));
97
+ }, [searchValue]);
69
98
  var getParentType = function getParentType(type) {
70
99
  if (!type) return FormulaTypes.CONSTANT;
71
100
  return type === FormulaTypes.EVENT ? FormulaTypes.EVENT : FormulaTypes.WHOLE;
@@ -139,7 +168,8 @@ var FormulaPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
139
168
  onChange: onChangeFilter
140
169
  }) : /*#__PURE__*/React.createElement("div", {
141
170
  className: "".concat(classPrefix, "-right")
142
- }, type === FormulaTypes.EVENT && allList[type] && allList[type].length ? /*#__PURE__*/React.createElement(BizSearchInput, {
171
+ }, type === FormulaTypes.EVENT ? /*#__PURE__*/React.createElement(BizSearchInput, {
172
+ value: searchValue,
143
173
  className: "".concat(classPrefix, "-right-search"),
144
174
  onChange: setSearchValue
145
175
  }) : null, type === FormulaTypes.CONSTANT ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(InputNumber, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/business-lib",
3
- "version": "1.1.73-beta.2",
3
+ "version": "1.1.73-beta.3",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -58,5 +58,5 @@
58
58
  "react": "^16.12.0 || ^17.0.0",
59
59
  "yorkie": "^2.0.0"
60
60
  },
61
- "gitHead": "b1c514087cea5c722c4070e358ffa095e903fc67"
61
+ "gitHead": "6d36b67191115534f359c4ebc27b3bd1c66807a8"
62
62
  }