@zgfe/modules-page 1.0.1-alpha.18 → 1.0.1-alpha.19
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.
|
@@ -6,9 +6,9 @@ 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
14
|
var SearchPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
@@ -33,11 +33,9 @@ var SearchPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
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 () {
|
|
@@ -1,4 +1,4 @@
|
|
|
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;
|
|
@@ -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,6 +1,6 @@
|
|
|
1
|
-
import { AttrConditionTypes
|
|
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
5
|
userGroup: (number | string[])[];
|
|
6
6
|
pageTitle: string | undefined;
|
|
@@ -1,23 +1,7 @@
|
|
|
1
|
-
import { util } from '@zgfe/business-lib';
|
|
2
1
|
import _ from 'lodash';
|
|
3
2
|
import { OperateTypes } from '@zgfe/business-lib/es/attrConditions/types';
|
|
4
|
-
export var formValue = function formValue(source
|
|
3
|
+
export var formValue = function formValue(source) {
|
|
5
4
|
var data = _.cloneDeep(source) || {};
|
|
6
|
-
// 用户群变形
|
|
7
|
-
var result = [];
|
|
8
|
-
if (data.userGroup && data.userGroup.length) {
|
|
9
|
-
userGroupList === null || userGroupList === void 0 ? void 0 : userGroupList.forEach(function (user) {
|
|
10
|
-
var _data$userGroup;
|
|
11
|
-
if ((_data$userGroup = data.userGroup) !== null && _data$userGroup !== void 0 && _data$userGroup.includes(user.id)) {
|
|
12
|
-
result.push(user);
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
} else {
|
|
16
|
-
result = userGroupList ? [userGroupList[0]] : [{
|
|
17
|
-
id: 0,
|
|
18
|
-
name: '所有用户'
|
|
19
|
-
}];
|
|
20
|
-
}
|
|
21
5
|
var page = {
|
|
22
6
|
type: 'page',
|
|
23
7
|
pageGroup: data === null || data === void 0 ? void 0 : data.pageGroup,
|
|
@@ -25,42 +9,17 @@ export var formValue = function formValue(source, userGroupList) {
|
|
|
25
9
|
pageTitle: data === null || data === void 0 ? void 0 : data.pageTitle
|
|
26
10
|
};
|
|
27
11
|
return {
|
|
28
|
-
userGroup:
|
|
12
|
+
userGroup: data.userGroup || [0],
|
|
29
13
|
page: page,
|
|
30
14
|
filters: data.filters
|
|
31
15
|
};
|
|
32
16
|
};
|
|
33
17
|
export var formatValue = function formatValue(source) {
|
|
34
|
-
var _data$
|
|
18
|
+
var _data$page, _data$page2, _data$page3;
|
|
35
19
|
var data = _.cloneDeep(source) || {};
|
|
36
|
-
var
|
|
37
|
-
(_data$userGroup2 = data.userGroup) === null || _data$userGroup2 === void 0 ? void 0 : _data$userGroup2.forEach(function (item) {
|
|
38
|
-
if (util.isArray(item)) {
|
|
39
|
-
var childGroup = [];
|
|
40
|
-
item.forEach(function (cItem) {
|
|
41
|
-
var name = '';
|
|
42
|
-
if (!cItem || !cItem.length) return;
|
|
43
|
-
name = "".concat(cItem[1].id, ":").concat(cItem[2].layerLabelId);
|
|
44
|
-
childGroup.push(name);
|
|
45
|
-
});
|
|
46
|
-
group.push(childGroup);
|
|
47
|
-
} else {
|
|
48
|
-
if (!item) return;
|
|
49
|
-
group.push(item.id);
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
var filters = undefined;
|
|
53
|
-
if (data.filters) {
|
|
54
|
-
var conditions = getConditionList(data.filters.conditions);
|
|
55
|
-
if (conditions) {
|
|
56
|
-
filters = {
|
|
57
|
-
conditions: conditions,
|
|
58
|
-
relation: 'and'
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
}
|
|
20
|
+
var filters = getConditionList(data.filters);
|
|
62
21
|
return {
|
|
63
|
-
userGroup:
|
|
22
|
+
userGroup: data.userGroup || [0],
|
|
64
23
|
pageTitle: (_data$page = data.page) === null || _data$page === void 0 ? void 0 : _data$page.pageTitle,
|
|
65
24
|
pageUrl: (_data$page2 = data.page) === null || _data$page2 === void 0 ? void 0 : _data$page2.pageUrl,
|
|
66
25
|
pageGroup: (_data$page3 = data.page) === null || _data$page3 === void 0 ? void 0 : _data$page3.pageGroup,
|
|
@@ -70,13 +29,13 @@ export var formatValue = function formatValue(source) {
|
|
|
70
29
|
|
|
71
30
|
/**
|
|
72
31
|
* 筛选条件当未选择值时,不查询
|
|
73
|
-
* @param
|
|
32
|
+
* @param filters 筛选条件数组
|
|
74
33
|
* @returns
|
|
75
34
|
*/
|
|
76
|
-
function getConditionList(
|
|
77
|
-
if (!
|
|
35
|
+
function getConditionList(filters) {
|
|
36
|
+
if (!filters || !filters.conditions) return;
|
|
78
37
|
var conditionList = [];
|
|
79
|
-
|
|
38
|
+
filters.conditions.forEach(function (item) {
|
|
80
39
|
if (!item.attrId && !item.attrName) return;
|
|
81
40
|
if (!item.values || !item.values.length) {
|
|
82
41
|
if (item.operator === OperateTypes.IsNotNull || item.operator === OperateTypes.IsNull) {
|
|
@@ -86,5 +45,8 @@ function getConditionList(condition) {
|
|
|
86
45
|
conditionList.push(item);
|
|
87
46
|
}
|
|
88
47
|
});
|
|
89
|
-
return conditionList.length ?
|
|
48
|
+
return conditionList.length ? {
|
|
49
|
+
conditions: conditionList,
|
|
50
|
+
relation: 'and'
|
|
51
|
+
} : undefined;
|
|
90
52
|
}
|
|
@@ -37,6 +37,6 @@ export declare namespace ModulesPageTypes {
|
|
|
37
37
|
export declare const ModulesPageContext: import("react").Context<{
|
|
38
38
|
pageList: ModulesPageTypes.Page[];
|
|
39
39
|
pageGroupList: ModulesPageTypes.PageGroup[];
|
|
40
|
-
currentClickPage?: ModulesPageTypes.
|
|
40
|
+
currentClickPage?: ModulesPageTypes.Page | ModulesPageTypes.PageGroup | undefined;
|
|
41
41
|
setCurrentClickPage?: ((data: ModulesPageTypes.Page) => void) | undefined;
|
|
42
42
|
}>;
|
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.19",
|
|
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.7",
|
|
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": "9b3a155c02d5b57ae51663062fc6a6aa33a571c0"
|
|
54
54
|
}
|