@zgfe/business-lib 1.1.35-idmapping.0 → 1.1.35
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.
- package/es/attrConditions/demo/group.js +3 -2
- package/es/attrConditions/index.d.ts +3 -1
- package/es/attrConditions/index.js +23 -19
- package/es/attrConditions/types.d.ts +1 -1
- package/es/attributeSelector/types.d.ts +2 -0
- package/es/attributeSelector/util.js +5 -1
- package/es/context/index.d.ts +3 -2
- package/es/demoWrapper/content.js +2 -0
- package/es/dialog/index.js +1 -1
- package/es/socket/index.d.ts +5 -3
- package/es/socket/index.js +23 -10
- package/es/utils/ajax.js +0 -1
- package/package.json +2 -2
|
@@ -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:
|
|
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:
|
|
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,
|
|
@@ -79,25 +101,7 @@ var BizConditionItem = function BizConditionItem(props) {
|
|
|
79
101
|
useEffect(function () {
|
|
80
102
|
if (props.onChange) {
|
|
81
103
|
if (!attr) return;
|
|
82
|
-
|
|
83
|
-
attrId: attr.id,
|
|
84
|
-
propCategory: attr.propCategory,
|
|
85
|
-
type: attr.type,
|
|
86
|
-
operator: operate,
|
|
87
|
-
values: values || [],
|
|
88
|
-
dimensionSub: attr.dimensionSub,
|
|
89
|
-
label: attr.alias || attr.label
|
|
90
|
-
};
|
|
91
|
-
if (attr.propCategory === PropCategory.EventProp) {
|
|
92
|
-
responseData.attrName = attr.label;
|
|
93
|
-
} else {
|
|
94
|
-
responseData.attrName = attr.name;
|
|
95
|
-
responseData.category = attr.category;
|
|
96
|
-
if (attr.propCategory === PropCategory.UserProp && attr.subtype) {
|
|
97
|
-
responseData.subtype = attr.subtype;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
props.onChange(responseData);
|
|
104
|
+
props.onChange(getCondition(attr, operate, values));
|
|
101
105
|
}
|
|
102
106
|
}, [attr, operate, values]);
|
|
103
107
|
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?:
|
|
21
|
+
operator?: OperateTypes;
|
|
22
22
|
values?: string[];
|
|
23
23
|
}
|
|
24
24
|
interface GroupValue {
|
|
@@ -63,6 +63,8 @@ export interface PropGroups {
|
|
|
63
63
|
eventGroupList?: EventGroup[];
|
|
64
64
|
userPropList?: UserProp[];
|
|
65
65
|
envPropList?: EnvProp[];
|
|
66
|
+
eventNameMap?: Record<string, AnalysisEvent>;
|
|
67
|
+
eventIdMap?: Record<number, AnalysisEvent>;
|
|
66
68
|
}
|
|
67
69
|
export declare namespace AttributeSelect {
|
|
68
70
|
type Value = EventProp | UserProp | EnvProp | null;
|
|
@@ -3,7 +3,9 @@ export default function convertAttributeData(store) {
|
|
|
3
3
|
var res = {
|
|
4
4
|
envPropList: [],
|
|
5
5
|
eventGroupList: [],
|
|
6
|
-
userPropList: []
|
|
6
|
+
userPropList: [],
|
|
7
|
+
eventNameMap: {},
|
|
8
|
+
eventIdMap: {}
|
|
7
9
|
};
|
|
8
10
|
(_store$eventList = store.eventList) === null || _store$eventList === void 0 ? void 0 : _store$eventList.forEach(function (group_) {
|
|
9
11
|
var _res$eventGroupList;
|
|
@@ -39,6 +41,8 @@ export default function convertAttributeData(store) {
|
|
|
39
41
|
eventHidden: e.event_hidden,
|
|
40
42
|
marked: Boolean(e.mark_type)
|
|
41
43
|
};
|
|
44
|
+
res.eventNameMap[event.name] = event;
|
|
45
|
+
res.eventIdMap[event.id] = event;
|
|
42
46
|
if (event.marked) {
|
|
43
47
|
markList.push(event);
|
|
44
48
|
} else {
|
package/es/context/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { EventGroup, UserProp, EnvProp } from '../attributeSelector/types';
|
|
2
|
+
import { EventGroup, UserProp, EnvProp, AnalysisEvent } from '../attributeSelector/types';
|
|
3
3
|
export interface AppInfoProps {
|
|
4
4
|
appId?: string | number;
|
|
5
5
|
platform?: string | number;
|
|
@@ -24,6 +24,8 @@ export interface Menu {
|
|
|
24
24
|
export interface GlobalContextProps {
|
|
25
25
|
userGroupList?: Array<any>;
|
|
26
26
|
eventGroupList?: EventGroup[];
|
|
27
|
+
eventNameMap?: Record<string, AnalysisEvent>;
|
|
28
|
+
eventIdMap?: Record<number, AnalysisEvent>;
|
|
27
29
|
userPropList?: UserProp[];
|
|
28
30
|
eventEnvList?: EnvProp[];
|
|
29
31
|
menuNameMap?: {
|
|
@@ -36,7 +38,6 @@ export interface GlobalContextProps {
|
|
|
36
38
|
router?: any;
|
|
37
39
|
routes?: any;
|
|
38
40
|
envs?: Record<string, any>;
|
|
39
|
-
setPageLoading?: (isLoading: boolean) => void;
|
|
40
41
|
}
|
|
41
42
|
declare const BizGlobalDataContext: import("react").Context<GlobalContextProps>;
|
|
42
43
|
export default BizGlobalDataContext;
|
|
@@ -175,6 +175,8 @@ var DemoContent = function DemoContent(_ref3) {
|
|
|
175
175
|
eventGroupList: store === null || store === void 0 ? void 0 : store.eventGroupList,
|
|
176
176
|
userPropList: store === null || store === void 0 ? void 0 : store.userPropList,
|
|
177
177
|
eventEnvList: store === null || store === void 0 ? void 0 : store.envPropList,
|
|
178
|
+
eventIdMap: store === null || store === void 0 ? void 0 : store.eventIdMap,
|
|
179
|
+
eventNameMap: store === null || store === void 0 ? void 0 : store.eventNameMap,
|
|
178
180
|
userGroupList: userGroups
|
|
179
181
|
}
|
|
180
182
|
}, children));
|
package/es/dialog/index.js
CHANGED
package/es/socket/index.d.ts
CHANGED
|
@@ -8,11 +8,12 @@ declare class SocketClient {
|
|
|
8
8
|
private showLog;
|
|
9
9
|
private pingTimer?;
|
|
10
10
|
private appkey?;
|
|
11
|
+
private token?;
|
|
11
12
|
constructor(url: string, appkey: string, params?: Record<string, any>);
|
|
12
13
|
emit(event: string, payload?: SocketClientTypes.Message['data']['payload']): void;
|
|
13
14
|
on<T>(type: SocketClientTypes.EventType | string, handle: (data?: T) => void): void;
|
|
14
|
-
onConnected(handle: () => void): void;
|
|
15
|
-
onDisconnected(handle: () => void): void;
|
|
15
|
+
onConnected(handle: (data?: any) => void): void;
|
|
16
|
+
onDisconnected(handle: (data?: any) => void): void;
|
|
16
17
|
onError(handle: (data?: Error) => void): void;
|
|
17
18
|
private _onError;
|
|
18
19
|
private _onClose;
|
|
@@ -21,11 +22,12 @@ declare class SocketClient {
|
|
|
21
22
|
private ping;
|
|
22
23
|
removeAllListeners(): void;
|
|
23
24
|
removeListener(event: string, handle?: (data?: any) => void): void;
|
|
24
|
-
private
|
|
25
|
+
private _getToken;
|
|
25
26
|
open(url?: string, params?: Record<string, any>): void;
|
|
26
27
|
close(): void;
|
|
27
28
|
destroy(): void;
|
|
28
29
|
private log;
|
|
29
30
|
openLog(open: boolean): void;
|
|
31
|
+
getToken(): string | undefined;
|
|
30
32
|
}
|
|
31
33
|
export default SocketClient;
|
package/es/socket/index.js
CHANGED
|
@@ -29,6 +29,7 @@ var SocketClient = /*#__PURE__*/function () {
|
|
|
29
29
|
this.showLog = false;
|
|
30
30
|
this.pingTimer = void 0;
|
|
31
31
|
this.appkey = void 0;
|
|
32
|
+
this.token = void 0;
|
|
32
33
|
this.appkey = appkey;
|
|
33
34
|
this.url = url;
|
|
34
35
|
this.params = params;
|
|
@@ -122,7 +123,7 @@ var SocketClient = /*#__PURE__*/function () {
|
|
|
122
123
|
_this = this;
|
|
123
124
|
this.log('info', 'socket连接成功', event);
|
|
124
125
|
(_this$listeners$conne = this.listeners['connected']) === null || _this$listeners$conne === void 0 ? void 0 : _this$listeners$conne.forEach(function (handle) {
|
|
125
|
-
handle.call(undefined);
|
|
126
|
+
handle.call(undefined, _this.token);
|
|
126
127
|
});
|
|
127
128
|
this.log('info', 'clear catch', this.catch);
|
|
128
129
|
this.catch.forEach(function (_ref) {
|
|
@@ -137,7 +138,7 @@ var SocketClient = /*#__PURE__*/function () {
|
|
|
137
138
|
}, {
|
|
138
139
|
key: "onMessage",
|
|
139
140
|
value: function onMessage(event) {
|
|
140
|
-
var _this$listeners$Socke, _this$listeners$Socke2, _this$listeners$Socke3;
|
|
141
|
+
var _this$listeners$Socke, _this$listeners$Socke2, _this$listeners$Socke3, _this$listeners$unkno;
|
|
141
142
|
var res = JSON.parse(event.data);
|
|
142
143
|
if (res.code) {
|
|
143
144
|
switch (Number(res.code)) {
|
|
@@ -158,6 +159,10 @@ var SocketClient = /*#__PURE__*/function () {
|
|
|
158
159
|
break;
|
|
159
160
|
case SocketClientTypes.ResponseCode.paramError:
|
|
160
161
|
this._onError(new Error('参数缺失或错误'));
|
|
162
|
+
default:
|
|
163
|
+
(_this$listeners$unkno = this.listeners['unknownCode']) === null || _this$listeners$unkno === void 0 ? void 0 : _this$listeners$unkno.forEach(function (handle) {
|
|
164
|
+
handle.call(undefined, res);
|
|
165
|
+
});
|
|
161
166
|
}
|
|
162
167
|
} else if (res.type === SocketClientTypes.RequestType.pong) {
|
|
163
168
|
return;
|
|
@@ -191,7 +196,8 @@ var SocketClient = /*#__PURE__*/function () {
|
|
|
191
196
|
value: function removeListener(event, handle) {
|
|
192
197
|
var _this3 = this;
|
|
193
198
|
if (handle) {
|
|
194
|
-
|
|
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) {
|
|
195
201
|
if (item === handle) {
|
|
196
202
|
_this3.listeners[event].splice(i, 1);
|
|
197
203
|
}
|
|
@@ -201,9 +207,9 @@ var SocketClient = /*#__PURE__*/function () {
|
|
|
201
207
|
}
|
|
202
208
|
}
|
|
203
209
|
}, {
|
|
204
|
-
key: "
|
|
210
|
+
key: "_getToken",
|
|
205
211
|
value: function () {
|
|
206
|
-
var
|
|
212
|
+
var _getToken2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
207
213
|
var res;
|
|
208
214
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
209
215
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -224,21 +230,23 @@ var SocketClient = /*#__PURE__*/function () {
|
|
|
224
230
|
}
|
|
225
231
|
}, _callee, this);
|
|
226
232
|
}));
|
|
227
|
-
function
|
|
228
|
-
return
|
|
233
|
+
function _getToken() {
|
|
234
|
+
return _getToken2.apply(this, arguments);
|
|
229
235
|
}
|
|
230
|
-
return
|
|
236
|
+
return _getToken;
|
|
231
237
|
}()
|
|
232
238
|
}, {
|
|
233
239
|
key: "open",
|
|
234
240
|
value: function open(url, params) {
|
|
235
241
|
var _this4 = this;
|
|
236
|
-
this.
|
|
242
|
+
this._getToken().then(function (token) {
|
|
237
243
|
_this4.params = params || _this4.params;
|
|
244
|
+
_this4.token = token;
|
|
238
245
|
if (_this4.client) _this4.close();
|
|
239
246
|
var paramUrl = ["socketToken=".concat(token)];
|
|
240
247
|
if (_this4.params) {
|
|
241
|
-
|
|
248
|
+
var _Object$keys;
|
|
249
|
+
(_Object$keys = Object.keys(_this4.params || {})) === null || _Object$keys === void 0 ? void 0 : _Object$keys.forEach(function (key) {
|
|
242
250
|
if (_.isObject(_this4.params[key]) || _.isArray(_this4.params[key])) {
|
|
243
251
|
paramUrl.push("".concat(key, "=").concat(JSON.stringify(_this4.params[key])));
|
|
244
252
|
} else {
|
|
@@ -285,6 +293,11 @@ var SocketClient = /*#__PURE__*/function () {
|
|
|
285
293
|
value: function openLog(open) {
|
|
286
294
|
this.showLog = open;
|
|
287
295
|
}
|
|
296
|
+
}, {
|
|
297
|
+
key: "getToken",
|
|
298
|
+
value: function getToken() {
|
|
299
|
+
return this.token;
|
|
300
|
+
}
|
|
288
301
|
}]);
|
|
289
302
|
return SocketClient;
|
|
290
303
|
}();
|
package/es/utils/ajax.js
CHANGED
|
@@ -62,7 +62,6 @@ function responseErrorHandler(url, apiResult, errorTitle, notifyType) {
|
|
|
62
62
|
if (new RegExp("".concat(ResponseStatus.success, "$")).test(apiResult.code)) {
|
|
63
63
|
flag = true;
|
|
64
64
|
} else if (new RegExp("".concat(ResponseStatus.notLogin)).test(apiResult.code)) {
|
|
65
|
-
flag = true;
|
|
66
65
|
message = '账户未登录或登录已失效';
|
|
67
66
|
} else if (new RegExp("".concat(ResponseStatus.noPermission)).test(apiResult.code)) {
|
|
68
67
|
window.location.href = '/webapp/app/noPermission';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgfe/business-lib",
|
|
3
|
-
"version": "1.1.35
|
|
3
|
+
"version": "1.1.35",
|
|
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": "
|
|
62
|
+
"gitHead": "3d79ca5a2961f8d7a99156d3a3cb71d6274bf83e"
|
|
63
63
|
}
|