@zgfe/business-lib 1.1.33-visual.5 → 1.1.33-visual.7

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.
@@ -7,11 +7,12 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  import React, { useRef, useState } from 'react';
8
8
  import { BizConditionGroup, DemoWrapper } from '@zgfe/business-lib';
9
9
  import { Button } from 'antd';
10
+ import { OperateTypes } from '../types';
10
11
  var conditions = [{
11
12
  propCategory: 'userProp',
12
13
  attrId: 0,
13
14
  type: 2,
14
- operator: 'gt',
15
+ operator: OperateTypes.GT,
15
16
  values: ['25200', '1'],
16
17
  attrName: 'duration',
17
18
  category: 'fixed',
@@ -19,7 +20,7 @@ var conditions = [{
19
20
  }, {
20
21
  propCategory: 'eventProp',
21
22
  type: 1,
22
- operator: 'equal',
23
+ operator: OperateTypes.Equal,
23
24
  values: ['Safari', 'Apple WebKit'],
24
25
  attrId: 30183426
25
26
  }];
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
+ import { AttributeSelect } from '../attributeSelector/types';
2
3
  import './styles/index.less';
3
- import { AttrConditionTypes } from './types';
4
+ import { AttrConditionTypes, OperateTypes } from './types';
4
5
  export declare const classPrefix = "biz-condition-item";
6
+ export declare function getCondition(attr: AttributeSelect.Value, operate: OperateTypes, values: string[]): AttrConditionTypes.ItemValue | undefined;
5
7
  declare const BizConditionItem: React.FC<AttrConditionTypes.ItemProp>;
6
8
  export default BizConditionItem;
@@ -12,6 +12,28 @@ import BizOperateList from './components/operateList';
12
12
  import ValuesList from './components/valuesList';
13
13
  import { Skeleton } from 'antd';
14
14
  export var classPrefix = 'biz-condition-item';
15
+ export function getCondition(attr, operate, values) {
16
+ if (!attr) return;
17
+ var responseData = {
18
+ attrId: attr.id,
19
+ propCategory: attr.propCategory,
20
+ type: attr.type,
21
+ operator: operate,
22
+ values: values || [],
23
+ dimensionSub: attr.dimensionSub,
24
+ label: attr.label
25
+ };
26
+ if (attr.propCategory === PropCategory.EventProp) {
27
+ responseData.attrName = attr.label;
28
+ } else {
29
+ responseData.attrName = attr.name;
30
+ responseData.category = attr.category;
31
+ if (attr.propCategory === PropCategory.UserProp && attr.subtype) {
32
+ responseData.subtype = attr.subtype;
33
+ }
34
+ }
35
+ return responseData;
36
+ }
15
37
  var BizConditionItem = function BizConditionItem(props) {
16
38
  var _props$defaultValue, _props$value, _props$defaultValue2, _props$value2;
17
39
  var defaultValue = props.defaultValue,
@@ -78,25 +100,7 @@ var BizConditionItem = function BizConditionItem(props) {
78
100
  useEffect(function () {
79
101
  if (props.onChange) {
80
102
  if (!attr) return;
81
- var responseData = {
82
- attrId: attr.id,
83
- propCategory: attr.propCategory,
84
- type: attr.type,
85
- operator: operate,
86
- values: values || [],
87
- dimensionSub: attr.dimensionSub,
88
- label: attr.label
89
- };
90
- if (attr.propCategory === PropCategory.EventProp) {
91
- responseData.attrName = attr.label;
92
- } else {
93
- responseData.attrName = attr.name;
94
- responseData.category = attr.category;
95
- if (attr.propCategory === PropCategory.UserProp && attr.subtype) {
96
- responseData.subtype = attr.subtype;
97
- }
98
- }
99
- props.onChange(responseData);
103
+ props.onChange(getCondition(attr, operate, values));
100
104
  }
101
105
  }, [attr, operate, values]);
102
106
  var onChangeAttr = function onChangeAttr(attrData) {
@@ -18,7 +18,7 @@ export declare namespace AttrConditionTypes {
18
18
  propCategory?: 'userProp' | 'eventProp' | 'envProp';
19
19
  category?: 'fixed' | 'custom';
20
20
  dimensionSub?: string;
21
- operator?: string;
21
+ operator?: OperateTypes;
22
22
  values?: string[];
23
23
  }
24
24
  interface GroupValue {
@@ -196,7 +196,8 @@ var SocketClient = /*#__PURE__*/function () {
196
196
  value: function removeListener(event, handle) {
197
197
  var _this3 = this;
198
198
  if (handle) {
199
- this.listeners[event].forEach(function (item, i) {
199
+ var _this$listeners$event;
200
+ (_this$listeners$event = this.listeners[event]) === null || _this$listeners$event === void 0 ? void 0 : _this$listeners$event.forEach(function (item, i) {
200
201
  if (item === handle) {
201
202
  _this3.listeners[event].splice(i, 1);
202
203
  }
@@ -244,7 +245,8 @@ var SocketClient = /*#__PURE__*/function () {
244
245
  if (_this4.client) _this4.close();
245
246
  var paramUrl = ["socketToken=".concat(token)];
246
247
  if (_this4.params) {
247
- Object.keys(_this4.params || {}).forEach(function (key) {
248
+ var _Object$keys;
249
+ (_Object$keys = Object.keys(_this4.params || {})) === null || _Object$keys === void 0 ? void 0 : _Object$keys.forEach(function (key) {
248
250
  if (_.isObject(_this4.params[key]) || _.isArray(_this4.params[key])) {
249
251
  paramUrl.push("".concat(key, "=").concat(JSON.stringify(_this4.params[key])));
250
252
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/business-lib",
3
- "version": "1.1.33-visual.5",
3
+ "version": "1.1.33-visual.7",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -59,5 +59,5 @@
59
59
  "react": "^16.12.0 || ^17.0.0",
60
60
  "yorkie": "^2.0.0"
61
61
  },
62
- "gitHead": "c82c160b1ec392b9d12b8e1990d2f778a051aa76"
62
+ "gitHead": "9f5fb07ede61f809d3aa2efcd69ccfffeeea206a"
63
63
  }