@zgfe/modules-page 1.0.1-alpha.19 → 1.0.1-alpha.20
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 +1 -0
- package/dist/esm/components/content/types.d.ts +1 -0
- package/dist/esm/components/pageSelect/index.js +23 -20
- package/dist/esm/components/searchPanel/util.js +2 -1
- package/dist/esm/modules/home/demo/index.js +20 -2
- package/dist/esm/modules/home/index.js +21 -4
- 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 +6 -1
- package/package.json +3 -3
|
@@ -46,6 +46,7 @@ var PageContent = function PageContent(props) {
|
|
|
46
46
|
return /*#__PURE__*/React.createElement("div", {
|
|
47
47
|
className: classPrefix
|
|
48
48
|
}, /*#__PURE__*/React.createElement(BizTable, {
|
|
49
|
+
rowKey: "id",
|
|
49
50
|
dataSource: props.type === 'pageGroup' ? groupList : props.value,
|
|
50
51
|
columns: columns
|
|
51
52
|
}));
|
|
@@ -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,
|
|
@@ -43,7 +43,7 @@ var PageSelect = function PageSelect(props) {
|
|
|
43
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
44
|
setCurrentType(pageTypes[type]);
|
|
45
45
|
setCurrentValue(function () {
|
|
46
|
-
if (type ===
|
|
46
|
+
if (type === 0) {
|
|
47
47
|
var data = props.value;
|
|
48
48
|
return {
|
|
49
49
|
id: "".concat(data.pageTitle ? data.pageTitle + '-' : '').concat(data.pageUrl),
|
|
@@ -53,12 +53,15 @@ var PageSelect = function PageSelect(props) {
|
|
|
53
53
|
}
|
|
54
54
|
return pageGroupList.filter(function (item) {
|
|
55
55
|
var _props$value3;
|
|
56
|
-
return item.id
|
|
56
|
+
return item.id == ((_props$value3 = props.value) === null || _props$value3 === void 0 ? void 0 : _props$value3.pageGroup);
|
|
57
57
|
})[0];
|
|
58
58
|
});
|
|
59
|
+
setTimeout(function () {
|
|
60
|
+
setIsFirst(false);
|
|
61
|
+
}, 0);
|
|
59
62
|
}, []);
|
|
60
63
|
useEffect(function () {
|
|
61
|
-
if (!currentClickPage) return;
|
|
64
|
+
if (!currentClickPage || isFirst) return;
|
|
62
65
|
setCurrentValue(function () {
|
|
63
66
|
if (currentClickPage && currentClickPage.pageUrl) {
|
|
64
67
|
var _ref = currentClickPage,
|
|
@@ -72,10 +75,10 @@ var PageSelect = function PageSelect(props) {
|
|
|
72
75
|
});
|
|
73
76
|
}, [currentClickPage]);
|
|
74
77
|
useEffect(function () {
|
|
78
|
+
if (isFirst) return;
|
|
75
79
|
var list = currentType.value === 'page' ? pageList : pageGroupList;
|
|
76
|
-
setOptions(list);
|
|
77
80
|
setCurrentValue(list[0]);
|
|
78
|
-
}, [currentType
|
|
81
|
+
}, [currentType]);
|
|
79
82
|
useEffect(function () {
|
|
80
83
|
props.onChange && props.onChange(_objectSpread(_objectSpread({}, currentValue || {}), {}, {
|
|
81
84
|
pageGroup: currentType.value === 'pageGroup' ? currentValue === null || currentValue === void 0 ? void 0 : currentValue.id : undefined,
|
|
@@ -101,7 +104,7 @@ var PageSelect = function PageSelect(props) {
|
|
|
101
104
|
}, /*#__PURE__*/React.createElement("div", {
|
|
102
105
|
className: "".concat(classPrefix, "-panel")
|
|
103
106
|
}, /*#__PURE__*/React.createElement(BizSelect, {
|
|
104
|
-
|
|
107
|
+
value: currentType,
|
|
105
108
|
className: "".concat(classPrefix, "-panel-type"),
|
|
106
109
|
options: pageTypes,
|
|
107
110
|
popupContainer: true,
|
|
@@ -112,10 +115,10 @@ var PageSelect = function PageSelect(props) {
|
|
|
112
115
|
}), /*#__PURE__*/React.createElement(BizSelect, {
|
|
113
116
|
value: currentValue,
|
|
114
117
|
className: "".concat(classPrefix, "-panel-page"),
|
|
115
|
-
options:
|
|
118
|
+
options: currentType.value === 'page' ? pageList : pageGroupList,
|
|
116
119
|
labelField: currentType.value === 'page' ? 'pageTitle' : 'name',
|
|
117
120
|
popupContainer: true,
|
|
118
|
-
enableSearch:
|
|
121
|
+
enableSearch: true,
|
|
119
122
|
onChange: setCurrentValue,
|
|
120
123
|
customLabel: getCustomLabel
|
|
121
124
|
}), /*#__PURE__*/React.createElement(Tooltip, {
|
|
@@ -2,8 +2,9 @@ import _ from 'lodash';
|
|
|
2
2
|
import { OperateTypes } from '@zgfe/business-lib/es/attrConditions/types';
|
|
3
3
|
export var formValue = function formValue(source) {
|
|
4
4
|
var data = _.cloneDeep(source) || {};
|
|
5
|
+
var type = data !== null && data !== void 0 && data.pageGroup || (data === null || data === void 0 ? void 0 : data.pageGroup) === 0 ? 'pageGroup' : 'page';
|
|
5
6
|
var page = {
|
|
6
|
-
type:
|
|
7
|
+
type: type,
|
|
7
8
|
pageGroup: data === null || data === void 0 ? void 0 : data.pageGroup,
|
|
8
9
|
pageUrl: data === null || data === void 0 ? void 0 : data.pageUrl,
|
|
9
10
|
pageTitle: data === null || data === void 0 ? void 0 : data.pageTitle
|
|
@@ -1,19 +1,37 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ModulesPage } from '@zgfe/modules-page';
|
|
3
3
|
import { DemoWrapper } from '@zgfe/business-lib';
|
|
4
|
+
var defaultValue = {
|
|
5
|
+
appId: 225,
|
|
6
|
+
platform: 3,
|
|
7
|
+
module: 'page',
|
|
8
|
+
time: {
|
|
9
|
+
begin: '2023-09-09',
|
|
10
|
+
end: '2023-09-12',
|
|
11
|
+
unit: 'day'
|
|
12
|
+
},
|
|
13
|
+
userGroup: [0],
|
|
14
|
+
pageTitle: '进入百度首页780300590145',
|
|
15
|
+
pageUrl: 'http://baidu.com/query/780300590145'
|
|
16
|
+
};
|
|
4
17
|
export default (function () {
|
|
5
18
|
var onClickWarn = function onClickWarn() {
|
|
6
19
|
console.log('onClickWarn');
|
|
7
20
|
};
|
|
21
|
+
var onChange = function onChange(data) {
|
|
22
|
+
console.log('onChange:', data);
|
|
23
|
+
};
|
|
8
24
|
return /*#__PURE__*/React.createElement(DemoWrapper, {
|
|
9
25
|
needMeta: true,
|
|
10
|
-
defaultApp:
|
|
26
|
+
defaultApp: 225
|
|
11
27
|
}, /*#__PURE__*/React.createElement("div", {
|
|
12
28
|
style: {
|
|
13
29
|
height: 750,
|
|
14
30
|
overflow: 'auto'
|
|
15
31
|
}
|
|
16
32
|
}, /*#__PURE__*/React.createElement(ModulesPage, {
|
|
17
|
-
|
|
33
|
+
value: defaultValue,
|
|
34
|
+
onClickWarn: onClickWarn,
|
|
35
|
+
onChange: onChange
|
|
18
36
|
})));
|
|
19
37
|
});
|
|
@@ -13,7 +13,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
13
13
|
import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
14
14
|
import EmptyPanel from "../empty";
|
|
15
15
|
import { BizGlobalDataContext, BizLayout } from '@zgfe/business-lib';
|
|
16
|
-
import { Button, Spin } from 'antd';
|
|
16
|
+
import { Button, Skeleton, Spin } from 'antd';
|
|
17
17
|
import "./style/index.less";
|
|
18
18
|
import SearchPanel from "../../components/searchPanel";
|
|
19
19
|
import TopContent from "../../components/topContent";
|
|
@@ -112,6 +112,9 @@ var ModulesPage = function ModulesPage(props) {
|
|
|
112
112
|
};
|
|
113
113
|
getPageList(param, setPageList);
|
|
114
114
|
getPageGroupList(param, setPageGroupList, setPageLoading);
|
|
115
|
+
if (props.value) {
|
|
116
|
+
setSearchValue(props.value);
|
|
117
|
+
}
|
|
115
118
|
}, []);
|
|
116
119
|
useEffect(function () {
|
|
117
120
|
if (!showGroup) {
|
|
@@ -130,6 +133,12 @@ var ModulesPage = function ModulesPage(props) {
|
|
|
130
133
|
if (type === 'pageGroup' && !(searchValue !== null && searchValue !== void 0 && searchValue.pageGroup)) return;
|
|
131
134
|
if (type === 'page' || pageType === 'detail') {
|
|
132
135
|
fetch();
|
|
136
|
+
} else if (type === 'pageGroup') {
|
|
137
|
+
props.onChange && props.onChange(_objectSpread({
|
|
138
|
+
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
139
|
+
platform: 3,
|
|
140
|
+
module: 'page'
|
|
141
|
+
}, searchValue));
|
|
133
142
|
}
|
|
134
143
|
}, [searchValue]);
|
|
135
144
|
// 查询结果
|
|
@@ -140,6 +149,7 @@ var ModulesPage = function ModulesPage(props) {
|
|
|
140
149
|
setLoading(true);
|
|
141
150
|
setTimer(setTimeout(function () {
|
|
142
151
|
if (_.isEqual(originSearchValue, searchValue)) {
|
|
152
|
+
setLoading(false);
|
|
143
153
|
return;
|
|
144
154
|
}
|
|
145
155
|
setOriginSearchValue(_.cloneDeep(searchValue));
|
|
@@ -148,10 +158,11 @@ var ModulesPage = function ModulesPage(props) {
|
|
|
148
158
|
platform: 3,
|
|
149
159
|
module: 'page'
|
|
150
160
|
}, searchValue);
|
|
161
|
+
props.onChange && props.onChange(param);
|
|
151
162
|
getPageResult(param, setResult, setLoading);
|
|
152
163
|
}, 500));
|
|
153
164
|
};
|
|
154
|
-
//
|
|
165
|
+
// 改变查询条件/
|
|
155
166
|
var onChange = function onChange(data) {
|
|
156
167
|
setSearchValue(function (value) {
|
|
157
168
|
if (!value) return data;
|
|
@@ -206,11 +217,17 @@ var ModulesPage = function ModulesPage(props) {
|
|
|
206
217
|
}, /*#__PURE__*/React.createElement(BizLayout, {
|
|
207
218
|
title: "\u9875\u9762\u5206\u6790",
|
|
208
219
|
hasCollapse: true,
|
|
209
|
-
topPanel: /*#__PURE__*/React.createElement(
|
|
220
|
+
topPanel: /*#__PURE__*/React.createElement(Skeleton, {
|
|
221
|
+
loading: pageLoading,
|
|
222
|
+
active: true,
|
|
223
|
+
paragraph: {
|
|
224
|
+
rows: 4
|
|
225
|
+
}
|
|
226
|
+
}, /*#__PURE__*/React.createElement(SearchPanel, {
|
|
210
227
|
ref: selectRef,
|
|
211
228
|
value: searchValue,
|
|
212
229
|
onChange: onChange
|
|
213
|
-
}),
|
|
230
|
+
})),
|
|
214
231
|
topRender: props.onClickWarn ? render : null,
|
|
215
232
|
collapseRef: selectRef
|
|
216
233
|
}, /*#__PURE__*/React.createElement(Spin, {
|
|
@@ -5,9 +5,13 @@ export declare namespace ModulesPageTypes {
|
|
|
5
5
|
interface Props {
|
|
6
6
|
value?: Value;
|
|
7
7
|
onClickWarn?: () => void;
|
|
8
|
+
onChange?: (data: Value) => void;
|
|
8
9
|
}
|
|
9
10
|
interface Value extends SearchValue {
|
|
10
11
|
time?: DatePickerTypes.Value;
|
|
12
|
+
appId?: number | string;
|
|
13
|
+
platform?: number;
|
|
14
|
+
module?: string;
|
|
11
15
|
}
|
|
12
16
|
interface Page {
|
|
13
17
|
pageTitle?: string;
|
|
@@ -37,6 +41,6 @@ export declare namespace ModulesPageTypes {
|
|
|
37
41
|
export declare const ModulesPageContext: import("react").Context<{
|
|
38
42
|
pageList: ModulesPageTypes.Page[];
|
|
39
43
|
pageGroupList: ModulesPageTypes.PageGroup[];
|
|
40
|
-
currentClickPage?: ModulesPageTypes.
|
|
44
|
+
currentClickPage?: ModulesPageTypes.PageGroup | ModulesPageTypes.Page | undefined;
|
|
41
45
|
setCurrentClickPage?: ((data: ModulesPageTypes.Page) => void) | undefined;
|
|
42
46
|
}>;
|
|
@@ -2,6 +2,6 @@ import { ModulesPageTypes } from './types';
|
|
|
2
2
|
import { AppInfoProps } from '@zgfe/business-lib/es/context';
|
|
3
3
|
export declare const getPageList: (data: ModulesPageTypes.Params, callback: Function) => void;
|
|
4
4
|
export declare const getPageGroupList: (data: ModulesPageTypes.Params, callback: Function, loadingCallback?: Function) => void;
|
|
5
|
-
export declare const getPageResult: (params: ModulesPageTypes.
|
|
5
|
+
export declare const getPageResult: (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;
|
|
@@ -67,8 +67,13 @@ export var getPageResult = function getPageResult(params, callback, loadingCallb
|
|
|
67
67
|
method: 'post',
|
|
68
68
|
data: params
|
|
69
69
|
}).then(function (res) {
|
|
70
|
+
var _res$data;
|
|
70
71
|
if (!res || !res.data) return;
|
|
71
|
-
callback(res.data)
|
|
72
|
+
callback((_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.map(function (item) {
|
|
73
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
74
|
+
id: "".concat(item.userGroup, "-").concat(item.pageTitle, "-").concat(item.pageUrl)
|
|
75
|
+
});
|
|
76
|
+
}));
|
|
72
77
|
}).finally(function () {
|
|
73
78
|
loadingCallback(false);
|
|
74
79
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgfe/modules-page",
|
|
3
|
-
"version": "1.0.1-alpha.
|
|
3
|
+
"version": "1.0.1-alpha.20",
|
|
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.81-page.
|
|
42
|
+
"@zgfe/business-lib": "1.1.81-page.10",
|
|
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": "
|
|
53
|
+
"gitHead": "ec25eecbfc957817643b49e2df5d8f03e14463e4"
|
|
54
54
|
}
|