@zgfe/modules-page 1.0.1-alpha.1 → 1.0.1-alpha.3
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/groupModal/index.js +24 -21
- package/dist/esm/components/groupModal/index.less +17 -0
- package/dist/esm/components/groupModal/inputSelect.d.ts +9 -0
- package/dist/esm/components/groupModal/inputSelect.js +67 -0
- package/dist/esm/components/groupModal/pageItem.js +47 -58
- package/dist/esm/components/groupModal/types.d.ts +0 -2
- package/dist/esm/components/groupModal/utils.js +2 -8
- package/dist/esm/components/pageSelect/index.js +26 -3
- package/dist/esm/components/searchPanel/index.js +1 -1
- package/dist/esm/components/searchPanel/index.less +3 -5
- package/dist/esm/components/searchPanel/util.d.ts +3 -11
- package/dist/esm/components/searchPanel/util.js +7 -11
- package/dist/esm/modules/home/demo/index.js +1 -1
- package/dist/esm/modules/home/index.js +29 -22
- package/dist/esm/modules/home/utils.d.ts +1 -1
- package/dist/esm/modules/home/utils.js +5 -2
- package/package.json +2 -2
- package/dist/esm/components/groupModal/mock.d.ts +0 -5
- package/dist/esm/components/groupModal/mock.js +0 -16
|
@@ -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",
|
|
@@ -75,11 +67,15 @@ var GroupModal = function GroupModal(props) {
|
|
|
75
67
|
method: 'post',
|
|
76
68
|
data: {
|
|
77
69
|
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
78
|
-
platform:
|
|
70
|
+
platform: 3,
|
|
79
71
|
id: props.value.id
|
|
80
72
|
}
|
|
81
73
|
}).then(function (res) {
|
|
82
|
-
if (!res)
|
|
74
|
+
if (!res) {
|
|
75
|
+
message.error("\u5220\u9664\u5931\u8D25");
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
message.success("\u5220\u9664\u6210\u529F");
|
|
83
79
|
props.onOk && props.onOk();
|
|
84
80
|
}).finally(function () {
|
|
85
81
|
setLoading(false);
|
|
@@ -104,10 +100,18 @@ var GroupModal = function GroupModal(props) {
|
|
|
104
100
|
ajax(url, {
|
|
105
101
|
method: 'post',
|
|
106
102
|
data: _objectSpread({
|
|
103
|
+
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
104
|
+
platform: 3,
|
|
107
105
|
id: (_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id
|
|
108
106
|
}, data)
|
|
109
107
|
}).then(function (res) {
|
|
110
|
-
|
|
108
|
+
var _props$value3;
|
|
109
|
+
if (!res) {
|
|
110
|
+
var _props$value2;
|
|
111
|
+
message.error("".concat((_props$value2 = props.value) !== null && _props$value2 !== void 0 && _props$value2.id ? '修改' : '创建', "\u5931\u8D25"));
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
message.success("".concat((_props$value3 = props.value) !== null && _props$value3 !== void 0 && _props$value3.id ? '修改' : '创建', "\u6210\u529F"));
|
|
111
115
|
props.onOk && props.onOk();
|
|
112
116
|
}).finally(function () {
|
|
113
117
|
setLoading(false);
|
|
@@ -160,7 +164,6 @@ var GroupModal = function GroupModal(props) {
|
|
|
160
164
|
}, " \u6DFB\u52A0\u9875\u9762"), /*#__PURE__*/React.createElement(Form.Item, {
|
|
161
165
|
name: "filters"
|
|
162
166
|
}, /*#__PURE__*/React.createElement(PageItem, {
|
|
163
|
-
defaultOption: defaultOption,
|
|
164
167
|
validate: validate
|
|
165
168
|
}))), /*#__PURE__*/React.createElement(Button, null)));
|
|
166
169
|
};
|
|
@@ -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,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
|
-
|
|
49
|
-
|
|
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
|
|
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
|
-
|
|
58
|
-
|
|
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
|
-
|
|
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
|
|
123
|
-
newValue && setSearchValue(newValue);
|
|
114
|
+
var _onSearch = function onSearch(newValue, index) {
|
|
124
115
|
if (timer) {
|
|
125
116
|
clearTimeout(timer);
|
|
126
117
|
}
|
|
127
|
-
|
|
128
|
-
setParamOption(
|
|
129
|
-
|
|
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
|
-
|
|
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(
|
|
179
|
-
className: "".concat(prefix, "-content-item-param"),
|
|
180
|
-
options: paramOption,
|
|
180
|
+
}) : /*#__PURE__*/React.createElement(InputSelect, {
|
|
181
181
|
value: item.param,
|
|
182
|
-
|
|
183
|
-
className: "".concat(prefix, "-down-icon"),
|
|
184
|
-
type: "xiangxia"
|
|
185
|
-
}),
|
|
182
|
+
options: paramOption ? paramOption[index] : [],
|
|
186
183
|
status: !item.param && props.validate ? 'error' : '',
|
|
187
|
-
|
|
188
|
-
|
|
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,4 +1,3 @@
|
|
|
1
|
-
import { SelectProps } from 'antd';
|
|
2
1
|
import { ModulesPageTypes } from '../../modules/home/types';
|
|
3
2
|
export declare namespace GroupModalType {
|
|
4
3
|
interface Props {
|
|
@@ -6,7 +5,6 @@ export declare namespace GroupModalType {
|
|
|
6
5
|
}
|
|
7
6
|
interface ItemProps {
|
|
8
7
|
value?: ModulesPageTypes.ItemValue[];
|
|
9
|
-
defaultOption?: SelectProps['options'];
|
|
10
8
|
validate?: boolean;
|
|
11
9
|
onChange?: (data: ModulesPageTypes.ItemValue[]) => void;
|
|
12
10
|
}
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
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;
|
|
@@ -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),
|
|
@@ -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
|
|
47
|
-
userGroup: group
|
|
48
|
-
|
|
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
|
};
|
|
@@ -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
|
-
|
|
65
|
-
|
|
66
|
-
//
|
|
67
|
-
var _useState17 = useState(
|
|
63
|
+
pageLoading = _useState16[0],
|
|
64
|
+
setPageLoading = _useState16[1];
|
|
65
|
+
// 要编辑的分组
|
|
66
|
+
var _useState17 = useState(),
|
|
68
67
|
_useState18 = _slicedToArray(_useState17, 2),
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
editGroup = _useState18[0],
|
|
69
|
+
setEditGroup = _useState18[1];
|
|
70
|
+
// 当前页面类型 list/detail
|
|
71
|
+
var _useState19 = useState('list'),
|
|
72
72
|
_useState20 = _slicedToArray(_useState19, 2),
|
|
73
|
-
|
|
74
|
-
|
|
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
|
-
|
|
79
|
-
|
|
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:
|
|
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,7 +113,7 @@ var ModulesPage = function ModulesPage(props) {
|
|
|
109
113
|
if (isEmpty) return;
|
|
110
114
|
if (!searchValue) return;
|
|
111
115
|
console.log('searchValue:', searchValue);
|
|
112
|
-
var type =
|
|
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)) {
|
|
@@ -128,7 +132,7 @@ var ModulesPage = function ModulesPage(props) {
|
|
|
128
132
|
setTimer(setTimeout(function () {
|
|
129
133
|
var param = _objectSpread({
|
|
130
134
|
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
131
|
-
platform:
|
|
135
|
+
platform: 3
|
|
132
136
|
}, searchValue);
|
|
133
137
|
getPageResult(param, setResult, setLoading);
|
|
134
138
|
}, 500));
|
|
@@ -150,11 +154,12 @@ var ModulesPage = function ModulesPage(props) {
|
|
|
150
154
|
};
|
|
151
155
|
// 分组弹窗编辑回调,更新分组列表
|
|
152
156
|
var onOk = function onOk() {
|
|
157
|
+
setShowGroup(false);
|
|
153
158
|
var param = {
|
|
154
159
|
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
155
|
-
platform:
|
|
160
|
+
platform: 3
|
|
156
161
|
};
|
|
157
|
-
getPageGroupList(param, setPageGroupList);
|
|
162
|
+
getPageGroupList(param, setPageGroupList, setPageLoading);
|
|
158
163
|
};
|
|
159
164
|
|
|
160
165
|
// 点击表格中页面
|
|
@@ -191,7 +196,9 @@ var ModulesPage = function ModulesPage(props) {
|
|
|
191
196
|
onChange: onChange
|
|
192
197
|
}),
|
|
193
198
|
topRender: props.onClickWarn ? render : null
|
|
194
|
-
}, /*#__PURE__*/React.createElement(
|
|
199
|
+
}, /*#__PURE__*/React.createElement(Spin, {
|
|
200
|
+
spinning: pageLoading
|
|
201
|
+
}, /*#__PURE__*/React.createElement(TopContent, {
|
|
195
202
|
value: searchValue === null || searchValue === void 0 ? void 0 : searchValue.time,
|
|
196
203
|
type: currentType,
|
|
197
204
|
disabled: !result.length,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ModulesPageTypes } from './types';
|
|
2
2
|
import { AppInfoProps } from '@zgfe/business-lib/es/context';
|
|
3
3
|
export declare const getPageList: (data: any, callback: Function) => void;
|
|
4
|
-
export declare const getPageGroupList: (data: any, callback: Function) => void;
|
|
4
|
+
export declare const getPageGroupList: (data: any, callback: Function, loadingCallback?: Function) => void;
|
|
5
5
|
export declare const getPageResult: (params: any, callback: Function, loadingCallback: Function) => void;
|
|
6
6
|
export declare const getSocketSecret: () => string;
|
|
7
7
|
export declare const onDownload: (params?: ModulesPageTypes.Value, currentApp?: AppInfoProps) => void;
|
|
@@ -36,7 +36,8 @@ export var getPageList = function getPageList(data, callback) {
|
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
// 获取页面分组列表
|
|
39
|
-
export var getPageGroupList = function getPageGroupList(data, callback) {
|
|
39
|
+
export var getPageGroupList = function getPageGroupList(data, callback, loadingCallback) {
|
|
40
|
+
loadingCallback && loadingCallback(true);
|
|
40
41
|
ajax(api.getPageGroup, {
|
|
41
42
|
method: 'post',
|
|
42
43
|
data: data
|
|
@@ -54,6 +55,8 @@ export var getPageGroupList = function getPageGroupList(data, callback) {
|
|
|
54
55
|
name: '全部页面组'
|
|
55
56
|
});
|
|
56
57
|
callback(list);
|
|
58
|
+
}).finally(function () {
|
|
59
|
+
loadingCallback && loadingCallback(false);
|
|
57
60
|
});
|
|
58
61
|
};
|
|
59
62
|
|
|
@@ -84,7 +87,7 @@ export var onDownload = function onDownload(params, currentApp) {
|
|
|
84
87
|
method: 'post',
|
|
85
88
|
data: _objectSpread({
|
|
86
89
|
appId: currentApp.appId,
|
|
87
|
-
platform:
|
|
90
|
+
platform: 3
|
|
88
91
|
}, params),
|
|
89
92
|
responseType: 'blob',
|
|
90
93
|
fileName: '页面列表',
|
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.3",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"start": "dumi dev",
|
|
6
6
|
"docs:build": "dumi build",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"prettier": "^2.2.1",
|
|
51
51
|
"yorkie": "^2.0.0"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "d0b4bcb08f0d51b7d891d84c3f0b12fd466f44a5"
|
|
54
54
|
}
|
|
@@ -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
|
-
}];
|