@zgfe/modules-page 1.0.1-alpha.1 → 1.0.1-alpha.10

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.
Files changed (30) hide show
  1. package/dist/esm/components/content/index.d.ts +1 -1
  2. package/dist/esm/components/content/index.js +1 -0
  3. package/dist/esm/components/content/utils.d.ts +4 -15
  4. package/dist/esm/components/content/utils.js +10 -11
  5. package/dist/esm/components/detail/index.js +33 -54
  6. package/dist/esm/components/groupModal/index.d.ts +2 -6
  7. package/dist/esm/components/groupModal/index.js +28 -24
  8. package/dist/esm/components/groupModal/index.less +17 -0
  9. package/dist/esm/components/groupModal/inputSelect.d.ts +9 -0
  10. package/dist/esm/components/groupModal/inputSelect.js +67 -0
  11. package/dist/esm/components/groupModal/pageItem.js +47 -58
  12. package/dist/esm/components/groupModal/types.d.ts +2 -2
  13. package/dist/esm/components/groupModal/utils.js +2 -8
  14. package/dist/esm/components/pageSelect/index.js +26 -3
  15. package/dist/esm/components/pageSelect/types.d.ts +0 -2
  16. package/dist/esm/components/searchPanel/index.js +2 -1
  17. package/dist/esm/components/searchPanel/index.less +3 -5
  18. package/dist/esm/components/searchPanel/util.d.ts +3 -11
  19. package/dist/esm/components/searchPanel/util.js +7 -11
  20. package/dist/esm/constants/api.js +1 -1
  21. package/dist/esm/modules/home/base64.d.ts +23 -0
  22. package/dist/esm/modules/home/base64.js +132 -0
  23. package/dist/esm/modules/home/demo/index.js +1 -1
  24. package/dist/esm/modules/home/index.js +31 -22
  25. package/dist/esm/modules/home/types.d.ts +4 -0
  26. package/dist/esm/modules/home/utils.d.ts +3 -3
  27. package/dist/esm/modules/home/utils.js +16 -5
  28. package/package.json +3 -3
  29. package/dist/esm/components/groupModal/mock.d.ts +0 -5
  30. package/dist/esm/components/groupModal/mock.js +0 -16
@@ -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
  };
@@ -10,7 +10,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
10
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
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
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
- import React, { useContext, useEffect, useState } from 'react';
13
+ import React, { useContext, useEffect, useMemo, useState } from 'react';
14
14
  import "./index.less";
15
15
  import { BizGlobalDataContext, IconFont, SocketClient, ajax } from '@zgfe/business-lib';
16
16
  import { Tooltip } from 'antd';
@@ -18,40 +18,29 @@ import { getNumPer, toThousands } from "../content/utils";
18
18
  import percentImg from "./images/color_pallete_percent.png";
19
19
  import renderImg from "./images/empty.png";
20
20
  import { ModulesPageContext } from "../../modules/home/types";
21
- import api from "../../constants/api";
22
21
  import { getSocketSecret } from "../../modules/home/utils";
