@zgfe/modules-page 1.0.1-alpha.9 → 1.0.2
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.js +5 -2
- package/dist/esm/components/content/types.d.ts +1 -0
- package/dist/esm/components/content/utils.js +2 -1
- package/dist/esm/components/detail/images/percent.png +0 -0
- package/dist/esm/components/detail/index.js +11 -47
- package/dist/esm/components/detail/index.less +9 -2
- package/dist/esm/components/groupModal/index.js +10 -5
- package/dist/esm/components/groupModal/index.less +26 -1
- package/dist/esm/components/groupModal/inputSelect.js +1 -0
- package/dist/esm/components/pageSelect/index.js +48 -37
- package/dist/esm/components/searchPanel/index.d.ts +1 -1
- package/dist/esm/components/searchPanel/index.js +14 -38
- package/dist/esm/components/searchPanel/index.less +7 -34
- 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 +35 -29
- package/dist/esm/components/topContent/index.less +1 -0
- package/dist/esm/modules/empty/index.js +3 -1
- package/dist/esm/modules/empty/index.less +11 -6
- package/dist/esm/modules/home/demo/index.js +60 -2
- package/dist/esm/modules/home/index.js +95 -50
- package/dist/esm/modules/home/style/index.less +23 -0
- package/dist/esm/modules/home/types.d.ts +5 -1
- package/dist/esm/modules/home/utils.d.ts +1 -1
- package/dist/esm/modules/home/utils.js +25 -12
- package/package.json +3 -3
- package/dist/esm/components/detail/images/color_pallete_percent.png +0 -0
- package/dist/esm/modules/home/base64.d.ts +0 -23
- package/dist/esm/modules/home/base64.js +0 -132
|
@@ -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,9 +46,9 @@ var PageContent = function PageContent(props) {
|
|
|
43
46
|
return /*#__PURE__*/React.createElement("div", {
|
|
44
47
|
className: classPrefix
|
|
45
48
|
}, /*#__PURE__*/React.createElement(BizTable, {
|
|
46
|
-
rowKey:
|
|
49
|
+
rowKey: "id",
|
|
47
50
|
dataSource: props.type === 'pageGroup' ? groupList : props.value,
|
|
48
|
-
columns:
|
|
51
|
+
columns: columns
|
|
49
52
|
}));
|
|
50
53
|
};
|
|
51
54
|
export default PageContent;
|
|
Binary file
|
|
@@ -15,40 +15,28 @@ 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
42
|
var url = "wss://".concat(location.host).concat(api.socket);
|
|
@@ -100,7 +88,6 @@ var DetailContent = function DetailContent(props) {
|
|
|
100
88
|
console.log('连接已存在');
|
|
101
89
|
});
|
|
102
90
|
client.on('pageInfo', function (message) {
|
|
103
|
-
console.log('接收消息', message);
|
|
104
91
|
if (message.href !== openUrl) {
|
|
105
92
|
setPageUrl(message.href);
|
|
106
93
|
// 如果当前类型是单页面,则更新页面选择
|
|
@@ -135,29 +122,6 @@ var DetailContent = function DetailContent(props) {
|
|
|
135
122
|
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
136
123
|
platform: 3
|
|
137
124
|
}, props.params));
|
|
138
|
-
// if (timer) {
|
|
139
|
-
// clearTimeout(timer);
|
|
140
|
-
// }
|
|
141
|
-
// setTimer(
|
|
142
|
-
// setTimeout(() => {
|
|
143
|
-
// setLoading(true);
|
|
144
|
-
// ajax(api.getDetailResult, {
|
|
145
|
-
// method:'post',
|
|
146
|
-
// data: {
|
|
147
|
-
// appId: currentApp?.appId,
|
|
148
|
-
// platform: currentApp?.platform || 0,
|
|
149
|
-
// // ...props.params,
|
|
150
|
-
// },
|
|
151
|
-
// })
|
|
152
|
-
// .then((res) => {
|
|
153
|
-
// if (!res) return;
|
|
154
|
-
// setDetailList(res.data as PageColumnType[]);
|
|
155
|
-
// })
|
|
156
|
-
// .finally(() => {
|
|
157
|
-
// setLoading(false);
|
|
158
|
-
// });
|
|
159
|
-
// }, 500),
|
|
160
|
-
// );
|
|
161
125
|
}, [props.params]);
|
|
162
126
|
var openUrl = useMemo(function () {
|
|
163
127
|
if (!pageUrl) return '';
|
|
@@ -192,7 +156,7 @@ var DetailContent = function DetailContent(props) {
|
|
|
192
156
|
return /*#__PURE__*/React.createElement("div", {
|
|
193
157
|
className: "".concat(classPrefix, "-top-item"),
|
|
194
158
|
key: index
|
|
195
|
-
}, (_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, {
|
|
196
160
|
title: "\u70B9\u51FB\u4EBA\u6570\u5360\u6BD4\uFF1D\u9875\u9762\u5185\u70B9\u51FB\u4EBA\u6570\uFF0F\u9875\u9762\u6D4F\u89C8\u4EBA\u6570"
|
|
197
161
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
198
162
|
type: "tishi"
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
justify-content: space-between;
|
|
12
12
|
padding: 16px;
|
|
13
13
|
background: #fafafb;
|
|
14
|
+
border-radius: 8px 8px 0 0;
|
|
14
15
|
&-title {
|
|
15
16
|
display: flex;
|
|
16
17
|
flex: 1;
|
|
@@ -18,7 +19,7 @@
|
|
|
18
19
|
}
|
|
19
20
|
&-value {
|
|
20
21
|
display: inline-block;
|
|
21
|
-
width: calc(100% - 100px);
|
|
22
|
+
max-width: calc(100% - 100px);
|
|
22
23
|
.__default-overflow();
|
|
23
24
|
}
|
|
24
25
|
&-label {
|
|
@@ -36,12 +37,16 @@
|
|
|
36
37
|
&-item {
|
|
37
38
|
display: flex;
|
|
38
39
|
gap: 40px;
|
|
40
|
+
align-items: center;
|
|
39
41
|
color: #67727f;
|
|
40
42
|
.bsicon {
|
|
41
43
|
margin-left: 8px;
|
|
42
44
|
color: #9aa1a9;
|
|
43
45
|
font-size: 16px !important;
|
|
44
46
|
cursor: pointer;
|
|
47
|
+
&:hover {
|
|
48
|
+
color: @primary-color;
|
|
49
|
+
}
|
|
45
50
|
}
|
|
46
51
|
}
|
|
47
52
|
}
|
|
@@ -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;
|
|
@@ -45,12 +45,14 @@ var GroupModal = function GroupModal(props) {
|
|
|
45
45
|
}, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button, {
|
|
46
46
|
key: "submit",
|
|
47
47
|
type: "primary",
|
|
48
|
+
disabled: isDemo,
|
|
48
49
|
onClick: onOk
|
|
49
50
|
}, "\u786E\u5B9A")];
|
|
50
51
|
if (props.value) {
|
|
51
52
|
btnGroup.unshift( /*#__PURE__*/React.createElement(Button, {
|
|
52
53
|
key: "delete",
|
|
53
54
|
type: "text",
|
|
55
|
+
disabled: isDemo,
|
|
54
56
|
className: "".concat(classPrefix, "-footer-del"),
|
|
55
57
|
onClick: onDelete,
|
|
56
58
|
icon: /*#__PURE__*/React.createElement(IconFont, {
|
|
@@ -120,6 +122,7 @@ var GroupModal = function GroupModal(props) {
|
|
|
120
122
|
};
|
|
121
123
|
return /*#__PURE__*/React.createElement(BizDialog, {
|
|
122
124
|
open: true,
|
|
125
|
+
closable: true,
|
|
123
126
|
className: classPrefix,
|
|
124
127
|
width: 720,
|
|
125
128
|
title: props.value ? '修改分组' : '创建分组',
|
|
@@ -127,7 +130,8 @@ var GroupModal = function GroupModal(props) {
|
|
|
127
130
|
okButtonProps: {
|
|
128
131
|
disabled: isDemo
|
|
129
132
|
},
|
|
130
|
-
footer: btnList
|
|
133
|
+
footer: btnList,
|
|
134
|
+
onCancel: props.onCancel
|
|
131
135
|
}, /*#__PURE__*/React.createElement(Spin, {
|
|
132
136
|
spinning: loading
|
|
133
137
|
}, /*#__PURE__*/React.createElement(Form, {
|
|
@@ -151,7 +155,7 @@ var GroupModal = function GroupModal(props) {
|
|
|
151
155
|
name: "initPage",
|
|
152
156
|
rules: [{
|
|
153
157
|
validator: function validator(_, value) {
|
|
154
|
-
var reg = /^(
|
|
158
|
+
var reg = /^((http:\/\/)|(https:\/\/)|(\/\/))[A-Za-z0-9]/;
|
|
155
159
|
if (!value || !/\S+/.test(value)) return Promise.reject("\u8BF7\u8F93\u5165\u80CC\u666F\u9875\u5730\u5740");
|
|
156
160
|
if (!reg.test(value)) return Promise.reject('必须是合法的网页链接');
|
|
157
161
|
return Promise.resolve();
|
|
@@ -160,12 +164,13 @@ var GroupModal = function GroupModal(props) {
|
|
|
160
164
|
}, /*#__PURE__*/React.createElement(Input, {
|
|
161
165
|
className: "".concat(classPrefix, "-form-input"),
|
|
162
166
|
placeholder: "\u8BF7\u8F93\u5165\u5728\u67E5\u770B\u70B9\u51FB\u56FE\u65F6\u7684\u80CC\u666F\u9875\u9762"
|
|
163
|
-
})), /*#__PURE__*/React.createElement(
|
|
167
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
164
168
|
className: "".concat(classPrefix, "-form-title")
|
|
165
169
|
}, " \u6DFB\u52A0\u9875\u9762"), /*#__PURE__*/React.createElement(Form.Item, {
|
|
166
|
-
name: "filters"
|
|
170
|
+
name: "filters",
|
|
171
|
+
className: "".concat(classPrefix, "-form-item-filter")
|
|
167
172
|
}, /*#__PURE__*/React.createElement(PageItem, {
|
|
168
173
|
validate: validate
|
|
169
|
-
})))
|
|
174
|
+
})))));
|
|
170
175
|
};
|
|
171
176
|
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,6 +138,9 @@
|
|
|
137
138
|
}
|
|
138
139
|
}
|
|
139
140
|
|
|
141
|
+
&-form-item-filter.ant-form-item {
|
|
142
|
+
margin-bottom: 12px;
|
|
143
|
+
}
|
|
140
144
|
&-dropdown {
|
|
141
145
|
width: 300px;
|
|
142
146
|
&-handle {
|
|
@@ -153,9 +157,14 @@
|
|
|
153
157
|
&:not([disabled]):focus {
|
|
154
158
|
border-color: @primary-color;
|
|
155
159
|
}
|
|
160
|
+
&[disabled] {
|
|
161
|
+
color: #ccd0d4;
|
|
162
|
+
background: @background-color-gray;
|
|
163
|
+
}
|
|
156
164
|
}
|
|
157
165
|
.ant-modal-content {
|
|
158
166
|
.ant-modal-body {
|
|
167
|
+
padding-top: 8px;
|
|
159
168
|
padding-bottom: 0;
|
|
160
169
|
}
|
|
161
170
|
.ant-modal-footer {
|
|
@@ -163,9 +172,25 @@
|
|
|
163
172
|
border-top: 1px solid #f2f3f4 !important;
|
|
164
173
|
|
|
165
174
|
.group-modal-footer-del {
|
|
175
|
+
display: flex;
|
|
176
|
+
align-items: center;
|
|
166
177
|
float: left;
|
|
178
|
+
background: #f2f3f4 !important;
|
|
167
179
|
.bsicon {
|
|
168
180
|
margin-right: 8px;
|
|
181
|
+
font-size: 16px !important;
|
|
182
|
+
line-height: 1;
|
|
183
|
+
}
|
|
184
|
+
&.ant-btn-text[disabled]:hover {
|
|
185
|
+
color: rgba(0, 0, 0, 0.25) !important;
|
|
186
|
+
}
|
|
187
|
+
&.ant-btn-text:not([disabled]):hover {
|
|
188
|
+
color: #fb5547 !important;
|
|
189
|
+
background: #f2f3f4 !important;
|
|
190
|
+
}
|
|
191
|
+
&.ant-btn-text:not([disabled]):focus {
|
|
192
|
+
color: #e24c40 !important;
|
|
193
|
+
background: #f2f3f4 !important;
|
|
169
194
|
}
|
|
170
195
|
}
|
|
171
196
|
}
|
|
@@ -52,6 +52,7 @@ var InputSelect = function InputSelect(props) {
|
|
|
52
52
|
}, "\u6682\u65E0\u6570\u636E");
|
|
53
53
|
}
|
|
54
54
|
}, /*#__PURE__*/React.createElement(Input, {
|
|
55
|
+
placeholder: "\u8BF7\u9009\u62E9",
|
|
55
56
|
className: "".concat(classPrefix, "-dropdown-handle"),
|
|
56
57
|
value: searchValue,
|
|
57
58
|
allowClear: true,
|
|
@@ -17,21 +17,21 @@ import "./index.less";
|
|
|
17
17
|
import { ModulesPageContext } from "../../modules/home/types";
|
|
18
18
|
import { Tooltip } from 'antd';
|
|
19
19
|
var PageSelect = function PageSelect(props) {
|
|
20
|
-
// 根据类型展示的列表
|
|
21
|
-
var _useState = useState([]),
|
|
22
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
23
|
-
options = _useState2[0],
|
|
24
|
-
setOptions = _useState2[1];
|
|
25
20
|
// 当前类型
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
currentType =
|
|
29
|
-
setCurrentType =
|
|
21
|
+
var _useState = useState(pageTypes[0]),
|
|
22
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
23
|
+
currentType = _useState2[0],
|
|
24
|
+
setCurrentType = _useState2[1];
|
|
30
25
|
// 当前页面/分组
|
|
31
|
-
var
|
|
26
|
+
var _useState3 = useState(),
|
|
27
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
28
|
+
currentValue = _useState4[0],
|
|
29
|
+
setCurrentValue = _useState4[1];
|
|
30
|
+
// 是否第一次
|
|
31
|
+
var _useState5 = useState(true),
|
|
32
32
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
isFirst = _useState6[0],
|
|
34
|
+
setIsFirst = _useState6[1];
|
|
35
35
|
var classPrefix = 'page-select';
|
|
36
36
|
var _useContext = useContext(ModulesPageContext),
|
|
37
37
|
pageList = _useContext.pageList,
|
|
@@ -39,26 +39,30 @@ var PageSelect = function PageSelect(props) {
|
|
|
39
39
|
currentClickPage = _useContext.currentClickPage;
|
|
40
40
|
useEffect(function () {
|
|
41
41
|
var _props$value, _props$value2;
|
|
42
|
-
if (!props.value) return;
|
|
43
42
|
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
43
|
setCurrentType(pageTypes[type]);
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
44
|
+
if (props.value) {
|
|
45
|
+
setCurrentValue(function () {
|
|
46
|
+
if (type === 0) {
|
|
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
|
+
setTimeout(function () {
|
|
61
|
+
setIsFirst(false);
|
|
62
|
+
}, 0);
|
|
59
63
|
}, []);
|
|
60
64
|
useEffect(function () {
|
|
61
|
-
if (!currentClickPage) return;
|
|
65
|
+
if (!currentClickPage || isFirst) return;
|
|
62
66
|
setCurrentValue(function () {
|
|
63
67
|
if (currentClickPage && currentClickPage.pageUrl) {
|
|
64
68
|
var _ref = currentClickPage,
|
|
@@ -72,14 +76,18 @@ var PageSelect = function PageSelect(props) {
|
|
|
72
76
|
});
|
|
73
77
|
}, [currentClickPage]);
|
|
74
78
|
useEffect(function () {
|
|
79
|
+
if (isFirst) return;
|
|
75
80
|
var list = currentType.value === 'page' ? pageList : pageGroupList;
|
|
76
|
-
setOptions(list);
|
|
77
81
|
setCurrentValue(list[0]);
|
|
78
|
-
}, [currentType
|
|
82
|
+
}, [currentType]);
|
|
79
83
|
useEffect(function () {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
84
|
+
if (props.value) return;
|
|
85
|
+
setCurrentValue(pageList[0]);
|
|
86
|
+
}, [pageList.length]);
|
|
87
|
+
useEffect(function () {
|
|
88
|
+
if (!currentValue) return;
|
|
89
|
+
props.onChange && props.onChange(_objectSpread(_objectSpread({}, currentValue), {}, {
|
|
90
|
+
pageGroup: currentType.value === 'pageGroup' ? currentValue === null || currentValue === void 0 ? void 0 : currentValue.id : undefined
|
|
83
91
|
}));
|
|
84
92
|
}, [currentType, currentValue]);
|
|
85
93
|
var getCustomLabel = function getCustomLabel(node, option) {
|
|
@@ -101,7 +109,7 @@ var PageSelect = function PageSelect(props) {
|
|
|
101
109
|
}, /*#__PURE__*/React.createElement("div", {
|
|
102
110
|
className: "".concat(classPrefix, "-panel")
|
|
103
111
|
}, /*#__PURE__*/React.createElement(BizSelect, {
|
|
104
|
-
|
|
112
|
+
value: currentType,
|
|
105
113
|
className: "".concat(classPrefix, "-panel-type"),
|
|
106
114
|
options: pageTypes,
|
|
107
115
|
popupContainer: true,
|
|
@@ -112,10 +120,10 @@ var PageSelect = function PageSelect(props) {
|
|
|
112
120
|
}), /*#__PURE__*/React.createElement(BizSelect, {
|
|
113
121
|
value: currentValue,
|
|
114
122
|
className: "".concat(classPrefix, "-panel-page"),
|
|
115
|
-
options:
|
|
123
|
+
options: currentType.value === 'page' ? pageList : pageGroupList,
|
|
116
124
|
labelField: currentType.value === 'page' ? 'pageTitle' : 'name',
|
|
117
125
|
popupContainer: true,
|
|
118
|
-
enableSearch:
|
|
126
|
+
enableSearch: true,
|
|
119
127
|
onChange: setCurrentValue,
|
|
120
128
|
customLabel: getCustomLabel
|
|
121
129
|
}), /*#__PURE__*/React.createElement(Tooltip, {
|
|
@@ -123,7 +131,10 @@ var PageSelect = function PageSelect(props) {
|
|
|
123
131
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
124
132
|
className: "".concat(classPrefix, "-panel-icon").concat(!props.enableAdd ? ' disabled' : ''),
|
|
125
133
|
type: "shaixuan",
|
|
126
|
-
onClick:
|
|
134
|
+
onClick: function onClick() {
|
|
135
|
+
if (!props.enableAdd) return;
|
|
136
|
+
props.onAdd && props.onAdd();
|
|
137
|
+
}
|
|
127
138
|
}))));
|
|
128
139
|
};
|
|
129
140
|
export default PageSelect;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SearchPanelProps } from './types';
|
|
3
3
|
import './index.less';
|
|
4
|
-
declare const SearchPanel: React.
|
|
4
|
+
declare const SearchPanel: React.ForwardRefExoticComponent<SearchPanelProps & React.RefAttributes<any>>;
|
|
5
5
|
export default SearchPanel;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
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."); }
|
|
4
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); }
|
|
@@ -6,12 +5,12 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
6
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; } }
|
|
7
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
7
|
import { Form, Skeleton } from 'antd';
|
|
9
|
-
import React, {
|
|
8
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
10
9
|
import "./index.less";
|
|
11
|
-
import { BizAttrConditionGroup,
|
|
10
|
+
import { BizAttrConditionGroup, BizUserGroupHeader } from '@zgfe/business-lib';
|
|
12
11
|
import PageSelect from "../pageSelect";
|
|
13
12
|
import { formValue, formatValue } from "./util";
|
|
14
|
-
var SearchPanel = function
|
|
13
|
+
var SearchPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
15
14
|
var classPrefix = 'page-search-panel';
|
|
16
15
|
// form 值
|
|
17
16
|
var _Form$useForm = Form.useForm(),
|
|
@@ -33,11 +32,9 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
33
32
|
count = _useState6[0],
|
|
34
33
|
setCount = _useState6[1];
|
|
35
34
|
var groupRef = useRef(null);
|
|
36
|
-
var _useContext = useContext(BizGlobalDataContext),
|
|
37
|
-
userGroupList = _useContext.userGroupList;
|
|
38
35
|
useEffect(function () {
|
|
39
36
|
var _data$filters;
|
|
40
|
-
var data = formValue(props.value
|
|
37
|
+
var data = formValue(props.value);
|
|
41
38
|
setCount(((_data$filters = data.filters) === null || _data$filters === void 0 ? void 0 : _data$filters.conditions.length) || 0);
|
|
42
39
|
setFormData(data);
|
|
43
40
|
setTimeout(function () {
|
|
@@ -53,7 +50,6 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
53
50
|
*/
|
|
54
51
|
var onChange = function onChange(_changedValues, allValues) {
|
|
55
52
|
setFormData(allValues);
|
|
56
|
-
console.log(formatValue(allValues), 'onChange allValues');
|
|
57
53
|
props.onChange && props.onChange(formatValue(allValues));
|
|
58
54
|
};
|
|
59
55
|
var onAdd = function onAdd() {
|
|
@@ -76,34 +72,14 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
76
72
|
initialValues: formData,
|
|
77
73
|
onValuesChange: onChange
|
|
78
74
|
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}, fields.map(function (field, index) {
|
|
88
|
-
return /*#__PURE__*/React.createElement(Form.Item, _extends({}, field, {
|
|
89
|
-
className: "".concat(classPrefix, "-item"),
|
|
90
|
-
key: field.key
|
|
91
|
-
}), /*#__PURE__*/React.createElement(BizUserGroup, {
|
|
92
|
-
enableDelete: fields.length > 1,
|
|
93
|
-
onDelete: function onDelete() {
|
|
94
|
-
return remove(index);
|
|
95
|
-
}
|
|
96
|
-
}));
|
|
97
|
-
})), fields.length < 2 && /*#__PURE__*/React.createElement("div", {
|
|
98
|
-
className: "".concat(classPrefix, "-add"),
|
|
99
|
-
onClick: function onClick() {
|
|
100
|
-
return add();
|
|
101
|
-
}
|
|
102
|
-
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
103
|
-
className: "biz-icon",
|
|
104
|
-
type: 'tianjia1'
|
|
105
|
-
}), "\u6DFB\u52A0\u7528\u6237\u7FA4"));
|
|
106
|
-
}), /*#__PURE__*/React.createElement(Form.Item, {
|
|
75
|
+
name: "userGroup",
|
|
76
|
+
className: "".concat(classPrefix, "-item1")
|
|
77
|
+
}, /*#__PURE__*/React.createElement(BizUserGroupHeader, {
|
|
78
|
+
max: 2,
|
|
79
|
+
enableTags: true
|
|
80
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
81
|
+
ref: ref
|
|
82
|
+
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
107
83
|
className: "".concat(classPrefix, "-title")
|
|
108
84
|
}, " \u9875\u9762 "), /*#__PURE__*/React.createElement(Form.Item, {
|
|
109
85
|
className: "".concat(classPrefix, "-item2"),
|
|
@@ -119,6 +95,6 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
119
95
|
onlyAnd: true,
|
|
120
96
|
enableDelete: true,
|
|
121
97
|
onConditionsCount: setCount
|
|
122
|
-
})))));
|
|
123
|
-
};
|
|
98
|
+
}))))));
|
|
99
|
+
});
|
|
124
100
|
export default SearchPanel;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
.page-search-panel {
|
|
4
4
|
&-title.ant-form-item {
|
|
5
|
-
margin-bottom:
|
|
5
|
+
margin-bottom: 8px;
|
|
6
6
|
padding-left: 24px;
|
|
7
7
|
color: @text-color-secondary;
|
|
8
8
|
font-weight: 500;
|
|
@@ -13,42 +13,15 @@
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
&-item-horizontal {
|
|
17
|
-
display: flex;
|
|
18
|
-
flex-wrap: wrap;
|
|
19
|
-
gap: 16px;
|
|
20
|
-
padding: 0 24px;
|
|
21
|
-
&:hover {
|
|
22
|
-
background: #e8efff;
|
|
23
|
-
}
|
|
24
|
-
.page-search-panel-item.ant-form-item {
|
|
25
|
-
margin-bottom: 0;
|
|
26
|
-
padding: 4px 0;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
&-add {
|
|
30
|
-
width: fit-content;
|
|
31
|
-
height: 20px;
|
|
32
|
-
margin-top: 8px;
|
|
33
|
-
margin-left: 24px;
|
|
34
|
-
color: @primary-color;
|
|
35
|
-
line-height: 20px;
|
|
36
|
-
cursor: pointer;
|
|
37
|
-
span {
|
|
38
|
-
margin-right: 4px;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
16
|
|
|
42
|
-
&-item3:not(.page-search-panel-hidden) {
|
|
17
|
+
&-item3.ant-form-item:not(.page-search-panel-hidden) {
|
|
43
18
|
margin-bottom: 20px;
|
|
44
|
-
padding: 4px 24px;
|
|
45
|
-
&:hover {
|
|
46
|
-
background: #e8efff;
|
|
47
|
-
}
|
|
48
19
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
20
|
+
&-item1.ant-form-item {
|
|
21
|
+
margin-bottom: 20px !important;
|
|
22
|
+
}
|
|
23
|
+
&-item2.ant-form-item {
|
|
24
|
+
margin-bottom: 4px !important;
|
|
52
25
|
}
|
|
53
26
|
|
|
54
27
|
&-hidden.ant-form-item {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { AttrConditionTypes
|
|
1
|
+
import { AttrConditionTypes } from '@zgfe/business-lib';
|
|
2
2
|
export interface SearchPanelProps {
|
|
3
3
|
value?: SearchValue;
|
|
4
4
|
onChange?: (data: SearchValue) => void;
|
|
5
5
|
}
|
|
6
6
|
export interface SearchValue {
|
|
7
|
-
userGroup?: number[];
|
|
7
|
+
userGroup?: (number | string[])[];
|
|
8
8
|
pageUrl?: string;
|
|
9
9
|
pageTitle?: string;
|
|
10
10
|
pageGroup?: number;
|
|
@@ -12,7 +12,7 @@ export interface SearchValue {
|
|
|
12
12
|
type?: string;
|
|
13
13
|
}
|
|
14
14
|
export interface FormValue {
|
|
15
|
-
userGroup?:
|
|
15
|
+
userGroup?: (number | string[])[];
|
|
16
16
|
page?: PageTypes;
|
|
17
17
|
filters?: AttrConditionTypes.GroupValue;
|
|
18
18
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AttrConditionTypes } from '@zgfe/business-lib';
|
|
2
2
|
import { FormValue, SearchValue } from './types';
|
|
3
|
-
export declare const formValue: (source?: SearchValue
|
|
3
|
+
export declare const formValue: (source?: SearchValue) => FormValue;
|
|
4
4
|
export declare const formatValue: (source: FormValue) => {
|
|
5
|
-
userGroup: number[];
|
|
5
|
+
userGroup: (number | string[])[];
|
|
6
6
|
pageTitle: string | undefined;
|
|
7
7
|
pageUrl: string | undefined;
|
|
8
8
|
pageGroup: number | undefined;
|
|
9
|
-
filters:
|
|
9
|
+
filters: AttrConditionTypes.GroupValue | undefined;
|
|
10
10
|
};
|