@zw-team/react-lib 1.0.4 → 1.0.5-beta.1
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/components/Block/Block.css +18 -0
- package/dist/components/ConfigProvider/ConfigProvider.js +1 -1
- package/dist/components/ConfigProvider/types.d.ts +1 -0
- package/dist/components/Form/Form.js +2 -1
- package/dist/components/FormItem/FormItem.css +92 -3
- package/dist/components/SearchBlock/SearchBlock.d.ts +4 -0
- package/dist/components/SearchBlock/SearchBlock.js +22 -0
- package/dist/components/SearchBlock/index.d.ts +2 -0
- package/dist/components/SearchBlock/index.js +2 -0
- package/dist/components/SearchBlock/types.d.ts +13 -0
- package/dist/components/SearchBlock/types.js +0 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/utils/request/index.d.ts +2 -0
- package/dist/utils/request/index.js +14 -2
- package/dist/utils/svgIcon/index.d.ts +2 -2
- package/dist/utils/svgIcon/index.js +10 -8
- package/package.json +1 -1
|
@@ -6,3 +6,21 @@
|
|
|
6
6
|
.block-box + .block-box {
|
|
7
7
|
margin-top: 15px;
|
|
8
8
|
}
|
|
9
|
+
|
|
10
|
+
.search-block-box {
|
|
11
|
+
padding: 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.search-block-box .block-content {
|
|
15
|
+
padding: 16px 20px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.search-block-box .block-footer {
|
|
19
|
+
box-shadow: 0 -1px 0 0 #e5e6eb;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.search-block-box .block-footer:empty {
|
|
23
|
+
padding: 0;
|
|
24
|
+
margin-top: 0;
|
|
25
|
+
box-shadow: none;
|
|
26
|
+
}
|
|
@@ -33,7 +33,7 @@ const ConfigProvider_ConfigProvider_ConfigProvider = ({ children, antdConfig, ..
|
|
|
33
33
|
js_cookie.set('$BiEnv', contextValue.env);
|
|
34
34
|
js_cookie.set('$BiSystem', contextValue.system);
|
|
35
35
|
initProdEnvWarning(contextValue.env || 'production');
|
|
36
|
-
loadSvg(contextValue.system, contextValue.env || 'production');
|
|
36
|
+
loadSvg(contextValue.system, contextValue.env || 'production', contextValue.mainOrigin);
|
|
37
37
|
if (contextValue.needIcon) loadIconMock(contextValue.env || 'production', (data)=>{
|
|
38
38
|
updateConfig({
|
|
39
39
|
iconList: data.data,
|
|
@@ -2,13 +2,14 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import "./Form.css";
|
|
3
3
|
import { Form } from "antd";
|
|
4
4
|
const BaseForm = (props)=>{
|
|
5
|
-
const { form: externalForm, children, ...rest } = props;
|
|
5
|
+
const { form: externalForm, children, layout = 'inline', ...rest } = props;
|
|
6
6
|
const [internalForm] = Form.useForm();
|
|
7
7
|
const form = externalForm ?? internalForm;
|
|
8
8
|
return /*#__PURE__*/ jsx("div", {
|
|
9
9
|
className: "search-form",
|
|
10
10
|
children: /*#__PURE__*/ jsx(Form, {
|
|
11
11
|
form: form,
|
|
12
|
+
layout: layout,
|
|
12
13
|
...rest,
|
|
13
14
|
children: children
|
|
14
15
|
})
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
box-sizing: border-box;
|
|
5
|
-
min-width:
|
|
5
|
+
min-width: 352px;
|
|
6
6
|
padding: 0 16px 16px 0;
|
|
7
|
+
margin: 0;
|
|
8
|
+
flex: 0 0 auto;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
.search-item .search-item-label {
|
|
@@ -13,6 +15,10 @@
|
|
|
13
15
|
display: flex;
|
|
14
16
|
align-items: center;
|
|
15
17
|
justify-content: flex-end;
|
|
18
|
+
flex-shrink: 0;
|
|
19
|
+
margin: 0;
|
|
20
|
+
max-height: 32px;
|
|
21
|
+
overflow: hidden;
|
|
16
22
|
}
|
|
17
23
|
|
|
18
24
|
.search-item .ant-form-item {
|
|
@@ -21,18 +27,101 @@
|
|
|
21
27
|
|
|
22
28
|
.search-item .search-label-select {
|
|
23
29
|
padding-right: 0;
|
|
30
|
+
margin-right: -1px;
|
|
24
31
|
}
|
|
25
32
|
|
|
26
33
|
.search-item .search-item-content {
|
|
27
34
|
flex: 1;
|
|
35
|
+
flex-grow: 1;
|
|
36
|
+
min-width: 0;
|
|
28
37
|
}
|
|
29
38
|
|
|
30
|
-
.search-item .ant-select
|
|
39
|
+
.search-item .ant-select,
|
|
40
|
+
.search-item .ant-input-affix-wrapper,
|
|
41
|
+
.search-item .ant-picker,
|
|
42
|
+
.search-item .ant-cascader,
|
|
43
|
+
.search-item .ant-cascader-picker,
|
|
44
|
+
.search-item .search-item-content > * {
|
|
31
45
|
width: 100%;
|
|
32
46
|
}
|
|
33
47
|
|
|
34
48
|
.search-item-button {
|
|
35
49
|
width: 100%;
|
|
36
50
|
flex-shrink: 0;
|
|
37
|
-
|
|
51
|
+
padding-bottom: 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.search-item-button .search-item-content {
|
|
55
|
+
width: 100%;
|
|
56
|
+
padding-left: 96px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.search-form .search-item:last-child {
|
|
60
|
+
width: 100%;
|
|
61
|
+
padding-bottom: 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.hideSidebar .search-form .search-item-button,
|
|
65
|
+
.openSidebar .search-form .search-item-button,
|
|
66
|
+
.search-form .search-item-button,
|
|
67
|
+
.hideSidebar .search-form .search-item:last-child,
|
|
68
|
+
.openSidebar .search-form .search-item:last-child {
|
|
69
|
+
width: 100%;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@media screen and (max-width: 1285px) {
|
|
73
|
+
.hideSidebar .search-form .search-item {
|
|
74
|
+
width: 50%;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@media screen and (min-width: 1186px) {
|
|
79
|
+
.hideSidebar .search-form .search-item {
|
|
80
|
+
width: 33.3%;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@media screen and (min-width: 1538px) {
|
|
85
|
+
.hideSidebar .search-form .search-item {
|
|
86
|
+
width: 25%;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@media screen and (min-width: 1890px) {
|
|
91
|
+
.hideSidebar .search-form .search-item {
|
|
92
|
+
width: 20%;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@media screen and (max-width: 1345px) {
|
|
97
|
+
.openSidebar .search-form .search-item {
|
|
98
|
+
width: 50%;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
@media screen and (min-width: 1346px) {
|
|
103
|
+
.openSidebar .search-form .search-item {
|
|
104
|
+
width: 33.3%;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@media screen and (min-width: 1698px) {
|
|
109
|
+
.openSidebar .search-form .search-item {
|
|
110
|
+
width: 25%;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@media screen and (min-width: 2050px) {
|
|
115
|
+
.openSidebar .search-form .search-item {
|
|
116
|
+
width: 20%;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@media screen {
|
|
121
|
+
.hideSidebar .search-form .search-item-button,
|
|
122
|
+
.openSidebar .search-form .search-item-button,
|
|
123
|
+
.hideSidebar .search-form .search-item:last-child,
|
|
124
|
+
.openSidebar .search-form .search-item:last-child {
|
|
125
|
+
width: 100%;
|
|
126
|
+
}
|
|
38
127
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { classNames } from "../../utils/classNames.js";
|
|
3
|
+
import "../Block/Block.css";
|
|
4
|
+
const SearchBlock = (props)=>{
|
|
5
|
+
const { children, footer, className, style, contentClassName, footerClassName } = props;
|
|
6
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
7
|
+
className: classNames('block-box search-block-box', className),
|
|
8
|
+
style: style,
|
|
9
|
+
children: [
|
|
10
|
+
/*#__PURE__*/ jsx("div", {
|
|
11
|
+
className: classNames('block-content', contentClassName),
|
|
12
|
+
children: children
|
|
13
|
+
}),
|
|
14
|
+
/*#__PURE__*/ jsx("div", {
|
|
15
|
+
className: classNames('block-footer', footerClassName),
|
|
16
|
+
children: footer
|
|
17
|
+
})
|
|
18
|
+
]
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
const SearchBlock_SearchBlock = SearchBlock;
|
|
22
|
+
export { SearchBlock_SearchBlock as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface SearchBlockProps {
|
|
2
|
+
children: React.ReactNode;
|
|
3
|
+
/** 底部视图区域,用于承载筛选区下方的自定义视图组件 */
|
|
4
|
+
footer?: React.ReactNode;
|
|
5
|
+
/** 额外 className */
|
|
6
|
+
className?: string;
|
|
7
|
+
/** 额外 style */
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
/** 内容区额外 className */
|
|
10
|
+
contentClassName?: string;
|
|
11
|
+
/** 底部区额外 className */
|
|
12
|
+
footerClassName?: string;
|
|
13
|
+
}
|
|
File without changes
|
|
@@ -22,6 +22,7 @@ export * from './NavbarTool';
|
|
|
22
22
|
export * from './NoticeCenter';
|
|
23
23
|
export * from './Pagination';
|
|
24
24
|
export { default as ResponseInterceptor } from './ResponseInterceptor';
|
|
25
|
+
export * from './SearchBlock';
|
|
25
26
|
export * from './SuperDate';
|
|
26
27
|
export * from './SystemLink';
|
|
27
28
|
export * from './Table';
|
package/dist/components/index.js
CHANGED
|
@@ -20,6 +20,7 @@ export * from "./MoreButton/index.js";
|
|
|
20
20
|
export * from "./NavbarTool/index.js";
|
|
21
21
|
export * from "./NoticeCenter/index.js";
|
|
22
22
|
export * from "./Pagination/index.js";
|
|
23
|
+
export * from "./SearchBlock/index.js";
|
|
23
24
|
export * from "./SuperDate/index.js";
|
|
24
25
|
export * from "./SystemLink/index.js";
|
|
25
26
|
export * from "./Table/index.js";
|
|
@@ -5,9 +5,21 @@ var request_SystemType = /*#__PURE__*/ function(SystemType) {
|
|
|
5
5
|
SystemType["OTHER"] = "other";
|
|
6
6
|
return SystemType;
|
|
7
7
|
}({});
|
|
8
|
+
function isAbsoluteUrl(url) {
|
|
9
|
+
return /^https?:\/\//i.test(url);
|
|
10
|
+
}
|
|
11
|
+
function joinUrl(origin, path) {
|
|
12
|
+
const normalizedOrigin = origin.replace(/\/$/, '');
|
|
13
|
+
const normalizedPath = path.startsWith('/') ? path : `/${path}`;
|
|
14
|
+
return `${normalizedOrigin}${normalizedPath}`;
|
|
15
|
+
}
|
|
16
|
+
function resolveBaseUrl(baseUrl, mainOrigin) {
|
|
17
|
+
if (!mainOrigin || isAbsoluteUrl(baseUrl)) return baseUrl;
|
|
18
|
+
return joinUrl(mainOrigin, baseUrl);
|
|
19
|
+
}
|
|
8
20
|
function request(config) {
|
|
9
|
-
const { env = 'production', system, api, data = {}, headers = {} } = config;
|
|
10
|
-
const baseUrl = getServiceURL(void 0, env);
|
|
21
|
+
const { env = 'production', system, api, data = {}, headers = {}, mainOrigin } = config;
|
|
22
|
+
const baseUrl = resolveBaseUrl(getServiceURL(void 0, env), mainOrigin);
|
|
11
23
|
if ("zq" === system) {
|
|
12
24
|
const defaultHeaders = {
|
|
13
25
|
Authkey: 'authtpe84dzfl3iq62'
|
|
@@ -32,13 +32,13 @@ export type LoadIconCallback = (data: IconListResponse['data']) => void;
|
|
|
32
32
|
* @param character 图标字符
|
|
33
33
|
* @param env 环境参数
|
|
34
34
|
*/
|
|
35
|
-
export declare function loadSvg(character: string, env: string): void;
|
|
35
|
+
export declare function loadSvg(character: string, env: string, mainOrigin?: string): void;
|
|
36
36
|
/**
|
|
37
37
|
* 加载图标列表
|
|
38
38
|
* @param env 环境参数
|
|
39
39
|
* @param callback 加载完成回调函数
|
|
40
40
|
*/
|
|
41
|
-
export declare function loadIcon(env: string, callback: LoadIconCallback): void;
|
|
41
|
+
export declare function loadIcon(env: string, callback: LoadIconCallback, mainOrigin?: string): void;
|
|
42
42
|
/**
|
|
43
43
|
* 加载图标列表-mock
|
|
44
44
|
* @param env 环境参数
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import request from "../request/index.js";
|
|
2
|
-
function getIconUrl(character, env) {
|
|
2
|
+
function getIconUrl(character, env, mainOrigin) {
|
|
3
3
|
return request({
|
|
4
4
|
env,
|
|
5
5
|
system: 'zq',
|
|
6
6
|
api: '/data/system/getInfo',
|
|
7
7
|
data: {
|
|
8
8
|
character
|
|
9
|
-
}
|
|
9
|
+
},
|
|
10
|
+
mainOrigin
|
|
10
11
|
});
|
|
11
12
|
}
|
|
12
|
-
function getIconList(env) {
|
|
13
|
+
function getIconList(env, mainOrigin) {
|
|
13
14
|
return request({
|
|
14
15
|
env,
|
|
15
16
|
system: 'zq',
|
|
16
|
-
api: '/api/icon/list'
|
|
17
|
+
api: '/api/icon/list',
|
|
18
|
+
mainOrigin
|
|
17
19
|
});
|
|
18
20
|
}
|
|
19
21
|
function loadScript(url) {
|
|
@@ -21,16 +23,16 @@ function loadScript(url) {
|
|
|
21
23
|
script.src = url;
|
|
22
24
|
document.head.appendChild(script);
|
|
23
25
|
}
|
|
24
|
-
function loadSvg(character, env) {
|
|
25
|
-
getIconUrl(character, env).then((res)=>{
|
|
26
|
+
function loadSvg(character, env, mainOrigin) {
|
|
27
|
+
getIconUrl(character, env, mainOrigin).then((res)=>{
|
|
26
28
|
loadScript('https://lf1-cdn-tos.bytegoofy.com/obj/iconpark/svg_27771_3.b32c3fc4f408b5328f0e67954786ee1f.js');
|
|
27
29
|
if (1 === res.status_code && res.data.icon_url) setTimeout(()=>{
|
|
28
30
|
loadScript(res.data.icon_url);
|
|
29
31
|
});
|
|
30
32
|
});
|
|
31
33
|
}
|
|
32
|
-
function loadIcon(env, callback) {
|
|
33
|
-
getIconList(env).then((res)=>{
|
|
34
|
+
function loadIcon(env, callback, mainOrigin) {
|
|
35
|
+
getIconList(env, mainOrigin).then((res)=>{
|
|
34
36
|
if (1 === res.status_code) {
|
|
35
37
|
callback(res.data);
|
|
36
38
|
setTimeout(()=>{
|