22
+ import api from "../../constants/api";
23
23
  var DetailContent = function DetailContent(props) {
24
24
  var classPrefix = 'detail-content';
25
- var _useState = useState([]),
26
- _useState2 = _slicedToArray(_useState, 2),
27
- detailList = _useState2[0],
28
- setDetailList = _useState2[1];
29
- var _useState3 = useState(true),
30
- _useState4 = _slicedToArray(_useState3, 2),
31
- loading = _useState4[0],
32
- setLoading = _useState4[1];
33
- var _useState5 = useState(0),
34
- _useState6 = _slicedToArray(_useState5, 2),
35
- timer = _useState6[0],
36
- setTimer = _useState6[1];
37
25
  var _useContext = useContext(BizGlobalDataContext),
38
26
  currentApp = _useContext.currentApp;
39
27
  var _useContext2 = useContext(ModulesPageContext),
40
28
  pageGroupList = _useContext2.pageGroupList,
41
29
  pageList = _useContext2.pageList,
42
30
  setCurrentClickPage = _useContext2.setCurrentClickPage;
43
- var _useState7 = useState(),
44
- _useState8 = _slicedToArray(_useState7, 2),
45
- client = _useState8[0],
46
- setClient = _useState8[1];
31
+ var _useState = useState(),
32
+ _useState2 = _slicedToArray(_useState, 2),
33
+ client = _useState2[0],
34
+ setClient = _useState2[1];
47
35
  // 当前url
48
- var _useState9 = useState(),
49
- _useState10 = _slicedToArray(_useState9, 2),
50
- pageUrl = _useState10[0],
51
- setPageUrl = _useState10[1];
36
+ var _useState3 = useState(),
37
+ _useState4 = _slicedToArray(_useState3, 2),
38
+ pageUrl = _useState4[0],
39
+ setPageUrl = _useState4[1];
52
40
  useEffect(function () {
53
41
  var secret = getSocketSecret();
54
- var socket = new SocketClient(api.socket, currentApp === null || currentApp === void 0 ? void 0 : currentApp.appKey, {
42
+ var url = "wss://".concat(location.host).concat(api.socket);
43
+ var socket = new SocketClient(url, currentApp === null || currentApp === void 0 ? void 0 : currentApp.appKey, {
55
44
  appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
56
45
  origin: 4,
57
46
  role: 'server',
@@ -88,8 +77,8 @@ var DetailContent = function DetailContent(props) {
88
77
  });
89
78
  client.onConnected(function () {
90
79
  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
80
+ appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
81
+ platform: 3
93
82
  }, props.params));
94
83
  });
95
84
  client.onError(function (err) {
@@ -99,8 +88,7 @@ var DetailContent = function DetailContent(props) {
99
88
  console.log('连接已存在');
100
89
  });
101
90
  client.on('pageInfo', function (message) {
102
- console.log('接收消息', message);
103
- if (message.href !== pageUrl) {
91
+ if (message.href !== openUrl) {
104
92
  setPageUrl(message.href);
105
93
  // 如果当前类型是单页面,则更新页面选择
106
94
  if (props.type === 'page') {
@@ -131,33 +119,24 @@ var DetailContent = function DetailContent(props) {
131
119
  href: pageUrl
132
120
  });
133
121
  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
122
+ appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
123
+ platform: 3
136
124
  }, props.params));
137
- // if (timer) {
138
- // clearTimeout(timer);
139
- // }
140
- // setTimer(
141
- // setTimeout(() => {
142
- // setLoading(true);
143
- // ajax(api.getDetailResult, {
144
- // method:'post',
145
- // data: {
146
- // appId: currentApp?.appId,
147
- // platform: currentApp?.platform || 0,
148
- // // ...props.params,
149
- // },
150
- // })
151
- // .then((res) => {
152
- // if (!res) return;
153
- // setDetailList(res.data as PageColumnType[]);
154
- // })
155
- // .finally(() => {
156
- // setLoading(false);
157
- // });
158
- // }, 500),
159
- // );
160
125
  }, [props.params]);
126
+ var openUrl = useMemo(function () {
127
+ if (!pageUrl) return '';
128
+ var pUrl = pageUrl,
129
+ url = '';
130
+ var hash = pUrl.match(/#\S*$/) || [''];
131
+ if (hash) pUrl = pUrl.replace(hash[0], '');
132
+ var secret = 'autoTrack-' + getSocketSecret();
133
+ if (/\?/.test(pageUrl)) {
134
+ url = "".concat(pUrl.replace(/\/$/, ''), "&zgSecret=").concat(secret).concat(hash);
135
+ } else {
136
+ url = "".concat(pUrl.replace(/\/$/, ''), "?zgSecret=").concat(secret).concat(hash);
137
+ }
138
+ return url;
139
+ }, [pageUrl]);
161
140
  return /*#__PURE__*/React.createElement("div", {
162
141
  className: classPrefix
163
142
  }, /*#__PURE__*/React.createElement("div", {
@@ -170,7 +149,7 @@ var DetailContent = function DetailContent(props) {
170
149
  title: pageUrl
171
150
  }, /*#__PURE__*/React.createElement("span", {
172
151
  className: "".concat(classPrefix, "-top-value")
173
- }, pageUrl))), /*#__PURE__*/React.createElement("div", {
152
+ }, decodeURI(pageUrl || '')))), /*#__PURE__*/React.createElement("div", {
174
153
  className: "".concat(classPrefix, "-top-content")
175
154
  }, props.result.map(function (item, index) {
176
155
  var _props$params2, _props$params$userGro;
@@ -193,7 +172,7 @@ var DetailContent = function DetailContent(props) {
193
172
  }, /*#__PURE__*/React.createElement("img", {
194
173
  src: renderImg
195
174
  }), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("a", {
196
- href: pageUrl === null || pageUrl === void 0 ? void 0 : pageUrl.trim(),
175
+ href: openUrl,
197
176
  target: "_blank"
198
177
  }, "\u6253\u5F00\u65B0\u6807\u7B7E\u9875", /*#__PURE__*/React.createElement(IconFont, {
199
178
  type: "zhuanfa"
@@ -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;
@@ -11,12 +11,10 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
11
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
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
13
  import { BizDialog, BizGlobalDataContext, IconFont, ajax } from '@zgfe/business-lib';
14
- import { Button, Form, Input, Spin } from 'antd';
14
+ import { Button, Form, Input, Spin, message } from 'antd';
15
15
  import React, { useContext, useEffect, useRef, useState } from 'react';
16
16
  import "./index.less";
17
17
  import PageItem from "./pageItem";
18
- import { getPageEsData } from "./utils";
19
- import mockData from "./mock";
20
18
  import api from "../../constants/api";
21
19
  export var classPrefix = 'group-modal';
22
20
  var GroupModal = function GroupModal(props) {
@@ -28,23 +26,17 @@ var GroupModal = function GroupModal(props) {
28
26
  currentApp = _useContext.currentApp,
29
27
  isDemo = _useContext.isDemo;
30
28
  var refForm = useRef();
31
- // 默认的url数组
32
- var _useState3 = useState(mockData),
33
- _useState4 = _slicedToArray(_useState3, 2),
34
- defaultOption = _useState4[0],
35
- setDefaultOption = _useState4[1];
36
29
  // 是否校验
37
- var _useState5 = useState(false),
38
- _useState6 = _slicedToArray(_useState5, 2),
39
- validate = _useState6[0],
40
- setValidate = _useState6[1];
30
+ var _useState3 = useState(false),
31
+ _useState4 = _slicedToArray(_useState3, 2),
32
+ validate = _useState4[0],
33
+ setValidate = _useState4[1];
41
34
  // 按钮组
42
- var _useState7 = useState([]),
43
- _useState8 = _slicedToArray(_useState7, 2),
44
- btnList = _useState8[0],
45
- setBtnList = _useState8[1];
35
+ var _useState5 = useState([]),
36
+ _useState6 = _slicedToArray(_useState5, 2),
37
+ btnList = _useState6[0],
38
+ setBtnList = _useState6[1];
46
39
  useEffect(function () {
47
- getPageEsData('', setDefaultOption, currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId, currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform);
48
40
  setBtnList(function () {
49
41
  var btnGroup = [/*#__PURE__*/React.createElement(Button, {
50
42
  key: "cancel",
@@ -70,16 +62,21 @@ var GroupModal = function GroupModal(props) {
70
62
  });
71
63
  }, []);
72
64
  var onDelete = function onDelete() {
65
+ var _props$value;
73
66
  setLoading(true);
74
67
  ajax(api.deletePageGroup, {
75
68
  method: 'post',
76
69
  data: {
77
70
  appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
78
- platform: (currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform) || 0,
79
- id: props.value.id
71
+ platform: 3,
72
+ id: (_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id
80
73
  }
81
74
  }).then(function (res) {
82
- if (!res) return;
75
+ if (!res) {
76
+ message.error("\u5220\u9664\u5931\u8D25");
77
+ return;
78
+ }
79
+ message.success("\u5220\u9664\u6210\u529F");
83
80
  props.onOk && props.onOk();
84
81
  }).finally(function () {
85
82
  setLoading(false);
@@ -90,7 +87,7 @@ var GroupModal = function GroupModal(props) {
90
87
  (_refForm$current = refForm.current) === null || _refForm$current === void 0 ? void 0 : _refForm$current.submit();
91
88
  };
92
89
  var onSubmit = function onSubmit(data) {
93
- var _props$value;
90
+ var _props$value2;
94
91
  setValidate(true);
95
92
  var flag = true;
96
93
  data.filters.forEach(function (item) {
@@ -104,10 +101,18 @@ var GroupModal = function GroupModal(props) {
104
101
  ajax(url, {
105
102
  method: 'post',
106
103
  data: _objectSpread({
107
- id: (_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id
104
+ appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
105
+ platform: 3,
106
+ id: (_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.id
108
107
  }, data)
109
108
  }).then(function (res) {
110
- if (!res) return;
109
+ var _props$value4;
110
+ if (!res) {
111
+ var _props$value3;
112
+ message.error("".concat((_props$value3 = props.value) !== null && _props$value3 !== void 0 && _props$value3.id ? '修改' : '创建', "\u5931\u8D25"));
113
+ return;
114
+ }
115
+ message.success("".concat((_props$value4 = props.value) !== null && _props$value4 !== void 0 && _props$value4.id ? '修改' : '创建', "\u6210\u529F"));
111
116
  props.onOk && props.onOk();
112
117
  }).finally(function () {
113
118
  setLoading(false);
@@ -160,7 +165,6 @@ var GroupModal = function GroupModal(props) {
160
165
  }, " \u6DFB\u52A0\u9875\u9762"), /*#__PURE__*/React.createElement(Form.Item, {
161
166
  name: "filters"
162
167
  }, /*#__PURE__*/React.createElement(PageItem, {
163
- defaultOption: defaultOption,
164
168
  validate: validate
165
169
  }))), /*#__PURE__*/React.createElement(Button, null)));
166
170
  };
@@ -137,6 +137,23 @@
137
137
  }
138
138
  }
139
139
 
140
+ &-dropdown {
141
+ width: 300px;
142
+ &-handle {
143
+ width: 300px;
144
+ }
145
+ }
146
+ &-dropdown-panel {
147
+ .__select-panel();
148
+ }
149
+
150
+ .ant-input {
151
+ border-color: #fafafb;
152
+ &:not([disabled]):hover,
153
+ &:not([disabled]):focus {
154
+ border-color: @primary-color;
155
+ }
156
+ }
140
157
  .ant-modal-content {
141
158
  .ant-modal-body {
142
159
  padding-bottom: 0;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ declare const InputSelect: React.FC<{
3
+ value?: string;
4
+ options?: string[];
5
+ status?: '' | 'warning' | 'error';
6
+ onChange?: (data: string) => void;
7
+ onSearch?: (data: string) => void;
8
+ }>;
9
+ export default InputSelect;
@@ -0,0 +1,67 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ 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."); }
3
+ 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); }
4
+ 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; }
5
+ 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; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import { Dropdown, Input } from 'antd';
8
+ import React, { useEffect, useMemo, useState } from 'react';
9
+ import { classPrefix } from '.';
10
+ import { IconFont } from '@zgfe/business-lib';
11
+ var InputSelect = function InputSelect(props) {
12
+ var _useState = useState(props.value),
13
+ _useState2 = _slicedToArray(_useState, 2),
14
+ searchValue = _useState2[0],
15
+ setSearchValue = _useState2[1];
16
+ useEffect(function () {}, []);
17
+ var options = useMemo(function () {
18
+ if (!props.options) return [];
19
+ return props.options.map(function (item) {
20
+ return {
21
+ key: item,
22
+ label: item,
23
+ title: item
24
+ };
25
+ });
26
+ }, [props.options]);
27
+ var onChange = function onChange(e) {
28
+ var val = e.target.value;
29
+ if (searchValue === val) return;
30
+ setSearchValue(val);
31
+ props.onSearch && props.onSearch(val);
32
+ };
33
+ var onClick = function onClick(data) {
34
+ setSearchValue(data.key);
35
+ props.onChange && props.onChange(data.key);
36
+ };
37
+ return /*#__PURE__*/React.createElement(Dropdown, {
38
+ overlayClassName: "".concat(classPrefix, "-dropdown"),
39
+ trigger: ['click'],
40
+ menu: {
41
+ items: options,
42
+ selectedKeys: props.value ? [props.value] : undefined,
43
+ onClick: onClick
44
+ },
45
+ dropdownRender: function dropdownRender(menus) {
46
+ var _props$options;
47
+ if ((_props$options = props.options) !== null && _props$options !== void 0 && _props$options.length) {
48
+ return menus;
49
+ }
50
+ return /*#__PURE__*/React.createElement("div", {
51
+ className: "".concat(classPrefix, "-dropdown-panel")
52
+ }, "\u6682\u65E0\u6570\u636E");
53
+ }
54
+ }, /*#__PURE__*/React.createElement(Input, {
55
+ className: "".concat(classPrefix, "-dropdown-handle"),
56
+ value: searchValue,
57
+ allowClear: true,
58
+ title: searchValue,
59
+ status: props.status,
60
+ onChange: onChange,
61
+ suffix: /*#__PURE__*/React.createElement(IconFont, {
62
+ className: "".concat(classPrefix, "-item-down-icon"),
63
+ type: "xiangxia"
64
+ })
65
+ }));
66
+ };
67
+ export default InputSelect;
@@ -21,6 +21,7 @@ import "./index.less";
21
21
  import { Input, Select } from 'antd';
22
22
  import _ from 'lodash';
23
23
  import { getPageEsData } from "./utils";
24
+ import InputSelect from "./inputSelect";
24
25
  var PageItem = function PageItem(props) {
25
26
  var prefix = "".concat(classPrefix, "-item");
26
27
  var operatorStore = [{
@@ -42,20 +43,19 @@ var PageItem = function PageItem(props) {
42
43
  _useState2 = _slicedToArray(_useState, 2),
43
44
  pageList = _useState2[0],
44
45
  setPageList = _useState2[1];
45
- // 文本框中输入关键词搜索
46
- var _useState3 = useState(''),
46
+ var _useState3 = useState(0),
47
47
  _useState4 = _slicedToArray(_useState3, 2),
48
- searchValue = _useState4[0],
49
- setSearchValue = _useState4[1];
50
- var _useState5 = useState(0),
51
- _useState6 = _slicedToArray(_useState5, 2),
52
- timer = _useState6[0],
53
- setTimer = _useState6[1];
48
+ timer = _useState4[0],
49
+ setTimer = _useState4[1];
54
50
  // param options
55
- var _useState7 = useState(props.defaultOption || []),
51
+ var _useState5 = useState([]),
52
+ _useState6 = _slicedToArray(_useState5, 2),
53
+ paramOption = _useState6[0],
54
+ setParamOption = _useState6[1];
55
+ var _useState7 = useState([]),
56
56
  _useState8 = _slicedToArray(_useState7, 2),
57
- paramOption = _useState8[0],
58
- setParamOption = _useState8[1];
57
+ defaultOption = _useState8[0],
58
+ setDefaultOption = _useState8[1];
59
59
  var _useContext = useContext(BizGlobalDataContext),
60
60
  currentApp = _useContext.currentApp;
61
61
  useEffect(function () {
@@ -66,7 +66,11 @@ var PageItem = function PageItem(props) {
66
66
  }, item);
67
67
  });
68
68
  });
69
+ getPageEsData('', setDefaultOption, currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId, currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform);
69
70
  }, []);
71
+ useEffect(function () {
72
+ setParamOption(new Array((props.value || [newItem]).length).fill(defaultOption));
73
+ }, [defaultOption]);
70
74
  useEffect(function () {
71
75
  props.onChange && props.onChange(pageList.map(function (item) {
72
76
  var data = _.cloneDeep(item);
@@ -80,6 +84,9 @@ var PageItem = function PageItem(props) {
80
84
  id: util.guid()
81
85
  }, newItem)]);
82
86
  });
87
+ setParamOption(function (options) {
88
+ return [].concat(_toConsumableArray(options), [defaultOption]);
89
+ });
83
90
  };
84
91
  var onDelete = function onDelete(index) {
85
92
  if (pageList.length <= 1) return;
@@ -88,6 +95,11 @@ var PageItem = function PageItem(props) {
88
95
  data.splice(index, 1);
89
96
  return data;
90
97
  });
98
+ setParamOption(function (options) {
99
+ var data = _.cloneDeep(options);
100
+ data.splice(index, 1);
101
+ return data;
102
+ });
91
103
  };
92
104
  // 改变关系
93
105
  var onChangeOperator = function onChangeOperator(operator, index) {
@@ -97,44 +109,34 @@ var PageItem = function PageItem(props) {
97
109
  return data;
98
110
  });
99
111
  };
100
- // 键盘enter确定时的方法
101
- var handleValue = function handleValue(e, index) {
102
- //当点击回车键或失去焦点后执行,并且verify为true,保证只有页面和埋点这里需要使用此处逻辑
103
- if (e.key === 'Enter') {
104
- e.stopPropagation();
105
- setPageList(function (list) {
106
- var data = _.cloneDeep(list);
107
- data[index].param = searchValue;
108
- return data;
109
- });
110
- }
111
- };
112
- // 失焦
113
- var _onBlur = function onBlur(e, index) {
114
- e.stopPropagation();
115
- setPageList(function (list) {
116
- var data = _.cloneDeep(list);
117
- data[index].param = searchValue;
118
- return data;
119
- });
120
- };
112
+
121
113
  // 搜索
122
- var onSearch = function onSearch(newValue) {
123
- newValue && setSearchValue(newValue);
114
+ var _onSearch = function onSearch(newValue, index) {
124
115
  if (timer) {
125
116
  clearTimeout(timer);
126
117
  }
127
- if (!newValue) {
128
- setParamOption(_toConsumableArray(props.defaultOption));
129
- return;
130
- }
118
+ var handle = function handle(optionData) {
119
+ setParamOption(function (options) {
120
+ var data = _.cloneDeep(options);
121
+ data[index] = optionData;
122
+ return data;
123
+ });
124
+ };
131
125
  setTimer(setTimeout(function () {
132
- getPageEsData(newValue, setParamOption, currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId, currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform);
126
+ if (!newValue) {
127
+ handle(defaultOption);
128
+ } else {
129
+ getPageEsData(newValue, handle, currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId, currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform);
130
+ }
131
+ setPageList(function (list) {
132
+ var data = _.cloneDeep(list);
133
+ data[index].param = newValue;
134
+ return data;
135
+ });
133
136
  }, 300));
134
137
  };
135
138
  // 改变值
136
139
  var onChangeParam = function onChangeParam(param, index) {
137
- setSearchValue(param);
138
140
  setPageList(function (list) {
139
141
  var data = _.cloneDeep(list);
140
142
  data[index].param = param;
@@ -175,26 +177,16 @@ var PageItem = function PageItem(props) {
175
177
  onChange: function onChange(e) {
176
178
  return onChangeParam(e.target.value, index);
177
179
  }
178
- }) : /*#__PURE__*/React.createElement(Select, {
179
- className: "".concat(prefix, "-content-item-param"),
180
- options: paramOption,
180
+ }) : /*#__PURE__*/React.createElement(InputSelect, {
181
181
  value: item.param,
182
- suffixIcon: /*#__PURE__*/React.createElement(IconFont, {
183
- className: "".concat(prefix, "-down-icon"),
184
- type: "xiangxia"
185
- }),
182
+ options: paramOption ? paramOption[index] : [],
186
183
  status: !item.param && props.validate ? 'error' : '',
187
- showSearch: true,
188
- onBlur: function onBlur(e) {
189
- return _onBlur(e, index);
190
- },
191
- onInputKeyDown: function onInputKeyDown(e) {
192
- return handleValue(e, index);
184
+ onSearch: function onSearch(val) {
185
+ return _onSearch(val, index);
193
186
  },
194
187
  onChange: function onChange(data) {
195
188
  return onChangeParam(data, index);
196
- },
197
- onSearch: onSearch
189
+ }
198
190
  }), !item.param && props.validate ? /*#__PURE__*/React.createElement("div", {
199
191
  className: "".concat(prefix, "-tip")
200
192
  }, "\u6761\u4EF6\u4E0D\u80FD\u4E3A\u7A7A") : null), /*#__PURE__*/React.createElement(IconFont, {
@@ -211,7 +203,4 @@ var PageItem = function PageItem(props) {
211
203
  type: "tianjia1"
212
204
  }), /*#__PURE__*/React.createElement("span", null, "\u6DFB\u52A0\u9875\u9762")) : null);
213
205
  };
214
- PageItem.defaultProps = {
215
- defaultOption: []
216
- };
217
206
  export default PageItem;
@@ -1,12 +1,12 @@
1
- import { SelectProps } from 'antd';
2
1
  import { ModulesPageTypes } from '../../modules/home/types';
3
2
  export declare namespace GroupModalType {
4
3
  interface Props {
5
4
  value?: ModulesPageTypes.PageGroup;
5
+ onOk?: () => void;
6
+ onCancel?: () => void;
6
7
  }
7
8
  interface ItemProps {
8
9
  value?: ModulesPageTypes.ItemValue[];
9
- defaultOption?: SelectProps['options'];
10
10
  validate?: boolean;
11
11
  onChange?: (data: ModulesPageTypes.ItemValue[]) => void;
12
12
  }
@@ -6,18 +6,12 @@ export var getPageEsData = function getPageEsData(searchValue, callback, appId,
6
6
  data: {
7
7
  appId: appId,
8
8
  platform: platform || 0,
9
- limit: 10000,
9
+ dimensionSub: 'current_url',
10
10
  attr: 0,
11
11
  v: searchValue
12
12
  }
13
13
  }).then(function (res) {
14
14
  if (!res || !res.data) return;
15
- var list = res.data.sources;
16
- callback(list.map(function (item) {
17
- return {
18
- name: item,
19
- value: item
20
- };
21
- }));
15
+ callback(res.data.sources);
22
16
  });
23
17
  };
@@ -15,6 +15,7 @@ import { pageTypes } from "../../constants";
15
15
  import React, { useContext, useEffect, useState } from 'react';
16
16
  import "./index.less";
17
17
  import { ModulesPageContext } from "../../modules/home/types";
18
+ import { Tooltip } from 'antd';
18
19
  var PageSelect = function PageSelect(props) {
19
20
  // 根据类型展示的列表
20
21
  var _useState = useState([]),
@@ -37,7 +38,27 @@ var PageSelect = function PageSelect(props) {
37
38
  pageGroupList = _useContext.pageGroupList,
38
39
  currentClickPage = _useContext.currentClickPage;
39
40
  useEffect(function () {
40
- console.log('currentClickPage;', currentClickPage);
41
+ var _props$value, _props$value2;
42
+ if (!props.value) return;
43
+ var type = (_props$value = props.value) !== null && _props$value !== void 0 && _props$value.pageGroup || ((_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.pageGroup) === 0 ? 1 : 0;
44
+ setCurrentType(pageTypes[type]);
45
+ setCurrentValue(function () {
46
+ if (type === 1) {
47
+ var data = props.value;
48
+ return {
49
+ id: "".concat(data.pageTitle ? data.pageTitle + '-' : '').concat(data.pageUrl),
50
+ pageTitle: data.pageTitle,
51
+ pageUrl: data.pageUrl
52
+ };
53
+ }
54
+ return pageGroupList.filter(function (item) {
55
+ var _props$value3;
56
+ return item.id === ((_props$value3 = props.value) === null || _props$value3 === void 0 ? void 0 : _props$value3.pageGroup);
57
+ })[0];
58
+ });
59
+ }, []);
60
+ useEffect(function () {
61
+ if (!currentClickPage) return;
41
62
  setCurrentValue(function () {
42
63
  if (currentClickPage && currentClickPage.pageUrl) {
43
64
  var _ref = currentClickPage,
@@ -97,10 +118,12 @@ var PageSelect = function PageSelect(props) {
97
118
  enableSearch: options.length > 5,
98
119
  onChange: setCurrentValue,
99
120
  customLabel: getCustomLabel
100
- }), /*#__PURE__*/React.createElement(IconFont, {
121
+ }), /*#__PURE__*/React.createElement(Tooltip, {
122
+ title: "\u6DFB\u52A0\u5C5E\u6027\u7B5B\u9009"
123
+ }, /*#__PURE__*/React.createElement(IconFont, {
101
124
  className: "".concat(classPrefix, "-panel-icon").concat(!props.enableAdd ? ' disabled' : ''),
102
125
  type: "shaixuan",
103
126
  onClick: props.onAdd
104
- })));
127
+ }))));
105
128
  };
106
129
  export default PageSelect;
@@ -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;
@@ -12,7 +12,7 @@ import { BizAttrConditionGroup, BizGlobalDataContext, BizUserGroup, IconFont } f
12
12
  import PageSelect from "../pageSelect";
13
13
  import { formValue, formatValue } from "./util";
14
14
  var SearchPanel = function SearchPanel(props) {
15
- var classPrefix = 'search-panel';
15
+ var classPrefix = 'page-search-panel';
16
16
  // form 值
17
17
  var _Form$useForm = Form.useForm(),
18
18
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
@@ -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
  }
@@ -1,6 +1,6 @@
1
1
  @import '~@zgfe/business-lib/es/assets/styles/inner.less';
2
2
 
3
- .search-panel {
3
+ .page-search-panel {
4
4
  &-title.ant-form-item {
5
5
  margin-bottom: 12px;
6
6
  padding-left: 24px;
@@ -21,7 +21,7 @@
21
21
  &:hover {
22
22
  background: #e8efff;
23
23
  }
24
- .search-panel-item.ant-form-item {
24
+ .page-search-panel-item.ant-form-item {
25
25
  margin-bottom: 0;
26
26
  padding: 4px 0;
27
27
  }
@@ -39,7 +39,7 @@
39
39
  }
40
40
  }
41
41
 
42
- &-item3:not(.search-panel-hidden) {
42
+ &-item3:not(.page-search-panel-hidden) {
43
43
  margin-bottom: 20px;
44
44
  padding: 4px 24px;
45
45
  &:hover {
@@ -49,8 +49,6 @@
49
49
 
50
50
  &-item2 {
51
51
  margin-bottom: 4px;
52
- .page-select-panel {
53
- }
54
52
  }
55
53
 
56
54
  &-hidden.ant-form-item {
@@ -2,17 +2,9 @@ import { BizSelectTypes } from '@zgfe/business-lib';
2
2
  import { FormValue, SearchValue } from './types';
3
3
  export declare const formValue: (source?: SearchValue, userGroupList?: BizSelectTypes.Option[]) => FormValue;
4
4
  export declare const formatValue: (source: FormValue) => {
5
- filters: import("@zgfe/business-lib").AttrConditionTypes.GroupValue | undefined;
6
- userGroup: number[];
7
- } | {
8
- filters: import("@zgfe/business-lib").AttrConditionTypes.GroupValue | undefined;
9
- type?: string | undefined;
10
- pageUrl?: string | undefined;
11
- pageTitle?: string | undefined;
12
5
  userGroup: number[];
13
- } | {
6
+ pageTitle: string | undefined;
7
+ pageUrl: string | undefined;
8
+ pageGroup: number | undefined;
14
9
  filters: import("@zgfe/business-lib").AttrConditionTypes.GroupValue | undefined;
15
- type?: string | undefined;
16
- pageGroup?: number | undefined;
17
- userGroup: number[];
18
10
  };
@@ -1,9 +1,3 @@
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
1
  import _ from 'lodash';
8
2
  export var formValue = function formValue(source, userGroupList) {
9
3
  var data = _.cloneDeep(source) || {};
@@ -35,7 +29,7 @@ export var formValue = function formValue(source, userGroupList) {
35
29
  };
36
30
  };
37
31
  export var formatValue = function formatValue(source) {
38
- var _data$userGroup2;
32
+ var _data$userGroup2, _data$page, _data$page2, _data$page3;
39
33
  var data = _.cloneDeep(source) || {};
40
34
  var group = [];
41
35
  (_data$userGroup2 = data.userGroup) === null || _data$userGroup2 === void 0 ? void 0 : _data$userGroup2.forEach(function (item) {
@@ -43,9 +37,11 @@ export var formatValue = function formatValue(source) {
43
37
  group.push(item.id);
44
38
  }
45
39
  });
46
- return _objectSpread(_objectSpread({
47
- userGroup: group
48
- }, data.page), {}, {
40
+ return {
41
+ userGroup: group,
42
+ pageTitle: (_data$page = data.page) === null || _data$page === void 0 ? void 0 : _data$page.pageTitle,
43
+ pageUrl: (_data$page2 = data.page) === null || _data$page2 === void 0 ? void 0 : _data$page2.pageUrl,
44
+ pageGroup: (_data$page3 = data.page) === null || _data$page3 === void 0 ? void 0 : _data$page3.pageGroup,
49
45
  filters: data.filters
50
- });
46
+ };
51
47
  };
@@ -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
+ };
@@ -4,7 +4,7 @@ import { DemoWrapper } from '@zgfe/business-lib';
4
4
  export default (function () {
5
5
  return /*#__PURE__*/React.createElement(DemoWrapper, {
6
6
  needMeta: true,
7
- defaultApp: 269
7
+ defaultApp: 266
8
8
  }, /*#__PURE__*/React.createElement("div", {
9
9
  style: {
10
10
  height: 750,
@@ -58,25 +58,29 @@ var ModulesPage = function ModulesPage(props) {
58
58
  _useState14 = _slicedToArray(_useState13, 2),
59
59
  loading = _useState14[0],
60
60
  setLoading = _useState14[1];
61
- // 要编辑的分组
62
- var _useState15 = useState(),
61
+ var _useState15 = useState(true),
63
62
  _useState16 = _slicedToArray(_useState15, 2),
64
- editGroup = _useState16[0],
65
- setEditGroup = _useState16[1];
66
- // 当前页面类型 list/detail
67
- var _useState17 = useState('list'),
63
+ pageLoading = _useState16[0],
64
+ setPageLoading = _useState16[1];
65
+ // 要编辑的分组
66
+ var _useState17 = useState(),
68
67
  _useState18 = _slicedToArray(_useState17, 2),
69
- pageType = _useState18[0],
70
- setPageType = _useState18[1];
71
- var _useState19 = useState(0),
68
+ editGroup = _useState18[0],
69
+ setEditGroup = _useState18[1];
70
+ // 当前页面类型 list/detail
71
+ var _useState19 = useState('list'),
72
72
  _useState20 = _slicedToArray(_useState19, 2),
73
- timer = _useState20[0],
74
- setTimer = _useState20[1];
75
- //当前点击内容(用于同步查询条件中的内容)
76
- var _useState21 = useState(),
73
+ pageType = _useState20[0],
74
+ setPageType = _useState20[1];
75
+ var _useState21 = useState(0),
77
76
  _useState22 = _slicedToArray(_useState21, 2),
78
- currentClickPage = _useState22[0],
79
- setCurrentClickPage = _useState22[1];
77
+ timer = _useState22[0],
78
+ setTimer = _useState22[1];
79
+ //当前点击内容(用于同步查询条件中的内容)
80
+ var _useState23 = useState(),
81
+ _useState24 = _slicedToArray(_useState23, 2),
82
+ currentClickPage = _useState24[0],
83
+ setCurrentClickPage = _useState24[1];
80
84
  var _useContext = useContext(BizGlobalDataContext),
81
85
  eventGroupList = _useContext.eventGroupList,
82
86
  currentApp = _useContext.currentApp;
@@ -95,10 +99,10 @@ var ModulesPage = function ModulesPage(props) {
95
99
  useEffect(function () {
96
100
  var param = {
97
101
  appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
98
- platform: (currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform) || 0
102
+ platform: 3
99
103
  };
100
- getPageGroupList(param, setPageGroupList);
101
104
  getPageList(param, setPageList);
105
+ getPageGroupList(param, setPageGroupList, setPageLoading);
102
106
  }, []);
103
107
  useEffect(function () {
104
108
  if (!showGroup) {
@@ -109,12 +113,13 @@ var ModulesPage = function ModulesPage(props) {
109
113
  if (isEmpty) return;
110
114
  if (!searchValue) return;
111
115
  console.log('searchValue:', searchValue);
112
- var type = (searchValue === null || searchValue === void 0 ? void 0 : searchValue.type) || (searchValue !== null && searchValue !== void 0 && searchValue.pageGroup ? 'pageGroup' : 'page');
116
+ var type = searchValue !== null && searchValue !== void 0 && searchValue.pageGroup || (searchValue === null || searchValue === void 0 ? void 0 : searchValue.pageGroup) === 0 ? 'pageGroup' : 'page';
113
117
  setCurrentType(type);
114
118
  // 选择概览时,跳到列表页
115
119
  if (type === 'page' && !(searchValue !== null && searchValue !== void 0 && searchValue.pageUrl) || type === 'pageGroup' && !(searchValue !== null && searchValue !== void 0 && searchValue.pageGroup)) {
116
120
  setPageType('list');
117
121
  }
122
+ if (type === 'pageGroup' && !(searchValue !== null && searchValue !== void 0 && searchValue.pageGroup)) return;
118
123
  if (type === 'page' || pageType === 'detail') {
119
124
  fetch();
120
125
  }
@@ -128,7 +133,8 @@ var ModulesPage = function ModulesPage(props) {
128
133
  setTimer(setTimeout(function () {
129
134
  var param = _objectSpread({
130
135
  appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
131
- platform: (currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform) || 0
136
+ platform: 3,
137
+ modules: 'page'
132
138
  }, searchValue);
133
139
  getPageResult(param, setResult, setLoading);
134
140
  }, 500));
@@ -150,11 +156,12 @@ var ModulesPage = function ModulesPage(props) {
150
156
  };
151
157
  // 分组弹窗编辑回调,更新分组列表
152
158
  var onOk = function onOk() {
159
+ setShowGroup(false);
153
160
  var param = {
154
161
  appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
155
- platform: (currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform) || 0
162
+ platform: 3
156
163
  };
157
- getPageGroupList(param, setPageGroupList);
164
+ getPageGroupList(param, setPageGroupList, setPageLoading);
158
165
  };
159
166
 
160
167
  // 点击表格中页面
@@ -191,7 +198,9 @@ var ModulesPage = function ModulesPage(props) {
191
198
  onChange: onChange
192
199
  }),
193
200
  topRender: props.onClickWarn ? render : null
194
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(TopContent, {
201
+ }, /*#__PURE__*/React.createElement(Spin, {
202
+ spinning: pageLoading
203
+ }, /*#__PURE__*/React.createElement(TopContent, {
195
204
  value: searchValue === null || searchValue === void 0 ? void 0 : searchValue.time,
196
205
  type: currentType,
197
206
  disabled: !result.length,
@@ -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) => 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, {
@@ -36,7 +38,8 @@ export var getPageList = function getPageList(data, callback) {
36
38
  };
37
39
 
38
40
  // 获取页面分组列表
39
- export var getPageGroupList = function getPageGroupList(data, callback) {
41
+ export var getPageGroupList = function getPageGroupList(data, callback, loadingCallback) {
42
+ loadingCallback && loadingCallback(true);
40
43
  ajax(api.getPageGroup, {
41
44
  method: 'post',
42
45
  data: data
@@ -54,6 +57,8 @@ export var getPageGroupList = function getPageGroupList(data, callback) {
54
57
  name: '全部页面组'
55
58
  });
56
59
  callback(list);
60
+ }).finally(function () {
61
+ loadingCallback && loadingCallback(false);
57
62
  });
58
63
  };
59
64
 
@@ -80,14 +85,20 @@ export var getSocketSecret = function getSocketSecret() {
80
85
  };
81
86
  export var onDownload = function onDownload(params, currentApp) {
82
87
  if (!params || !currentApp) return;
88
+ var title = params.pageTitle || '页面列表';
83
89
  ajax(api.download, {
84
90
  method: 'post',
85
- data: _objectSpread({
91
+ data: _objectSpread(_objectSpread({
86
92
  appId: currentApp.appId,
87
- platform: currentApp.platform
88
- }, params),
93
+ platform: 3
94
+ }, params), {}, {
95
+ down: {
96
+ fname: base64.encode(title),
97
+ titles: []
98
+ }
99
+ }),
89
100
  responseType: 'blob',
90
- fileName: '页面列表',
101
+ fileName: title,
91
102
  getResponse: true
92
103
  }).then(function () {});
93
104
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/modules-page",
3
- "version": "1.0.1-alpha.1",
3
+ "version": "1.0.1-alpha.10",
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": "83eb5d8859328ab65d78573352b4bcd5a23d1d31"
53
+ "gitHead": "fdd9e45dec51d4d415d507454d257171fa2b1a5c"
54
54
  }
@@ -1,5 +0,0 @@
1
- declare const _default: {
2
- label: string;
3
- value: string;
4
- }[];
5
- export default _default;
@@ -1,16 +0,0 @@
1
- export default [{
2
- label: 'file:///C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%207.0/webapps/test/test.html',
3
- value: 'file:///C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%207.0/webapps/test/test.html'
4
- }, {
5
- label: 'file:///C:/Users/54451/Desktop/sign/signin.html',
6
- value: 'file:///C:/Users/54451/Desktop/sign/signin.html'
7
- }, {
8
- label: 'http://localhost:8080/sign/signup.html',
9
- value: 'http://localhost:8080/sign/signup.html'
10
- }, {
11
- label: 'http://www.yayibang.com/html/web/article/index.html',
12
- value: 'http://www.yayibang.com/html/web/article/index.html'
13
- }, {
14
- label: 'http://localhost:8080/#/login',
15
- value: 'http://localhost:8080/#/login'
16
- }];