@zgfe/modules-page 1.0.1-alpha.3 → 1.0.1-alpha.5

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,7 +7,7 @@ declare const PageContent: React.FC<{
7
7
  value?: PageColumnType[];
8
8
  groupId?: number;
9
9
  hasUserGroup?: boolean;
10
- onClick?: (data: any) => void;
10
+ onClick?: (data: ModulesPageTypes.PageGroup | ModulesPageTypes.Page) => void;
11
11
  onEdit?: (data: ModulesPageTypes.PageGroup) => void;
12
12
  onCreate?: () => void;
13
13
  }>;
@@ -43,6 +43,7 @@ var PageContent = function PageContent(props) {
43
43
  return /*#__PURE__*/React.createElement("div", {
44
44
  className: classPrefix
45
45
  }, /*#__PURE__*/React.createElement(BizTable, {
46
+ rowKey: props.type === 'pageGroup' ? 'id' : 'pageUrl',
46
47
  dataSource: props.type === 'pageGroup' ? groupList : props.value,
47
48
  columns: getColumns(props.type, props.hasUserGroup, props.onClick, props.onEdit)
48
49
  }));
@@ -1,17 +1,6 @@
1
- import { ColumnGroupType, ColumnType, ColumnsType } from 'antd/lib/table';
2
- import React from 'react';
3
- export declare const getColumns: (type: string, hasUserGroup?: boolean, onClickCallback?: Function, onEditCallback?: Function) => ((ColumnGroupType<object> | ColumnType<object>)[] & ColumnsType<any>) | ({
4
- title: string;
5
- dataIndex: string;
6
- key: string;
7
- render: (txt: string, record: any) => React.JSX.Element;
8
- width?: undefined;
9
- } | {
10
- title: string;
11
- dataIndex: string;
12
- key: string;
13
- width: number;
14
- render?: undefined;
15
- })[];
1
+ import { ColumnsType } from 'antd/lib/table';
2
+ import { PageColumnType } from './types';
3
+ import { ModulesPageTypes } from '../../modules/home/types';
4
+ export declare const getColumns: (type: string, hasUserGroup?: boolean, onClickCallback?: Function, onEditCallback?: Function) => ColumnsType<PageColumnType> | ColumnsType<ModulesPageTypes.PageGroup>;
16
5
  export declare const getNumPer: (viewUser: number, clickUser: number) => string;
17
6
  export declare const toThousands: (num?: number) => string | number | undefined;
@@ -19,7 +19,10 @@ export var getColumns = function getColumns(type, hasUserGroup, onClickCallback,
19
19
  return /*#__PURE__*/React.createElement("div", {
20
20
  className: "table-td-page",
21
21
  onClick: function onClick() {
22
- return onClickCallback && onClickCallback(record);
22
+ return onClickCallback && onClickCallback({
23
+ pageTitle: record.pageTitle,
24
+ pageUrl: record.pageUrl
25
+ });
23
26
  }
24
27
  }, /*#__PURE__*/React.createElement(Tooltip, {
25
28
  title: record.pageTitle
@@ -37,9 +40,10 @@ export var getColumns = function getColumns(type, hasUserGroup, onClickCallback,
37
40
  onClick: function onClick(e) {
38
41
  var _navigator, _navigator$clipboard;
39
42
  e.stopPropagation();
40
- (_navigator = navigator) === null || _navigator === void 0 ? void 0 : (_navigator$clipboard = _navigator.clipboard) === null || _navigator$clipboard === void 0 ? void 0 : _navigator$clipboard.writeText(record.pageUrl).catch(function () {
43
+ if (!(record !== null && record !== void 0 && record.pageUrl)) return;
44
+ (_navigator = navigator) === null || _navigator === void 0 ? void 0 : (_navigator$clipboard = _navigator.clipboard) === null || _navigator$clipboard === void 0 ? void 0 : _navigator$clipboard.writeText(record === null || record === void 0 ? void 0 : record.pageUrl).catch(function () {
41
45
  var el = document.createElement('textarea');
42
- el.value = record.pageUrl;
46
+ el.value = record.pageUrl || '';
43
47
  document.body.appendChild(el);
44
48
  el.select();
45
49
  document.execCommand('copy');
@@ -117,7 +121,7 @@ export var getColumns = function getColumns(type, hasUserGroup, onClickCallback,
117
121
  },
118
122
  showSorterTooltip: false,
119
123
  render: function render(_txt, record) {
120
- return getNumPer(record.viewUser, record.clickUser);
124
+ return getNumPer(record.viewUser || 0, record.clickUser || 0);
121
125
  }
122
126
  }];
123
127
  if (hasUserGroup) {
@@ -140,7 +144,7 @@ export var getColumns = function getColumns(type, hasUserGroup, onClickCallback,
140
144
  onClick: function onClick() {
141
145
  return onClickCallback && onClickCallback(record);
142
146
  }
143
- }, ' ', txt), /*#__PURE__*/React.createElement(IconFont, {
147
+ }, txt), /*#__PURE__*/React.createElement(IconFont, {
144
148
  type: "bianji1",
145
149
  onClick: function onClick() {
146
150
  return onEditCallback && onEditCallback(record);
@@ -156,7 +160,7 @@ export var getColumns = function getColumns(type, hasUserGroup, onClickCallback,
156
160
  return type === 'page' ? pageColumns : groupColumns;
157
161
  };
158
162
  export var getNumPer = function getNumPer(viewUser, clickUser) {
159
- if (viewUser === -1) {
163
+ if (!viewUser || viewUser === -1) {
160
164
  return '-';
161
165
  }
162
166
  return viewUser ? (clickUser / viewUser * 100).toFixed(1) + '%' : 0 + '%';
@@ -166,9 +170,4 @@ export var toThousands = function toThousands(num) {
166
170
  return num === -1 ? '-' : util.toThousands(num);
167
171
  }
168
172
  return num;
169
- };
170
- var sorter = function sorter(a, b) {
171
- if (a.viewUser === -1 || !a.viewUser) return 0;
172
- if (b.viewUser === -1 || !b.viewUser) return 1;
173
- return a.clickUser / a.viewUser - b.clickUser / b.viewUser;
174
173
  };
@@ -88,8 +88,8 @@ var DetailContent = function DetailContent(props) {
88
88
  });
89
89
  client.onConnected(function () {
90
90
  client.emit('openAutoTrack', _objectSpread({
91
- app_id: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
92
- platform: (currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform) || 0
91
+ appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
92
+ platform: 3
93
93
  }, props.params));
94
94
  });
95
95
  client.onError(function (err) {
@@ -131,8 +131,8 @@ var DetailContent = function DetailContent(props) {
131
131
  href: pageUrl
132
132
  });
133
133
  client.emit('updateAutoTrackParam', _objectSpread({
134
- app_id: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
135
- platform: (currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform) || 0
134
+ appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
135
+ platform: 3
136
136
  }, props.params));
137
137
  // if (timer) {
138
138
  // clearTimeout(timer);
@@ -1,10 +1,6 @@
1
1
  import React from 'react';
2
2
  import './index.less';
3
+ import { GroupModalType } from './types';
3
4
  export declare const classPrefix = "group-modal";
4
- declare const GroupModal: React.FC<{
5
- value?: any;
6
- type?: string;
7
- onOk?: () => void;
8
- onCancel?: () => void;
9
- }>;
5
+ declare const GroupModal: React.FC<GroupModalType.Props>;
10
6
  export default GroupModal;
@@ -62,13 +62,14 @@ var GroupModal = function GroupModal(props) {
62
62
  });
63
63
  }, []);
64
64
  var onDelete = function onDelete() {
65
+ var _props$value;
65
66
  setLoading(true);
66
67
  ajax(api.deletePageGroup, {
67
68
  method: 'post',
68
69
  data: {
69
70
  appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
70
71
  platform: 3,
71
- id: props.value.id
72
+ id: (_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id
72
73
  }
73
74
  }).then(function (res) {
74
75
  if (!res) {
@@ -86,7 +87,7 @@ var GroupModal = function GroupModal(props) {
86
87
  (_refForm$current = refForm.current) === null || _refForm$current === void 0 ? void 0 : _refForm$current.submit();
87
88
  };
88
89
  var onSubmit = function onSubmit(data) {
89
- var _props$value;
90
+ var _props$value2;
90
91
  setValidate(true);
91
92
  var flag = true;
92
93
  data.filters.forEach(function (item) {
@@ -102,16 +103,16 @@ var GroupModal = function GroupModal(props) {
102
103
  data: _objectSpread({
103
104
  appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
104
105
  platform: 3,
105
- id: (_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id
106
+ id: (_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.id
106
107
  }, data)
107
108
  }).then(function (res) {
108
- var _props$value3;
109
+ var _props$value4;
109
110
  if (!res) {
110
- var _props$value2;
111
- message.error("".concat((_props$value2 = props.value) !== null && _props$value2 !== void 0 && _props$value2.id ? '修改' : '创建', "\u5931\u8D25"));
111
+ var _props$value3;
112
+ message.error("".concat((_props$value3 = props.value) !== null && _props$value3 !== void 0 && _props$value3.id ? '修改' : '创建', "\u5931\u8D25"));
112
113
  return;
113
114
  }
114
- message.success("".concat((_props$value3 = props.value) !== null && _props$value3 !== void 0 && _props$value3.id ? '修改' : '创建', "\u6210\u529F"));
115
+ message.success("".concat((_props$value4 = props.value) !== null && _props$value4 !== void 0 && _props$value4.id ? '修改' : '创建', "\u6210\u529F"));
115
116
  props.onOk && props.onOk();
116
117
  }).finally(function () {
117
118
  setLoading(false);
@@ -2,6 +2,8 @@ import { ModulesPageTypes } from '../../modules/home/types';
2
2
  export declare namespace GroupModalType {
3
3
  interface Props {
4
4
  value?: ModulesPageTypes.PageGroup;
5
+ onOk?: () => void;
6
+ onCancel?: () => void;
5
7
  }
6
8
  interface ItemProps {
7
9
  value?: ModulesPageTypes.ItemValue[];
@@ -1,8 +1,6 @@
1
1
  export declare namespace PageSelectTypes {
2
2
  interface Props {
3
3
  value?: Value;
4
- pageList?: any[];
5
- pageGroupList?: any[];
6
4
  enableAdd?: boolean;
7
5
  onAdd?: () => void;
8
6
  onChange?: (data: Value) => void;
@@ -89,6 +89,7 @@ var SearchPanel = function SearchPanel(props) {
89
89
  className: "".concat(classPrefix, "-item"),
90
90
  key: field.key
91
91
  }), /*#__PURE__*/React.createElement(BizUserGroup, {
92
+ enableDelete: fields.length > 1,
92
93
  onDelete: function onDelete() {
93
94
  return remove(index);
94
95
  }
@@ -7,5 +7,5 @@ export default {
7
7
  getPageResult: '/zg/web/v2/data/pageDataList',
8
8
  getPageEsData: '/zg/web/v2/data/queryEsData',
9
9
  download: '/zg/web/v2/data/pagedownloadReport',
10
- socket: 'wss://rt2.zhugeio.com/eventtracking/ws'
10
+ socket: '/eventtracking/ws'
11
11
  };
@@ -0,0 +1,23 @@
1
+ declare const _default: {
2
+ _keyStr: string;
3
+ _utf8_encode: (string: string) => string;
4
+ _utf8_decode: (utftext: string) => string;
5
+ encode: (input: string, type?: boolean) => string;
6
+ decode: (input: string) => string;
7
+ _$: string[];
8
+ pw: string;
9
+ gString: (O6b8: {
10
+ [x: string]: (arg0: number) => {
11
+ (): any;
12
+ new (): any;
13
+ [x: string]: () => any;
14
+ };
15
+ }[], O492: {
16
+ [x: string]: (arg0: number) => {
17
+ (): any;
18
+ new (): any;
19
+ [x: string]: () => any;
20
+ };
21
+ }[]) => string;
22
+ };
23
+ export default _default;
@@ -0,0 +1,132 @@
1
+ /**
2
+ * Created by yqdong on 16/3/15.
3
+ * qq: 1013501639
4
+ * @author yqdong
5
+ *
6
+ */
7
+ export default {
8
+ _keyStr: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
9
+ _utf8_encode: function _utf8_encode(string) {
10
+ string = string.replace(/\r\n/g, '\n');
11
+ var utftext = '';
12
+ for (var n = 0; n < string.length; n++) {
13
+ var c = string.charCodeAt(n);
14
+ if (c < 128) {
15
+ utftext += String.fromCharCode(c);
16
+ } else if (c > 127 && c < 2048) {
17
+ utftext += String.fromCharCode(c >> 6 | 192); // jshint ignore:line
18
+ utftext += String.fromCharCode(c & 63 | 128); // jshint ignore:line
19
+ } else {
20
+ utftext += String.fromCharCode(c >> 12 | 224); // jshint ignore:line
21
+ utftext += String.fromCharCode(c >> 6 & 63 | 128); // jshint ignore:line
22
+ utftext += String.fromCharCode(c & 63 | 128); // jshint ignore:line
23
+ }
24
+ }
25
+
26
+ return utftext;
27
+ },
28
+ _utf8_decode: function _utf8_decode(utftext) {
29
+ var string = '';
30
+ var i = 0,
31
+ c = 0,
32
+ c2 = 0,
33
+ c3 = 0;
34
+ while (i < utftext.length) {
35
+ c = utftext.charCodeAt(i);
36
+ if (c < 128) {
37
+ string += String.fromCharCode(c);
38
+ i++;
39
+ } else if (c > 191 && c < 224) {
40
+ c2 = utftext.charCodeAt(i + 1);
41
+ string += String.fromCharCode((c & 31) << 6 | c2 & 63); // jshint ignore:line
42
+ i += 2;
43
+ } else {
44
+ c2 = utftext.charCodeAt(i + 1);
45
+ c3 = utftext.charCodeAt(i + 2);
46
+ string += String.fromCharCode((c & 15) << 12 | (c2 & 63) << 6 | c3 & 63); // jshint ignore:line
47
+ i += 3;
48
+ }
49
+ }
50
+ return string;
51
+ },
52
+ encode: function encode(input, type) {
53
+ var output = '';
54
+ var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
55
+ var i = 0;
56
+ input = this._utf8_encode(input);
57
+ while (i < input.length) {
58
+ chr1 = input.charCodeAt(i++);
59
+ chr2 = input.charCodeAt(i++);
60
+ chr3 = input.charCodeAt(i++);
61
+ enc1 = chr1 >> 2; // jshint ignore:line
62
+ enc2 = (chr1 & 3) << 4 | chr2 >> 4; // jshint ignore:line
63
+ enc3 = (chr2 & 15) << 2 | chr3 >> 6; // jshint ignore:line
64
+ enc4 = chr3 & 63; // jshint ignore:line
65
+ if (isNaN(chr2)) {
66
+ enc3 = enc4 = 64;
67
+ } else if (isNaN(chr3)) {
68
+ enc4 = 64;
69
+ }
70
+ output = output + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
71
+ }
72
+ if (type) {
73
+ return output.replace(/[\+]?[\/]?[\=]?/g, '');
74
+ } else {
75
+ return output.replace(/\+/g, '-');
76
+ }
77
+ },
78
+ decode: function decode(input) {
79
+ input = input.replace(/\-/g, '+');
80
+ var output = '';
81
+ var chr1, chr2, chr3;
82
+ var enc1, enc2, enc3, enc4;
83
+ var i = 0;
84
+ while (i < input.length) {
85
+ enc1 = this._keyStr.indexOf(input.charAt(i++));
86
+ enc2 = this._keyStr.indexOf(input.charAt(i++));
87
+ enc3 = this._keyStr.indexOf(input.charAt(i++));
88
+ enc4 = this._keyStr.indexOf(input.charAt(i++));
89
+ chr1 = enc1 << 2 | enc2 >> 4; // jshint ignore:line
90
+ chr2 = (enc2 & 15) << 4 | enc3 >> 2; // jshint ignore:line
91
+ chr3 = (enc3 & 3) << 6 | enc4; // jshint ignore:line
92
+ output = output + String.fromCharCode(chr1);
93
+ if (enc3 != 64) {
94
+ output = output + String.fromCharCode(chr2);
95
+ }
96
+ if (enc4 != 64) {
97
+ output = output + String.fromCharCode(chr3);
98
+ }
99
+ }
100
+ output = this._utf8_decode(output);
101
+ return output;
102
+ },
103
+ _$: [''],
104
+ pw: '0&Gqs0a5',
105
+ gString: function gString(O6b8, O492) {
106
+ var dfc4 = Array(0x100);
107
+ var O26e = Array(0x100);
108
+ var O999 = O492['\x6c\x65\x6e\x67\x74\x68'];
109
+ var O453 = O6b8['\x6c\x65\x6e\x67\x74\x68'];
110
+ for (var O98c = 0x0; O98c < 0x100; O98c++) {
111
+ dfc4[O98c] = O492[O98c % O999]['\x63\x68\x61\x72\x41\x74'](0x0)['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74']();
112
+ O26e[O98c] = O98c;
113
+ }
114
+ for (var O8cf = O98c = 0x0; O98c < 0x100; O98c++) {
115
+ O8cf = (O8cf + O26e[O98c] + dfc4[O98c]) % 0x100;
116
+ var O23f = O26e[O98c];
117
+ O26e[O98c] = O26e[O8cf];
118
+ O26e[O8cf] = O23f;
119
+ }
120
+ var ac35 = this._$[0];
121
+ for (var O577 = O8cf = O98c = 0x0; O98c < O453; O98c++) {
122
+ O577 = (O577 + 0x1) % 0x100;
123
+ O8cf = (O8cf + O26e[O577]) % 0x100;
124
+ var tmp = O26e[O577];
125
+ O26e[O577] = O26e[O8cf];
126
+ O26e[O8cf] = tmp;
127
+ var O3d6 = O26e[(O26e[O577] + O26e[O8cf]) % 0x100];
128
+ ac35 += String['\x66\x72\x6f\x6d\x43\x68\x61\x72\x43\x6f\x64\x65'](O6b8[O98c]['\x63\x68\x61\x72\x41\x74'](0x0)['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74']() ^ O3d6);
129
+ }
130
+ return ac35;
131
+ }
132
+ };
@@ -119,6 +119,7 @@ var ModulesPage = function ModulesPage(props) {
119
119
  if (type === 'page' && !(searchValue !== null && searchValue !== void 0 && searchValue.pageUrl) || type === 'pageGroup' && !(searchValue !== null && searchValue !== void 0 && searchValue.pageGroup)) {
120
120
  setPageType('list');
121
121
  }
122
+ if (type === 'pageGroup' && !(searchValue !== null && searchValue !== void 0 && searchValue.pageGroup)) return;
122
123
  if (type === 'page' || pageType === 'detail') {
123
124
  fetch();
124
125
  }
@@ -29,6 +29,10 @@ export declare namespace ModulesPageTypes {
29
29
  param?: string;
30
30
  id?: string;
31
31
  }
32
+ interface Params {
33
+ appId?: number | string;
34
+ platform: number;
35
+ }
32
36
  }
33
37
  export declare const ModulesPageContext: import("react").Context<{
34
38
  pageList: ModulesPageTypes.Page[];
@@ -1,7 +1,7 @@
1
1
  import { ModulesPageTypes } from './types';
2
2
  import { AppInfoProps } from '@zgfe/business-lib/es/context';
3
- export declare const getPageList: (data: any, callback: Function) => void;
4
- export declare const getPageGroupList: (data: any, callback: Function, loadingCallback?: Function) => void;
5
- export declare const getPageResult: (params: any, callback: Function, loadingCallback: Function) => void;
3
+ export declare const getPageList: (data: ModulesPageTypes.Params, callback: Function) => void;
4
+ export declare const getPageGroupList: (data: ModulesPageTypes.Params, callback: Function, loadingCallback?: Function) => void;
5
+ export declare const getPageResult: (params: ModulesPageTypes.Params & ModulesPageTypes.Value, callback: Function, loadingCallback: Function) => void;
6
6
  export declare const getSocketSecret: () => string;
7
7
  export declare const onDownload: (params?: ModulesPageTypes.Value, currentApp?: AppInfoProps) => void;
@@ -6,6 +6,8 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
6
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
7
  import { ajax, util } from '@zgfe/business-lib';
8
8
  import api from "../../constants/api";
9
+ import base64 from "./base64";
10
+
9
11
  // 获取页面列表
10
12
  export var getPageList = function getPageList(data, callback) {
11
13
  ajax(api.getPageList, {
@@ -83,14 +85,20 @@ export var getSocketSecret = function getSocketSecret() {
83
85
  };
84
86
  export var onDownload = function onDownload(params, currentApp) {
85
87
  if (!params || !currentApp) return;
88
+ var title = params.pageTitle || '页面列表';
86
89
  ajax(api.download, {
87
90
  method: 'post',
88
- data: _objectSpread({
91
+ data: _objectSpread(_objectSpread({
89
92
  appId: currentApp.appId,
90
93
  platform: 3
91
- }, params),
94
+ }, params), {}, {
95
+ down: {
96
+ fname: base64.encode(title),
97
+ titles: []
98
+ }
99
+ }),
92
100
  responseType: 'blob',
93
- fileName: '页面列表',
101
+ fileName: title,
94
102
  getResponse: true
95
103
  }).then(function () {});
96
104
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/modules-page",
3
- "version": "1.0.1-alpha.3",
3
+ "version": "1.0.1-alpha.5",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -39,7 +39,7 @@
39
39
  "@types/lodash": "^4.14.197",
40
40
  "@umijs/fabric": "^2.8.1",
41
41
  "@umijs/test": "^3.0.5",
42
- "@zgfe/business-lib": "1.1.76-page.0",
42
+ "@zgfe/business-lib": "1.1.80-page.0",
43
43
  "antd": "^4.22.6",
44
44
  "dumi": "^1.1.0",
45
45
  "father": "^4.0.0-rc.2",
@@ -50,5 +50,5 @@
50
50
  "prettier": "^2.2.1",
51
51
  "yorkie": "^2.0.0"
52
52
  },
53
- "gitHead": "d0b4bcb08f0d51b7d891d84c3f0b12fd466f44a5"
53
+ "gitHead": "0f105de940a7565e234ddfb12d91232acba43e50"
54
54
  }