@zw-team/react-lib 1.0.5-beta.2 → 1.0.5-beta.4

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.
Files changed (34) hide show
  1. package/dist/components/AccessReport/index.d.ts +7 -5
  2. package/dist/components/AccessReport/index.js +14 -2
  3. package/dist/components/ConfigProvider/ConfigProvider.js +15 -12
  4. package/dist/components/ConfigProvider/types.d.ts +1 -0
  5. package/dist/components/FormItem/FormItem.css +26 -0
  6. package/dist/components/Log/src/Detail.js +8 -6
  7. package/dist/components/Log/src/Detail.scss +2 -1
  8. package/dist/components/Log/src/Log.d.ts +1 -2
  9. package/dist/components/Log/src/Log.js +267 -227
  10. package/dist/components/Log/src/Log.scss +8 -3
  11. package/dist/components/Log/src/useLogTableColumns.d.ts +4 -1
  12. package/dist/components/Log/src/useLogTableColumns.js +21 -7
  13. package/dist/components/Log/types.d.ts +1 -0
  14. package/dist/components/LogButton/LogButton.js +5 -4
  15. package/dist/components/LogButton/logbutton.css +0 -1
  16. package/dist/components/LogButton/types.d.ts +3 -2
  17. package/dist/components/LogDialog/BiLogManager.d.ts +6 -4
  18. package/dist/components/LogDialog/BiLogManager.js +11 -5
  19. package/dist/components/LogDialog/LogDialog.js +133 -74
  20. package/dist/components/LogDialog/LogDialog.scss +10 -1
  21. package/dist/components/LogDialog/types.d.ts +3 -1
  22. package/dist/components/NavbarTool/NavbarTool.js +4 -4
  23. package/dist/components/NavbarTool/types.d.ts +2 -0
  24. package/dist/components/NoticeCenter/NoticeCenter.d.ts +1 -1
  25. package/dist/components/NoticeCenter/NoticeCenter.js +118 -73
  26. package/dist/components/NoticeCenter/noticeCenter.scss +10 -1
  27. package/dist/components/NoticeCenter/types.d.ts +1 -3
  28. package/dist/components/Table/useHeaderPopper.js +13 -5
  29. package/dist/hooks/useAccessReport.js +7 -1
  30. package/dist/package.json +74 -0
  31. package/dist/utils/advisory.d.ts +2 -2
  32. package/dist/utils/advisory.js +7 -2
  33. package/dist/utils/request/index.js +7 -1
  34. package/package.json +2 -2
