@zgfe/modules-settings 1.2.20 → 1.2.21

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.
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { AppInfoProps } from '@zgfe/business-lib/es/context';
3
+ declare const SetDataRangeDialog: React.FC<{
4
+ currentSelectAppInfo: AppInfoProps;
5
+ onChangeCondition: (data: any[]) => void;
6
+ currentJson: any[];
7
+ }>;
8
+ export default SetDataRangeDialog;
@@ -0,0 +1,162 @@
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 React, { useEffect, useState, useContext } from 'react';
14
+ import { Spin } from 'antd';
15
+ import { BizUserCondition, BizGlobalDataContext, ajax } from '@zgfe/business-lib';
16
+ import convertAttributeData from './util';
17
+ var SetDataRangeDialog = function SetDataRangeDialog(props) {
18
+ var currentSelectAppInfo = props.currentSelectAppInfo,
19
+ onChangeCondition = props.onChangeCondition,
20
+ currentJson = props.currentJson;
21
+ var _useContext = useContext(BizGlobalDataContext),
22
+ authority = _useContext.authority;
23
+ var _useState = useState([]),
24
+ _useState2 = _slicedToArray(_useState, 2),
25
+ eventGroups = _useState2[0],
26
+ setEventGroups = _useState2[1];
27
+ var _useState3 = useState([]),
28
+ _useState4 = _slicedToArray(_useState3, 2),
29
+ userProps = _useState4[0],
30
+ setUserProps = _useState4[1];
31
+ var _useState5 = useState([]),
32
+ _useState6 = _slicedToArray(_useState5, 2),
33
+ envList = _useState6[0],
34
+ setEnvList = _useState6[1];
35
+ var _useState7 = useState(true),
36
+ _useState8 = _slicedToArray(_useState7, 2),
37
+ loadEvent = _useState8[0],
38
+ setLoadEvent = _useState8[1];
39
+ var _useState9 = useState(true),
40
+ _useState10 = _slicedToArray(_useState9, 2),
41
+ loadEnv = _useState10[0],
42
+ setLoadEnv = _useState10[1];
43
+ var _useState11 = useState(true),
44
+ _useState12 = _slicedToArray(_useState11, 2),
45
+ loadUsers = _useState12[0],
46
+ setLoadUsers = _useState12[1];
47
+ // const [tagsGroup, setTagsGroup] = useState<any>([]);
48
+ var _useState13 = useState({
49
+ eventGroupList: [],
50
+ userPropList: [],
51
+ eventEnvList: []
52
+ }),
53
+ _useState14 = _slicedToArray(_useState13, 2),
54
+ newStore = _useState14[0],
55
+ setStore = _useState14[1];
56
+ useEffect(function () {
57
+ // 请求下拉数据
58
+ initData();
59
+ }, [currentSelectAppInfo]);
60
+ var initData = function initData() {
61
+ loadUserProps(currentSelectAppInfo.app_id);
62
+ loadEvents(currentSelectAppInfo.app_id);
63
+ loadEnvList(currentSelectAppInfo.app_id);
64
+ // queryGroupTags(currentSelectAppInfo);
65
+ };
66
+
67
+ function loadUserProps(appId) {
68
+ setLoadUsers(true);
69
+ ajax('/zg/web/v2/appusergroup/getUserPropMeta', {
70
+ method: 'post',
71
+ data: {
72
+ appId: appId,
73
+ platform: 0
74
+ }
75
+ }).then(function (res) {
76
+ setUserProps(res.data);
77
+ setLoadUsers(false);
78
+ });
79
+ }
80
+ function loadEvents(appId) {
81
+ setLoadEvent(true);
82
+ ajax('/zg/web/v2/data/queryEventMetasOfGroup', {
83
+ method: 'post',
84
+ data: {
85
+ appId: appId,
86
+ platform: 0,
87
+ isAll: true
88
+ }
89
+ }).then(function (res) {
90
+ res.data.forEach(function (item1) {
91
+ item1.eventList.forEach(function (item2) {
92
+ item2.name = item2.event_name;
93
+ item2.alias = item2.event_name;
94
+ });
95
+ });
96
+ setEventGroups(res.data);
97
+ setLoadEvent(false);
98
+ });
99
+ }
100
+ function loadEnvList(appId) {
101
+ setLoadEnv(true);
102
+ ajax('/zg/web/v2/appusergroup/getEventEnvData', {
103
+ method: 'post',
104
+ data: {
105
+ appId: appId,
106
+ platform: 0
107
+ }
108
+ }).then(function (res) {
109
+ setEnvList(res.data.eventEnv);
110
+ setLoadEnv(false);
111
+ });
112
+ }
113
+ // function queryGroupTags(appInfo: AppInfoProps) {
114
+ // ajax('/zg/web/v2/v4/userGroup/label/list', {
115
+ // method: 'post',
116
+ // data: {
117
+ // appId: appInfo?.app_id,
118
+ // platform: appInfo?.platform || 0,
119
+ // },
120
+ // }).then((res: any) => {
121
+ // if (!res) return;
122
+ // setTagsGroup(res.data);
123
+ // });
124
+ // }
125
+ useEffect(function () {
126
+ if (loadEnv || loadEvent || loadUsers) return;
127
+ var newStore = convertAttributeData({
128
+ eventList: eventGroups,
129
+ userPropList: userProps,
130
+ envPropList: envList
131
+ });
132
+ setStore(newStore);
133
+ }, [loadEvent, loadEnv, loadUsers]);
134
+ return /*#__PURE__*/React.createElement("div", null, !loadEnv && !loadEvent && !loadUsers ? /*#__PURE__*/React.createElement(BizGlobalDataContext.Provider, {
135
+ value: {
136
+ eventGroupList: newStore.eventGroupList,
137
+ userPropList: newStore.userPropList,
138
+ eventEnvList: newStore.eventEnvList,
139
+ currentApp: _objectSpread({
140
+ appId: currentSelectAppInfo.app_id,
141
+ platform: 0
142
+ }, currentSelectAppInfo),
143
+ authority: authority
144
+ }
145
+ }, /*#__PURE__*/React.createElement(BizUserCondition, {
146
+ openCdpCondition: true,
147
+ openBusinessDataCondition: true,
148
+ openOrderDataCondition: true,
149
+ openTagCondition: false,
150
+ // userTagsData={tagsGroup}
151
+ defaultValue: currentJson,
152
+ onChange: onChangeCondition,
153
+ orConditionNum: 3,
154
+ andConditionNum: 8,
155
+ eventAttrNum: 3,
156
+ isRealTime: true,
157
+ key: currentSelectAppInfo.app_id
158
+ })) : /*#__PURE__*/React.createElement(Spin, {
159
+ tip: "\u57FA\u7840\u6570\u636E\u52A0\u8F7D\u4E2D"
160
+ }));
161
+ };
162
+ export default SetDataRangeDialog;
@@ -0,0 +1,344 @@
1
+ import { SizeType } from 'antd/es/config-provider/SizeContext';
2
+ import { ReactNode } from 'react';
3
+ /**
4
+ * 属性类型
5
+ */
6
+ export declare enum PropType {
7
+ STRING = 1,
8
+ NUMBER = 2,
9
+ DATE = 3
10
+ }
11
+ /**
12
+ * 属性类别
13
+ */
14
+ export declare enum PropCategory {
15
+ EventProp = "eventProp",
16
+ UserProp = "userProp",
17
+ EnvProp = "envProp",
18
+ SessionProp = "sessionProp"
19
+ }
20
+ export declare enum ShowStatus {
21
+ show = 0,
22
+ hidden = 1
23
+ }
24
+ /**
25
+ * 事件数据类型
26
+ */
27
+ export interface AnalysisEvent {
28
+ /**
29
+ * 事件id
30
+ */
31
+ id: number;
32
+ /**
33
+ * 事件id
34
+ */
35
+ event_id?: number;
36
+ /**
37
+ * 事件名称
38
+ */
39
+ name: string;
40
+ /**
41
+ * 事件名称
42
+ */
43
+ event_name?: string;
44
+ /**
45
+ * 事件别名
46
+ */
47
+ alias?: string;
48
+ /**
49
+ * 事件属性列表
50
+ */
51
+ attrList: Array<EventProp>;
52
+ /**
53
+ * 是否被删除
54
+ */
55
+ isDelete?: boolean;
56
+ /**
57
+ * 是否被停止采集
58
+ */
59
+ isStop?: boolean;
60
+ /**
61
+ * 是否是事件概览(true时代表,这不是一个真实事件数据)
62
+ */
63
+ isOverview?: boolean;
64
+ /**
65
+ * 事件显示状态
66
+ */
67
+ eventHidden?: ShowStatus;
68
+ /**
69
+ * 是否被收藏标记
70
+ */
71
+ marked?: boolean;
72
+ /**
73
+ * 是否是内置指标
74
+ */
75
+ isBuiltIn?: boolean;
76
+ /**
77
+ * 指标类型, 默认是event
78
+ */
79
+ type?: string;
80
+ /**
81
+ * 是否埋点分析(页面判断使用)
82
+ */
83
+ clickAnalysis?: boolean;
84
+ /**
85
+ * 所有权
86
+ */
87
+ owner?: string;
88
+ }
89
+ /**
90
+ * 事件分组
91
+ */
92
+ export interface EventGroup {
93
+ /**
94
+ * 分组id
95
+ */
96
+ id: number;
97
+ /**
98
+ * 分组名称
99
+ */
100
+ name?: string;
101
+ /**
102
+ * 事件列表
103
+ */
104
+ eventList: AnalysisEvent[];
105
+ }
106
+ /**
107
+ * 通用属性信息
108
+ */
109
+ export interface BasicProp {
110
+ /**
111
+ * 属性id
112
+ */
113
+ id?: number;
114
+ /**
115
+ * 属性展示名称
116
+ */
117
+ label?: string;
118
+ /**
119
+ * 属性别名
120
+ */
121
+ alias?: string;
122
+ /**
123
+ * 属性类型
124
+ */
125
+ type?: PropType;
126
+ /**
127
+ * 是否实时
128
+ */
129
+ realTime?: boolean;
130
+ /**
131
+ * 类别
132
+ */
133
+ dimensionSub?: string;
134
+ /**
135
+ * 是否展示
136
+ */
137
+ isHidden?: boolean;
138
+ /**
139
+ * 属性类别:fixed(内置属性),custom(自定义属性)
140
+ */
141
+ category?: 'fixed' | 'custom';
142
+ }
143
+ /**
144
+ * 用户属性
145
+ */
146
+ export interface UserProp extends BasicProp {
147
+ /**
148
+ * 属性标识名称(可用于做属性唯一标识)
149
+ */
150
+ name?: string;
151
+ /**
152
+ * 属性类别
153
+ */
154
+ propCategory: 'userProp';
155
+ /**
156
+ * 用户属性唯一标识,取值为:userProp-name
157
+ */
158
+ key?: string;
159
+ subtype?: number;
160
+ }
161
+ /**
162
+ * 触发环境属性
163
+ */
164
+ export interface EnvProp extends BasicProp {
165
+ /**
166
+ * 属性类别
167
+ */
168
+ propCategory: 'envProp';
169
+ /**
170
+ * 属性标识名称(可用于做属性唯一标识)
171
+ */
172
+ name?: string;
173
+ /**
174
+ * 环境属性唯一标识,取值为:envProp-name
175
+ */
176
+ key?: string;
177
+ }
178
+ /**
179
+ * 事件属性
180
+ */
181
+ export interface EventProp extends BasicProp {
182
+ /**
183
+ * 所属事件id
184
+ */
185
+ eventId?: number;
186
+ /**
187
+ * 属性类别
188
+ */
189
+ propCategory: 'eventProp';
190
+ /**
191
+ * 事件属性唯一标识,取值为:eventProp-id
192
+ */
193
+ key?: number | string;
194
+ /**
195
+ * 所属步骤下标(漏斗场景下有)
196
+ */
197
+ step?: number;
198
+ }
199
+ /**
200
+ * 属性组,包含事件属性、用户属性、事件触发环境列表
201
+ */
202
+ export interface PropGroups {
203
+ eventGroupList?: EventGroup[];
204
+ userPropList?: UserProp[];
205
+ envPropList?: EnvProp[];
206
+ eventNameMap?: Record<string, AnalysisEvent>;
207
+ eventIdMap?: Record<number, AnalysisEvent>;
208
+ }
209
+ export declare namespace AttributeSelect {
210
+ /**
211
+ * 属性下拉值
212
+ */
213
+ type Value = EventProp | UserProp | EnvProp | ExtraProp | null;
214
+ /**
215
+ * 属性下拉props
216
+ */
217
+ interface Props {
218
+ /**
219
+ * @description 组件唯一id,不用主动传,组件自动生成,请忽略!!!
220
+ */
221
+ id?: string;
222
+ /**
223
+ * @description 若组件是表单选项,value就是form的initialValues,也是组件的默认选项
224
+ * @default -
225
+ */
226
+ value?: Value;
227
+ /**
228
+ * @description 默认值
229
+ */
230
+ defaultValue?: Value;
231
+ /**
232
+ * @description 禁用选项列表
233
+ */
234
+ disableItemList?: (EventProp | UserProp | EnvProp | ExtraProp)[];
235
+ /**
236
+ * @description 删除按钮是否可用
237
+ * @default false
238
+ */
239
+ enableDelete?: boolean;
240
+ /**
241
+ * @description 默认提示文本
242
+ * @default 请选择
243
+ */
244
+ placeholder?: string;
245
+ /**
246
+ * @description 是否启用事件属性,启用后,eventIdList为必传
247
+ * @default false
248
+ */
249
+ enableEventProp?: boolean;
250
+ /**
251
+ * @description 是否启用用户属性
252
+ * @default true
253
+ */
254
+ enableUserProp?: boolean;
255
+ /**
256
+ * @description 是否启用事件触发环境属性
257
+ */
258
+ enableEnvProp?: boolean;
259
+ /**
260
+ * @description 支持的事件列表,当enableEventProp为true时有效
261
+ */
262
+ eventIdList?: number[];
263
+ /**
264
+ * @description 支持的漏斗事件列表,当enableEventProp为true时有效,eventIdList和funnelEventIdList只能传一个,通过该属性传递的事件属性,选中时会回传所属步骤
265
+ */
266
+ funnelEventIdList?: number[][];
267
+ /**
268
+ * @description 是否显示通用属性(展示通用属性后,单独事件分组将隐藏)
269
+ */
270
+ showCommonProp?: boolean;
271
+ /**
272
+ * @description 非实时后缀图标名称(iconfont)
273
+ * @default *
274
+ */
275
+ propSymbol?: ReactNode;
276
+ /**
277
+ * @description 属性下拉提示
278
+ * @default 带*的属性每日凌晨更新
279
+ */
280
+ optionsHeaderTip?: string;
281
+ /**
282
+ * @description onChange
283
+ */
284
+ onChange?: (value: Value) => void;
285
+ /**
286
+ * @description 删除事件监听
287
+ */
288
+ onDelete?: (value?: Value, e?: any) => void;
289
+ /**
290
+ * 主题
291
+ */
292
+ theme?: string;
293
+ /**
294
+ * @description 关闭后是否销毁下拉
295
+ * @default false
296
+ */
297
+ destroyPopupOnHide?: boolean;
298
+ /**
299
+ * @description 文本框大小 ,40px | 32px | 24px
300
+ * @default middle
301
+ */
302
+ size?: SizeType;
303
+ /**
304
+ * 状态
305
+ */
306
+ status?: string;
307
+ /**
308
+ * 自定义属性类型
309
+ */
310
+ extra?: AttributeExtra[];
311
+ /**
312
+ * 数字类型
313
+ */
314
+ isNumber?: Boolean;
315
+ }
316
+ interface AttributeExtra {
317
+ type: string;
318
+ name: string;
319
+ attrList: ExtraProp[];
320
+ }
321
+ interface ExtraProp extends BasicProp {
322
+ /**
323
+ * 属性类别
324
+ */
325
+ propCategory: string;
326
+ /**
327
+ * 事件属性唯一标识,取值为:propCategory-id||name
328
+ */
329
+ key?: number | string;
330
+ name?: string;
331
+ subtype?: number;
332
+ [key: string]: any;
333
+ }
334
+ /**
335
+ * 下拉选项
336
+ */
337
+ interface Option {
338
+ groupName: string;
339
+ isEvent: boolean;
340
+ key: string;
341
+ anchor: string;
342
+ children: Value[];
343
+ }
344
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * 属性类型
3
+ */
4
+ export var PropType;
5
+ (function (PropType) {
6
+ PropType[PropType["STRING"] = 1] = "STRING";
7
+ PropType[PropType["NUMBER"] = 2] = "NUMBER";
8
+ PropType[PropType["DATE"] = 3] = "DATE";
9
+ })(PropType || (PropType = {}));
10
+ /**
11
+ * 属性类别
12
+ */
13
+ export var PropCategory;
14
+ (function (PropCategory) {
15
+ PropCategory["EventProp"] = "eventProp";
16
+ PropCategory["UserProp"] = "userProp";
17
+ PropCategory["EnvProp"] = "envProp";
18
+ PropCategory["SessionProp"] = "sessionProp";
19
+ })(PropCategory || (PropCategory = {}));
20
+ export var ShowStatus;
21
+ (function (ShowStatus) {
22
+ ShowStatus[ShowStatus["show"] = 0] = "show";
23
+ ShowStatus[ShowStatus["hidden"] = 1] = "hidden";
24
+ })(ShowStatus || (ShowStatus = {}));
@@ -0,0 +1,13 @@
1
+ import { OldSystem } from '@zgfe/business-lib/es/utils/type';
2
+ import { PropGroups } from './types';
3
+ /**
4
+ * 老系统(vue)基础数据转化程序
5
+ * @param store
6
+ * @returns PropGropus
7
+ */
8
+ export default function convertAttributeData(store: {
9
+ envPropList?: OldSystem.EnvProp[];
10
+ userPropList?: OldSystem.UserProp[];
11
+ eventList?: OldSystem.EventGroup[];
12
+ }): PropGroups;
13
+ export declare function getIcon(name: string): string;