@zgfe/business-lib 1.1.3-user.1 → 1.1.3-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.
@@ -40,6 +40,8 @@ var Text = function Text(props) {
40
40
  userTagsData = _useContext3.userTagsData;
41
41
 
42
42
  function render() {
43
+ console.log('render:', condition);
44
+
43
45
  if (condition.labels) {
44
46
  return renderTags(condition);
45
47
  }
@@ -50,7 +50,7 @@ export default (function () {
50
50
  }, [conditions]);
51
51
 
52
52
  function onChange(value) {
53
- console.log('change:', JSON.stringify(value));
53
+ console.log('change:', JSON.parse(JSON.stringify(value)));
54
54
  }
55
55
 
56
56
  var descDom = /*#__PURE__*/React.createElement(BizUserCondition, {
@@ -24,7 +24,6 @@ import RelationLabel from './relationLabel';
24
24
  import OrConditions from './orConditions';
25
25
  import './styles/index.less';
26
26
  import { buildCondition } from './util';
27
- import _ from 'lodash';
28
27
  import BizGlobalDataContext from '../context';
29
28
  import IconFont from '../icon/iconFont';
30
29
  import request from '../utils/ajax';
@@ -67,11 +66,35 @@ var BizUserCondition = function BizUserCondition(props) {
67
66
  setDataList = _useState4[1];
68
67
 
69
68
  var _useState5 = useState(function () {
69
+ var list = [];
70
+
70
71
  if (defaultValue) {
71
- return _.cloneDeep(defaultValue);
72
+ var showTag = openTagCondition && (!menuNameMap || menuNameMap['userTags']);
73
+ var showCdp = openCdpCondition && (!menuNameMap || menuNameMap['dataset']);
74
+ var flag = false;
75
+ defaultValue.forEach(function (item) {
76
+ var showItem = _toConsumableArray(item);
77
+
78
+ if (!(showTag && showCdp)) {
79
+ item.forEach(function (data, index) {
80
+ if (data.dataset && !showCdp || data.labels && !showTag) {
81
+ showItem.splice(index, 1);
82
+ flag = true;
83
+ }
84
+ });
85
+ }
86
+
87
+ if (showItem.length > 0) {
88
+ list.push(showItem);
89
+ }
90
+ });
91
+
92
+ if (flag) {
93
+ props.onChange(list);
94
+ }
72
95
  }
73
96
 
74
- return [];
97
+ return list;
75
98
  }),
76
99
  _useState6 = _slicedToArray(_useState5, 2),
77
100
  value = _useState6[0],
@@ -111,29 +134,11 @@ var BizUserCondition = function BizUserCondition(props) {
111
134
 
112
135
  function initShowList() {
113
136
  var showList = [];
114
- var showTag = openTagCondition && (!menuNameMap || menuNameMap['userTags']);
115
- var showCdp = openCdpCondition && (!menuNameMap || menuNameMap['dataset']);
116
137
  value.forEach(function (item) {
117
- var showItem = _toConsumableArray(item);
118
-
119
- if (!(showTag && showCdp)) {
120
- item.forEach(function (data, index) {
121
- if (data.dataset && !showCdp) {
122
- showItem.splice(index, 1);
123
- }
124
-
125
- if (data.labels && !showTag) {
126
- showItem.splice(index, 1);
127
- }
128
- });
129
- }
130
-
131
- if (showItem.length > 0) {
132
- showList.push({
133
- id: Math.random(),
134
- orConditions: showItem
135
- });
136
- }
138
+ showList.push({
139
+ id: Math.random(),
140
+ orConditions: item
141
+ });
137
142
  });
138
143
  setShowList(showList);
139
144
  setDataList(showList);
@@ -50,6 +50,8 @@ var OrConditions = function OrConditions(props) {
50
50
  setShowList = _useState2[1];
51
51
 
52
52
  useEffect(function () {
53
+ console.log('orConditions:', orConditions);
54
+
53
55
  if (orConditions) {
54
56
  initShowList();
55
57
  }
@@ -64,6 +66,7 @@ var OrConditions = function OrConditions(props) {
64
66
  };
65
67
  showList.push(item);
66
68
  });
69
+ console.log('showList:', showList);
67
70
  setShowList(showList);
68
71
  }
69
72
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/business-lib",
3
- "version": "1.1.3-user.1",
3
+ "version": "1.1.3-user.3",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -60,5 +60,5 @@
60
60
  "react": "^16.12.0 || ^17.0.0",
61
61
  "yorkie": "^2.0.0"
62
62
  },
63
- "gitHead": "513c2967ae788c511226f44e778f204eecd9086e"
63
+ "gitHead": "e22bc32b4be87eb1d3390d9861ddfda9e099f1ca"
64
64
  }