@zgfe/modules-page 1.0.1-alpha.2 → 1.0.1-alpha.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.
- package/dist/esm/components/content/index.d.ts +1 -1
- package/dist/esm/components/content/index.js +5 -1
- package/dist/esm/components/content/types.d.ts +1 -0
- package/dist/esm/components/content/utils.d.ts +4 -15
- package/dist/esm/components/content/utils.js +10 -11
- package/dist/esm/components/detail/images/percent.png +0 -0
- package/dist/esm/components/detail/index.js +37 -57
- package/dist/esm/components/detail/index.less +9 -2
- package/dist/esm/components/groupModal/index.d.ts +2 -6
- package/dist/esm/components/groupModal/index.js +36 -29
- package/dist/esm/components/groupModal/index.less +36 -1
- package/dist/esm/components/groupModal/inputSelect.d.ts +9 -0
- package/dist/esm/components/groupModal/inputSelect.js +68 -0
- package/dist/esm/components/groupModal/pageItem.js +47 -58
- package/dist/esm/components/groupModal/types.d.ts +2 -2
- package/dist/esm/components/groupModal/utils.js +2 -8
- package/dist/esm/components/pageSelect/index.js +48 -37
- package/dist/esm/components/pageSelect/types.d.ts +0 -2
- package/dist/esm/components/searchPanel/index.d.ts +1 -1
- package/dist/esm/components/searchPanel/index.js +11 -10
- package/dist/esm/components/searchPanel/index.less +3 -3
- package/dist/esm/components/searchPanel/types.d.ts +3 -3
- package/dist/esm/components/searchPanel/util.d.ts +4 -4
- package/dist/esm/components/searchPanel/util.js +33 -29
- package/dist/esm/components/topContent/index.less +1 -0
- package/dist/esm/constants/api.js +1 -1
- package/dist/esm/modules/empty/index.js +3 -1
- package/dist/esm/modules/empty/index.less +7 -5
- package/dist/esm/modules/home/demo/index.js +25 -2
- package/dist/esm/modules/home/index.js +96 -50
- package/dist/esm/modules/home/style/index.less +10 -0
- package/dist/esm/modules/home/types.d.ts +9 -1
- package/dist/esm/modules/home/utils.d.ts +3 -3
- package/dist/esm/modules/home/utils.js +25 -10
- package/package.json +4 -3
- package/dist/esm/components/detail/images/color_pallete_percent.png +0 -0
- package/dist/esm/components/groupModal/mock.d.ts +0 -5
- 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:
|
|
10
|
+
onClick?: (data: ModulesPageTypes.PageGroup | ModulesPageTypes.Page) => void;
|
|
11
11
|
onEdit?: (data: ModulesPageTypes.PageGroup) => void;
|
|
12
12
|
onCreate?: () => void;
|
|
13
13
|
}>;
|
|
@@ -21,6 +21,9 @@ var PageContent = function PageContent(props) {
|
|
|
21
21
|
}
|
|
22
22
|
return data;
|
|
23
23
|
}, [pageGroupList, props.groupId]);
|
|
24
|
+
var columns = useMemo(function () {
|
|
25
|
+
return getColumns(props.type, props.hasUserGroup, props.onClick, props.onEdit);
|
|
26
|
+
}, [props.type, props.hasUserGroup]);
|
|
24
27
|
if (props.type === 'pageGroup' && !groupList.length) {
|
|
25
28
|
return /*#__PURE__*/React.createElement("div", {
|
|
26
29
|
className: "".concat(classPrefix, "-empty")
|
|
@@ -43,8 +46,9 @@ var PageContent = function PageContent(props) {
|
|
|
43
46
|
return /*#__PURE__*/React.createElement("div", {
|
|
44
47
|
className: classPrefix
|
|
45
48
|
}, /*#__PURE__*/React.createElement(BizTable, {
|
|
49
|
+
rowKey: "id",
|
|
46
50
|
dataSource: props.type === 'pageGroup' ? groupList : props.value,
|
|
47
|
-
columns:
|
|
51
|
+
columns: columns
|
|
48
52
|
}));
|
|
49
53
|
};
|
|
50
54
|
export default PageContent;
|
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
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(
|
|
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
|
-
|
|
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
|
-
},
|
|
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
|
};
|
|
Binary file
|
|
@@ -10,48 +10,37 @@ 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';
|
|
17
17
|
import { getNumPer, toThousands } from "../content/utils";
|
|
18
|
-
import percentImg from "./images/
|
|
18
|
+
import percentImg from "./images/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
|
|
44
|
-
|
|
45
|
-
client =
|
|
46
|
-
setClient =
|
|
31
|
+
var _useState = useState(),
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
client = _useState2[0],
|
|
34
|
+
setClient = _useState2[1];
|
|
47
35
|
// 当前url
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
pageUrl =
|
|
51
|
-
setPageUrl =
|
|
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
|
|
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
|
-
|
|
92
|
-
platform:
|
|
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
|
-
|
|
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
|
-
|
|
135
|
-
platform:
|
|
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,17 +149,18 @@ 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;
|
|
177
156
|
return /*#__PURE__*/React.createElement("div", {
|
|
178
157
|
className: "".concat(classPrefix, "-top-item"),
|
|
179
158
|
key: index
|
|
180
|
-
}, (_props$params2 = props.params) !== null && _props$params2 !== void 0 && _props$params2.userGroup && ((_props$params$userGro = props.params.userGroup) === null || _props$params$userGro === void 0 ? void 0 : _props$params$userGro.length) > 1 ? /*#__PURE__*/React.createElement("
|
|
159
|
+
}, (_props$params2 = props.params) !== null && _props$params2 !== void 0 && _props$params2.userGroup && ((_props$params$userGro = props.params.userGroup) === null || _props$params$userGro === void 0 ? void 0 : _props$params$userGro.length) > 1 ? /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, "\u7528\u6237\u7FA4\uFF1A"), /*#__PURE__*/React.createElement("span", null, item.userGroup)) : null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, "\u6D4F\u89C8\uFF1A"), /*#__PURE__*/React.createElement("span", null, toThousands(item.viewTimes), "\u6B21"), /*#__PURE__*/React.createElement("span", null, toThousands(item.viewUser), "\u4EBA")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, "\u9875\u9762\u5185\u70B9\u51FB\uFF1A"), /*#__PURE__*/React.createElement("span", null, toThousands(item.clickTimes), "\u6B21"), /*#__PURE__*/React.createElement("span", null, toThousands(item.clickUser), "\u4EBA")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, "\u70B9\u51FB\u4EBA\u6570\u5360\u6BD4\uFF1A"), /*#__PURE__*/React.createElement("span", null, getNumPer(item.viewUser, item.clickUser)), /*#__PURE__*/React.createElement(Tooltip, {
|
|
181
160
|
title: "\u70B9\u51FB\u4EBA\u6570\u5360\u6BD4\uFF1D\u9875\u9762\u5185\u70B9\u51FB\u4EBA\u6570\uFF0F\u9875\u9762\u6D4F\u89C8\u4EBA\u6570"
|
|
182
161
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
183
|
-
type: "tishi"
|
|
162
|
+
type: "tishi",
|
|
163
|
+
className: "".concat(classPrefix, "-tip")
|
|
184
164
|
}))));
|
|
185
165
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
186
166
|
className: "".concat(classPrefix, "-content")
|
|
@@ -193,7 +173,7 @@ var DetailContent = function DetailContent(props) {
|
|
|
193
173
|
}, /*#__PURE__*/React.createElement("img", {
|
|
194
174
|
src: renderImg
|
|
195
175
|
}), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("a", {
|
|
196
|
-
href:
|
|
176
|
+
href: openUrl,
|
|
197
177
|
target: "_blank"
|
|
198
178
|
}, "\u6253\u5F00\u65B0\u6807\u7B7E\u9875", /*#__PURE__*/React.createElement(IconFont, {
|
|
199
179
|
type: "zhuanfa"
|
|
@@ -5,12 +5,16 @@
|
|
|
5
5
|
border: 1px solid #ecedf0;
|
|
6
6
|
border-radius: 8px;
|
|
7
7
|
|
|
8
|
+
&-tip:hover {
|
|
9
|
+
color: @primary-color;
|
|
10
|
+
}
|
|
8
11
|
&-top {
|
|
9
12
|
display: flex;
|
|
10
13
|
align-items: flex-start;
|
|
11
14
|
justify-content: space-between;
|
|
12
15
|
padding: 16px;
|
|
13
16
|
background: #fafafb;
|
|
17
|
+
border-radius: 8px 8px 0 0;
|
|
14
18
|
&-title {
|
|
15
19
|
display: flex;
|
|
16
20
|
flex: 1;
|
|
@@ -18,7 +22,7 @@
|
|
|
18
22
|
}
|
|
19
23
|
&-value {
|
|
20
24
|
display: inline-block;
|
|
21
|
-
width: calc(100% - 100px);
|
|
25
|
+
max-width: calc(100% - 100px);
|
|
22
26
|
.__default-overflow();
|
|
23
27
|
}
|
|
24
28
|
&-label {
|
|
@@ -36,6 +40,7 @@
|
|
|
36
40
|
&-item {
|
|
37
41
|
display: flex;
|
|
38
42
|
gap: 40px;
|
|
43
|
+
align-items: center;
|
|
39
44
|
color: #67727f;
|
|
40
45
|
.bsicon {
|
|
41
46
|
margin-left: 8px;
|
|
@@ -52,8 +57,10 @@
|
|
|
52
57
|
min-height: 422px;
|
|
53
58
|
padding: 16px;
|
|
54
59
|
&-img {
|
|
55
|
-
height: 22px;
|
|
56
60
|
text-align: right;
|
|
61
|
+
img {
|
|
62
|
+
height: 22px;
|
|
63
|
+
}
|
|
57
64
|
}
|
|
58
65
|
&-panel {
|
|
59
66
|
display: flex;
|
|
@@ -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
|
|
38
|
-
|
|
39
|
-
validate =
|
|
40
|
-
setValidate =
|
|
30
|
+
var _useState3 = useState(false),
|
|
31
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
32
|
+
validate = _useState4[0],
|
|
33
|
+
setValidate = _useState4[1];
|
|
41
34
|
// 按钮组
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
btnList =
|
|
45
|
-
setBtnList =
|
|
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:
|
|
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)
|
|
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$
|
|
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
|
-
|
|
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
|
-
|
|
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);
|
|
@@ -115,6 +120,7 @@ var GroupModal = function GroupModal(props) {
|
|
|
115
120
|
};
|
|
116
121
|
return /*#__PURE__*/React.createElement(BizDialog, {
|
|
117
122
|
open: true,
|
|
123
|
+
closable: true,
|
|
118
124
|
className: classPrefix,
|
|
119
125
|
width: 720,
|
|
120
126
|
title: props.value ? '修改分组' : '创建分组',
|
|
@@ -122,7 +128,8 @@ var GroupModal = function GroupModal(props) {
|
|
|
122
128
|
okButtonProps: {
|
|
123
129
|
disabled: isDemo
|
|
124
130
|
},
|
|
125
|
-
footer: btnList
|
|
131
|
+
footer: btnList,
|
|
132
|
+
onCancel: props.onCancel
|
|
126
133
|
}, /*#__PURE__*/React.createElement(Spin, {
|
|
127
134
|
spinning: loading
|
|
128
135
|
}, /*#__PURE__*/React.createElement(Form, {
|
|
@@ -146,7 +153,7 @@ var GroupModal = function GroupModal(props) {
|
|
|
146
153
|
name: "initPage",
|
|
147
154
|
rules: [{
|
|
148
155
|
validator: function validator(_, value) {
|
|
149
|
-
var reg = /^(
|
|
156
|
+
var reg = /^((http:\/\/)|(https:\/\/)|(\/\/))[A-Za-z0-9]/;
|
|
150
157
|
if (!value || !/\S+/.test(value)) return Promise.reject("\u8BF7\u8F93\u5165\u80CC\u666F\u9875\u5730\u5740");
|
|
151
158
|
if (!reg.test(value)) return Promise.reject('必须是合法的网页链接');
|
|
152
159
|
return Promise.resolve();
|
|
@@ -155,13 +162,13 @@ var GroupModal = function GroupModal(props) {
|
|
|
155
162
|
}, /*#__PURE__*/React.createElement(Input, {
|
|
156
163
|
className: "".concat(classPrefix, "-form-input"),
|
|
157
164
|
placeholder: "\u8BF7\u8F93\u5165\u5728\u67E5\u770B\u70B9\u51FB\u56FE\u65F6\u7684\u80CC\u666F\u9875\u9762"
|
|
158
|
-
})), /*#__PURE__*/React.createElement(
|
|
165
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
159
166
|
className: "".concat(classPrefix, "-form-title")
|
|
160
167
|
}, " \u6DFB\u52A0\u9875\u9762"), /*#__PURE__*/React.createElement(Form.Item, {
|
|
161
|
-
name: "filters"
|
|
168
|
+
name: "filters",
|
|
169
|
+
className: "".concat(classPrefix, "-form-item-filter")
|
|
162
170
|
}, /*#__PURE__*/React.createElement(PageItem, {
|
|
163
|
-
defaultOption: defaultOption,
|
|
164
171
|
validate: validate
|
|
165
|
-
})))
|
|
172
|
+
})))));
|
|
166
173
|
};
|
|
167
174
|
export default GroupModal;
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
border-color: #fafafb;
|
|
6
6
|
}
|
|
7
7
|
&-form-title {
|
|
8
|
-
margin-bottom: 12px;
|
|
9
8
|
color: @text-color-secondary;
|
|
9
|
+
line-height: 1;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
&-item {
|
|
@@ -109,6 +109,7 @@
|
|
|
109
109
|
align-items: center;
|
|
110
110
|
width: fit-content;
|
|
111
111
|
height: 32px;
|
|
112
|
+
margin-bottom: 12px;
|
|
112
113
|
color: @primary-color;
|
|
113
114
|
cursor: pointer;
|
|
114
115
|
|
|
@@ -137,8 +138,33 @@
|
|
|
137
138
|
}
|
|
138
139
|
}
|
|
139
140
|
|
|
141
|
+
&-form-item-filter.ant-form-item {
|
|
142
|
+
margin-bottom: 12px;
|
|
143
|
+
}
|
|
144
|
+
&-dropdown {
|
|
145
|
+
width: 300px;
|
|
146
|
+
&-handle {
|
|
147
|
+
width: 300px;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
&-dropdown-panel {
|
|
151
|
+
.__select-panel();
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.ant-input {
|
|
155
|
+
border-color: #fafafb;
|
|
156
|
+
&:not([disabled]):hover,
|
|
157
|
+
&:not([disabled]):focus {
|
|
158
|
+
border-color: @primary-color;
|
|
159
|
+
}
|
|
160
|
+
&[disabled] {
|
|
161
|
+
color: #ccd0d4;
|
|
162
|
+
background: @background-color-gray;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
140
165
|
.ant-modal-content {
|
|
141
166
|
.ant-modal-body {
|
|
167
|
+
padding-top: 8px;
|
|
142
168
|
padding-bottom: 0;
|
|
143
169
|
}
|
|
144
170
|
.ant-modal-footer {
|
|
@@ -147,9 +173,18 @@
|
|
|
147
173
|
|
|
148
174
|
.group-modal-footer-del {
|
|
149
175
|
float: left;
|
|
176
|
+
background: #f2f3f4 !important;
|
|
150
177
|
.bsicon {
|
|
151
178
|
margin-right: 8px;
|
|
152
179
|
}
|
|
180
|
+
&.ant-btn-text:hover {
|
|
181
|
+
color: #fb5547 !important;
|
|
182
|
+
background: #f2f3f4 !important;
|
|
183
|
+
}
|
|
184
|
+
&.ant-btn-text:focus {
|
|
185
|
+
color: #e24c40 !important;
|
|
186
|
+
background: #f2f3f4 !important;
|
|
187
|
+
}
|
|
153
188
|
}
|
|
154
189
|
}
|
|
155
190
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
placeholder: "\u8BF7\u9009\u62E9",
|
|
56
|
+
className: "".concat(classPrefix, "-dropdown-handle"),
|
|
57
|
+
value: searchValue,
|
|
58
|
+
allowClear: true,
|
|
59
|
+
title: searchValue,
|
|
60
|
+
status: props.status,
|
|
61
|
+
onChange: onChange,
|
|
62
|
+
suffix: /*#__PURE__*/React.createElement(IconFont, {
|
|
63
|
+
className: "".concat(classPrefix, "-item-down-icon"),
|
|
64
|
+
type: "xiangxia"
|
|
65
|
+
})
|
|
66
|
+
}));
|
|
67
|
+
};
|
|
68
|
+
export default InputSelect;
|