@zgfe/modules-page 1.0.1-alpha.1 → 1.0.1-alpha.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/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/index.js +1 -1
- package/dist/esm/modules/home/types.d.ts +1 -1
- package/package.json +2 -3
|
@@ -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
|
};
|
|
@@ -109,7 +109,7 @@ var ModulesPage = function ModulesPage(props) {
|
|
|
109
109
|
if (isEmpty) return;
|
|
110
110
|
if (!searchValue) return;
|
|
111
111
|
console.log('searchValue:', searchValue);
|
|
112
|
-
var type =
|
|
112
|
+
var type = searchValue !== null && searchValue !== void 0 && searchValue.pageGroup || (searchValue === null || searchValue === void 0 ? void 0 : searchValue.pageGroup) === 0 ? 'pageGroup' : 'page';
|
|
113
113
|
setCurrentType(type);
|
|
114
114
|
// 选择概览时,跳到列表页
|
|
115
115
|
if (type === 'page' && !(searchValue !== null && searchValue !== void 0 && searchValue.pageUrl) || type === 'pageGroup' && !(searchValue !== null && searchValue !== void 0 && searchValue.pageGroup)) {
|
|
@@ -33,6 +33,6 @@ export declare namespace ModulesPageTypes {
|
|
|
33
33
|
export declare const ModulesPageContext: import("react").Context<{
|
|
34
34
|
pageList: ModulesPageTypes.Page[];
|
|
35
35
|
pageGroupList: ModulesPageTypes.PageGroup[];
|
|
36
|
-
currentClickPage?: ModulesPageTypes.
|
|
36
|
+
currentClickPage?: ModulesPageTypes.PageGroup | ModulesPageTypes.Page | undefined;
|
|
37
37
|
setCurrentClickPage?: ((data: ModulesPageTypes.Page) => void) | undefined;
|
|
38
38
|
}>;
|
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.2",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"start": "dumi dev",
|
|
6
6
|
"docs:build": "dumi build",
|
|
@@ -49,6 +49,5 @@
|
|
|
49
49
|
"lodash": "^4.17.21",
|
|
50
50
|
"prettier": "^2.2.1",
|
|
51
51
|
"yorkie": "^2.0.0"
|
|
52
|
-
}
|
|
53
|
-
"gitHead": "83eb5d8859328ab65d78573352b4bcd5a23d1d31"
|
|
52
|
+
}
|
|
54
53
|
}
|