@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
|
@@ -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,12 +1,12 @@
|
|
|
1
|
-
import { SelectProps } from 'antd';
|
|
2
1
|
import { ModulesPageTypes } from '../../modules/home/types';
|
|
3
2
|
export declare namespace GroupModalType {
|
|
4
3
|
interface Props {
|
|
5
4
|
value?: ModulesPageTypes.PageGroup;
|
|
5
|
+
onOk?: () => void;
|
|
6
|
+
onCancel?: () => void;
|
|
6
7
|
}
|
|
7
8
|
interface ItemProps {
|
|
8
9
|
value?: ModulesPageTypes.ItemValue[];
|
|
9
|
-
defaultOption?: SelectProps['options'];
|
|
10
10
|
validate?: boolean;
|
|
11
11
|
onChange?: (data: ModulesPageTypes.ItemValue[]) => void;
|
|
12
12
|
}
|
|
@@ -6,18 +6,12 @@ export var getPageEsData = function getPageEsData(searchValue, callback, appId,
|
|
|
6
6
|
data: {
|
|
7
7
|
appId: appId,
|
|
8
8
|
platform: platform || 0,
|
|
9
|
-
|
|
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
|
};
|
|
@@ -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;
|
|
@@ -6,12 +6,12 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
6
6
|
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
7
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
8
|
import { Form, Skeleton } from 'antd';
|
|
9
|
-
import React, {
|
|
9
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
10
10
|
import "./index.less";
|
|
11
|
-
import { BizAttrConditionGroup,
|
|
11
|
+
import { BizAttrConditionGroup, BizUserGroup, IconFont } from '@zgfe/business-lib';
|
|
12
12
|
import PageSelect from "../pageSelect";
|
|
13
13
|
import { formValue, formatValue } from "./util";
|
|
14
|
-
var SearchPanel = function
|
|
14
|
+
var SearchPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
15
15
|
var classPrefix = 'page-search-panel';
|
|
16
16
|
// form 值
|
|
17
17
|
var _Form$useForm = Form.useForm(),
|
|
@@ -33,11 +33,9 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
33
33
|
count = _useState6[0],
|
|
34
34
|
setCount = _useState6[1];
|
|
35
35
|
var groupRef = useRef(null);
|
|
36
|
-
var _useContext = useContext(BizGlobalDataContext),
|
|
37
|
-
userGroupList = _useContext.userGroupList;
|
|
38
36
|
useEffect(function () {
|
|
39
37
|
var _data$filters;
|
|
40
|
-
var data = formValue(props.value
|
|
38
|
+
var data = formValue(props.value);
|
|
41
39
|
setCount(((_data$filters = data.filters) === null || _data$filters === void 0 ? void 0 : _data$filters.conditions.length) || 0);
|
|
42
40
|
setFormData(data);
|
|
43
41
|
setTimeout(function () {
|
|
@@ -53,7 +51,6 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
53
51
|
*/
|
|
54
52
|
var onChange = function onChange(_changedValues, allValues) {
|
|
55
53
|
setFormData(allValues);
|
|
56
|
-
console.log(formatValue(allValues), 'onChange allValues');
|
|
57
54
|
props.onChange && props.onChange(formatValue(allValues));
|
|
58
55
|
};
|
|
59
56
|
var onAdd = function onAdd() {
|
|
@@ -89,6 +86,8 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
89
86
|
className: "".concat(classPrefix, "-item"),
|
|
90
87
|
key: field.key
|
|
91
88
|
}), /*#__PURE__*/React.createElement(BizUserGroup, {
|
|
89
|
+
enableTags: true,
|
|
90
|
+
enableDelete: fields.length > 1,
|
|
92
91
|
onDelete: function onDelete() {
|
|
93
92
|
return remove(index);
|
|
94
93
|
}
|
|
@@ -102,7 +101,9 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
102
101
|
className: "biz-icon",
|
|
103
102
|
type: 'tianjia1'
|
|
104
103
|
}), "\u6DFB\u52A0\u7528\u6237\u7FA4"));
|
|
105
|
-
}), /*#__PURE__*/React.createElement(
|
|
104
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
105
|
+
ref: ref
|
|
106
|
+
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
106
107
|
className: "".concat(classPrefix, "-title")
|
|
107
108
|
}, " \u9875\u9762 "), /*#__PURE__*/React.createElement(Form.Item, {
|
|
108
109
|
className: "".concat(classPrefix, "-item2"),
|
|
@@ -118,6 +119,6 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
118
119
|
onlyAnd: true,
|
|
119
120
|
enableDelete: true,
|
|
120
121
|
onConditionsCount: setCount
|
|
121
|
-
})))));
|
|
122
|
-
};
|
|
122
|
+
}))))));
|
|
123
|
+
});
|
|
123
124
|
export default SearchPanel;
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
&-item3:not(.page-search-panel-hidden) {
|
|
42
|
+
&-item3.ant-form-item:not(.page-search-panel-hidden) {
|
|
43
43
|
margin-bottom: 20px;
|
|
44
44
|
padding: 4px 24px;
|
|
45
45
|
&:hover {
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
&-item2 {
|
|
51
|
-
margin-bottom: 4px;
|
|
50
|
+
&-item2.ant-form-item {
|
|
51
|
+
margin-bottom: 4px !important;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
&-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
|
};
|
|
@@ -1,47 +1,51 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
|
-
|
|
2
|
+
import { OperateTypes } from '@zgfe/business-lib/es/attrConditions/types';
|
|
3
|
+
export var formValue = function formValue(source) {
|
|
3
4
|
var data = _.cloneDeep(source) || {};
|
|
4
|
-
|
|
5
|
-
var result = [];
|
|
6
|
-
if (data.userGroup && data.userGroup.length) {
|
|
7
|
-
userGroupList === null || userGroupList === void 0 ? void 0 : userGroupList.forEach(function (user) {
|
|
8
|
-
var _data$userGroup;
|
|
9
|
-
if ((_data$userGroup = data.userGroup) !== null && _data$userGroup !== void 0 && _data$userGroup.includes(user.id)) {
|
|
10
|
-
result.push(user);
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
} else {
|
|
14
|
-
result = userGroupList ? [userGroupList[0]] : [{
|
|
15
|
-
id: 0,
|
|
16
|
-
name: '所有用户'
|
|
17
|
-
}];
|
|
18
|
-
}
|
|
19
|
-
var page = {
|
|
20
|
-
type: 'page',
|
|
5
|
+
var page = !data.pageUrl && !data.pageTitle && !data.pageGroup && data.pageGroup != 0 ? undefined : {
|
|
21
6
|
pageGroup: data === null || data === void 0 ? void 0 : data.pageGroup,
|
|
22
7
|
pageUrl: data === null || data === void 0 ? void 0 : data.pageUrl,
|
|
23
8
|
pageTitle: data === null || data === void 0 ? void 0 : data.pageTitle
|
|
24
9
|
};
|
|
25
10
|
return {
|
|
26
|
-
userGroup:
|
|
11
|
+
userGroup: data.userGroup || [0],
|
|
27
12
|
page: page,
|
|
28
13
|
filters: data.filters
|
|
29
14
|
};
|
|
30
15
|
};
|
|
31
16
|
export var formatValue = function formatValue(source) {
|
|
32
|
-
var _data$
|
|
17
|
+
var _data$page, _data$page2, _data$page3;
|
|
33
18
|
var data = _.cloneDeep(source) || {};
|
|
34
|
-
var
|
|
35
|
-
(_data$userGroup2 = data.userGroup) === null || _data$userGroup2 === void 0 ? void 0 : _data$userGroup2.forEach(function (item) {
|
|
36
|
-
if (item) {
|
|
37
|
-
group.push(item.id);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
19
|
+
var filters = getConditionList(data.filters);
|
|
40
20
|
return {
|
|
41
|
-
userGroup:
|
|
21
|
+
userGroup: data.userGroup || [0],
|
|
42
22
|
pageTitle: (_data$page = data.page) === null || _data$page === void 0 ? void 0 : _data$page.pageTitle,
|
|
43
23
|
pageUrl: (_data$page2 = data.page) === null || _data$page2 === void 0 ? void 0 : _data$page2.pageUrl,
|
|
44
24
|
pageGroup: (_data$page3 = data.page) === null || _data$page3 === void 0 ? void 0 : _data$page3.pageGroup,
|
|
45
|
-
filters:
|
|
25
|
+
filters: filters
|
|
46
26
|
};
|
|
47
|
-
};
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* 筛选条件当未选择值时,不查询
|
|
31
|
+
* @param filters 筛选条件数组
|
|
32
|
+
* @returns
|
|
33
|
+
*/
|
|
34
|
+
function getConditionList(filters) {
|
|
35
|
+
if (!filters || !filters.conditions) return;
|
|
36
|
+
var conditionList = [];
|
|
37
|
+
filters.conditions.forEach(function (item) {
|
|
38
|
+
if (!item.attrId && !item.attrName) return;
|
|
39
|
+
if (!item.values || !item.values.length) {
|
|
40
|
+
if (item.operator === OperateTypes.IsNotNull || item.operator === OperateTypes.IsNull) {
|
|
41
|
+
conditionList.push(item);
|
|
42
|
+
}
|
|
43
|
+
} else {
|
|
44
|
+
conditionList.push(item);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
return conditionList.length ? {
|
|
48
|
+
conditions: conditionList,
|
|
49
|
+
relation: 'and'
|
|
50
|
+
} : undefined;
|
|
51
|
+
}
|
|
@@ -28,6 +28,8 @@ var EmptyPanel = function EmptyPanel() {
|
|
|
28
28
|
}, /*#__PURE__*/React.createElement("div", {
|
|
29
29
|
className: "".concat(classPrefix, "-title")
|
|
30
30
|
}, "\u9875\u9762\u70B9\u51FB\u5206\u6790"), /*#__PURE__*/React.createElement("p", null, "\u9875\u9762\u7684\u70B9\u51FB\u6548\u679C\u5C55\u793A\uFF0C\u53EF\u4EE5\u66F4\u52A0\u76F4\u89C2\u7684\u770B\u51FA\u9875\u9762\u4E2D\u70B9\u51FB\u7684\u5206\u5E03\u60C5\u51B5"), /*#__PURE__*/React.createElement("div", {
|
|
31
|
+
className: "".concat(classPrefix, "-content2")
|
|
32
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
31
33
|
className: "".concat(classPrefix, "-title-secondary")
|
|
32
34
|
}, "\u8BBE\u7F6E\u65B9\u6CD5"), /*#__PURE__*/React.createElement("p", null, "\u70B9\u51FB\u5206\u6790\u6570\u636E\u9ED8\u8BA4\u4E3A\u4E0D\u91C7\u96C6\uFF0C\u5982\u9700\u91C7\u96C6\uFF0C\u53EF\u5728\u76F8\u5E94\u9875\u9762\u7684SDK\u4EE3\u7801\u4E2D\u52A0\u5165\u4EE5\u4E0B\u53C2\u6570\u914D\u7F6E"), /*#__PURE__*/React.createElement("div", {
|
|
33
35
|
className: "".concat(classPrefix, "-code-container")
|
|
@@ -40,7 +42,7 @@ var EmptyPanel = function EmptyPanel() {
|
|
|
40
42
|
className: "".concat(classPrefix, "-code")
|
|
41
43
|
}, "autoTrack: true,", /*#__PURE__*/React.createElement("span", null, "//\u5168\u57CB\u70B9\u5F00\u5173")), /*#__PURE__*/React.createElement("div", {
|
|
42
44
|
className: "".concat(classPrefix, "-code")
|
|
43
|
-
}, "singlePage: false", /*#__PURE__*/React.createElement("span", null, "//\u662F\u5426\u4E3A\u5355\u9875\u9762\u5E94\u7528 \u9ED8\u8BA4\u4E3Afalse")), /*#__PURE__*/React.createElement("div", null, '}', ");")), /*#__PURE__*/React.createElement("p", null, "\u9002\u7528\u4E8ELanding Page\u3001\u6D3B\u52A8\u9875\u3001\u5B98\u7F51\uFF0C\u9875\u9762\u7B80\u5355\u53EF\u4F7F\u7528\u9875\u9762\u70B9\u51FB\u5206\u6790\u63D0\u5347\u6548\u7387\uFF0C\u5EFA\u8BAE\u4E0D\u8981\u5728\u590D\u6742\u9875\u9762\u4F7F\u7528\u3002")), /*#__PURE__*/React.createElement("img", {
|
|
45
|
+
}, "singlePage: false", /*#__PURE__*/React.createElement("span", null, "//\u662F\u5426\u4E3A\u5355\u9875\u9762\u5E94\u7528 \u9ED8\u8BA4\u4E3Afalse")), /*#__PURE__*/React.createElement("div", null, '}', ");")), /*#__PURE__*/React.createElement("p", null, "\u9002\u7528\u4E8ELanding Page\u3001\u6D3B\u52A8\u9875\u3001\u5B98\u7F51\uFF0C\u9875\u9762\u7B80\u5355\u53EF\u4F7F\u7528\u9875\u9762\u70B9\u51FB\u5206\u6790\u63D0\u5347\u6548\u7387\uFF0C\u5EFA\u8BAE\u4E0D\u8981\u5728\u590D\u6742\u9875\u9762\u4F7F\u7528\u3002"))), /*#__PURE__*/React.createElement("img", {
|
|
44
46
|
className: "".concat(classPrefix, "-img"),
|
|
45
47
|
src: chartImg
|
|
46
48
|
}));
|
|
@@ -9,13 +9,16 @@
|
|
|
9
9
|
background: url(./img/bg.png);
|
|
10
10
|
background-size: cover;
|
|
11
11
|
&-content {
|
|
12
|
-
width:
|
|
12
|
+
width: 406px;
|
|
13
13
|
margin-left: 136px;
|
|
14
14
|
p {
|
|
15
15
|
color: #9aa1a9;
|
|
16
16
|
font-size: 14px;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
+
&-content2 {
|
|
20
|
+
width: 400px;
|
|
21
|
+
}
|
|
19
22
|
&-title {
|
|
20
23
|
margin-bottom: 24px;
|
|
21
24
|
font-weight: 500;
|
|
@@ -32,7 +35,7 @@
|
|
|
32
35
|
position: relative;
|
|
33
36
|
height: 200px;
|
|
34
37
|
padding: 16px;
|
|
35
|
-
background: #
|
|
38
|
+
background: #fafafb;
|
|
36
39
|
border-radius: 8px;
|
|
37
40
|
|
|
38
41
|
&:hover {
|
|
@@ -57,12 +60,11 @@
|
|
|
57
60
|
}
|
|
58
61
|
&-code-copy {
|
|
59
62
|
position: absolute;
|
|
60
|
-
top:
|
|
61
|
-
right:
|
|
63
|
+
top: 16px;
|
|
64
|
+
right: 16px;
|
|
62
65
|
display: flex;
|
|
63
66
|
display: none;
|
|
64
67
|
align-items: center;
|
|
65
|
-
align-items: center;
|
|
66
68
|
height: 24px;
|
|
67
69
|
padding: 0 8px;
|
|
68
70
|
background: #f2f3f4;
|