@@ -1,12 +1,14 @@
1
+ interface AccessReportOptions {
2
+ system?: string;
3
+ authorization?: string;
4
+ env?: string;
5
+ mainOrigin?: string;
6
+ }
1
7
  declare class AccessReport {
2
8
  systemName: string;
3
9
  authorization: string;
4
10
  baseUrl: string;
5
- constructor({ system, authorization, env }: {
6
- system?: string | undefined;
7
- authorization?: string | undefined;
8
- env?: string | undefined;
9
- });
11
+ constructor({ system, authorization, env, mainOrigin, }: AccessReportOptions);
10
12
  report(router: string, page: string | string[]): void;
11
13
  loginReport(): void;
12
14
  accessReportSavev(data: any): Promise<import("axios").AxiosResponse<any, any, {}>>;
@@ -1,13 +1,25 @@
1
1
  import { getServiceURL } from "../../config/index.js";
2
2
  import defaultRequest from "../../utils/request/defaultRequest.js";
3
+ function isAbsoluteUrl(url) {
4
+ return /^https?:\/\//i.test(url);
5
+ }
6
+ function joinUrl(origin, path) {
7
+ const normalizedOrigin = origin.replace(/\/$/, '');
8
+ const normalizedPath = path.startsWith('/') ? path : `/${path}`;
9
+ return `${normalizedOrigin}${normalizedPath}`;
10
+ }
11
+ function resolveBaseUrl(baseUrl, mainOrigin) {
12
+ if (!mainOrigin || isAbsoluteUrl(baseUrl)) return baseUrl;
13
+ return joinUrl(mainOrigin, baseUrl);
14
+ }
3
15
  class AccessReport_AccessReport {
4
16
  systemName = '';
5
17
  authorization = '';
6
18
  baseUrl = 'https://zqapi.wozhangwan.com';
7
- constructor({ system = '', authorization = '', env = 'production' }){
19
+ constructor({ system = '', authorization = '', env = 'production', mainOrigin }){
8
20
  this.systemName = system;
9
21
  this.authorization = authorization;
10
- this.baseUrl = getServiceURL(void 0, env);
22
+ this.baseUrl = resolveBaseUrl(getServiceURL(void 0, env), mainOrigin);
11
23
  }
12
24
  report(router, page) {
13
25
  const params = {
@@ -7,9 +7,20 @@ import { loadIcon, loadSvg } from "../../utils/svgIcon/index.js";
7
7
  import AccessReport from "../AccessReport/index.js";
8
8
  import { ConfigContext, defaultConfig } from "./ConfigContext.js";
9
9
  const ConfigProvider_ConfigProvider_ConfigProvider = ({ children, antdConfig, ...restProps })=>{
10
- const [contextValue, setContextValue] = useState({
11
- ...defaultConfig.contextValue,
12
- ...restProps
10
+ const [contextValue, setContextValue] = useState(()=>{
11
+ const initialValue = {
12
+ ...defaultConfig.contextValue,
13
+ ...restProps
14
+ };
15
+ return {
16
+ ...initialValue,
17
+ componentsKeys: Date.now(),
18
+ $AccessReport: new AccessReport({
19
+ system: initialValue.system,
20
+ env: initialValue.env || 'production',
21
+ mainOrigin: initialValue.mainOrigin
22
+ })
23
+ };
13
24
  });
14
25
  const updateConfig = useCallback((newConfig)=>{
15
26
  setContextValue((prev)=>({
@@ -18,21 +29,13 @@ const ConfigProvider_ConfigProvider_ConfigProvider = ({ children, antdConfig, ..
18
29
  }));
19
30
  }, []);
20
31
  const install = ()=>{
21
- setContextValue((prev)=>({
22
- ...prev,
23
- componentsKeys: Date.now(),
24
- $AccessReport: new AccessReport({
25
- system: prev.system,
26
- env: prev.env || 'production'
27
- })
28
- }));
29
32
  window.$BI = contextValue;
30
33
  window.$AccessReport = contextValue.$AccessReport;
31
34
  window.$BiEnv = contextValue.env;
32
35
  window.$BiSystem = contextValue.system;
33
36
  js_cookie.set('$BiEnv', contextValue.env);
34
37
  js_cookie.set('$BiSystem', contextValue.system);
35
- initProdEnvWarning(contextValue.env || 'production');
38
+ initProdEnvWarning(contextValue.env || 'production', contextValue.showProdEnvWarning);
36
39
  loadSvg(contextValue.system, contextValue.env || 'production', contextValue.mainOrigin);
37
40
  if (contextValue.needIcon) loadIcon(contextValue.env || 'production', (data)=>{
38
41
  updateConfig({
@@ -9,6 +9,7 @@ export interface ContextValue {
9
9
  iconInit: boolean;
10
10
  iconList: Record<string, any>;
11
11
  componentsKeys: string | number;
12
+ showProdEnvWarning?: boolean;
12
13
  $AccessReport?: AccessReport;
13
14
  [key: string]: any;
14
15
  }
@@ -17,6 +17,7 @@
17
17
  justify-content: flex-end;
18
18
  flex-shrink: 0;
19
19
  margin: 0;
20
+ line-height: 16px;
20
21
  max-height: 32px;
21
22
  overflow: hidden;
22
23
  }
@@ -45,6 +46,27 @@
45
46
  width: 100%;
46
47
  }
47
48
 
49
+ .search-item .search-label-select > .ant-select.ant-select-outlined {
50
+ position: relative;
51
+ border-top-right-radius: 0;
52
+ border-bottom-right-radius: 0;
53
+ }
54
+
55
+ .search-item .search-label-select:focus-within {
56
+ z-index: 1;
57
+ }
58
+
59
+ .search-item .search-label-select + .search-item-content .ant-input,
60
+ .search-item
61
+ .search-label-select
62
+ + .search-item-content
63
+ .ant-input-affix-wrapper,
64
+ .search-item .search-label-select + .search-item-content .ant-select-selector,
65
+ .search-item .search-label-select + .search-item-content .ant-picker {
66
+ border-start-start-radius: 0;
67
+ border-end-start-radius: 0;
68
+ }
69
+
48
70
  .search-item-button {
49
71
  width: 100%;
50
72
  flex-shrink: 0;
@@ -56,6 +78,10 @@
56
78
  padding-left: 96px;
57
79
  }
58
80
 
81
+ .search-item-button .search-item-content > * {
82
+ width: auto;
83
+ }
84
+
59
85
  .search-form .search-item:last-child {
60
86
  width: 100%;
61
87
  padding-bottom: 0;
@@ -1,14 +1,16 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Button } from "antd";
3
- import { useState } from "react";
4
3
  import { useBiLog } from "../../LogDialog/index.js";
5
4
  import "./Detail.scss";
6
5
  const arrowImg = 'https://wanxiaomeng-1255977238.file.myqcloud.com/bi-element-ui/Log/detail-arrow.png';
7
6
  const LogDetail = (props)=>{
8
7
  const { data = {} } = props;
9
- const [dialogVisible, setDialogVisible] = useState(false);
10
- const [dialogData, setDialogData] = useState({});
11
8
  const { openRichText } = useBiLog();
9
+ const isRichText = (item)=>{
10
+ if ('rich_text' === item.type) return true;
11
+ const htmlReg = /<[a-z][\s\S]*>/i;
12
+ return htmlReg.test(item.new || '') || htmlReg.test(item.old || '');
13
+ };
12
14
  const handleRichTextLog = (item)=>{
13
15
  openRichText({
14
16
  newContent: item.new,
@@ -31,10 +33,10 @@ const LogDetail = (props)=>{
31
33
  ":"
32
34
  ]
33
35
  }),
34
- 'rich_text' === item.type ? /*#__PURE__*/ jsx("div", {
36
+ isRichText(item) ? /*#__PURE__*/ jsx("div", {
35
37
  className: "operates-info",
36
38
  children: /*#__PURE__*/ jsx(Button, {
37
- type: 'text',
39
+ type: 'link',
38
40
  size: "middle",
39
41
  className: "new",
40
42
  onClick: ()=>handleRichTextLog(item),
@@ -49,7 +51,7 @@ const LogDetail = (props)=>{
49
51
  }),
50
52
  /*#__PURE__*/ jsx("img", {
51
53
  style: {
52
- display: item.old ? 'block' : 'none'
54
+ display: item.old ? void 0 : 'none'
53
55
  },
54
56
  src: arrowImg
55
57
  }),
@@ -14,6 +14,7 @@
14
14
  align-items: center;
15
15
 
16
16
  img {
17
+ display: inline-block;
17
18
  width: 14px;
18
19
  height: 7px;
19
20
  margin: 0 10px;
@@ -24,4 +25,4 @@
24
25
  flex-shrink: 0;
25
26
  }
26
27
  }
27
- }
28
+ }
@@ -1,5 +1,4 @@
1
- import React from 'react';
2
1
  import type { LogProps } from '../types';
3
2
  import './Log.scss';
4
- declare const BiLog: React.ForwardRefExoticComponent<Omit<LogProps, "ref"> & React.RefAttributes<any>>;
3
+ declare const BiLog: import("react").ForwardRefExoticComponent<Omit<LogProps, "ref"> & import("react").RefAttributes<any>>;
5
4
  export default BiLog;